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

[XaraXtreme-commits] Commit Complete



Commit by  : phil
Repository : xara
Revision   : 1459
Date       : Mon Jul 17 18:35:59 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/rulers.cpp
   M /Trunk/XaraLX/Kernel/rulers.h
   M /Trunk/XaraLX/Kernel/tool.cpp
   M /Trunk/XaraLX/Kernel/tool.h
   M /Trunk/XaraLX/tools/textinfo.cpp
   M /Trunk/XaraLX/tools/textinfo.h
   M /Trunk/XaraLX/tools/texttool.cpp
   M /Trunk/XaraLX/tools/texttool.h
   M /Trunk/XaraLX/wxOil/oilruler.cpp
   M /Trunk/XaraLX/wxOil/oilruler.h

MartinW's patch36 to tidy up click modifiers use in ruler click handling


Diff:
Index: Trunk/XaraLX/tools/textinfo.cpp
===================================================================
--- Trunk/XaraLX/tools/textinfo.cpp	(revision 1458)
+++ Trunk/XaraLX/tools/textinfo.cpp	(revision 1459)
@@ -3168,13 +3168,12 @@
 
 /********************************************************************************************
 
->   BOOL TextInfoBarOp::OnRulerClick(UINT32 nFlags, UserCoord PointerPos, ClickType Click, ClickModifiers Mods,
+>   BOOL TextInfoBarOp::OnRulerClick(UserCoord PointerPos, ClickType Click, ClickModifiers Mods,
 									 Spread* pSpread, RulerBase* pRuler)
 
 	Author:		Martin Wuerthner <xara@xxxxxxxxxxxxxxx>
 	Created:	07/07/06
-	Inputs:     nFlags      - synthesized mouse event flags (to be passed through to StartToolDrag)
-				PointerPos	- user coordinates of click on ruler (relative to origin set by tool)
+	Inputs:     PointerPos	- user coordinates of click on ruler (relative to origin set by tool)
 				Click		- Type of click enum
 				Mods		- Modifier flags struct
 				pSpread		- pointer to spread upon which click occurred
@@ -3184,7 +3183,7 @@
 
 ********************************************************************************************/
 
-BOOL TextInfoBarOp::OnRulerClick(UINT32 nFlags, UserCoord PointerPos, ClickType Click, ClickModifiers Mods,
+BOOL TextInfoBarOp::OnRulerClick(UserCoord PointerPos, ClickType Click, ClickModifiers Mods,
 								 Spread* pSpread, RulerBase* pRuler)
 {
 	if (!pRuler->IsHorizontal()) return FALSE;
@@ -3296,7 +3295,7 @@
 			TRACEUSER("wuerthne", _T("starting drag"));
 			TabStopDragOpParam* pParam = new TabStopDragOpParam(DragType, DraggedTabStop, PointerPos);
 			
-			if (pRuler->StartToolDrag(nFlags, PointerPos, &OpToken, pParam))
+			if (pRuler->StartToolDrag(Mods, PointerPos, &OpToken, pParam))
 			{
 				// the kernel has accepted the drag request
 				TextInfoBarOp::TabStopDragStarting(DragType);
Index: Trunk/XaraLX/tools/texttool.cpp
===================================================================
--- Trunk/XaraLX/tools/texttool.cpp	(revision 1458)
+++ Trunk/XaraLX/tools/texttool.cpp	(revision 1459)
@@ -972,10 +972,8 @@
 
 void TextTool::GetRulerOrigin(Spread* pSpread, UserCoord *pOrigin)
 {
-	TRACEUSER("wuerthne", _T("GetRulerOrigin"));
 	if (TextInfoBarOp::IsRulerOriginClaimed())
 	{
-		TRACEUSER("wuerthne", _T("set origin"));
 		pOrigin->x = TextInfoBarOp::GetRulerOrigin();
 	}
 }
@@ -984,7 +982,7 @@
 {
 	// we only draw onto the horizontal ruler and only if we have claimed it
 	if (!TextInfoBarOp::IsRulerOriginClaimed()) return;
-	TRACEUSER("wuerthne", _T("RenderRulerBlobs"));
+
 	// draw the highlighted background or the blobs
 	if (IsBackground)
 	{
@@ -998,13 +996,12 @@
 
 /********************************************************************************************
 
->   BOOL TextTool::OnRulerClick(UINT32 nFlags, UserCoord PointerPos, ClickType Click, ClickModifiers Mods,
+>   BOOL TextTool::OnRulerClick(UserCoord PointerPos, ClickType Click, ClickModifiers Mods,
 								Spread* pSpread, RulerBase* pRuler)
 
 	Author:		Martin Wuerthner <xara@xxxxxxxxxxxxxxx>
 	Created:	07/07/06
-	Inputs:     nFlags      - synthesized mouse event flags (to be passed through to StartToolDrag)
-				PointerPos	- user coordinates of click on ruler (relative to origin set by tool)
+	Inputs:     PointerPos	- user coordinates of click on ruler (relative to origin set by tool)
 				Click		- Type of click enum
 				Mods		- Modifier flags struct
 				pSpread		- pointer to spread upon which click occurred
@@ -1014,13 +1011,11 @@
 
 ********************************************************************************************/
 
-BOOL TextTool::OnRulerClick(UINT32 nFlags, UserCoord PointerPos, ClickType Click, ClickModifiers Mods,
+BOOL TextTool::OnRulerClick(UserCoord PointerPos, ClickType Click, ClickModifiers Mods,
 							Spread* pSpread, RulerBase* pRuler)
 {
 	if (!TextInfoBarOp::IsRulerOriginClaimed()) return FALSE;
-
-	TRACEUSER("wuerthne", _T("TextTool OnRulerClick %d at %d"), Click, PointerPos.x);
-	return TextInfoBarOp::OnRulerClick(nFlags, PointerPos, Click, Mods, pSpread, pRuler);
+	return TextInfoBarOp::OnRulerClick(PointerPos, Click, Mods, pSpread, pRuler);
 }
 
 
@@ -1272,6 +1267,7 @@
 
 BOOL TextTool::HandleSpecialStoryKeys(KeyPress* pKeyPress, TextStory* pStory, CaretNode* pCaret)
 {
+	TRACEUSER("wuerthne", _T("HandleSpecialStoryKeys %d"), pKeyPress->GetVirtKey());
 	ERROR3IF(pKeyPress == NULL, "KeyPress pointer was NULL");
 	ERROR3IF(pStory == NULL, "Story pointer was NULL");
 	ERROR3IF(pCaret == NULL, "Caret pointer was NULL");
Index: Trunk/XaraLX/tools/textinfo.h
===================================================================
--- Trunk/XaraLX/tools/textinfo.h	(revision 1458)
+++ Trunk/XaraLX/tools/textinfo.h	(revision 1459)
@@ -314,7 +314,7 @@
 	static void ReleaseRuler();
 	static void HighlightRulerSection(RulerBase* pRuler, UserRect& UpdateRect);
 	static void RenderRulerBlobs(RulerBase* pRuler, UserRect& UpdateRect);
-	static BOOL OnRulerClick(UINT32 nFlags, UserCoord PointerPos, ClickType Click, ClickModifiers Mods,
+	static BOOL OnRulerClick(UserCoord PointerPos, ClickType Click, ClickModifiers Mods,
 							 Spread* pSpread, RulerBase* pRuler);
 
 	static void ForceRulerRedraw();
Index: Trunk/XaraLX/tools/texttool.h
===================================================================
--- Trunk/XaraLX/tools/texttool.h	(revision 1458)
+++ Trunk/XaraLX/tools/texttool.h	(revision 1459)
@@ -212,7 +212,7 @@
 	// new event handles for handling tab stops on the page ruler
 	void GetRulerOrigin(Spread*,UserCoord*);
 	void RenderRulerBlobs(RulerBase* pRuler, UserRect& UpdateRect, BOOL IsBackground);
-	BOOL OnRulerClick( UINT32 nFlags, UserCoord PointerPos, ClickType Click, ClickModifiers Mods,
+	BOOL OnRulerClick( UserCoord PointerPos, ClickType Click, ClickModifiers Mods,
 					   Spread* pSpread, RulerBase* pRuler);
 
 
Index: Trunk/XaraLX/Kernel/tool.h
===================================================================
--- Trunk/XaraLX/Kernel/tool.h	(revision 1458)
+++ Trunk/XaraLX/Kernel/tool.h	(revision 1459)
@@ -366,8 +366,7 @@
 	virtual void RenderRulerBlobs(RulerBase* pRuler, UserRect& UpdateRect, BOOL IsBackground);
 
 	// Allow the Current Tool to handle Ruler clicks
-	virtual BOOL OnRulerClick( UINT32 nFlags,
-							   UserCoord PointerPos,
+	virtual BOOL OnRulerClick( UserCoord PointerPos,
 							   ClickType Click,
 							   ClickModifiers Mods,
 							   Spread* pSpread,
Index: Trunk/XaraLX/Kernel/rulers.h
===================================================================
--- Trunk/XaraLX/Kernel/rulers.h	(revision 1458)
+++ Trunk/XaraLX/Kernel/rulers.h	(revision 1459)
@@ -148,9 +148,9 @@
 	BOOL DrawBitmap(MILLIPOINT ord, ResourceID BitmapID);
 	// Allow tools to start a drag after receiving an OnRulerClick call.
 	// Drag events will be dispatched via OnRulerClick.
-	BOOL StartToolDrag(UINT32 nFlags, UserCoord, String_256* pOpToken, OpParam* pParam);
+	BOOL StartToolDrag(ClickModifiers Mods, UserCoord, String_256* pOpToken, OpParam* pParam);
 
-	virtual BOOL OnRulerClick(UINT32 nFlags, OilCoord, ClickType, ClickModifiers);
+	virtual BOOL OnRulerClick(OilCoord, ClickType, ClickModifiers);
 
 protected:
 	RulerPair* pRulerPair;
Index: Trunk/XaraLX/Kernel/rulers.cpp
===================================================================
--- Trunk/XaraLX/Kernel/rulers.cpp	(revision 1458)
+++ Trunk/XaraLX/Kernel/rulers.cpp	(revision 1459)
@@ -342,7 +342,7 @@
 
 ********************************************************************************************/
 
-BOOL RulerBase::OnRulerClick(UINT32 nFlags, OilCoord PointerPos, ClickType Click, ClickModifiers Mods)
+BOOL RulerBase::OnRulerClick(OilCoord PointerPos, ClickType Click, ClickModifiers Mods)
 {
 	ERROR3IF(pRulerPair==NULL, "pRulerPair unexpectedly NULL");
 	ERROR3IF(pRulerPair->GetpSpread()==NULL, "pRulerPair->pSpread unexpectedly NULL");
@@ -384,12 +384,28 @@
 	UserPos.translate(-Offsets.x, -Offsets.y);
 
 	if (Tool::GetCurrent())
-		return Tool::GetCurrent()->OnRulerClick(nFlags, UserPos, Click, Mods, pSpread, this);
+		return Tool::GetCurrent()->OnRulerClick(UserPos, Click, Mods, pSpread, this);
 
 	return FALSE;
 }
 
-BOOL RulerBase::StartToolDrag(UINT32 nFlags, UserCoord PointerPos, String_256* pOpToken, OpParam* pParam)
+/********************************************************************************************
+
+> 	BOOL RulerBase::StartToolDrag(ClickModifiers Mods, UserCoord PointerPos,
+								  String_256* pOpToken, OpParam* pParam)
+
+    Author: 	Martin Wuerthner <xara@xxxxxxxxxxxxxxx>
+    Created:	12/07/06
+	Inputs:		Mods - click modifiers (as passed to OnRulerClick)
+				PointerPos - pointer position (as passed to OnRulerClick)
+				pOpToken - name of the operation to invoke for handling the drag
+				pParam - the parameters to pass to the operation
+    Purpose:    Allows tools to start a drag operation on the ruler
+                   			                                     
+********************************************************************************************/
+
+BOOL RulerBase::StartToolDrag(ClickModifiers Mods, UserCoord PointerPos,
+							  String_256* pOpToken, OpParam* pParam)
 {
 	// Find the spread in which the click happened
 	Spread *pSpread = pRulerPair->GetpSpread();
@@ -402,7 +418,7 @@
 	PointerPos.translate(Offsets.x, Offsets.y);
 
 	OilCoord OilPos = PointerPos.ToSpread(pSpread).ToOil(pSpread,pDocView);
-	return pOILRuler->StartToolDrag(nFlags, OilPos, pOpToken, pParam);
+	return pOILRuler->StartToolDrag(Mods, OilPos, pOpToken, pParam);
 }
 
 
Index: Trunk/XaraLX/Kernel/tool.cpp
===================================================================
--- Trunk/XaraLX/Kernel/tool.cpp	(revision 1458)
+++ Trunk/XaraLX/Kernel/tool.cpp	(revision 1459)
@@ -1578,8 +1578,7 @@
 									  )
 	Author:		Phil_Martin (Xara Group Ltd) <camelotdev@xxxxxxxx>
 	Created:	30/Jun/2006
-	Inputs:		nFlags      - synthesized mouse event flags (to be passed through to StartToolDrag)
-				PointerPos	- user coordinates of click on ruler (relative to origin set by tool)
+	Inputs:		PointerPos	- user coordinates of click on ruler (relative to origin set by tool)
 				Click		- Type of click enum
 				Mods		- Modifier flags struct
 				pSpread		- pointer to spread upon which click occurred
@@ -1592,8 +1591,7 @@
 
 ********************************************************************************************/
 
-BOOL Tool_v1::OnRulerClick( UINT32 nFlags,
-							UserCoord PointerPos,
+BOOL Tool_v1::OnRulerClick( UserCoord PointerPos,
 							ClickType Click,
 							ClickModifiers Mods,
 							Spread* pSpread,
Index: Trunk/XaraLX/wxOil/oilruler.h
===================================================================
--- Trunk/XaraLX/wxOil/oilruler.h	(revision 1458)
+++ Trunk/XaraLX/wxOil/oilruler.h	(revision 1459)
@@ -206,7 +206,7 @@
 	virtual BOOL DrawMinorGraticule(OilCoord GratOilPos, INT32 ExtraSize=0);
 	BOOL HighlightSection(OilCoord Lo, OilCoord Hi);
 	BOOL DrawBitmap(OilCoord Pos, ResourceID BitmapID);
-	BOOL StartToolDrag(UINT32 nFlags, OilCoord point, String_256* OpToken, OpParam* Param);
+	BOOL StartToolDrag(ClickModifiers Mods, OilCoord point, String_256* OpToken, OpParam* Param);
 
 	BOOL PaintMouseFollower(OilCoord OilPos, DocView* pDocView, MouseFollowerRenderType RenderType);
 	BOOL  DrawMouseFollower(OilCoord OilPos, DocView* pDocView, MouseFollowerRenderType RenderType, wxDC* pDC);
Index: Trunk/XaraLX/wxOil/oilruler.cpp
===================================================================
--- Trunk/XaraLX/wxOil/oilruler.cpp	(revision 1458)
+++ Trunk/XaraLX/wxOil/oilruler.cpp	(revision 1459)
@@ -343,11 +343,11 @@
 }
 
 /********************************************************************************************
->	BOOL OILRuler::StartToolDrag(UINT32 nFlags, wxPoint point, String_256* OpToken, void* Params)
+>	BOOL OILRuler::StartToolDrag(ClickModifiers Mods, wxPoint point, String_256* OpToken, void* Params)
 
 	Author:		Martin Wuerthner <xara@xxxxxxxxxxxxxxx>
 	Created:	12/07/06
-	Input:      nFlags - the mouse event flags (as passed to OnRulerClick)
+	Input:      Mods - the click modifiers (as passed to OnRulerClick)
 				point - the pointer position (as passed to OnRulerClick)
 				OpToken - name of the operation to invoke
 				Params - an opaque pointer to the parameters for the operation
@@ -355,13 +355,13 @@
 	Purpose:	StartDrag function for tool drags.
 ********************************************************************************************/
                     
-BOOL OILRuler::StartToolDrag(UINT32 nFlags, OilCoord point, String_256* pOpToken, OpParam* pParam)
-{ 
+BOOL OILRuler::StartToolDrag(ClickModifiers Mods, OilCoord point, String_256* pOpToken, OpParam* pParam)
+{
 	if (m_pOwnerView != NULL)
 	{
 		DocView* pDocView = m_pOwnerView->GetDocViewPtr();
 		wxPoint ClientPoint = point.ToWin(pDocView);
-		m_pOwnerView->InvokeDragOp(pOpToken, pParam, nFlags, ClientPoint);
+		m_pOwnerView->InvokeDragOp(pOpToken, pParam, Mods, ClientPoint);
 		return TRUE;
 	}
 
@@ -1002,7 +1002,7 @@
 
 	// Convert the click position to OIL coordinates before passing to the kernel.
 	OilCoord ocoord = ClientToOil(pDocView, point);
-	return pKernelRuler->OnRulerClick(nFlags, ocoord, t, m_LastClickMods);
+	return pKernelRuler->OnRulerClick(ocoord, t, m_LastClickMods);
 }
 
 
@@ -1072,7 +1072,7 @@
 			m_FirstClickButton = 0;
 
 			//Then pass the Up-Click message to CCamView::OnClick
-			return pKernelRuler->OnRulerClick(0, ocoord, CLICKTYPE_UP, m_LastClickMods);
+			return pKernelRuler->OnRulerClick(ocoord, CLICKTYPE_UP, m_LastClickMods);
 		}
 	}
 	else


Xara