1 #include "command/clef.h"
2 #include "command/commandfuncs.h"
3 #include "core/utils.h"
4
5 /**
6 * Create a new clef object
7 * @param type clef type to create
8 *
9 * @return the clef
10 */
11 DenemoObject *
clef_new(enum clefs type)12 clef_new (enum clefs type)
13 {
14 DenemoObject *ret;
15 clef *newclef = (clef *) g_malloc (sizeof (clef));
16 ret = (DenemoObject *) g_malloc (sizeof (DenemoObject));
17 ret->type = CLEF;
18 newclef->type = type;
19 ret->object = newclef;
20 set_basic_numticks (ret);
21 setpixelmin (ret);
22 return ret;
23 }
24
25 /**
26 * Wrapper function to create new treble clef and insert into the score
27 */
28 void
clef_new_treble(GtkAction * action,DenemoScriptParam * param)29 clef_new_treble (GtkAction* action, DenemoScriptParam *param)
30 {
31 object_insert (Denemo.project, clef_new (DENEMO_TREBLE_CLEF));
32 }
33
34 /**
35 * Wrapper function to create new bass clef and insert into the score
36 */
37 void
clef_new_bass(GtkAction * action,DenemoScriptParam * param)38 clef_new_bass (GtkAction* action, DenemoScriptParam *param)
39 {
40 object_insert (Denemo.project, clef_new (DENEMO_BASS_CLEF));
41 }
42
43 /**
44 * Wrapper function to create new alto clef and insert into the score
45 */
46 void
clef_new_alto(GtkAction * action,DenemoScriptParam * param)47 clef_new_alto (GtkAction* action, DenemoScriptParam *param)
48 {
49 object_insert (Denemo.project, clef_new (DENEMO_ALTO_CLEF));
50 }
51
52 /**
53 * Wrapper function to create new treble_8 clef and insert into the score
54 */
55 void
clef_new_g8(GtkAction * action,DenemoScriptParam * param)56 clef_new_g8 (GtkAction* action, DenemoScriptParam *param)
57 {
58 object_insert (Denemo.project, clef_new (DENEMO_G_8_CLEF));
59 }
60
61 /**
62 * Wrapper function to create new bass_8 clef and insert into the score
63 */
64 void
clef_new_f8(GtkAction * action,DenemoScriptParam * param)65 clef_new_f8 (GtkAction* action, DenemoScriptParam *param)
66 {
67 object_insert (Denemo.project, clef_new (DENEMO_F_8_CLEF));
68 }
69
70 /**
71 * Wrapper function to create new tenor clef and insert into the score
72 */
73 void
clef_new_tenor(GtkAction * action,DenemoScriptParam * param)74 clef_new_tenor (GtkAction* action, DenemoScriptParam *param)
75 {
76 object_insert (Denemo.project, clef_new (DENEMO_TENOR_CLEF));
77 }
78
79 /**
80 * Wrapper function to create new soprano clef and insert into the score
81 */
82 void
clef_new_soprano(GtkAction * action,DenemoScriptParam * param)83 clef_new_soprano (GtkAction* action, DenemoScriptParam *param)
84 {
85 object_insert (Denemo.project, clef_new (DENEMO_SOPRANO_CLEF));
86 }
87
88 /**
89 * Wrapper function to create new french clef and insert into the score
90 */
91 void
clef_new_french(GtkAction * action,DenemoScriptParam * param)92 clef_new_french (GtkAction* action, DenemoScriptParam *param)
93 {
94 object_insert (Denemo.project, clef_new (DENEMO_FRENCH_CLEF));
95 }
96
97
98 void
clef_set_treble(GtkAction * action,DenemoScriptParam * param)99 clef_set_treble (GtkAction* action, DenemoScriptParam *param)
100 {
101 DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
102 if (curstaff)
103 dnm_setinitialclef (Denemo.project->movement, curstaff, DENEMO_TREBLE_CLEF);
104 }
105
106 void
clef_set_bass(GtkAction * action,DenemoScriptParam * param)107 clef_set_bass (GtkAction* action, DenemoScriptParam *param)
108 {
109 DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
110 if (curstaff)
111 dnm_setinitialclef (Denemo.project->movement, curstaff, DENEMO_BASS_CLEF);
112 }
113
114 void
clef_set_g8(GtkAction * action,DenemoScriptParam * param)115 clef_set_g8 (GtkAction* action, DenemoScriptParam *param)
116 {
117 DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
118 if (curstaff)
119 dnm_setinitialclef (Denemo.project->movement, curstaff, DENEMO_G_8_CLEF);
120 }
121
122 void
clef_set_f8(GtkAction * action,DenemoScriptParam * param)123 clef_set_f8 (GtkAction* action, DenemoScriptParam *param)
124 {
125 DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
126 if (curstaff)
127 dnm_setinitialclef (Denemo.project->movement, curstaff, DENEMO_F_8_CLEF);
128 }
129
130 void
clef_set_alto(GtkAction * action,DenemoScriptParam * param)131 clef_set_alto (GtkAction* action, DenemoScriptParam *param)
132 {
133 DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
134 if (curstaff)
135 dnm_setinitialclef (Denemo.project->movement, curstaff, DENEMO_ALTO_CLEF);
136 }
137
138 void
clef_set_tenor(GtkAction * action,DenemoScriptParam * param)139 clef_set_tenor (GtkAction* action, DenemoScriptParam *param)
140 {
141 DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
142 if (curstaff)
143 dnm_setinitialclef (Denemo.project->movement, curstaff, DENEMO_TENOR_CLEF);
144 }
145
146 void
clef_set_soprano(GtkAction * action,DenemoScriptParam * param)147 clef_set_soprano (GtkAction* action, DenemoScriptParam *param)
148 {
149 DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
150 if (curstaff)
151 dnm_setinitialclef (Denemo.project->movement, curstaff, DENEMO_SOPRANO_CLEF);
152 }
153
154 void
clef_set_french(GtkAction * action,DenemoScriptParam * param)155 clef_set_french (GtkAction* action, DenemoScriptParam *param)
156 {
157 DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
158 if (curstaff)
159 dnm_setinitialclef (Denemo.project->movement, curstaff, DENEMO_FRENCH_CLEF);
160 }
161