-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApplicationManager.h
139 lines (104 loc) · 3.33 KB
/
ApplicationManager.h
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#ifndef APPMANAGER_H
#define APPMANAGER_H
#include "DEFS.h"
#include "Figures\CFigure.h"
#include "GUI\input.h"
#include "GUI\output.h"
class Action;
//Main class that manages everything in the application.
class ApplicationManager
{
enum { MaxFigCount = 200 }; //Max no of figures
enum { MaxUndoCount = 5 }; //Max no of figures
enum { MaxRecord = 20 }; // Maximum number of recorded actions
private:
int FigCount; //Actual number of figures
CFigure* FigList[MaxFigCount]; //List of all figures (Array of pointers)
CFigure* SelectedFig; //Pointer to the selected figure
Action** RecordingList = new Action * [MaxRecord]; /// all the currently recorded actions
int RecordedActionsCount;
bool RecordingState;
bool PlayRecordingState;
bool playsound;
//Pointers to Input and Output classes
Input* pIn;
Output* pOut;
Action* undolist[MaxUndoCount];
int undocount;
int redocount;
CFigure* deletedlist[5];
int deletecount;
Action* LastAction;
int SquareCount;
int CircleCount;
int HexaCount;
int TriangleCount;
int RectCount;
int NoFillFigs;
int RedFigs;
int BlackFigs;
int BlueFigs;
int Greenfigs;
int YellowFigs;
int OrangeFigs;
public:
ApplicationManager();
~ApplicationManager();
// -- Action-Related Functions
//Reads the input command from the user and returns the corresponding action type
ActionType GetUserAction() const;
void ExecuteAction(ActionType); //Creates an action and executes it
// -- Figures Management Functions
void AddFigure(CFigure* pFig); //Adds a new figure to the FigList
CFigure *GetFigure(int x, int y) const; //Search for a figure given a point inside the figure
void SetSelectedFigure(CFigure*);
CFigure* GetSelectedFig() const;
// -- Interface Management Functions
Input *GetInput() const; //Return pointer to the input
Output *GetOutput() const; //Return pointer to the output
void UpdateInterface() const; //Redraws all the drawing window
// -- Functions which Loop on FigList
void SaveGraph(ofstream& OutFile);
void DeleteAll();
// -- Setters and Getters
int GetFigCount() const;
void SetFigcount(int x);
int getredocount();
int getundocount();
void SetRecordingState(bool b);
bool GetRecordingState() const;
void SetPlayRecordingState(bool b);
bool GetPlayRecordingState();
int GetRecordedActionsCount() const;
void PreviewRecordedActs();
void RemovePastRecording(); // This is called when Starting a new Recording or Clear ALL
void AddToRecordingList(Action*);
void DeleteFigure(CFigure* pFig);
void addtoundolist(Action*);
void Undo();
void Redo();
void EmptyUndoList();
void CountTypes();
void CountFillColors();
FillColors GetRandomFillColor(int index);
char GetRandomType(int index);
int GetCircleCount() const;
int GetRectCount() const;
int GetHexaCount() const;
int GetSquareCount() const;
int GetTriangleCount() const;
int GetBlackFigs();
int GetRedFigs();
int GetOrangeFigs();
int GetYellowFigs();
int GetGreenFigs();
int GetBlueFigs();
int GetNoFillFigs();
void ResetCounts();
void ResetFillColors();
int GetCountForTypeAndColor(char type, FillColors clr);
void ChangeStateOfSound();
void SetStateOfSound(bool b); //this is used when clearing all
bool GetStateOfSound();
};
#endif