1 #include "timesig.h"
2 #include "core/utils.h"
3 #include "command/commandfuncs.h"
4 
5 /**
6  * Create a new timesignature object
7  * @param time1 nominator of time signature
8  * @param time2 denominator of the time signature
9  * @return the timesignature
10  */
11 DenemoObject *
dnm_newtimesigobj(gint time1,gint time2)12 dnm_newtimesigobj (gint time1, gint time2)
13 {
14   DenemoObject *ret;
15   timesig *newtimesig = (timesig *) g_malloc0 (sizeof (timesig));
16   ret = (DenemoObject *) g_malloc0 (sizeof (DenemoObject));
17   ret->type = TIMESIG;
18   newtimesig->time1 = time1;
19   newtimesig->time2 = time2;
20   ret->object = newtimesig;
21   set_basic_numticks (ret);
22   setpixelmin (ret);
23   return ret;
24 }
25 
26 /**
27  * Wrapper function to create new 4/4 time sig and insert into the score
28  */
29 void
newtimesig44(GtkAction * action,DenemoScriptParam * param)30 newtimesig44 (GtkAction* action, DenemoScriptParam *param)
31 {
32   object_insert (Denemo.project, dnm_newtimesigobj (4, 4));
33 }
34 
35 /**
36  * Wrapper function to create new 2/4 time sig and insert into the score
37  */
38 void
newtimesig24(GtkAction * action,DenemoScriptParam * param)39 newtimesig24 (GtkAction* action, DenemoScriptParam *param)
40 {
41   object_insert (Denemo.project, dnm_newtimesigobj (2, 4));
42 }
43 
44 /**
45  * Wrapper function to create new 3/4 time sig and insert into the score
46  */
47 void
newtimesig34(GtkAction * action,DenemoScriptParam * param)48 newtimesig34 (GtkAction* action, DenemoScriptParam *param)
49 {
50   object_insert (Denemo.project, dnm_newtimesigobj (3, 4));
51 }
52 
53 /**
54  * Wrapper function to create new 6/4 time sig and insert into the score
55  */
56 void
newtimesig64(GtkAction * action,DenemoScriptParam * param)57 newtimesig64 (GtkAction* action, DenemoScriptParam *param)
58 {
59   object_insert (Denemo.project, dnm_newtimesigobj (6, 4));
60 }
61 
62 /**
63  * Wrapper function to create new 5/4 time sig and insert into the score
64  */
65 void
newtimesig54(GtkAction * action,DenemoScriptParam * param)66 newtimesig54 (GtkAction* action, DenemoScriptParam *param)
67 {
68   object_insert (Denemo.project, dnm_newtimesigobj (5, 4));
69 }
70 
71 /**
72  * Wrapper function to create new 3/8 time sig and insert into the score
73  */
74 void
newtimesig38(GtkAction * action,DenemoScriptParam * param)75 newtimesig38 (GtkAction* action, DenemoScriptParam *param)
76 {
77   object_insert (Denemo.project, dnm_newtimesigobj (3, 8));
78 }
79 
80 /**
81  * Wrapper function to create new 6/8 time sig and insert into the score
82  */
83 void
newtimesig68(GtkAction * action,DenemoScriptParam * param)84 newtimesig68 (GtkAction* action, DenemoScriptParam *param)
85 {
86   object_insert (Denemo.project, dnm_newtimesigobj (6, 8));
87 }
88 
89 /**
90  * Wrapper function to create new 9/8 time sig and insert into the score
91  */
92 void
newtimesig98(GtkAction * action,DenemoScriptParam * param)93 newtimesig98 (GtkAction* action, DenemoScriptParam *param)
94 {
95   object_insert (Denemo.project, dnm_newtimesigobj (9, 8));
96 }
97 
98 /**
99  * Wrapper function to create new 12/8 time sig and insert into the score
100  */
101 void
newtimesig128(GtkAction * action,DenemoScriptParam * param)102 newtimesig128 (GtkAction* action, DenemoScriptParam *param)
103 {
104   object_insert (Denemo.project, dnm_newtimesigobj (12, 8));
105 }
106 
107 /**
108  * Wrapper function to create new 2/2 time sig and insert into the score
109  */
110 void
newtimesig22(GtkAction * action,DenemoScriptParam * param)111 newtimesig22 (GtkAction* action, DenemoScriptParam *param)
112 {
113   object_insert (Denemo.project, dnm_newtimesigobj (2, 2));
114 }
115 
116 /**
117  * Wrapper function to create new 3/2 time sig and insert into the score
118  */
119 void
newtimesig32(GtkAction * action,DenemoScriptParam * param)120 newtimesig32 (GtkAction* action, DenemoScriptParam *param)
121 {
122   object_insert (Denemo.project, dnm_newtimesigobj (3, 2));
123 }
124 
125 /**
126  * Wrapper function to create new 4/2 time sig and insert into the score
127  */
128 void
newtimesig42(GtkAction * action,DenemoScriptParam * param)129 newtimesig42 (GtkAction* action, DenemoScriptParam *param)
130 {
131   object_insert (Denemo.project, dnm_newtimesigobj (4, 2));
132 }
133 
134 
135 void
settimesig22(GtkAction * action,DenemoScriptParam * param)136 settimesig22 (GtkAction* action, DenemoScriptParam *param)
137 {
138   DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
139   if (curstaff)
140     dnm_setinitialtimesig (Denemo.project->movement, curstaff, 2, 2, TRUE);
141 }
142 
143 void
settimesig42(GtkAction * action,DenemoScriptParam * param)144 settimesig42 (GtkAction* action, DenemoScriptParam *param)
145 {
146   DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
147   if (curstaff)
148     dnm_setinitialtimesig (Denemo.project->movement, curstaff, 4, 2, TRUE);
149 }
150 
151 void
settimesig32(GtkAction * action,DenemoScriptParam * param)152 settimesig32 (GtkAction* action, DenemoScriptParam *param)
153 {
154   DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
155   if (curstaff)
156     dnm_setinitialtimesig (Denemo.project->movement, curstaff, 3, 2, TRUE);
157 }
158 
159 void
settimesig44(GtkAction * action,DenemoScriptParam * param)160 settimesig44 (GtkAction* action, DenemoScriptParam *param)
161 {
162   DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
163   if (curstaff)
164     dnm_setinitialtimesig (Denemo.project->movement, curstaff, 4, 4, TRUE);
165 }
166 
167 void
settimesig54(GtkAction * action,DenemoScriptParam * param)168 settimesig54 (GtkAction* action, DenemoScriptParam *param)
169 {
170   DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
171   if (curstaff)
172     dnm_setinitialtimesig (Denemo.project->movement, curstaff, 5, 4, TRUE);
173 }
174 
175 void
settimesig24(GtkAction * action,DenemoScriptParam * param)176 settimesig24 (GtkAction* action, DenemoScriptParam *param)
177 {
178   DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
179   if (curstaff)
180     dnm_setinitialtimesig (Denemo.project->movement, curstaff, 2, 4, TRUE);
181 }
182 
183 void
settimesig34(GtkAction * action,DenemoScriptParam * param)184 settimesig34 (GtkAction* action, DenemoScriptParam *param)
185 {
186   DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
187   if (curstaff)
188     dnm_setinitialtimesig (Denemo.project->movement, curstaff, 3, 4, TRUE);
189 }
190 
191 void
settimesig68(GtkAction * action,DenemoScriptParam * param)192 settimesig68 (GtkAction* action, DenemoScriptParam *param)
193 {
194   DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
195   if (curstaff)
196     dnm_setinitialtimesig (Denemo.project->movement, curstaff, 6, 8, TRUE);
197 }
198 
199 void
settimesig128(GtkAction * action,DenemoScriptParam * param)200 settimesig128 (GtkAction* action, DenemoScriptParam *param)
201 {
202   DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
203   if (curstaff)
204     dnm_setinitialtimesig (Denemo.project->movement, curstaff, 12, 8, TRUE);
205 }
206 
207 void
settimesig38(GtkAction * action,DenemoScriptParam * param)208 settimesig38 (GtkAction* action, DenemoScriptParam *param)
209 {
210   DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
211   if (curstaff)
212     dnm_setinitialtimesig (Denemo.project->movement, curstaff, 3, 8, TRUE);
213 }
214 
215 void
settimesig98(GtkAction * action,DenemoScriptParam * param)216 settimesig98 (GtkAction* action, DenemoScriptParam *param)
217 {
218   DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
219   if (curstaff)
220     dnm_setinitialtimesig (Denemo.project->movement, curstaff, 9, 8, TRUE);
221 }
222 
223 void
settimesig64(GtkAction * action,DenemoScriptParam * param)224 settimesig64 (GtkAction* action, DenemoScriptParam *param)
225 {
226   DenemoStaff *curstaff = (DenemoStaff *) Denemo.project->movement->currentstaff->data;
227   if (curstaff)
228     dnm_setinitialtimesig (Denemo.project->movement, curstaff, 6, 4, TRUE);
229 }
230