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

Re: [XaraXtreme-dev] Ruler extensions



In message <44BB9195.2010605@xxxxxxxx>
          Phil Martin <phil@xxxxxxxx> wrote:

> Martin Wuerthner wrote:
> 
>>In message <44BB88E0.5030405@xxxxxxxx>
>>          Phil Martin <phil@xxxxxxxx> wrote:
>>
>>>[removing mouse flags word from call chain through Kernel to tools
>>>and back...]
>>>
>>>I'll alter HandleDragEvent then you can adjust your stuff whenever
>>>you're ready. OK?
>>
>>Yes, fine with me.
>
> OK, that's done (both HandleDragEvent and InvokeDragOp).

Thanks, find attached a patch to complete the change for the other 
layers.

Martin
Index: wxOil/oilruler.h
===================================================================
--- wxOil/oilruler.h	(Revision 1456)
+++ wxOil/oilruler.h	(Arbeitskopie)
@@ -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: wxOil/oilruler.cpp
===================================================================
--- wxOil/oilruler.cpp	(Revision 1456)
+++ wxOil/oilruler.cpp	(Arbeitskopie)
@@ -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
Index: Kernel/tool.h
===================================================================
--- Kernel/tool.h	(Revision 1456)
+++ Kernel/tool.h	(Arbeitskopie)
@@ -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: Kernel/tool.cpp
===================================================================
--- Kernel/tool.cpp	(Revision 1456)
+++ Kernel/tool.cpp	(Arbeitskopie)
@@ -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: Kernel/rulers.h
===================================================================
--- Kernel/rulers.h	(Revision 1456)
+++ Kernel/rulers.h	(Arbeitskopie)
@@ -147,9 +147,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: Kernel/rulers.cpp
===================================================================
--- Kernel/rulers.cpp	(Revision 1456)
+++ Kernel/rulers.cpp	(Arbeitskopie)
@@ -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: tools/textinfo.h
===================================================================
--- tools/textinfo.h	(Revision 1456)
+++ tools/textinfo.h	(Arbeitskopie)
@@ -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: tools/textinfo.cpp
===================================================================
--- tools/textinfo.cpp	(Revision 1456)
+++ tools/textinfo.cpp	(Arbeitskopie)
@@ -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: tools/texttool.cpp
===================================================================
--- tools/texttool.cpp	(Revision 1456)
+++ tools/texttool.cpp	(Arbeitskopie)
@@ -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: tools/texttool.h
===================================================================
--- tools/texttool.h	(Revision 1456)
+++ tools/texttool.h	(Arbeitskopie)
@@ -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);