forked from Karimgebril09/Paint-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStartRecording.cpp
More file actions
64 lines (56 loc) · 1.93 KB
/
StartRecording.cpp
File metadata and controls
64 lines (56 loc) · 1.93 KB
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
64
#include"StartRecording.h"
StartRecAction::StartRecAction(ApplicationManager* pApp) :Action(pApp)
{
}
//Reads parameters required for action to execute (code depends on action type)
void StartRecAction::ReadActionParameters()
{
Output* pOut = pManager->GetOutput();
if (pManager->Get_Recording_State()) // get recording state now
pOut->PrintMessage("You Are Already Recording"); //the kid is already recording because its true
else
{
if ((pManager->getfigcount() == 0) && (UI.DrawColor == BLUE) && (UI.isfilled == false)) //check state of the program to see wether to start recording or not
{
pOut->PrintMessage("Recording Started"); // record started successfully
checkstate = true;
}
else
{
pOut->PrintMessage("You Can Only Record After a Clear All or at Start"); // to alret him to clear all first
checkstate = false;
}
}
}
//Execute action (code depends on action type)
bool StartRecAction::Execute(bool readparams)
{
//This action needs to read some parameters first
if (readparams)
ReadActionParameters();
Output* pOut = pManager->GetOutput();
if (pManager->Get_Recording_State())
{
Action* Recording_Action = pManager->GetLastAction(); // gets the last action pointer and asign it to the recording action pointer
if (Recording_Action->record_me()) // to see if this action can be recorded or not
{
Recording_Action->setisrecorded(true);
pManager->AddinRecList(Recording_Action); //sent it to the function which add it in the recording list in appmanger
}
else
{
if (Recording_Action != this)
{
pManager->SetRecordingState(false);
pOut->PrintMessage("This Action is Not Supported, Recording Has Been Stopped Automatically");
}
}
}
else if (checkstate) // given from readparamters to see if to startrecording or not
pManager->SetRecordingState(true);
return false;
}
bool StartRecAction::record_me() const
{
return false;
}