-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNOTEDIT.CPP
executable file
·91 lines (78 loc) · 2.18 KB
/
NOTEDIT.CPP
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
_CLASSDEF(TNoteEdit)
class TNoteEdit
{
public:
PTEdit pTENote[MAX_NOTENUM]; // Edit region for notes
BYTE note[MAX_NOTENUM]; // temp array for probs
BYTE FromNote;
TNoteEdit(PTWindowsObject pwThisObj, BYTE nFrom);
virtual void ShowNotes();
virtual void InitNotes();
virtual void SetTempNotes(); // set this up before pass rhythms
virtual BOOL CanClose();
};
TNoteEdit::TNoteEdit(PTWindowsObject pwThisObj, BYTE nFrom = 0)
{
FromNote = nFrom;
// ptr window, ID #, Init txt, X, Y, dx, dy, text len, multi-line
for (int i = 0; i < MAX_NOTENUM; i++)
pTENote[i] = new TEdit(pwThisObj, NOTE_OFFSET + i, 3 );
}
void TNoteEdit::InitNotes()
{
for (int i = 0; i<MAX_NOTENUM; i++)
note[i] = 0;
// fill the array with values from tempTrack (non-zero values only)
// need to find the first ith position
for (i = 0; i<tempTrack.Note.count(); i++)
if (nProbType == CONDITIONAL) {
if ( tempTrack.Note[i].From == FromNote ) {
for (int j = i; j < tempTrack.Note.count() && tempTrack.Note[j].From == FromNote; j++ )
note[ tempTrack.Note[j].To ] = tempTrack.Note[j].Prob;
break;
}
}
else
note[ tempTrack.Note[i].To ] = tempTrack.Note[i].Prob;
ShowNotes();
}
void TNoteEdit::ShowNotes()
{
char buf2[3];
for (int i = 0; i < MAX_NOTENUM; i++) {
sprintf(buf2, "%2d", note[i] );
pTENote[i]->SetText(buf2);
}
}
void TNoteEdit::SetTempNotes()
{
char buf2[3];
for (int i=0; i<MAX_NOTENUM; i++) {
pTENote[i]->GetText(buf2, 3);
note[i] = atoi(buf2);
}
}
BOOL TNoteEdit::CanClose()
{
int sumnotes = 0;
BOOL check = TRUE;
char tempstr[80], errstr[80];
SetTempNotes();
for (int i=0; i< MAX_NOTENUM; i++)
if ( note[i] > 99 ) {
check = FALSE;
sprintf(tempstr, "* Invalid Note Probability.\n Please Check Values.\n");
strcat(errstr, tempstr);
break;
}
else
sumnotes+=note[i]; // then add up notes, if 0 no probs assigned
if (! sumnotes) {
check = FALSE;
sprintf(tempstr, "* No Note Probs Assigned.\n");
strcat(errstr, tempstr);
}
if (! check)
BWCCMessageBox(NULL, tempstr, "Note Edit", MB_OK|MB_ICONEXCLAMATION);
return check;
}