-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathalternateending.h
118 lines (102 loc) · 4.12 KB
/
alternateending.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
/////////////////////////////////////////////////////////////////////////////
// Name: alternateending.h
// Purpose: Stores and renders alternate ending symbols
// Author: Brad Larsen
// Modified by:
// Created: Dec 3, 2004
// RCS-ID:
// Copyright: (c) Brad Larsen
// License: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __ALTERNATEENDING_H__
#define __ALTERNATEENDING_H__
#include "systemsymbol.h"
/// Stores and renders alternate ending symbols
class AlternateEnding : public SystemSymbol
{
friend class AlternateEndingTestSuite;
// Constants
public:
enum alternateEndingFlags
{
daCapo = (wxWord)9,
dalSegno = (wxWord)10,
dalSegnoSegno = (wxWord)11,
numbersMask = (wxWord)0x7ff ///< Mask used to retrieve all allowable numbers
};
// Constructor/Destructor
public:
AlternateEnding();
AlternateEnding(wxUint32 system, wxUint32 position, wxWord numbers);
AlternateEnding(const AlternateEnding& alternateEnding);
~AlternateEnding();
// Creation Functions
/// Creates an exact duplicate of the object
/// @return The duplicate object
PowerTabObject* CloneObject() const
{return (new AlternateEnding(*this));}
// Operators
const AlternateEnding& operator=(const AlternateEnding& alternateEnding);
bool operator==(const AlternateEnding& alternateEnding) const;
bool operator!=(const AlternateEnding& alternateEnding) const;
// Serialization Functions
protected:
bool DoSerialize(PowerTabOutputStream& stream);
bool DoDeserialize(PowerTabInputStream& stream, wxWord version);
// MFC Class Functions
public:
/// Gets the MFC Class Name for the object
/// @return The MFC Class Name
wxString GetMFCClassName() const
{return (wxT("CSectionSymbol"));}
/// Gets the MFC Class Schema for the object
/// @return The MFC Class Schema
wxWord GetMFCClassSchema() const
{return ((wxWord)1);}
// Number Functions
/// Deteremines if a numbers bit map is valid
/// @param numbers Numbers bit map to validate
/// @return True if the numbers bit map is valid, false if not
static bool IsValidNumbers(wxWord numbers)
{
return ((numbers == 0) ||
(((numbers & numbersMask) != 0) && ((numbers & ~numbersMask) == 0)));
}
/// Determines if a number is valid
/// @param number Number to validate
/// @return True if the number is valid, false if not
static bool IsValidNumber(wxUint32 number)
{return ((number >= 1) && (number <= dalSegnoSegno));}
bool SetNumbers(wxWord numbers);
wxWord GetNumbers() const;
bool SetNumber(wxUint32 number);
bool IsNumberSet(wxUint32 number) const;
bool ClearNumber(wxUint32 number);
// Da Capo Functions
void SetDaCapo()
{SetNumber(daCapo);}
bool IsDaCapoSet() const
{return (IsNumberSet(daCapo));}
void ClearDaCapo()
{ClearNumber(daCapo);}
// Dal Segno Functions
void SetDalSegno()
{SetNumber(dalSegno);}
bool IsDalSegnoSet() const
{return (IsNumberSet(dalSegno));}
void ClearDalSegno()
{ClearNumber(dalSegno);}
// Dal Segno Segno Functions
void SetDalSegnoSegno()
{SetNumber(dalSegnoSegno);}
bool IsDalSegnoSegnoSet() const
{return (IsNumberSet(dalSegnoSegno));}
void ClearDalSegnoSegno()
{ClearNumber(dalSegnoSegno);}
// Operations
wxString GetText() const;
protected:
static wxString GetNumberText(wxUint32 number);
};
WX_DEFINE_POWERTABARRAY(AlternateEnding*, AlternateEndingArray);
#endif