[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : phil
Repository : xara
Revision   : 1252
Date       : Mon Jun  5 15:59:32 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/debugdlg.cpp
   M /Trunk/XaraLX/Kernel/range.cpp
   M /Trunk/XaraLX/Kernel/range.h
   M /Trunk/XaraLX/Kernel/rgnlist.cpp
   M /Trunk/XaraLX/Kernel/spread.cpp
   M /Trunk/XaraLX/Kernel/transop.cpp
   M /Trunk/XaraLX/Kernel/transop.h
   M /Trunk/XaraLX/tools/slicetool.cpp
   M /Trunk/XaraLX/tools/slicetool.h
   M /Trunk/XaraLX/tools/tranlate.cpp
   M /Trunk/XaraLX/tools/tranlate.h

Fixes for multi-spread documents.
The debug-only command to add a spread no longer needs compiling with NEW_PASTEBOARD=1.


Diff:
Index: Trunk/XaraLX/tools/tranlate.cpp
===================================================================
--- Trunk/XaraLX/tools/tranlate.cpp	(revision 1251)
+++ Trunk/XaraLX/tools/tranlate.cpp	(revision 1252)
@@ -260,20 +260,34 @@
 	// Make a mental note of the current position
 	LastPos = PointerPos;
 
-	// Update the current spread
+	// Update the current spread (must do this if CanChangeSpread returns TRUE)
 	CurrentSpread = pSpread;
-
-	// Have a look to see if we are on a different spread now
-	if (pSpread != StartSpread)
-		CanChangeToNewSpread = TRUE;
-	else
-		CanChangeToNewSpread = FALSE;
 }
 
 
 
 /********************************************************************************************
 
+>	virtual BOOL OpTranslateTrans::CanChangeSpread()
+
+	Author:		Phil_Martin (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	05/June/2006
+	Inputs:		-
+	Outputs:	-
+	Returns:	TRUE if this transform allows the drag to be transferred to another spread
+	Purpose:	Tell the baseclass functions whether to draw drag feedback only on the start
+				spread or to allow drag rendering to be done on other spreads too.
+
+********************************************************************************************/
+
+BOOL OpTranslateTrans::CanChangeSpread()
+{
+	return TRUE;
+}
+
+
+/********************************************************************************************
+
 >	void OpTranslateTrans::BuildMatrix()
 
 	Author:		Rik_Heywood (Xara Group Ltd) <camelotdev@xxxxxxxx>
Index: Trunk/XaraLX/tools/tranlate.h
===================================================================
--- Trunk/XaraLX/tools/tranlate.h	(revision 1251)
+++ Trunk/XaraLX/tools/tranlate.h	(revision 1252)
@@ -142,6 +142,7 @@
 	virtual void UpdateTransformOnDrag(DocCoord, Spread*, ClickModifiers&);
 	virtual void BuildMatrix();
 	virtual void ConstrainDrag(DocCoord*);
+	virtual BOOL CanChangeSpread();
 
 	// Member vars of the operation
 	DocCoord LastPos;
Index: Trunk/XaraLX/tools/slicetool.h
===================================================================
--- Trunk/XaraLX/tools/slicetool.h	(revision 1251)
+++ Trunk/XaraLX/tools/slicetool.h	(revision 1252)
@@ -543,6 +543,7 @@
 	virtual void UpdateTransformOnDrag(DocCoord, Spread*, ClickModifiers&);
 	virtual void BuildMatrix();
 	virtual void ConstrainDrag(DocCoord*);
+	virtual BOOL CanChangeSpread();
 
 /////////////////////////////////////////////////////////////////////////////////////////////
 //
Index: Trunk/XaraLX/tools/slicetool.cpp
===================================================================
--- Trunk/XaraLX/tools/slicetool.cpp	(revision 1251)
+++ Trunk/XaraLX/tools/slicetool.cpp	(revision 1252)
@@ -3694,20 +3694,34 @@
 	// Make a mental note of the current position
 	LastPos = PointerPos;
 
-	// Update the current spread
+	// Update the current spread (must do this if CanChangeSpread returns TRUE)
 	CurrentSpread = pSpread;
-
-	// Have a look to see if we are on a different spread now
-	if (pSpread != StartSpread)
-		CanChangeToNewSpread = TRUE;
-	else
-		CanChangeToNewSpread = FALSE;
 }
 
 
 
 /********************************************************************************************
 
+>	virtual BOOL OpSliceTranslate::CanChangeSpread()
+
+	Author:		Phil_Martin (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	05/June/2006
+	Inputs:		-
+	Outputs:	-
+	Returns:	TRUE if this transform allows the drag to be transferred to another spread
+	Purpose:	Tell the baseclass functions whether to draw drag feedback only on the start
+				spread or to allow drag rendering to be done on other spreads too.
+
+********************************************************************************************/
+
+BOOL OpSliceTranslate::CanChangeSpread()
+{
+	return TRUE;
+}
+
+
+/********************************************************************************************
+
 >	BOOL OpSliceTranslate::SnapRectToBoxList(	Spread* pSpread, DocRect* pDocRect,
 												const DocCoord& PrevCoord,
 												const DocCoord& CurCoord )
Index: Trunk/XaraLX/Kernel/range.h
===================================================================
--- Trunk/XaraLX/Kernel/range.h	(revision 1251)
+++ Trunk/XaraLX/Kernel/range.h	(revision 1252)
@@ -121,6 +121,7 @@
 class AttrFillGeometry;
 class EffectsStack;
 class ListRange;
+class Layer;
 
 // Define this if you want Phil's new SelRange area and perimeter features
 //#define SELECTION_AREA_FEATURE
@@ -411,7 +412,7 @@
 	virtual void AttrsHaveChanged(); 
 		 
 	virtual void SetRenderable(BOOL bNewVis = FALSE);
-	virtual Range* CloneNodes(UINT32 timeLimit, BOOL bCloneOnTop = FALSE, BOOL bLightweight = FALSE);
+	virtual Range* CloneNodes(UINT32 timeLimit, BOOL bCloneOnTop = FALSE, BOOL bLightweight = FALSE, Layer* pDestLayer = NULL);
 	virtual void DeleteNodes();
 	virtual void ForceRedrawView(DocView* pDocView, BOOL bReleaseCache = FALSE, BOOL bUseBlobRects = FALSE, BOOL bReleaseParentsOnly = FALSE);
 	virtual BOOL TransformNodes(TransformBase* Trans);
Index: Trunk/XaraLX/Kernel/transop.cpp
===================================================================
--- Trunk/XaraLX/Kernel/transop.cpp	(revision 1251)
+++ Trunk/XaraLX/Kernel/transop.cpp	(revision 1252)
@@ -183,7 +183,6 @@
 	// Give all the flags default values
 	LockAspect = FALSE;
 	LeaveCopy = TRUE;
-	CanChangeToNewSpread = FALSE;
 
 	// The scale factor is used to scale the line widths and by default it is ignored
 	ScaleLines = FALSE;
@@ -571,9 +570,6 @@
 
 	SetTransformRange(TransData->pRange, NULL);
 
-	// It is not possible to move between spreads in an immediate operation
-	CanChangeToNewSpread = FALSE;
-
 	// Where was this operation started from, and are we interested
 	SetStartBlob(TransData->StartBlob);
 
@@ -663,6 +659,7 @@
 	// Copy all the data that we will want to be keeping
 	StartSpread = pSpread;
 	CurrentSpread = pSpread;
+	m_pDragSpread = pSpread;
 	RawStartPos = ClickPos;
 	StartPos = ClickPos;
 	MagStartPos = ClickPos;
@@ -767,10 +764,6 @@
 	// By default we will use the proper centre of transform. Adjust may change this later
 	CentreOfTrans = OriginalCentre;
 	
-	// it is up to the transformation in question to change this when
-	// it decides that it would be possible
-	CanChangeToNewSpread = FALSE;
-
 	// Where was this operation started from, and are we interested
 	SetStartBlob(TransData->StartBlob);
 
@@ -1290,6 +1283,9 @@
 		// Try to build all the undo information
 	 	Worked = CompleteTransformation();
 
+		if (CanChangeSpread())
+			Document::SetSelectedViewAndSpread(NULL, NULL, m_pDragSpread);
+
 	 	// mark the selection cache as invalid (bounding rects etc will no longer be correct)
 		m_pTransformRange->Update();
 	}
@@ -1738,6 +1734,27 @@
 
 /********************************************************************************************
 
+>	virtual BOOL TransOperation::CanChangeSpread()
+
+	Author:		Phil_Martin (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	05/June/2006
+	Inputs:		-
+	Outputs:	-
+	Returns:	TRUE if this transform allows the drag to be transferred to another spread
+	Purpose:	Tell the baseclass functions whether to draw drag feedback only on the start
+				spread or to allow drag rendering to be done on other spreads too.
+
+********************************************************************************************/
+
+BOOL TransOperation::CanChangeSpread()
+{
+	// Overide this function if you allow your transform to cross spread boundaries
+	return FALSE;
+}
+
+
+/********************************************************************************************
+
 >	virtual void TransOperation::BuildMatrix()
 
 	Author:		Rik_Heywood (Xara Group Ltd) <camelotdev@xxxxxxxx>
@@ -1940,7 +1957,7 @@
 
   	// Start the selection operation which records the current selection status and 
 	// invalidates the rectangle covered by the selection and its blobs. 
-	BOOL RecordSelectionTwice = (CanChangeToNewSpread) && (StartSpread!=CurrentSpread);
+	BOOL RecordSelectionTwice = (CanChangeSpread()) && (StartSpread!=CurrentSpread);
 
 	// If the Selection only contains a single object then we pass this object as
 	// a parameter to DoStartTransOp. Otherwise the routine assumes that the 
@@ -1964,6 +1981,8 @@
 		// Move the selection to a new spread here
 		if (!DoMoveNodes(*m_pTransformRange, CurrentSpread->FindActiveLayer(), LASTCHILD))
 			return FALSE;
+
+		Document::GetSelected()->ResetInsertionPosition();
 	}
 	
 	// Change the bounds then ripple them up the tree
@@ -2086,6 +2105,14 @@
 	m_PrevTransform.Transform((DocCoord*)&tr, 2);
 	//TRACEUSER( "Phil", _T("M4 Test %d %d
"), abs(tr.lox-m_AccuracyTestRect.lox), abs(tr.loy-m_AccuracyTestRect.loy));
 
+	// We may need to move the dragged range to a new spread if the transform requires it...
+	if (CanChangeSpread() && (m_pDragSpread!=CurrentSpread))
+	{
+		// Move m_DraggedRange to the new spread
+		//TRACEUSER("Phil", _T("Move m_Dragged range to new spread!
"));
+		bForceRecopy = TRUE;
+	}
+
 	if( bForceRecopy || 
 		abs( tr.lo.x - m_AccuracyTestRect.lo.x ) > 10 ||
 		abs( tr.lo.y - m_AccuracyTestRect.lo.y ) > 10 || 
@@ -2097,13 +2124,18 @@
 		m_pDraggedRange->DeleteNodes();
 		delete m_pDraggedRange;
 
-		m_pDraggedRange = m_pTransformRange->CloneNodes(DocView::SolidDragTimeLimit);
+		Layer* pTargetLayer = NULL;
+		if (CurrentSpread!=m_pDragSpread)
+			pTargetLayer = CurrentSpread->FindActiveLayer();	// This logic must match the final copy done in DragFinished
 
+		m_pDraggedRange = m_pTransformRange->CloneNodes(DocView::SolidDragTimeLimit, FALSE, FALSE, pTargetLayer);
+
 		if (m_pDraggedRange==NULL)
 			return FALSE;
 
 		m_pDraggedRange->SetDraggedNodes(TRUE);
 		m_pDraggedRange->SetRenderable(TRUE);
+		m_pDragSpread = CurrentSpread;
 
 		// Scan the selection, and transform each selected object.
 		Trans->bSolidDrag = TRUE;
Index: Trunk/XaraLX/Kernel/spread.cpp
===================================================================
--- Trunk/XaraLX/Kernel/spread.cpp	(revision 1251)
+++ Trunk/XaraLX/Kernel/spread.cpp	(revision 1252)
@@ -128,6 +128,7 @@
 #include "progress.h"
 #include "docview.h"
 #include "optsmsgs.h"
+#include "oilbitmap.h"	// CWxBitmap
 
 //#include "prevwres.h"	// _R(IDS_TAG_LAYER_FRAMEPROPS)
 //#include "frameops.h" // for OpGrabAllFrames
@@ -609,7 +610,7 @@
 	pRender->GetRenderView()->GetScaledPixelSize(&ScaledPixelWidth, &ScaledPixelHeight);
 
 	// Find out how many millipoints 4 pixels is
-	MILLIPOINT DropWidth = 4 * (min(ScaledPixelWidth.MakeLong(), ScaledPixelHeight.MakeLong() )); 
+	MILLIPOINT DropWidth = 4 * (min(ScaledPixelWidth.MakeLong(), ScaledPixelHeight.MakeLong() ));
 	
 	MILLIPOINT ExtraPixel = ScaledPixelWidth.MakeLong();
 	if (PageBackgroundPresent)
@@ -637,9 +638,29 @@
 	                                  PageRect.HighCorner().y - DropWidth 
 									 );   
 									 
-			pRender->DrawRect(&RightHandDropShadow);        
-			
-			PageHasADropShadow = TRUE; 
+			pRender->DrawRect(&RightHandDropShadow);
+
+/*			// Attempt to render fuzzy shadow edge using bitmap...
+			{
+				DocRect r = RightHandDropShadow;
+				CWxBitmap*			pBitmap = new CWxBitmap();
+				pBitmap->LoadBitmap(_R(IDB_SPREAD_RIGHTEDGE));
+				KernelBitmap*		pkBitmap = new KernelBitmap(pBitmap, TRUE);
+
+				pRender->RenderBits(pkBitmap, (DocCoord*)&r, 2, TRUE, NULL);	// Unclean!
+	
+				if (pBitmap)
+				{
+					pBitmap->BMBytes = ((CWxBitmap*)OILBitmap::Default)->BMBytes;
+				}
+				if (pkBitmap)
+				{
+					delete pkBitmap;
+					pkBitmap = NULL;
+				}
+			}
+*/
+			PageHasADropShadow = TRUE;
 									 
 		}                                
 		
@@ -654,7 +675,28 @@
 								   PageRect.LowCorner().y  
 								  );         
 	        
-			pRender->DrawRect(&BottomDropShadow); 		
+			pRender->DrawRect(&BottomDropShadow);
+
+/*			// Attempt to render fuzzy shadow edge using bitmap...
+			{
+				DocRect r = BottomDropShadow;
+				CWxBitmap*			pBitmap = new CWxBitmap();
+				pBitmap->LoadBitmap(_R(IDB_SPREAD_BOTTOMEDGE));
+				KernelBitmap*		pkBitmap = new KernelBitmap(pBitmap, TRUE);
+
+				pRender->RenderBits(pkBitmap, (DocCoord*)&r, 2, TRUE, NULL);	// Unclean!
+	
+				if (pBitmap)
+				{
+					pBitmap->BMBytes = ((CWxBitmap*)OILBitmap::Default)->BMBytes;
+				}
+				if (pkBitmap)
+				{
+					delete pkBitmap;
+					pkBitmap = NULL;
+				}
+			}
+*/
 			PageHasADropShadow = TRUE; 
 		}       
 		
@@ -811,7 +853,7 @@
 		// --- Render spread dividers ---
 
 		// Set the colour for the spread divide (mid grey)
-		DocColour COLOUR_SPREADDIVIDE = DocColour(127L, 127L, 127L);
+/*		DocColour COLOUR_SPREADDIVIDE = DocColour(64L, 32L, 32L); //DocColour(127L, 127L, 127L);
 		COLOUR_SPREADDIVIDE.SetSeparable(FALSE);		// Don't colour-separate the spread divider
 
 		pRender->SetLineColour(COLOUR_SPREADDIVIDE);
@@ -830,8 +872,25 @@
 		MILLIPOINT Width = GetWidePasteboard(pView).Width();
 		MILLIPOINT Height = GetWidePasteboard(pView).Height();
 		pRender->DrawLine(DocCoord(-Width, Height), DocCoord(Width, Height));
+*/
+
+		if (FindPreviousSpread()!=NULL)
+		{
+			DocColour COLOUR_SPREADDIVIDE = DocColour(64L, 32L, 32L); //DocColour(127L, 127L, 127L);
+			COLOUR_SPREADDIVIDE.SetSeparable(FALSE);		// Don't colour-separate the spread divider
+			pRender->SetFillColour(COLOUR_SPREADDIVIDE);
+
+			View *pView = pRender->GetRenderView();
+			DocRect sd = GetWidePasteboard(pView);
+			DocCoordToSpreadCoord(&sd);
+
+			FIXED16 ScaledPixelWidth;
+			FIXED16 ScaledPixelHeight;
+			pRender->GetRenderView()->GetScaledPixelSize(&ScaledPixelWidth, &ScaledPixelHeight);
+			sd.lo.y = sd.hi.y - ScaledPixelWidth.MakeLong();
+			pRender->DrawRect(&sd);
+		}
 		
-		
 		// --- Render drop shadows ---
 		if (ShowDropShadow)
 			RenderDropShadows( pRender );      
@@ -3313,8 +3372,8 @@
 
 void Spread::AdjustPasteboards(void)
 {
-#if NEW_PASTEBOARD
-	Chapter *ParentChapter = FindParentChapter();
+//#if NEW_PASTEBOARD
+	Chapter* ParentChapter = FindParentChapter();
 	ERROR3IF(ParentChapter == NULL, "No parent Chapter?!");
 
 	// First, find the minimum and maximum pasteboard x extents for the entire document.
@@ -3325,12 +3384,30 @@
 	// 1) Make sure that each following spread is shifted to the correct document coordinates
 	//    by ensuring its pasteboard is placed after this spread's one.
 	// 2) Make sure that all default grids in all spreads fully cover the pasteboards.
-	Spread *pThisSpread = ParentChapter->FindFirstSpread();
+	Spread* pThisSpread = ParentChapter->FindFirstSpread();
 
 	// Force the x extent of the first pasteboard to match all others in this chapter
 	DocRect TempPasteRect = pThisSpread->GetPasteboardRect();
 	TempPasteRect.lo.x = ChapterBounds.lo.x;
 	TempPasteRect.hi.x = ChapterBounds.hi.x;
+
+/*if (pThisSpread->FindNextSpread())
+{
+	DocCoord OriginOffset(pThisSpread->SpreadOrigin.x - pThisSpread->PasteboardRect.lo.x,
+							pThisSpread->SpreadOrigin.y - pThisSpread->PasteboardRect.lo.y);
+
+	DocRect r;
+	pThisSpread->GetPagesRect(&r);
+	pThisSpread->SpreadCoordToDocCoord(&r);
+	r.Inflate(18000);
+	INT32 ydiff = r.lo.y - TempPasteRect.lo.y;
+	TempPasteRect.lo.y = r.lo.y;
+
+	pThisSpread->SpreadOrigin.x = TempPasteRect.lo.x + OriginOffset.x;
+	pThisSpread->SpreadOrigin.y = TempPasteRect.lo.y + OriginOffset.y - ydiff;
+}
+*/
+
 	pThisSpread->ChangePasteboardRect(TempPasteRect);
 	pThisSpread->InvalidateBoundingRect();
 
@@ -3345,11 +3422,51 @@
 		if (pNextSpread != NULL)
 		{
 			DocRect FirstPasteRect  = pThisSpread->GetPasteboardRect(FALSE);
+/*if (pThisSpread->FindNextSpread())
+{
+	DocRect r;
+	pThisSpread->GetPagesRect(&r);
+	pThisSpread->SpreadCoordToDocCoord(&r);
+	r.Inflate(18000);
+	FirstPasteRect.lo.y = r.lo.y;
+}
+if (pThisSpread->FindPreviousSpread())
+{
+	DocRect r;
+	pThisSpread->GetPagesRect(&r);
+	pThisSpread->SpreadCoordToDocCoord(&r);
+	r.Inflate(18000);
+	FirstPasteRect.hi.y = r.hi.y;
+}
+*/
 			DocRect SecondPasteRect = pNextSpread->GetPasteboardRect(FALSE);
+			DocCoord OriginOffset(pNextSpread->SpreadOrigin.x - pNextSpread->PasteboardRect.lo.x,
+									pNextSpread->SpreadOrigin.y - pNextSpread->PasteboardRect.lo.y);
 
+/*if (pNextSpread->FindNextSpread())
+{
+	DocRect r;
+	pNextSpread->GetPagesRect(&r);
+	pNextSpread->SpreadCoordToDocCoord(&r);
+	r.Inflate(18000);
+	INT32 ydiff = r.lo.y - SecondPasteRect.lo.y;
+	SecondPasteRect.lo.y = r.lo.y;
+	OriginOffset.y -= ydiff;
+}
+if (pNextSpread->FindPreviousSpread())
+{
+	DocRect r;
+	pNextSpread->GetPagesRect(&r);
+	pNextSpread->SpreadCoordToDocCoord(&r);
+	r.Inflate(18000);
+	SecondPasteRect.hi.y = r.hi.y;
+}
+*/
+
 			// Construct a new Pasteboard rectangle of the correct size, and move it
 			// to lie just below the previous spread's pasteboard area
 			TempPasteRect = SecondPasteRect;
+
 			TempPasteRect.Translate(-TempPasteRect.lo.x, -TempPasteRect.lo.y);
 			TempPasteRect.Translate(FirstPasteRect.lo.x, FirstPasteRect.lo.y - TempPasteRect.Height()); 
 
@@ -3360,9 +3477,6 @@
 			// Move the spread coordinate origin so that it stays at the same relative offset
 			// from the pasteboard bottom left corner, or else all objects inside the spread
 			// will suddenly shift to a new place on (or off) the pasteboard!
-			DocCoord OriginOffset(pNextSpread->SpreadOrigin.x - pNextSpread->PasteboardRect.lo.x,
-									pNextSpread->SpreadOrigin.y - pNextSpread->PasteboardRect.lo.y);
-
 			pNextSpread->SpreadOrigin.x = TempPasteRect.lo.x + OriginOffset.x;
 			pNextSpread->SpreadOrigin.y = TempPasteRect.lo.y + OriginOffset.y;
 
@@ -3406,9 +3520,9 @@
 	if (pDoc != NULL)
 		pDoc->ForceRedraw();
 
-#else
-ERROR3("Spread::AdjustPasteboards is unimplemented - see Jason/Phil");
-#endif
+//#else
+//ERROR3("Spread::AdjustPasteboards is unimplemented - see Jason/Phil");
+//#endif
 }
 
 
Index: Trunk/XaraLX/Kernel/rgnlist.cpp
===================================================================
--- Trunk/XaraLX/Kernel/rgnlist.cpp	(revision 1251)
+++ Trunk/XaraLX/Kernel/rgnlist.cpp	(revision 1252)
@@ -1303,6 +1303,7 @@
 	while (pRegion != NULL)
 	{
 		View *pView = pRegion->GetRenderView();
+		Spread* pSpread = pRegion->GetRenderSpread();
 
 		// Have we optimised this region's View already?
 		if (!Views.IsViewOptimised(pView))
@@ -1332,7 +1333,9 @@
 				while (pRegion2 != NULL)
 				{
 					// Is this the correct View and render context?
-					if (pRegion2->GetRenderView() == pView)
+					if (pRegion2->GetRenderView() == pView &&
+						pRegion2->GetRenderSpread() == pSpread
+						)
 					{
 						// More than one region - we can try to union them
 						TryUnion = TRUE;
@@ -1406,6 +1409,7 @@
 									DocRect TotalUnion)
 {
 	pRegion->ResetRegion(TotalUnion);
+	Spread* pSpread = pRegion->GetRenderSpread();
 
 	// Delete all the others
 	RenderRegion *pRegion2 =(RenderRegion *) GetNext(pRegion);
@@ -1417,6 +1421,7 @@
 
 		// Is this the correct DocView and render context?
 		if ((pRegion2->GetRenderView() == pView) &&
+			(pRegion2->GetRenderSpread() == pSpread) &&
 			(pRegion2->CanBeMerged()))
 		{
 			// Yes - delete this region
Index: Trunk/XaraLX/Kernel/transop.h
===================================================================
--- Trunk/XaraLX/Kernel/transop.h	(revision 1251)
+++ Trunk/XaraLX/Kernel/transop.h	(revision 1252)
@@ -316,6 +316,7 @@
 								  ClickModifiers ClickMods,
 								  Spread* pSpread,
 								  BOOL bForceRecopy = FALSE);
+	virtual BOOL CanChangeSpread();
 
 	// function to build the appropriate transform matrix
 	virtual void BuildMatrix();
@@ -396,7 +397,6 @@
 	BOOL LeaveCopy;
 	BOOL ScaleLines;
 	BOOL TransFills;
-	BOOL CanChangeToNewSpread;
 	BOOL MouseHasMoved;
 	BOOL CanScaleLines;
 
@@ -415,11 +415,14 @@
 
 	// David Mc 12/5/99
 	// The selection when entering DoStartTransOp
-	List * m_pSelList;
+	List* m_pSelList;
 
 	// This range represents the copied and transformed nodes that are used when solid dragging
 	Range* m_pDraggedRange;
 
+	// This is the spread that contains m_pDraggedRange
+	Spread* m_pDragSpread;
+
 	BOOL m_bFirstRedraw;
 	BOOL m_bShowDraggedOutlines;
 	MonotonicTime m_timeIdle;
Index: Trunk/XaraLX/Kernel/range.cpp
===================================================================
--- Trunk/XaraLX/Kernel/range.cpp	(revision 1251)
+++ Trunk/XaraLX/Kernel/range.cpp	(revision 1252)
@@ -3535,7 +3535,7 @@
 
 /*********************************************************************************************
 
->    Range* Range::CloneNodes(UINT32 timeLimit, BOOL bCloneOnTop, BOOL bLightweight)
+>    Range* Range::CloneNodes(UINT32 timeLimit, BOOL bCloneOnTop, BOOL bLightweight, Layer* pDestLayer = NULL)
      Author:    Phil_Martin (Xara Group Ltd) <camelotdev@xxxxxxxx>
      Created:   11/12/2003
      Inputs: 	timelimit		- if the clone doesn't complete within timelimit, back out
@@ -3553,7 +3553,7 @@
 
 **********************************************************************************************/
 
-Range* Range::CloneNodes(UINT32 timeLimit, BOOL bCloneOnTop, BOOL bLightweight)
+Range* Range::CloneNodes(UINT32 timeLimit, BOOL bCloneOnTop, BOOL bLightweight, Layer* pDestLayer)
 {
 	Node* pNode;
 	ListRange* pCloneRange = new ListRange();
@@ -3578,15 +3578,27 @@
 		// Make sure the copy is not selected
 		pCopy->SetSelected(FALSE);
 
-		if (!bCloneOnTop)
+		if (pDestLayer==NULL)
 		{
-			// Insert the copied node right alongside the original
-			pCopy->AttachNode(pNode, NEXT, FALSE, FALSE);
+			if (!bCloneOnTop)
+			{
+				// Insert the copied node right alongside the original
+				pCopy->AttachNode(pNode, NEXT, FALSE, FALSE);
+			}
+			else
+			{
+				Node* pTail = pNode->FindParent(CC_RUNTIME_CLASS(Layer))->FindLastChild(TRUE);
+				pCopy->AttachNode(pTail, NEXT, FALSE, FALSE);
+			}
 		}
 		else
 		{
-			Node* pTail = pNode->FindParent(CC_RUNTIME_CLASS(Layer))->FindLastChild(TRUE);
-			pCopy->AttachNode(pTail, NEXT, FALSE, FALSE);
+			// Copy the node into a new target spread...
+			Node* pTail = pDestLayer->FindLastChild(TRUE);
+			if (pTail)
+				pCopy->AttachNode(pTail, NEXT, FALSE, FALSE);
+			else
+				pCopy->AttachNode(pDestLayer, FIRSTCHILD, FALSE, FALSE);
 		}
 
 		// Add the copied node to the output ListRange
Index: Trunk/XaraLX/Kernel/debugdlg.cpp
===================================================================
--- Trunk/XaraLX/Kernel/debugdlg.cpp	(revision 1251)
+++ Trunk/XaraLX/Kernel/debugdlg.cpp	(revision 1252)
@@ -1652,7 +1652,7 @@
 					break;
 				case 4:
 					{
-#if NEW_PASTEBOARD
+//#if NEW_PASTEBOARD
 						Spread* pSpread = Document::GetSelectedSpread();
 						Spread* pNewSpread = NULL;
 						pSpread->NodeCopy((Node**)&pNewSpread);
@@ -1661,9 +1661,9 @@
 							pNewSpread->AttachNode(pSpread, NEXT);
 							pSpread->AdjustPasteboards();
 						}
-#else
-						InformWarning(_R(IDS_SPREADTESTWARNING));
-#endif
+//#else
+//						InformWarning(_R(IDS_SPREADTESTWARNING));
+//#endif
 					}
 					break;
 				}


Xara