-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScribbleArea.h
executable file
·152 lines (119 loc) · 3.25 KB
/
ScribbleArea.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
140
141
142
143
144
145
146
147
148
149
150
151
/*
* File: ScribbleArea.h
* Author: scribble
*
* Created on October 25, 2012, 2:17 PM
*/
class Sender;
#ifndef SCRIBBLEAREA_H
#define SCRIBBLEAREA_H
#include <GL/glu.h>
#include "Color.h"
#include "Path.h"
#include "Point.h"
#include <boost/thread/mutex.hpp>
#include "Document.h"
#define WRITE 0
#define ERASE 1
class ScribbleArea
{
public:
ScribbleArea();
ScribbleArea(int x_, int y_, int w_, int h_);
ScribbleArea(const ScribbleArea& orig);
virtual ~ScribbleArea();
Color getPenColor();
float getPenSize();
void setPenColor(Color newColor);
void setPenWidth(int newWidth);
bool pointInsideArea(Point * point);
void enableScribbleArea(bool en);
bool getEnabled();
void screenPressEvent(Point* point);
void screenMoveEvent(Point* point);
void screenReleaseEvent(/*Points *point*/);
//void nextPage();
//void previousPage();
void undo(int page);
void redo(int page);
void write();
void erase();
void clearAll(int page);
int getMode();
void setMode(int mode);
std::vector<std::vector<Path*> > getPathsOnPage();
int getCurrentPage();
void setLockForTempPath(bool lock);
void setLockForNetworkPath(bool lock);
void setLockForPath(bool lock);
Path* getTempPath();
bool getScribbling();
Path* getNetworkPath();
int getNetworkPage();
void setNetworkPage(int p);
void setNetworkPath(Path* p);
void addNetworkPoint(Point * p);
void endNetworkPath();
void setSender(Sender* sender);
Document* getDocument();
Sender* getSender();
int getX();
int getY();
int getWidth();
int getHeight();
void previousPage();
void nextPage();
void loadFile(std::string fileName);
void setOwnershipMe();
void setOwnershipFree();
void setOwnershipTaken();
/*
* Used for networking Functions
*/
void setFilesOnServer(std::vector<std::string> filesOnServer);
void addFileOnServer(std::string file);
void clearFilesOnServer();
std::vector<std::string> getFilesOnServer();
enum class NetworkActivity
{
NONE, WAITING_FOR_FILE_LIST, FILES_LIST_AVAILABLE, WAITING_FOR_FILE_DOWNLOAD, DOWNLOAD_COMPLETED, LOGIN_OK, LOGIN_FAILED,
WAITING_LOGIN, FILE_DOWNLOAD_FAILED, LOST_NETWORK_CONNECTION, WAITING_FOR_NEW_FILE, NEW_FILE_ALREADY_EXISTS, NEW_FILE_CREATION_FAILED,
};
void setNetworkActivity(NetworkActivity n);
NetworkActivity getNetworkActivity();
int getOwnershipValue();
enum Ownership
{
ME, TAKEN, FREE
};
private:
bool enable;
bool network;
int x;
int y;
int width;
int height;
Color penColor;
float penSize;
int mMode;
bool scribbling;
Path *mTempPath;
Point lastPoint;
boost::mutex pathsLock;
boost::mutex lockForTempPath;
std::vector<int> Paths_IDs;
std::vector< std::vector<Path*> > pathsOnPage;
std::vector< std::vector<Path*> > redoVector;
Document *document;
/*
* Used for networking Variables
*/
Sender* sender;
boost::mutex lockForNetworkPath;
int networkPathPage;
Path* mNetworkPath;
std::vector<std::string> filesOnServer;
Ownership ownership;
NetworkActivity networkActivity;
};
#endif /* SCRIBBLEAREA_H */