/************************************************************

	ToolItemMain.cpp

	Copyright © 2004 Nemetschek North America
	All Rights Reserved.
************************************************************/

#if _WINDOWS
#include <Windows.h>
#include "GSWinSDK.h"	// Graphsoft Required.
#else
#include "StdHeaders.h"
#endif


#include <gsesetup.h>
#include <MiniCadCallBacks.h>
#include <MiniCadExternals.h>
#include "CustomObjects.h"

#include <GSString.h>
#include <RecordHandler.h>



long ToolMain(long action, long message1, long message2, long &userData)
{
	GSExternalSetup(gCBP);

	long returnVal = 0L;

	switch (action) {

		case kToolInitGlobals : {

			//	The workspace that contains this tool is being opened.  This action is called
			//	so the tool can allocate and initialize any persistent data.
			//
			//	Do not allocate data using operator new.  On Windows this memory is disposed when the DLL is unloaded between calls
			//	Use GS_NewPtr(CALLBACKPTR, size_t size) and GS_DisposePtr(CALLBACKPTR, void* p) to allocate
			//	and destro persistent data.
			break;
		}
		case kToolDisposeGlobals : {

			//	The workspace that contains this tool is being closed.  This action is
			//	called so the tool can free any allocated memory.
			break;
		}
		case kToolDoSetup : {

			//	This tool is being made the active tool.
			//	Check the message1 parameter for setUp context.  If message1 == kSetupSetdownPauseRestoreFlag then the
			//	tool is being restored from a temporary pause  If message1 == 0 then the tool is being initially
			//	set up.
			break;
		}
		case kToolDoSetDown : {

			//	The tool is being deactivated. VectorWorks is switching the active tool.
			//	Check the message1 parameter for setUp context.  If message1 == kSetupSetdownPauseRestoreFlag then the
			//	tool is being temporarily paused.  If message1 == 0 then the tool is being set down for good.
			break;
		}
		case kToolGetCursor : {

			//	This action is called by the framework to get the cursor for the tool.
			break;
		}
		case kToolGetStatus: {

			//	This action is called so the Tool can return to the system the current state
			//	of the tool.  Return the result of one of the following callbacks:

			//	A tool can also return one of the following constants:
			//	kToolCompleted, kToolCollectingPoints, or kToolWaitingForFirstPoint.

			break;
		}
		case kToolPointAdded: {

			//	This action is called when the tool gets a mouse down in the content of
			//	the drawing.  This action is also called for a click drag mouse up.  A tool point
			//	has just been added.

			break;
		}
		case kToolPointRemoved: {

			//	This action is called whenever the tool framework removes a tool point for
			//	any reason.  Ue this action to clean up any state that becomes stale with
			//	the removal of a tool point.
			break;
		}
		case kToolMouseMove: {

			//	This action is called when the tool gets a mouse move in the content of
			//	the drawing.  If the tool has the screenBasedCursor flag set it gets
			//	kToolMouseMove action calls whenever the mouse moves a pixel.  If the tool
			//	does not set the screenBasedCursor flag, it gets called whenever the
			//	smartcursor snaps to a new point.
			break;
		}
		case kToolDraw: {
			//	This action is called when the tool needs to draw.  The framework calls this draw
			//	action handling expecting the tool to draw itself.  Tools use the GS_GetToolPt##
			//	callbacks to determine the current state of the tool and draw itself appropriately.

			break;
		}
		case kToolHandleComplete: {

			//	This action is called when the tool has signified, through a kToolGetStatus
			//	return value, that the tool is complete.  This is where the tool makes changes
			//	to the drawing.  kToolHandleComplete action handling is the most likely
			//	location for UNDO callbacks.

			break;
		}
		case kToolDoModeEvent : {

			//	This action is called when the user invokes a mode bar event.

			break;
		}
		case kToolDrawingDoubleClick: {

			//	This action is called whenever the user double-clicks in the content of the
			//	drawing window with more two or more Tool points.
			//
			break;
		}
		case kToolDoDoubleClick : {

			//	This action is called when the user double-clicks on the tool icon in a
			//	tool palette.  This is not the same as kToolDrawingDoubleClick above.
			break;
		}
	}

	GSExternalSetdown (0L);

	return returnVal;
}
