-
Notifications
You must be signed in to change notification settings - Fork 0
/
isInsideFunctions.h
57 lines (51 loc) · 1.64 KB
/
isInsideFunctions.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
bool isInsideFunction(node *p);
bool isInsideIf(node *p);
bool isInsideWhile(node *p);
bool isInsideFor(node *p); ///verifica daca pozitia cursorului se afla in interiorul instructiunii din nodul p
bool isInsideUntil(node *p);
bool isInsideInstruction(node *p);
bool isInsideFunction(node *p)
{
int mx, my;
mx=mousex();
my=mousey();
return p->left <= mx && mx <= p->right && p->nivel1 <= my && my <= p->nivel1 + loopHeight;
}
bool isInsideIf(node *p)
{
int mx, my;
mx=mousex();
my=mousey();
return p->left <= mx && mx <= p->right && p->nivel1 <= my && my <= p->nivel1 + ifHeight;
}
bool isInsideWhile(node *p)
{
int mx, my;
mx=mousex();
my=mousey();
return p->left <= mx && mx <= p->right && p->nivel1 <= my && my <= p->nivel1 + loopHeight ||
p->left <= mx && mx <= p->left + loopIndent && p->nivel1 <= my && my <= p->nivel2;
}
bool isInsideFor(node *p)
{
int mx, my;
mx=mousex();
my=mousey();
return p->left <= mx && mx <= p->right && p->nivel1 <= my && my <= p->nivel1 + loopHeight ||
p->left <= mx && mx <= p->left + loopIndent && p->nivel1 <= my && my <= p->nivel2;
}
bool isInsideUntil(node *p)
{
int mx, my;
mx=mousex();
my=mousey();
return p->left <= mx && mx <= p->right && p->nivel2 - loopHeight <= my && my <= p->nivel2 ||
p->left <= mx && mx <= p->left + loopIndent && p->nivel1 <= my && my <= p->nivel2;
}
bool isInsideInstruction(node *p)
{
int mx, my;
mx=mousex();
my=mousey();
return p->left <= mx && mx <= p->right && p->nivel1 <= my && my <= p->nivel1 + instructionHeight;
}