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

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 921
Date       : Sat Apr 29 15:52:09 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/sginit.cpp
   D /Trunk/XaraLX/Kernel/sgldrag.cpp
   D /Trunk/XaraLX/Kernel/sgldrag.h
   M /Trunk/XaraLX/Kernel/sgline.cpp
   M /Trunk/XaraLX/Kernel/sgline.h
   M /Trunk/XaraLX/wxOil/dragmgr.cpp
   A /Trunk/XaraLX/wxOil/sgldrag.cpp (from /Trunk/XaraLX/Kernel/sgldrag.cpp:920)
   A /Trunk/XaraLX/wxOil/sgldrag.h (from /Trunk/XaraLX/Kernel/sgldrag.h:920)

Some more line gallery preparatory work


Diff:
Index: Trunk/XaraLX/Kernel/sgline.cpp
===================================================================
--- Trunk/XaraLX/Kernel/sgline.cpp	(revision 920)
+++ Trunk/XaraLX/Kernel/sgline.cpp	(revision 921)
@@ -148,7 +148,7 @@
 //#include "rik.h"
 #include "brushmsg.h"
 #include "brshname.h"
-#include "resdll.h"
+//#include "resdll.h"
 #include "fileutil.h"
 #include "brushop.h"
 
@@ -244,7 +244,8 @@
 					"No attribute run-time classes in LineAttrItem::UpdateCurrentAttribStatus");
 
 		// Count how many types of classes the item represents.  Note the null statement.
-		for (CCRuntimeClass** pprtc = ppAttribClasses; *pprtc != NULL; pprtc++);
+		CCRuntimeClass**  pprtc;
+		for (pprtc = ppAttribClasses; *pprtc != NULL; pprtc++);
 		INT32 nAttribClasses = pprtc - ppAttribClasses;
 
 		// Allocate an array of NodeAttribute pointers for each run-time class.
@@ -756,7 +757,7 @@
 			{
 				//OK temporary dodge (see, not a bodge) to stop people doing things with brushes in the
 				//line gallery before we get them working!
-				LineAttrItem* pItem = this;
+				// LineAttrItem* pItem = this;
 	
 				{
 					// If the colour is in the selected document, then it is safe to
@@ -765,7 +766,7 @@
 					// Otherwise, the normal click action takes place.
 					// If the drag fails (turns into a click) then the normal click action
 					// takes place, passed on by the GalleryColourDragInfo::OnClick handler
-					SGDisplayGroup *Parent = (SGDisplayGroup *) GetParent();
+					// SGDisplayGroup *Parent = (SGDisplayGroup *) GetParent();
 
 					if (Mouse->DoubleClick) // || Parent->GetParentDocument() != Document::GetSelected())
 						DefaultClickHandler(Mouse, MiscInfo);
@@ -874,7 +875,7 @@
 			{
 				pParent->SetVisibility(FALSE);
 
-				pParent->SetSystemStateChanged();	// Ensure toolbar button pops out again
+				DialogBarOp::SetSystemStateChanged();	// Ensure toolbar button pops out again
 			}
 		}
 
@@ -1169,6 +1170,8 @@
 	// Remember a pointer to the global instance of this gallery.
 	ERROR3IF(m_pTheGallery != NULL, "Gallery already exists in LineGallery::LineGallery?");
 	m_pTheGallery = this;
+
+	DlgResID=_R(IDD_LINESGALLERY);
 	
 	// set to the normal default
 	m_PreviousLineWidth = 500;
@@ -1198,7 +1201,7 @@
 	// delete the string array
 	if (m_pFileNameArray != NULL)
 	{	
-		for (INT32 i = 0; i < m_NumDefaultFiles; i++)
+		for (UINT32 i = 0; i < m_NumDefaultFiles; i++)
 			m_pFileNameArray[i].Empty();
 
 		// don't forget that we allocated it with malloc..
@@ -1799,7 +1802,7 @@
 	// Create the default folder, which will contain the default stroke
 	LineAttrGroup *pGroup = CreateGroup(String_256(_R(IDS_BRUSHGROUP_DEFAULT)), TRUE);
 	if (pGroup == NULL)
-		return(NULL);
+		return(FALSE);
 
 	// Create a default 'no brush' brush
 	BrushAttrValue *pAttr;
@@ -1930,24 +1933,24 @@
 		{
 			// Gallery being created.
 			case DIM_CREATE:
-				SGInit::UpdateGalleryButton(OPTOKEN_DISPLAY_LINE_GALLERY, TRUE);
+				SGInit::UpdateGalleryButton(_R(OPTOKEN_DISPLAY_LINE_GALLERY), TRUE);
 				break;
 
 			// Gallery being closed.
 			case DIM_CANCEL:
-				SGInit::UpdateGalleryButton(OPTOKEN_DISPLAY_LINE_GALLERY, FALSE);
+				SGInit::UpdateGalleryButton(_R(OPTOKEN_DISPLAY_LINE_GALLERY), FALSE);
 				break;
 
-				case DIM_LFT_BN_CLICKED:
-				switch(pMsg->GadgetID)
+			case DIM_LFT_BN_CLICKED:
+				if (pMsg->GadgetID == _R(IDC_GALLERY_HELP))		// Show help page
 				{
-					case _R(IDC_GALLERY_HELP):		// Show help page
-					{
-						HelpUserTopic(_R(IDS_HELPPATH_Gallery_Line));
-					}
+					HelpUserTopic(_R(IDS_HELPPATH_Gallery_Line));
 				}
 				break;
 
+			default:
+				break;
+
 		}
 	}
 	
@@ -1955,7 +1958,7 @@
 	else if (MESSAGE_IS_A(pMessage, DocChangingMsg))
 	{
 		DocChangingMsg* pMsg = (DocChangingMsg*) pMessage;
-		if (pMsg->State == DocChangingMsg::DocState::SELCHANGED)
+		if (pMsg->State == DocChangingMsg::SELCHANGED)
 		{
 			if (pMsg->pNewDoc != NULL)
 			{
@@ -2698,7 +2701,9 @@
 BOOL LineGallery::PrepareBrushFolders()
 {
 	// find all .xar files in the /templates/brushes directory and put them in a temp array
-	
+PORTNOTE("other", "Disabled loading of line gallery templates")
+#ifndef EXCLUDE_FROM_XARALX
+
 	// allocate a stupidly large array
 	String_256 TempString[1000]; // surely can't be 1000 files!
 
@@ -2755,7 +2760,7 @@
 	memcpy(m_pFileNameArray, &TempString, size * Counter);
 	
 	m_NumDefaultFiles = Counter;  // remember how many we got
-
+#endif
 	return TRUE;
 }
 
@@ -2878,8 +2883,8 @@
 {
 	// If the gallery is currently open then the menu item should be ticked.
 	OpState OpSt;  
-	DialogBarOp* pDialogBarOp = FindGallery();
-	if (pDialogBarOp != NULL) OpSt.Ticked = pDialogBarOp->IsVisible();
+	SuperGallery* pSuperGallery = FindGallery();
+	if (pSuperGallery != NULL) OpSt.Ticked = pSuperGallery->IsVisible();
 
 	// If there are no open documents, you can't toggle the gallery
   	OpSt.Greyed = (Document::GetSelected() == NULL);
@@ -2903,15 +2908,15 @@
 
 void OpDisplayLineGallery::Do(OpDescriptor*)
 {
-	DialogBarOp *pDialogBarOp = FindGallery();
+	SuperGallery *pSuperGallery = FindGallery();
 
-	if (pDialogBarOp != NULL)
+	if (pSuperGallery != NULL)
 	{
 		// Toggle the visible state of the gallery window
-		pDialogBarOp->SetVisibility(!pDialogBarOp->IsVisible());
+		pSuperGallery->SetVisibility(!pSuperGallery->IsVisible());
 
 		// And update the gallery button state
-		SGInit::UpdateGalleryButton(OPTOKEN_DISPLAY_LINE_GALLERY, pDialogBarOp->IsVisible());
+		SGInit::UpdateGalleryButton(_R(OPTOKEN_DISPLAY_LINE_GALLERY), pSuperGallery->IsVisible());
 	}
 	
 	End();
@@ -2920,7 +2925,7 @@
 
 
 /********************************************************************************************
->   static DialogBarOp* OpDisplayLineGallery::FindGallery()
+>   static SuperGallery* OpDisplayLineGallery::FindGallery()
 
 	Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xxxxxxxx>
 	Created:    9/2/95 (base generated in sgbase.cpp)
@@ -2933,15 +2938,14 @@
 				Also check that bars.ini indicates the bar is of the LineGallery class
 ********************************************************************************************/
 
-DialogBarOp* OpDisplayLineGallery::FindGallery()
+SuperGallery* OpDisplayLineGallery::FindGallery()
 {
-	String_32 Name = _R(IDS_SGLINE_GALLERY_NAME); // "Line gallery";
-	DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(Name);
+	SuperGallery* pSuperGallery = SuperGallery::FindSuperGallery(_R(IDD_LINESGALLERY));
 
-	if (pDialogBarOp != NULL)
+	if (pSuperGallery != NULL)
 	{
-		if (pDialogBarOp->GetRuntimeClass() == CC_RUNTIME_CLASS(LineGallery))
-			return(pDialogBarOp);
+		if (pSuperGallery->GetRuntimeClass() == CC_RUNTIME_CLASS(LineGallery))
+			return(pSuperGallery);
 
 		ERROR3("Got the line gallery but it's not of the LineGallery class?");
 	}
Index: Trunk/XaraLX/Kernel/sgline.h
===================================================================
--- Trunk/XaraLX/Kernel/sgline.h	(revision 920)
+++ Trunk/XaraLX/Kernel/sgline.h	(revision 921)
@@ -415,7 +415,7 @@
 
 private:
 	// Finds the Line gallery class instance
-	static DialogBarOp* FindGallery(void);
+	static SuperGallery* FindGallery(void);
 };  
 
 #endif
Index: Trunk/XaraLX/Kernel/sginit.cpp
===================================================================
--- Trunk/XaraLX/Kernel/sginit.cpp	(revision 920)
+++ Trunk/XaraLX/Kernel/sginit.cpp	(revision 921)
@@ -109,7 +109,7 @@
 //#include "sgfonts.h"	// For OpDisplayFontsGallery
 //#include "sglcart.h"	// For OpDisplayLibClipartGallery et al
 //#include "sglfills.h"	// For OpDisplayLibFillsGallery
-//#include "sgline.h"		// For OpDisplayLineGallery
+#include "sgline.h"		// For OpDisplayLineGallery
 #include "ngdialog.h"	// For OpDisplayNameGallery & OpNGPropertyIndexDesc
 #include "sgscan.h"		// For Library::InitLibPrefs()
 #include "layerprp.h"	// For LayerPropertiesDlg::Init()
Index: Trunk/XaraLX/Kernel/sgldrag.h (deleted)
===================================================================
Index: Trunk/XaraLX/Kernel/sgldrag.cpp (deleted)
===================================================================
Index: Trunk/XaraLX/wxOil/sgldrag.h
===================================================================
--- Trunk/XaraLX/wxOil/sgldrag.h	(revision 0)
+++ Trunk/XaraLX/wxOil/sgldrag.h	(revision 921)
@@ -0,0 +1,202 @@
+// $Id$
+/* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
+================================XARAHEADERSTART===========================
+ 
+               Xara LX, a vector drawing and manipulation program.
+                    Copyright (C) 1993-2006 Xara Group Ltd.
+       Copyright on certain contributions may be held in joint with their
+              respective authors. See AUTHORS file for details.
+
+LICENSE TO USE AND MODIFY SOFTWARE
+----------------------------------
+
+This file is part of Xara LX.
+
+Xara LX is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 as published
+by the Free Software Foundation.
+
+Xara LX and its component source files are distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even the
+implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with Xara LX (see the file GPL in the root directory of the
+distribution); if not, write to the Free Software Foundation, Inc., 51
+Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+
+ADDITIONAL RIGHTS
+-----------------
+
+Conditional upon your continuing compliance with the GNU General Public
+License described above, Xara Group Ltd grants to you certain additional
+rights. 
+
+The additional rights are to use, modify, and distribute the software
+together with the wxWidgets library, the wxXtra library, and the "CDraw"
+library and any other such library that any version of Xara LX relased
+by Xara Group Ltd requires in order to compile and execute, including
+the static linking of that library to XaraLX. In the case of the
+"CDraw" library, you may satisfy obligation under the GNU General Public
+License to provide source code by providing a binary copy of the library
+concerned and a copy of the license accompanying it.
+
+Nothing in this section restricts any of the rights you have under
+the GNU General Public License.
+
+
+SCOPE OF LICENSE
+----------------
+
+This license applies to this program (XaraLX) and its constituent source
+files only, and does not necessarily apply to other Xara products which may
+in part share the same code base, and are subject to their own licensing
+terms.
+
+This license does not apply to files in the wxXtra directory, which
+are built into a separate library, and are subject to the wxWindows
+license contained within that directory in the file "WXXTRA-LICENSE".
+
+This license does not apply to the binary libraries (if any) within
+the "libs" directory, which are subject to a separate license contained
+within that directory in the file "LIBS-LICENSE".
+
+
+ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
+----------------------------------------------
+
+Subject to the terms of the GNU Public License (see above), you are
+free to do whatever you like with your modifications. However, you may
+(at your option) wish contribute them to Xara's source tree. You can
+find details of how to do this at:
+  http://www.xaraxtreme.org/developers/
+
+Prior to contributing your modifications, you will need to complete our
+contributor agreement. This can be found at:
+  http://www.xaraxtreme.org/developers/contribute/
+
+Please note that Xara will not accept modifications which modify any of
+the text between the start and end of this header (marked
+XARAHEADERSTART and XARAHEADEREND).
+
+
+MARKS
+-----
+
+Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
+designs are registered or unregistered trademarks, design-marks, and/or
+service marks of Xara Group Ltd. All rights in these marks are reserved.
+
+
+      Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
+                        http://www.xara.com/
+
+=================================XARAHEADEREND============================
+ */
+// sgldrag.h - Line gallery item dragging
+
+#ifndef INC_SGLDRAG
+#define INC_SGLDRAG
+
+#include "dragbmp.h"
+#include "sgdrag.h"
+#include "sgline.h"
+
+class Bitmap;
+class KernelBitmap;
+
+/********************************************************************************************
+
+>	class GalleryLineDragInfo : public BitmapDragInformation
+
+	Author:		Will_Cowling (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	10/4/95
+	Purpose:	A Line attribute drag, which was started from the line gallery
+	SeeAlso:	BitmapDragInformation
+				
+********************************************************************************************/
+
+class GalleryLineDragInfo : public BitmapDragInformation
+{ 
+	CC_DECLARE_DYNCREATE(GalleryLineDragInfo)
+ 
+public:
+	GalleryLineDragInfo();
+ 	GalleryLineDragInfo(	LineAttrItem *pSourceItem,
+							SGMouseInfo *pMouseInfo, SGMiscInfo *pMiscInfo,
+ 							BOOL IsAdjust = FALSE);
+
+	~GalleryLineDragInfo();
+
+	virtual void OnClick(INT32 Flags, POINT Point);
+
+	virtual UINT32 GetCursorID(DragTarget* pDragTarget);
+	virtual BOOL GetStatusLineText(String_256 * TheText, DragTarget* pDragTarget);
+
+	virtual BOOL CanDropOnPage() { return TRUE; }
+	virtual BOOL OnPageDrop(ViewDragTarget*);
+
+	virtual INT32 GetDragTransparency();
+	virtual KernelBitmap* GetSolidDragMask();
+	virtual BOOL OnDrawSolidDrag(wxPoint Origin, wxDC * TheDC, DragTarget* pDragTarget);
+
+	LineAttrItem*	GetDraggedLineAttr()	{ return(SourceItem); }
+
+protected:
+	BOOL DropStartOrEndArrow(Path*, DocCoord, BOOL*);
+	NodeAttribute* MakeStartOrEndArrow(NodeAttribute*, BOOL);
+
+protected:
+	LineAttrItem*	SourceItem;
+	SGMouseInfo				MouseInfo;
+	SGMiscInfo				MiscInfo;
+
+	NodeAttribute* pAttr;
+};
+
+/*********************************************************************************************
+
+>	class 	SGLineDragTarget : public SGListDragTarget
+
+	Author:		Will_Cowling (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	10/4/95
+
+	Purpose:	An instantiation of this class is created by each entity which wishes to 
+				provide a 'destination' to which the mouse can go to complete a drag.
+
+				This particular target is used for handling drags of BitmapSGalllery items
+				within their displayed list. It automatically handles drags with draginfo
+				derived from BitmapDragInformation.
+
+	Notes:		Drag targets are destructed automatically when a drag finishes by the drag
+				manager with which they were registered.
+
+				To remove a drag target at any time, destruct it - it automatically deregisters
+				and cleans up.
+				
+	SeeAlso:	DragManagerOp::StartDrag; DragInformation; DragTarget;
+				SGBitmapDragTarget::ProcessEvent
+
+	Documentation:	Docs\Specs\DragMan.doc; Docs\HowToUse\SGallery.doc
+
+*********************************************************************************************/
+
+class SGLineDragTarget : public SGListDragTarget
+{
+friend class DragManagerOp;
+	
+CC_DECLARE_DYNAMIC(SGLineDragTarget)
+
+public:	// Public interface
+	SGLineDragTarget(DialogOp *TheDialog, CGadgetID TheGadget = NULL);
+
+protected:
+		// Process a drag-related event
+	virtual BOOL ProcessEvent(DragEventType Event,
+								DragInformation *pDragInfo,
+								OilCoord *pMousePos, KeyPress* pKeyPress);
+};
+
+#endif

Property changes on: Trunk/XaraLX/wxOil/sgldrag.h
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Index: Trunk/XaraLX/wxOil/sgldrag.cpp
===================================================================
--- Trunk/XaraLX/wxOil/sgldrag.cpp	(revision 0)
+++ Trunk/XaraLX/wxOil/sgldrag.cpp	(revision 921)
@@ -0,0 +1,773 @@
+// $Id$
+/* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
+================================XARAHEADERSTART===========================
+ 
+               Xara LX, a vector drawing and manipulation program.
+                    Copyright (C) 1993-2006 Xara Group Ltd.
+       Copyright on certain contributions may be held in joint with their
+              respective authors. See AUTHORS file for details.
+
+LICENSE TO USE AND MODIFY SOFTWARE
+----------------------------------
+
+This file is part of Xara LX.
+
+Xara LX is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 as published
+by the Free Software Foundation.
+
+Xara LX and its component source files are distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even the
+implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with Xara LX (see the file GPL in the root directory of the
+distribution); if not, write to the Free Software Foundation, Inc., 51
+Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+
+ADDITIONAL RIGHTS
+-----------------
+
+Conditional upon your continuing compliance with the GNU General Public
+License described above, Xara Group Ltd grants to you certain additional
+rights. 
+
+The additional rights are to use, modify, and distribute the software
+together with the wxWidgets library, the wxXtra library, and the "CDraw"
+library and any other such library that any version of Xara LX relased
+by Xara Group Ltd requires in order to compile and execute, including
+the static linking of that library to XaraLX. In the case of the
+"CDraw" library, you may satisfy obligation under the GNU General Public
+License to provide source code by providing a binary copy of the library
+concerned and a copy of the license accompanying it.
+
+Nothing in this section restricts any of the rights you have under
+the GNU General Public License.
+
+
+SCOPE OF LICENSE
+----------------
+
+This license applies to this program (XaraLX) and its constituent source
+files only, and does not necessarily apply to other Xara products which may
+in part share the same code base, and are subject to their own licensing
+terms.
+
+This license does not apply to files in the wxXtra directory, which
+are built into a separate library, and are subject to the wxWindows
+license contained within that directory in the file "WXXTRA-LICENSE".
+
+This license does not apply to the binary libraries (if any) within
+the "libs" directory, which are subject to a separate license contained
+within that directory in the file "LIBS-LICENSE".
+
+
+ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
+----------------------------------------------
+
+Subject to the terms of the GNU Public License (see above), you are
+free to do whatever you like with your modifications. However, you may
+(at your option) wish contribute them to Xara's source tree. You can
+find details of how to do this at:
+  http://www.xaraxtreme.org/developers/
+
+Prior to contributing your modifications, you will need to complete our
+contributor agreement. This can be found at:
+  http://www.xaraxtreme.org/developers/contribute/
+
+Please note that Xara will not accept modifications which modify any of
+the text between the start and end of this header (marked
+XARAHEADERSTART and XARAHEADEREND).
+
+
+MARKS
+-----
+
+Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
+designs are registered or unregistered trademarks, design-marks, and/or
+service marks of Xara Group Ltd. All rights in these marks are reserved.
+
+
+      Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
+                        http://www.xara.com/
+
+=================================XARAHEADEREND============================
+ */
+// sgldrag.cpp - Line gallery item dragging
+
+#include "camtypes.h"
+
+#include "sgldrag.h"
+#include "dragmgr.h"
+#include "dragbmp.h"
+//#include "viewrc.h"
+//#include "resource.h"
+
+#include "docview.h"
+#include "scrcamvw.h"
+#include "spread.h"
+#include "attrmgr.h"
+#include "grndbmp.h"
+#include "nodepath.h"
+#include "lineattr.h"
+#include "sgline.h"
+
+//#include "richard2.h"	// string resources
+
+// Implement the dynamic class bits...
+CC_IMPLEMENT_DYNCREATE(GalleryLineDragInfo, BitmapDragInformation)
+CC_IMPLEMENT_DYNAMIC(SGLineDragTarget, SGListDragTarget);
+
+// This line mustn't go before any CC_IMPLEMENT_... macros
+#define new CAM_DEBUG_NEW
+
+// This determines where, if at all, the text description of a dragged line gallery item
+// will be displayed.
+const LineAttrItem::TextPosition c_eLineAttrDragTextPos = LineAttrItem::NO_LABEL;
+
+
+/********************************************************************************************
+
+>	SGLineDragTarget::SGLineDragTarget(DialogOp *TheDialog, CGadgetID TheGadget = NULL)
+	 
+	Author:		Will_Cowling (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	10/4/95
+	Inputs:		TheDialog - The kernel dialog in which the target exists
+				TheGadget - The gadget within that dialogue which is the target
+
+	Purpose:	Constructor
+
+********************************************************************************************/
+
+SGLineDragTarget::SGLineDragTarget(DialogOp *TheDialog, CGadgetID TheGadget)
+					: SGListDragTarget(TheDialog, TheGadget)
+{
+	ERROR3IF(!TheDialog->IsKindOf(CC_RUNTIME_CLASS(LineGallery)),
+			"You can only use SGLineDragTargets with LineGallery dialogues!");
+}
+
+
+
+/********************************************************************************************
+
+	BOOL SGLineDragTarget::ProcessEvent(DragEventType Event, DragInformation *pDragInfo,
+											OilCoord *pMousePos, KeyPress* pKeyPress)
+
+	Author:		Will_Cowling (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	10/4/95
+	Inputs:		Event - Indicates what has happened
+				pDragInfo - points to drag information describing this drag. This
+				should be a BitmapDragInformation or derivation thereof
+				pMousePos - points to information on the current mouse position, in OIL coords
+				pKeyPress - NULL, or if for a keypress event, keypress information
+
+	Returns:	TRUE to claim the event, FALSE to let it through to other targets
+
+	Purpose:	Event Handler for SuperGallery listitem drag events. Overrides the
+				base class handler to enable it to sort out the node being dragged
+				for Line drags.
+
+********************************************************************************************/
+
+BOOL SGLineDragTarget::ProcessEvent(DragEventType Event, DragInformation *pDragInfo,
+										OilCoord *pMousePos, KeyPress* pKeyPress)
+{
+	if (!pDragInfo->IsKindOf(CC_RUNTIME_CLASS(GalleryLineDragInfo)))
+		return(FALSE);
+
+	SGDisplayNode *DraggedNode = NULL;
+	BOOL IsSimpleBitmapDrag = TRUE;
+
+	if (IS_A(pDragInfo, GalleryLineDragInfo))
+	{
+		DraggedNode = ((GalleryLineDragInfo *)pDragInfo)->GetDraggedLineAttr();
+	}
+
+	if (DraggedNode != NULL)
+	{
+		switch(Event)
+		{
+			case DRAGEVENT_COMPLETED:
+				HandleDragCompleted((SuperGallery *) TargetDialog,
+									DraggedNode, pMousePos, IsSimpleBitmapDrag);
+				return(TRUE);
+
+
+			case DRAGEVENT_MOUSESTOPPED:
+			case DRAGEVENT_MOUSEMOVED:
+			case DRAGEVENT_MOUSEIDLE:
+				// Call a subroutine to work out and set our current cursor shape
+				return(DetermineCursorShape((SuperGallery *) TargetDialog,
+											DraggedNode, pMousePos));
+		}
+	}
+
+	// Otherwise, we aren't interested in the event, so we don't claim it
+	return(FALSE);
+}
+
+/********************************************************************************************
+
+>	void GalleryLineDragInfo::GalleryLineDragInfo() 
+	 
+	Author:		Will_Cowling (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	10/4/95		  
+
+	Purpose:	Default constructor - do not call this constructor
+
+********************************************************************************************/
+
+GalleryLineDragInfo::GalleryLineDragInfo()
+{
+	ERROR3("Default GalleryLineDragInfo constructor called");	
+}
+
+
+
+/********************************************************************************************
+
+>	GalleryLineDragInfo::GalleryLineDragInfo(LineAttrItem *pSourceItem,
+											SGMouseInfo *pMouseInfo, SGMiscInfo *pMiscInfo,
+ 											BOOL IsAdjust = FALSE)
+	 
+	Author:		Will_Cowling (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	10/4/95		  
+
+	Inputs:		pSourceItem - The gallery item from which the drag originated
+				pMouseInfo	- The mouse info which made the item start the drag
+				pMiscInfo	- The MiscInfo which accompanied the mouse event
+				IsAdjust	- TRUE if this is an adjust (line-Bitmap) drag
+
+	Purpose:	Constructor
+
+********************************************************************************************/
+
+GalleryLineDragInfo::GalleryLineDragInfo(LineAttrItem *pSourceItem,
+											SGMouseInfo *pMouseInfo, SGMiscInfo *pMiscInfo,
+ 											BOOL IsAdjust)
+					  : BitmapDragInformation(NULL, 100,50,0,0,
+					  							IsAdjust)
+{
+	SourceItem	= pSourceItem;	// Copy the source item pointer
+
+	pAttr 		= SourceItem->CreateNewAttribute(IsAdjust);
+
+	MouseInfo	= *pMouseInfo;	// Duplicate the structures (they may cease to exist
+	MiscInfo	= *pMiscInfo;	// soon after the drag is started)
+}
+
+/********************************************************************************************
+
+>	GalleryLineDragInfo::~GalleryLineDragInfo()
+ 
+	Author:		Will_Cowling (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	10/4/95		  
+
+	Purpose:	Destructor. Deletes the dragged bitmap.
+
+********************************************************************************************/
+
+GalleryLineDragInfo::~GalleryLineDragInfo()
+{
+	if (TheBitmap != NULL)
+	{
+		delete TheBitmap;
+		TheBitmap = NULL;
+	}
+
+	if (pAttr != NULL)
+		delete pAttr;
+}
+
+/********************************************************************************************
+
+>	void GalleryLineDragInfo::OnClick(INT32 Flags,POINT Point) 
+	 
+	Author:		Will_Cowling (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	10/4/95		  
+	Inputs:		-
+	Outputs:	-
+	Returns:	-
+	Purpose:	This is called if a drag was attempted but never started because it was a 
+				click all along. It calls back the SourceItem SGDisplayLine, to get it
+				to handle the click.
+	Errors:		-
+	SeeAlso:	-
+
+********************************************************************************************/
+
+void GalleryLineDragInfo::OnClick(INT32 Flags ,POINT Point)
+{
+	if (SourceItem != NULL)
+		SourceItem->DragWasReallyAClick(&MouseInfo, &MiscInfo);
+}
+
+/********************************************************************************************
+
+>	void GalleryLineDragInfo::GetCursorID(DragTarget* pDragTarget)
+
+	Author:		Will_Cowling (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	10/4/95
+	Purpose:	Set cursor over this target
+
+
+********************************************************************************************/
+
+UINT32 GalleryLineDragInfo::GetCursorID(DragTarget* pDragTarget)
+{
+	if (pDragTarget && pDragTarget->IS_KIND_OF(ViewDragTarget))
+	{
+		PageDropInfo PageDropInfo;
+		((ViewDragTarget*)pDragTarget)->GetDropInfo(&PageDropInfo);
+
+		NodeRenderableInk* pObjectHit 	= PageDropInfo.pObjectHit;
+		ObjectDragTarget TargetHit 		= PageDropInfo.TargetHit;
+
+		if (IS_A(pAttr, AttrStartArrow) || IS_A(pAttr, AttrEndArrow))
+		{
+			if (pObjectHit && pObjectHit->IS_KIND_OF(NodePath))
+			{
+				Path* pPath = &((NodePath*)pObjectHit)->InkPath;
+				BOOL IsStart;
+				if (DropStartOrEndArrow(pPath, PageDropInfo.DropPos, &IsStart))
+				{
+					TargetHit = IsStart ? STARTCOL_TARGET : ENDCOL_TARGET;
+				}
+			}
+		}
+
+		ClickModifiers ClickMods = ClickModifiers::GetClickModifiers();
+		BOOL IsInside = ClickMods.Constrain;
+
+		if (!IsInside && pObjectHit && pObjectHit->IsCompound())
+		{
+			TargetHit = MANY_TARGET;
+		}
+
+		switch (TargetHit)
+		{
+			case FILL_TARGET:
+				return IsInside ? _R(IDC_DROPINSIDEONLINE) : _R(IDC_CANDROPONLINE);
+			case LINE_TARGET:
+				return IsInside ? _R(IDC_DROPINSIDEONLINE) : _R(IDC_CANDROPONLINE);
+			case STARTCOL_TARGET:
+				return IsInside ? _R(IDC_DROPINSIDEONFILLSTART) : _R(IDC_CANDROPONFILLSTART);
+			case ENDCOL_TARGET:
+				return IsInside ? _R(IDC_DROPINSIDEONFILLEND) : _R(IDC_CANDROPONFILLEND);
+			case MANY_TARGET:
+				return IsInside ? _R(IDC_DROPINSIDEONLINE) : _R(IDC_CANDROPONLINE);
+
+			case NO_TARGET:
+				return _R(IDC_CANDROPONPAGE);
+		};
+
+		return _R(IDC_CANDROPONPAGE);
+	}
+
+	return _R(IDC_CANTDROP);
+}
+
+/********************************************************************************************
+
+>	virtual BOOL GalleryLineDragInfo::GetStatusLineText(String_256 * TheText, DragTarget* pDragTarget)
+
+	Author:		Will_Cowling (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	10/4/95
+	Returns:	Whether String is valid
+	Purpose:	provide status line text for this target
+   
+********************************************************************************************/
+
+BOOL GalleryLineDragInfo::GetStatusLineText(String_256 * TheText, DragTarget* pDragTarget)
+{
+	ERROR2IF(TheText==NULL,FALSE,"NULL string in GetStatusLineText()");
+
+	if (TheBitmap == NULL || TheBitmap->ActualBitmap == NULL)
+		return FALSE;
+
+ 	String_256 DragString(_R(IDS_SGLDRAG_DRAG_LINE_ATTR)); // "Dragging line attribute"
+	DragString += String_8(_R(IDS_SGDFONTS_STAT_COLON_SEP)); //" : ";
+
+	if (pDragTarget && pDragTarget->IS_KIND_OF(ViewDragTarget))
+	{
+		PageDropInfo PageDropInfo;
+		((ViewDragTarget*)pDragTarget)->GetDropInfo(&PageDropInfo);
+
+		NodeRenderableInk* pObjectHit 	= PageDropInfo.pObjectHit;
+		ObjectDragTarget TargetHit 		= PageDropInfo.TargetHit;
+
+		String_256 ObjectDesc = _R(IDS_SGLDRAG_THIS_OBJECT); // " this object";
+
+		if (pObjectHit)
+		{
+			ObjectDesc = pObjectHit->Describe(FALSE);
+		}
+
+		ClickModifiers ClickMods = ClickModifiers::GetClickModifiers();
+		BOOL IsInside = ClickMods.Constrain;
+
+		if (!IsInside && pObjectHit && pObjectHit->IsCompound())
+		{
+			TargetHit = MANY_TARGET;
+		}
+
+		switch (TargetHit)
+		{
+			case FILL_TARGET:
+			case LINE_TARGET:
+			case STARTCOL_TARGET:
+			case ENDCOL_TARGET:
+				DragString += String_64(_R(IDS_SGLDRAG_DROP_TO_APPLY)); // "Drop to apply this attribute to this ";
+				DragString += ObjectDesc;
+				if (IsInside)
+					DragString += String_64(_R(IDS_SGLDRAG_SPACE_ALONE)); // " alone";
+				break;
+
+			case MANY_TARGET:
+				DragString += String_64(_R(IDS_SGLDRAG_DROP_TO_APPLY)); // "Drop to apply this attribute to this ";
+				DragString += ObjectDesc;
+				DragString += String_64(_R(IDS_SGLDRAG_CONTROL_DROP_INSIDE)); // "; Press 'Control' to drop 'Inside'";
+				break;
+
+			case NO_TARGET:
+				DragString += String_64(_R(IDS_SGLDRAG_DROP_CURRENT_ATTRIBUTE)); // "Drop to set the Current Attribute";
+				break;
+		};
+
+	 	*TheText = DragString;
+		return TRUE;
+	}
+ 	
+	return FALSE;
+}
+
+/********************************************************************************************
+
+>	BOOL GalleryBitmapDragInfo::OnPageDrop(ViewDragTarget* pDragTarget)
+ 
+	Author:		Will_Cowling (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	10/4/95		  
+	Inputs:		-
+	Outputs:	-
+	Returns:	-
+	Purpose:	Called when a Line Attr is dropped onto the page.
+	Errors:		-
+	SeeAlso:	-
+
+********************************************************************************************/
+
+BOOL GalleryLineDragInfo::OnPageDrop(ViewDragTarget* pDragTarget)
+{
+	PageDropInfo PageDropInfo;
+	((ViewDragTarget*)pDragTarget)->GetDropInfo(&PageDropInfo);
+	NodeRenderableInk* pObjectHit = PageDropInfo.pObjectHit;
+
+	NodeAttribute* Attrib = SourceItem->CreateNewAttribute(IsAnAdjustDrag());
+
+	if (Attrib == NULL)
+		return FALSE;
+
+	if (pObjectHit && (IS_A(Attrib, AttrStartArrow) || IS_A(Attrib, AttrEndArrow)))
+	{
+		if (!pObjectHit->IS_KIND_OF(NodePath))
+		{
+			delete Attrib;
+			return FALSE;
+		}
+
+		Path* pPath = &((NodePath*)pObjectHit)->InkPath;
+		BOOL IsStart;
+
+		if (!DropStartOrEndArrow(pPath, PageDropInfo.DropPos, &IsStart))
+		{
+			delete Attrib;
+			return FALSE;
+		}
+
+		Attrib = MakeStartOrEndArrow(Attrib, IsStart);
+	}
+
+	if (pObjectHit) 
+	{
+		// Hit a Line Object, so apply attribute to it
+		AttributeManager::ApplyAttribToNode(pObjectHit, Attrib);
+	}
+	else
+	{
+		// Didn't hit anything, so just set the current attribute
+		AttributeManager::AttributeSelected(Attrib);
+	}
+
+	return TRUE;
+}
+
+
+/********************************************************************************************
+
+>	INT32 GalleryLineDragInfo::GetDragTransparency()
+ 
+	Author:		Will_Cowling (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	10/4/95		  
+	Returns:	-
+	Purpose:	Specifies how transparent a drag should be.
+				A value of 0, will cause a normal solid blit.
+				Any other value (between 0 and 100), will cause a masked blit.
+	SeeAlso:	-
+
+********************************************************************************************/
+
+INT32 GalleryLineDragInfo::GetDragTransparency()
+{
+//	if (IS_A(pAttr, AttrStartArrow) || IS_A(pAttr, AttrEndArrow))
+//		return 50;
+
+	return 50;
+}
+
+/********************************************************************************************
+
+>	KernelBitmap* GalleryLineDragInfo::GetSolidDragMask()
+
+	Author:		Will_Cowling (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	10/4/95		  
+	Returns:	-
+	Purpose:	Makes a 1bpp KernelBitmap mask for the solid drag.
+	SeeAlso:	-
+
+********************************************************************************************/
+
+KernelBitmap* GalleryLineDragInfo::GetSolidDragMask()
+{
+	if (DragMask == NULL)
+	{
+		DocView *View = DocView::GetCurrent();
+		if (View == NULL)
+		{
+			return NULL;
+		}
+		
+		Spread *pSpread = View->FindEnclosingSpread(OilCoord(0,0));
+		if (pSpread == NULL)
+		{
+			return NULL;
+		}
+
+		// Find the size of the rendered item.
+		DocRect ClipRegion(0,0, 750*100, 750*50);
+//		ClipRegion.lo.x = ClipRegion.lo.y = 0;
+//		SourceItem->GetSize(c_eLineAttrDragTextPos, &ClipRegion.hi.x, &ClipRegion.hi.y);
+		Matrix ConvertMatrix;
+		FIXED16 ViewScale = 1;
+
+		CDC DisplayDC;
+		DisplayDC.CreateDC("DISPLAY", NULL, NULL, NULL); 
+
+		double dpi = (double) GetDeviceCaps( DisplayDC.m_hDC, LOGPIXELSX );
+
+		GRenderBitmap* pMaskRegion 	= new GRenderBitmap(ClipRegion, ConvertMatrix, ViewScale, 
+														1, dpi);
+
+
+		pMaskRegion->AttachDevice(View, &DisplayDC, pSpread);
+
+		// Make a Mask Bitmap
+		pMaskRegion->StartRender();
+	  	SourceItem->Render(pMaskRegion, ClipRegion, c_eLineAttrDragTextPos);
+		pMaskRegion->StopRender();
+
+		OILBitmap* pOilMaskBmp = pMaskRegion->ExtractBitmap();
+		DragMask = new KernelBitmap(pOilMaskBmp, TRUE);	
+
+		delete pMaskRegion;
+	}
+
+	return DragMask;
+}
+
+/********************************************************************************************
+
+>	BOOL GalleryLineDragInfo::OnDrawSolidDrag(wxPoint Origin, wxDC * TheDC, DragTarget* pDragTarget)
+
+	Author:		Will_Cowling (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	10/4/95		  
+	Returns:	-
+	Purpose:	Gets the gallery item to render itself on the first OnDrawSolidDrag call.
+	SeeAlso:	-
+
+********************************************************************************************/
+
+BOOL OnDrawSolidDrag(wxPoint Origin, wxDC * TheDC, DragTarget* pDragTarget)
+{
+	if (TheBitmap == NULL)
+	{
+		DocView *View = DocView::GetCurrent();
+		if (View == NULL)
+		{
+			return NULL;
+		}
+		
+		Spread *pSpread = View->FindEnclosingSpread(OilCoord(0,0));
+		if (pSpread == NULL)
+		{
+			return NULL;
+		}
+
+		// Find the size of the rendered item.
+//		DocRect ClipRegion;
+		DocRect ClipRegion(0,0, 750*100, 750*50);
+//		ClipRegion.lo.x = ClipRegion.lo.y = 0;
+//		SourceItem->GetSize(c_eLineAttrDragTextPos, &ClipRegion.hi.x, &ClipRegion.hi.y);
+		Matrix ConvertMatrix;
+		FIXED16 ViewScale = 1;
+
+		CDC DisplayDC;
+		DisplayDC.CreateDC("DISPLAY", NULL, NULL, NULL); 
+
+		UINT32 Depth = GetDeviceCaps( DisplayDC.m_hDC, BITSPIXEL ) * 
+										GetDeviceCaps( DisplayDC.m_hDC, PLANES );
+
+		double dpi   = (double) GetDeviceCaps( DisplayDC.m_hDC, LOGPIXELSX );
+
+		GRenderBitmap* pRegion 	= new GRenderBitmap(ClipRegion, ConvertMatrix, ViewScale, 
+													Depth, dpi);
+
+		pRegion->AttachDevice(View, &DisplayDC, pSpread);
+
+		// Make the Drag Bitmap
+		pRegion->StartRender();
+	  	SourceItem->Render(pRegion, ClipRegion, c_eLineAttrDragTextPos);
+		pRegion->StopRender();
+
+		OILBitmap* pOilDragBmp = pRegion->ExtractBitmap();
+		TheBitmap = new KernelBitmap(pOilDragBmp, TRUE);	
+
+		delete pRegion;
+	}
+
+	// Call base class to do the actual drawing
+	return BitmapDragInformation::OnDrawSolidDrag(Origin, TheDC);
+}
+
+/********************************************************************************************
+
+>	BOOL GalleryLineDragInfo::DropStartOrEndArrow(Path* pPathHit, DocCoord DropPos,
+											  BOOL* IsStart)
+
+	Author:		Will_Cowling (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	10/4/95		  
+	Returns:	-
+	Purpose:	Checks to see whether the arrow was dropped nearer to the start or end of
+				a path.
+	SeeAlso:	-
+
+********************************************************************************************/
+
+BOOL GalleryLineDragInfo::DropStartOrEndArrow(Path* pPathHit, DocCoord DropPos,
+											  BOOL* IsStart)
+{
+	double NearestDist = -1;
+	BOOL GotNearest = FALSE;
+	BOOL NearestIsStart;
+
+	DocCoord* Coords = pPathHit->GetCoordArray();
+	PathVerb* Verbs  = pPathHit->GetVerbArray();
+	INT32 NumCoords   = pPathHit->GetNumCoords();
+
+	DocCoord ArrowCentre;
+	DocCoord ArrowDirection;
+
+	INT32 PathIndex = 0;
+
+	// Find the first position of an ArrowHead
+	BOOL GotPos = ArrowRec::GetFirstArrowPos(TRUE,
+											 Coords, Verbs, NumCoords, 
+								   			 &PathIndex, &ArrowCentre, &ArrowDirection);
+	while (GotPos)
+	{
+		double Dist = ArrowCentre.Distance(DropPos);
+
+		if (NearestDist == -1 || Dist < NearestDist)
+		{
+			NearestDist = Dist;
+			GotNearest = TRUE;
+			NearestIsStart = TRUE;
+		}
+
+		// Find the next Arrow position (if there are any more subpaths)
+		GotPos = ArrowRec::GetNextArrowPos(TRUE,
+								 		   Coords, Verbs, NumCoords, 
+							     		   &PathIndex, &ArrowCentre, &ArrowDirection);
+	}
+
+	// Now test all the end positions
+	PathIndex = 0;
+
+	// Find the first position of an ArrowHead
+	GotPos = ArrowRec::GetFirstArrowPos(FALSE,
+										 Coords, Verbs, NumCoords, 
+							   			 &PathIndex, &ArrowCentre, &ArrowDirection);
+	while (GotPos)
+	{
+		double Dist = ArrowCentre.Distance(DropPos);
+
+		if (NearestDist == -1 || Dist < NearestDist)
+		{
+			NearestDist = Dist;
+			GotNearest = TRUE;
+			NearestIsStart = FALSE;
+		}
+
+		// Find the next Arrow position (if there are any more subpaths)
+		GotPos = ArrowRec::GetNextArrowPos(FALSE,
+								 		   Coords, Verbs, NumCoords, 
+							     		   &PathIndex, &ArrowCentre, &ArrowDirection);
+	}
+
+	if (GotNearest)
+		*IsStart = NearestIsStart;
+
+	return GotNearest;
+}
+
+/********************************************************************************************
+
+>	NodeAttribute* GalleryLineDragInfo::MakeStartOrEndArrow(NodeAttribute* pArrowAttr, BOOL Start)
+
+	Author:		Will_Cowling (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	10/4/95		  
+	Returns:	-
+	Purpose:	Makes a Start or End arrow depending on where the arrow was dropped.
+	SeeAlso:	-
+
+********************************************************************************************/
+
+NodeAttribute* GalleryLineDragInfo::MakeStartOrEndArrow(NodeAttribute* pArrowAttr, BOOL Start)
+{
+	ArrowRec Arrow;
+	NodeAttribute* NewAttr;
+
+	if (IS_A(pArrowAttr, AttrStartArrow))
+	{
+		Arrow = ((AttrStartArrow*)pArrowAttr)->Value.StartArrow;
+	}
+	else
+	{
+		Arrow = ((AttrEndArrow*)pArrowAttr)->Value.EndArrow;
+	}
+
+	if (Start)
+	{
+		NewAttr = new AttrStartArrow();	
+		((AttrStartArrow*)NewAttr)->Value.StartArrow = Arrow;
+	}
+	else
+	{
+		NewAttr = new AttrEndArrow();	
+		((AttrEndArrow*)NewAttr)->Value.EndArrow = Arrow;
+	}
+
+	delete pArrowAttr;
+	return NewAttr;
+}

Property changes on: Trunk/XaraLX/wxOil/sgldrag.cpp
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Index: Trunk/XaraLX/wxOil/dragmgr.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dragmgr.cpp	(revision 920)
+++ Trunk/XaraLX/wxOil/dragmgr.cpp	(revision 921)
@@ -343,7 +343,10 @@
 		// write our own ordered dither! And neither do 1bpp wxBitmaps work as brushes
 		// sigh... And painting a 24bpp brush into a 1bpp bitmap dies horribly. Aaarrggghh
 		// Bayer table
-		INT32 OrderedDither[4*4]={1,9,3,11,13,5,15,7,4,12,2,10,16,8,14,6};
+		INT32 OrderedDither[4*4]={ 1, 9, 3,11,
+								  13, 5,15, 7,
+								   4,12, 2,10,
+								  16, 8,14, 6};
 		INT32 x, y;
 
 		unsigned char * pix=MaskImage.GetData();
@@ -351,7 +354,7 @@
 		for (y=0; y<DSize.y; y++) for (x=0; x<DSize.x; x++)
 		{
 			BYTE thresh = (GreyLevel>(OrderedDither[(x&3)|((y&3)<<2)]*16-8))?0xff:0x00;
-			// write three pixels
+			// write three bytes (R, G, B)
 			*pix++=thresh;
 			*pix++=thresh;
 			*pix++=thresh;


Xara