/*
* This file is part of project OpenEmbroidery. It's copyrighted by
* the contributors recorded in the version control history of the file.
* Original project location https://code.electrolab.fr/openEmbroidery/openEmbroidery_software
*
* SPDX-License-Identifier: CECILL-2.1
* License-Filename: Licence_CeCILL_V2.1-en.txt
*/

#pragma once

#include "stitchs/OE_fillstitch.h"
#include "actions/OE_actions.h"

class OE_actionNewFillStitch : public OE_actions
{
	public:
		OE_actionNewFillStitch(OE_document* doc, float len, float width, OE_pattern* pattern);

		virtual ~OE_actionNewFillStitch();

		virtual void undo();
		virtual void redo();

	protected:
		OE_actions* action;
		OE_fillstitch* FillStitch;
};

class OE_actionSetFillStitchPattern : public OE_actions
{
	public:
		OE_actionSetFillStitchPattern(OE_document* doc, OE_fillstitch* stitch, OE_pattern* pattern);

		virtual ~OE_actionSetFillStitchPattern();

		virtual void undo();
		virtual void redo();

	protected:
		OE_fillstitch* actionStitch;
		OE_pattern* oldPattern;
		OE_pattern* newPattern;
};

class OE_actionSetFillStitchLen : public OE_actions
{
	public:
		OE_actionSetFillStitchLen(OE_document* doc, OE_fillstitch* stitch, float len);

		virtual ~OE_actionSetFillStitchLen();

		virtual void undo();
		virtual void redo();

	protected:
		OE_fillstitch* actionStitch;
		float oldLen;
};

class OE_actionSetFillStitchWidth : public OE_actions
{
	public:
		OE_actionSetFillStitchWidth(OE_document* doc, OE_fillstitch* stitch, float width);

		virtual ~OE_actionSetFillStitchWidth();

		virtual void undo();
		virtual void redo();

		float getWidth();

		void setWidth(float width);

		void offsetWidth(float offset);

	protected:
		OE_fillstitch* actionStitch;
		float oldWidth;
		float oldOffset;
};

class OE_actionScaleSelectedFillStitchWidth : public OE_actions
{
	public:
		OE_actionScaleSelectedFillStitchWidth(OE_document* doc, float scale);

		virtual ~OE_actionScaleSelectedFillStitchWidth();

		virtual void undo();
		virtual void redo();

		void scaleWidth(float scale);

	protected:
		std::list<OE_actionSetFillStitchWidth*> actions;
		float oldScale;
};

class OE_actionScaleSelectedFillStitchLen : public OE_actions
{
	public:
		OE_actionScaleSelectedFillStitchLen(OE_document* doc, float scale);

		virtual ~OE_actionScaleSelectedFillStitchLen();

		virtual void undo();
		virtual void redo();

		void scaleLen(float scale);

	protected:
		std::list<OE_actionSetFillStitchLen*> actions;
};


class OE_actionSetSelectedFillStitchPattern : public OE_actions
{
	public:
		OE_actionSetSelectedFillStitchPattern(OE_document* doc, OE_pattern* pattern);

		virtual ~OE_actionSetSelectedFillStitchPattern();

		virtual void undo();
		virtual void redo();

	protected:
		std::list<OE_actionSetFillStitchPattern*> actions;
};

class OE_actionMovePointFillStitch : public OE_actions
{
	public:
		OE_actionMovePointFillStitch(OE_document* doc, OE_fillstitch* stitch, int _pos, vector_2d _offet);

		virtual ~OE_actionMovePointFillStitch();

		virtual void undo();
		virtual void redo();

		void setOffset(vector_2d offset);

	protected:
		OE_fillstitch* actionStitch;
		vector_2d oldPoint;
		vector_2d offset;
		int pos;
};

