Newer
Older
* 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
*/
#include "actions/OE_actions.h"
#include "OE_document.h"
#include "curves/OE_curve.h"
#include "stitchs/OE_stitchs.h"
OE_actions::OE_actions(OE_document* doc) : active(true), document(doc)
{
}
OE_actions::~OE_actions()
{
}
float OE_actions::switchVal(float Original, float* storage)
{
float tmp = *storage;
*storage = Original;
return tmp;
3dsman
committed
OE_curve* OE_actions::switchVal(OE_pointcurve* Original, OE_pointcurve** storage)
OE_pointcurve* tmp = *storage;
*storage = Original;
return tmp;
3dsman
committed
std::list<OE_pointcurve*> OE_actions::switchVal(std::list<OE_pointcurve*> Original, std::list<OE_pointcurve*>* storage)
std::list<OE_pointcurve*> tmp = *storage;
*storage = Original;
return tmp;
}
OE_stitchs* OE_actions::switchVal(OE_stitchs* Original, OE_stitchs** storage)
{
OE_stitchs* tmp = *storage;
*storage = Original;
return tmp;
}
std::list<OE_stitchs*> OE_actions::switchVal(std::list<OE_stitchs*> Original, std::list<OE_stitchs*>* storage)
{
std::list<OE_stitchs*> tmp = *storage;
*storage = Original;
return tmp;
unsigned OE_actions::switchVal(unsigned Original, unsigned* storage)
{
unsigned tmp = *storage;
*storage = Original;
return tmp;
}
bool OE_actions::switchVal(bool Original, bool* storage)
{
OE_actionsMeta::OE_actionsMeta(OE_document* doc) : OE_actions(doc)
{
}
OE_actionsMeta::~OE_actionsMeta()
{
if (document)
{
std::list<OE_actions*>::iterator action = actions.begin();
while (action != actions.end())
{
delete *action;
}
actions.clear();
}
}
void OE_actionsMeta::undo()
{
if (document)
{
std::list<OE_actions*>::iterator action = actions.begin();
while (action != actions.end())
{
(*action)->undo();
action++;
}
}
}
void OE_actionsMeta::redo()
{
if (document)
{
std::list<OE_actions*>::iterator action = actions.begin();
while (action != actions.end())
{
(*action)->redo();
action++;
}
}