/*
* 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_linestitch.h"
#include "actions/OE_actions.h"

class OE_actionNewLineStitch : public OE_actions
{
	public:
		OE_actionNewLineStitch(OE_document* doc, float len, float width, OE_pattern* pattern, unsigned patternSteps,
		                       float xOffset, float yOffset);

		virtual ~OE_actionNewLineStitch();

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

	protected:
		OE_actions* action;
		OE_linestitch* linestitch;
};

class OE_actionSetLineStitchPattern : public OE_actions
{
	public:
		OE_actionSetLineStitchPattern(OE_document* doc, OE_linestitch* stitch, OE_pattern* pattern);

		virtual ~OE_actionSetLineStitchPattern();

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

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

/*
class OE_actionSetLineStitchCurve : public OE_actions
{
	public:
		OE_actionSetLineStitchCurve(OE_linestitch* stitch, OE_curve* curve);

		virtual ~OE_actionSetLineStitchCurve();

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

	protected:
		OE_linestitch* actionStitch = 0;
		OE_curve* oldCurve = 0;
};
*/

class OE_actionSetLineStitchLen : public OE_actions
{
	public:
		OE_actionSetLineStitchLen(OE_document* doc, OE_linestitch* stitch, float len);

		virtual ~OE_actionSetLineStitchLen();

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

	protected:
		OE_linestitch* actionStitch;
		float oldLen;
};

class OE_actionSetLineStitchWidth : public OE_actions
{
	public:
		OE_actionSetLineStitchWidth(OE_document* doc, OE_linestitch* stitch, float width);

		virtual ~OE_actionSetLineStitchWidth();

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

		float getWidth();
		void setWidth(float width);

		void offsetWidth(float offset);

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

class OE_actionSetLineStitchReverse : public OE_actions
{
	public:
		OE_actionSetLineStitchReverse(OE_document* doc, OE_linestitch* stitch, bool reverse);

		virtual ~OE_actionSetLineStitchReverse();

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

	protected:
		OE_linestitch* actionStitch;
		bool oldReverse;
};

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

		virtual ~OE_actionScaleSelectedLineStitchWidth();

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

		void scaleWidth(float scale);

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

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

		virtual ~OE_actionScaleSelectedLineStitchLen();

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

		void scaleLen(float scale);

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


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

		virtual ~OE_actionSetSelectedLineStitchPattern();

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

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

