Initial Commit

This commit is contained in:
xypwn
2020-03-24 20:18:39 +01:00
commit dfeb7de33c
70 changed files with 4920 additions and 0 deletions

42
UndoCommands/AddPart.cpp Normal file
View File

@@ -0,0 +1,42 @@
#include "AddPart.h"
#include "RemoveWire.h"
#include "../Part.h"
#include "../Connector.h"
#include "../Scene.h"
#include "../Logic.h"
#include "../Parts/IntegratedCircuit.h"
#include <QDebug>
AddPart::AddPart(Scene* scene, PartType::PartType partType, QPointF pos, QString icFilename)
:m_scene(scene), m_partType(partType), m_pos(pos), m_icFilename(icFilename)
{
setText("Add Part");
}
AddPart::~AddPart()
{
m_scene->m_logic->deletePart(m_part);
}
void AddPart::redo()
{
if(!m_part)
{
if(m_partType == PartType::IntegratedCircuit)
m_part = m_scene->m_logic->createIC(m_icFilename, m_pos);
else
m_part = m_scene->m_logic->createPart(m_partType, m_pos);
}
else
{
m_scene->startTrackingPart(m_part);
}
}
void AddPart::undo()
{
m_scene->stopTrackingPart(m_part);
}