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

  	StairCommand.h

	Copyright (c)1990 - 1999 MetaCreations. All rights reserved.

	Author:	Jerome Bignon

	Date:	20/04/99

	Revision History

	when		who			what & why
	=========== ===========	=============================================================
	15/07/99	Jerome		Creation

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

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "Basic3DCOMImplementations.h"
#include "StairCommandDef.h"
#include "BitField.h"
#include "I3DShFacetMesh.h"
#include "I3DShScene.h"
#include "I3DExModifier.h"
#include "ISceneSelection.h"
#include "IChangeManagement.h"
#include "PublicUtilities.h"
#include "ISceneDocument.h"
#include "MCCountedPtrArray.h"
#include "MCCountedPtr.h"
#include "IShComponent.h" // for IShParameterComponent

// define the SceneOp CLSID

extern const MCGUID CLSID_StairCommand;

struct StairData
{
	TMCCountedPtr<IShParameterComponent> fApplyModifier;
	int16		fNbStep;
	real		fDx;
	real		fDy;
	real		fDz;
};
 
// SceneOp Object :
class StairCommand : public TBasicSceneCommand
{
	public :  
		StairCommand();
		~StairCommand();

		STANDARD_RELEASE;

		// IExDataExchanger methods :
		virtual void*	 MCCOMAPI GetExtensionDataBuffer	();
		virtual int32	 MCCOMAPI GetParamsBufferSize		() const	{ return sizeof(fData);}
		virtual MCCOMErr MCCOMAPI ExtensionDataChanged		();
		virtual int16	 MCCOMAPI GetResID					();

		virtual void	 MCCOMAPI GetMenuCallBack(ISelfPrepareMenuCallBack** callBack);

		virtual MCCOMErr MCCOMAPI Init						(ISceneDocument* sceneDocument);
		virtual MCCOMErr MCCOMAPI Prepare					();

		virtual boolean  MCCOMAPI CanUndo					();

		virtual boolean  MCCOMAPI Do						();
		virtual boolean  MCCOMAPI Undo						();
		virtual boolean  MCCOMAPI Redo						();

	private :
		StairData						fData;					// Scene Operation Data
		TMCCountedPtr<ISceneDocument>	fSceneDocument;
		TMCCountedPtr<I3DShTreeElement>	fTree;
		TMCCountedPtr<I3DShScene>		fScene;

		TMCCountedPtr<ISceneSelection>	fSelection;
		TMCCountedPtr<ISceneSelection>	fCloneSelection;		// undo info

		TMCCountedPtrArray<I3DShTreeElement>	fSteps;			// array of the new instances
		TMCArray<RelinkTreeElementInfo>			fRelinkInfo;	// redo info


		TMCCountedPtr<IChangeChannel>	fSelectionChannel;
		TMCCountedPtr<IChangeChannel>	fTreePropertyChannel;

		TMCCountedPtr<I3DExModifier>	fApplyModifier;
};