-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathApplicationManager.h
103 lines (77 loc) · 3.72 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
#ifndef APPLICATION_MANAGER_H
#define APPLICATION_MANAGER_H
#include "DEFS.h"
#include "Statements\Statement.h"
class Input;
class Output;
//Main class that manages everything in the application.
class ApplicationManager
{
enum { MaxCount = 200 }; //Max no of statements/connectors in a single flowchart
private:
Point P;
int StatCount; //Actual number of statements
int StatID;
int ConnCount; //Actual number of connectors
int VarCount;
Statement* StatList[MaxCount]; //List of all statements (Array of pointers)
Connector* ConnList[MaxCount]; //List of all connectors (Array of pointers)
Variable *VarList[MaxCount]; //list of all variables (array of pointers)
Statement *pSelectedStat; //a pointer to the last selected statement
Connector *pSelectedConn; //a pointer to the last selected Connector
Statement *pCopied;
int CopyType;
bool editedDesign; //boolean tells if the design is edited or not
//Pointers to Input and Output classes
Input *pIn;
Output *pOut;
string SaveArr[10000];
int GL,plus;
public:
ApplicationManager();
~ApplicationManager();
// -- Actions Related Functions
//Reads the input command from the user and returns the corresponding action type
ActionType GetUserAction();
void ExecuteAction(ActionType) ; //Creates an action and executes it
// -- Statements/Connector Management Functions
int GetStatCount(); //returns the number of statements in the statements list
int GetConnCount(); //returns the number of connectors in the connectors list
int GetVarCount(); //returns the number of variables in the variables list
void AddStatement(Statement* pStat); //Adds a new Statement to the Flowchart
Statement *GetStatement(Point P) const; //search for a statement where point P belongs
void DeleteStat (Statement* Stat); //delete a statement from the statements list
void SetConnector(Connector* pConn); //Adds a new Connector to the Flowchart
Connector *GetConnector(Point P) const; //search for a Connector where point P belongs
void EditConnectors(Statement *Stat); //edit the input connectors to a statement
void DeleteConn (Connector* Conn); //delete a connector from the connectors list
Variable* AddVariable(Variable *V);
Variable *GetVariable(int j) const;
void deleteVariable(Variable *V);
void InitializeVar();
Statement *GetSelectedStatement() const; //Returns the selected Statement
void SetSelectedStatement(Statement *pStat); //Set the Statement selected by the user
Connector *GetSelectedSConnector() const; //Returns the selected Connector
void SetSelectedConnector(Connector *pConn); //Set the Connector selected by the user
Statement *GetStatList(int j); //gets a statement from the statements list
Connector *GetConnList(int j); //gets a connector from the connectorslist
void SetCopied(Statement* P); //set the statement copied or cut by the user
Statement* GetCopied(); //get the copied or cut statement
void SetCopyType(int x); //set the copy type < 1 for copy > <2 for cut>
int GetCopyType(); //get the copy type
void UnSelect(); //unselect any selected object
Point getPoint(); //get the point where the user clicked
bool onBars(Point P); //check if the point the user clicked on any of tool bars or not
bool onObject(Point P); //check if the point where the user clicked on any drewn object or not
void setEditedDesign(bool E);
bool getEditedDesign();
void onExit();
void UndoRedo(int n=0);
void LoadModify(); //modify variables & connectors with statements after the load operation
void SwitchToSim(); //switch to simulation mode
// -- 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
};
#endif