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

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 825
Date       : Sun Apr 16 20:17:04 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/sgallery.cpp
   M /Trunk/XaraLX/Kernel/sgdrag.cpp
   M /Trunk/XaraLX/Kernel/sgframe.cpp
   M /Trunk/XaraLX/Kernel/sglayer.cpp

First cut at fixing dragging within galleries


Diff:
Index: Trunk/XaraLX/Kernel/sgallery.cpp
===================================================================
--- Trunk/XaraLX/Kernel/sgallery.cpp	(revision 824)
+++ Trunk/XaraLX/Kernel/sgallery.cpp	(revision 825)
@@ -111,7 +111,7 @@
 #include "progress.h"
 //#include "resource.h"	// For _R(IDS_OK) (dammit!)
 #include "sgallery.h"
-//#include "sgdrag.h"
+#include "sgdrag.h"
 #include "sgmenu.h"
 #include "sgtree.h"
 #include "thumbmsg.h"
@@ -650,8 +650,7 @@
 				break;
 		}
 	}
-PORTNOTE("drag", "Dragging disabled in SuperGallery::Message()")
-#ifndef EXCLUDE_FROM_XARALX
+
 	else if (MESSAGE_IS_A(Message, DragMessage) && IsVisible() && DisplayTree != NULL)
 	{
 		// If a drag starting message comes around, pass it on to the tree
@@ -665,7 +664,7 @@
 			HandleDragStart(Msg);
 		}
 	}
-#endif
+
 	else if (MESSAGE_IS_A(Message, ThumbMessage) && DisplayTree != NULL)
 	{
 		// If a library Thumb message comes around, pass it on to the tree
@@ -706,6 +705,9 @@
 
 BOOL SuperGallery::Create(void)
 {
+	if (!DialogOp::Create())
+		return(FALSE);
+
 	// Call derived class PreCreate handler (to create display tree, usually)
 	if (!PreCreate())
 		return(FALSE);
@@ -723,8 +725,8 @@
 	SetOffset(Offset);
 	SetFloatingCPoint(FloatPos);
 
-	if (!DialogOp::Create())
-		return(FALSE);
+//	if (!DialogOp::Create())
+//		return(FALSE);
 
 	AmShaded = FALSE;
 
@@ -966,16 +968,14 @@
 
 void SuperGallery::HandleDragStart(DragMessage *DragMsg)
 {
-PORTNOTE("bars", "SuperGallery::HandleDragStart Disabled")
-#ifndef EXCLUDE_FROM_XARALX
 	// If this is a gallery list-reorganising drag which originated from this gallery,
 	// then create a target for the gallery listbox.
 	if (DragMsg->pInfo->IsKindOf(CC_RUNTIME_CLASS(SGListDragInfo)) &&
 		((SGListDragInfo *)DragMsg->pInfo)->GetParentGallery() == this)
 	{
-		SGListDragTarget *NewTarget = new SGListDragTarget(this, GetListGadgetID());
+		// Note this sort of auto-attaches it seems - AMB
+		/*SGListDragTarget *NewTarget = */new SGListDragTarget(this, GetListGadgetID());
 	}
-#endif
 }
 
 
@@ -1138,11 +1138,8 @@
 		{
 			HasSelection = FALSE;
 			Ptr = CurrentGroup->GetChild();
-PORTNOTE("other", "Removed SGDisplayItem reference")
-#ifndef EXCLUDE_FROM_XARALX
 			ERROR3IF(Ptr != NULL && !Ptr->IsKindOf(CC_RUNTIME_CLASS(SGDisplayItem)),
 						"Sort hasn't found items! Heinous failure imminent!" );
-#endif
 			// Count the number of items we have to sort
 			NumItems = 0;
 			while (Ptr != NULL)
@@ -2438,11 +2435,8 @@
 
 	if (TheGroup == NULL)
 	{
-PORTNOTE("galleries", "SuperGallery::AddLibraryGroup removed SGDisplayGroup usage");
-#ifndef EXCLUDE_FROM_XARALX
 		// No existing group for that library, so create a new one
 		TheGroup = new SGDisplayGroup(this, NULL, LibraryToDisplay);
-#endif
 		if (TheGroup == NULL)				// Failed!
 			return(NULL);
 
@@ -3400,13 +3394,10 @@
 	SGMiscInfo MiscInfo;
 	FillInMiscInfo(&MiscInfo);
 
-PORTNOTE("galleries", "Removed SuperGallery::OnIdleEvent() - DoBGRedrawPass")
-#ifndef EXCLUDE_FROM_XARALX
 	if (LastBGNode == NULL)
 		DisplayTree->DoBGRedrawPass(&MiscInfo);
 	else
 		LastBGNode->DoBGRedrawPass(&MiscInfo);
-#endif
 
 	return(TRUE);
 }
Index: Trunk/XaraLX/Kernel/sglayer.cpp
===================================================================
--- Trunk/XaraLX/Kernel/sglayer.cpp	(revision 824)
+++ Trunk/XaraLX/Kernel/sglayer.cpp	(revision 825)
@@ -2200,7 +2200,7 @@
 	if (!pNewActiveLayer->IsActive())
 		LayerSGallery::SetActive(pDoc,pNewActiveLayer,TRUE);
 
-#if defined(EXCLUDE_FROM_RALPH) || defined(EXCLUDE_FROM_XARALX)
+#if defined(EXCLUDE_FROM_RALPH)
 	//ERROR3("LayerSGallery::MakeActiveLayer supressed broadcast - bad !");
 #else
 	if (TellAll)
@@ -2240,10 +2240,15 @@
 	// Start the search from the first layer
 	Layer* pLayer = pFirstLayer;
 
+	INT32 ActiveLayers = 0;
+
 	while (pLayer != NULL && pActiveLayer == NULL)
 	{
 		if (pLayer->IsActive())
+		{
+			ActiveLayers++;
 			pActiveLayer = pLayer;	// Found the active layer, so make a note of it
+		}
 
 		pLayer = pLayer->FindNextLayer();
 	}
@@ -2254,10 +2259,12 @@
 //#ifndef WEBSTER
 	if (pActiveLayer == NULL)
 //#endif // WEBSTER
-		pActiveLayer = pSpread->FindLastLayer();
+		pActiveLayer = pSpread->FindLastLayer(); // In this instance ActiveLayers must be 0
 
 	// If we have an active layer, ensure that it really is the one and only active layer
-	if (pActiveLayer != NULL)
+	// AMB20060416 - only make the call if did not have exactly one active layer before
+	// to save an unnecessary layer change message when the layer gallery is brought up
+	if ((pActiveLayer != NULL) /*&& (ActiveLayers != 1)*/)
 		LayerSGallery::MakeActiveLayer(pActiveLayer);
 
 	// If caller wants the ptr to the active layer
Index: Trunk/XaraLX/Kernel/sgframe.cpp
===================================================================
--- Trunk/XaraLX/Kernel/sgframe.cpp	(revision 824)
+++ Trunk/XaraLX/Kernel/sgframe.cpp	(revision 825)
@@ -1889,7 +1889,7 @@
 		LayerStateAction::Init(pUndoOp, pUndoOp->GetUndoActions(), Param);
 	}
 
-#if defined(EXCLUDE_FROM_RALPH) || defined(EXCLUDE_FROM_XARALX)
+#if defined(EXCLUDE_FROM_RALPH)
 	//ERROR3("FrameSGallery::MakeActiveLayer supressed broadcast - bad !");
 #else
 	BROADCAST_TO_ALL(LayerMsg(pNewActiveLayer,LayerMsg::LayerReason::ACTIVE_LAYER_CHANGED));
Index: Trunk/XaraLX/Kernel/sgdrag.cpp
===================================================================
--- Trunk/XaraLX/Kernel/sgdrag.cpp	(revision 824)
+++ Trunk/XaraLX/Kernel/sgdrag.cpp	(revision 825)
@@ -795,6 +795,7 @@
 											OilCoord *pMousePos,
 											BOOL DragThisItemOnly)
 {
+	TRACEUSER("amb", _T("SGListDragTarget::HandleDragCompleted"));
 	ERROR3IF(DraggedNode == NULL || pMousePos == NULL || ParentGallery == NULL,
 				"Illegal NULL params");
 


Xara