-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddCircle.cpp
63 lines (50 loc) · 1.33 KB
/
AddCircle.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include"AddCircle.h"
AddCircle::AddCircle(ApplicationManager* pApp,bool IsEnabled):Action(pApp)
{
Sound = IsEnabled;
}
void AddCircle::ReadActionParameters()
{
//Get a Pointer to the Input / Output Interfaces
Output* pOut = pManager->GetOutput();
pOut->PrintMessage("DRAW CIRCLE");
Input* pIn = pManager->GetInput();
pIn->GetPointClicked(P1.x, P1.y);
pIn->GetPointClicked(P2.x, P2.y);
//CircGfxInfo.isFilled = false; //default is not filled
//get drawing, filling colors and pen width from the interface
CircGfxInfo.DrawClr = pOut->getCrntDrawColor();
CircGfxInfo.FillClr = pOut->getCrntFillColor();
pOut->ClearStatusBar();
}
void AddCircle::Execute(bool read)
{
if (Sound)
{
PlaySound(TEXT("Sounds\\circle.wav"), NULL, SND_ASYNC);
}
//This action needs to read some parameters first
if(read)
ReadActionParameters();
//Create a Circle with the parameters read from the user
Ccircle* C = new Ccircle(P1,P2, CircGfxInfo);
//Add the Circle to the list of figures
pManager->AddFigure(C);
DeletedFig=C;
}
void AddCircle::AddMeUndo(bool redo)
{
pManager->AddToUndo(this,redo);
}
void AddCircle::undo()
{
DeletedFig=pManager->Deletelastfig();
}
void AddCircle::redo()
{
pManager->AddFigure(DeletedFig);
}
void AddCircle::AddMeRec()
{
pManager->AddToRec(this);
}