~ubuntu-branches/ubuntu/oneiric/denemo/oneiric

« back to all changes in this revision

Viewing changes to src/calculatepositions.c

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-10-27 08:00:18 UTC
  • mfrom: (1.3.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: james.westby@ubuntu.com-20101027080018-tuekd0869v8ptnqv
Tags: upstream-0.8.16
ImportĀ upstreamĀ versionĀ 0.8.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#include "utils.h"
14
14
 
15
15
#define mudobj(x) ((DenemoObject *) x->data)
16
 
 
 
16
#define CHORDTEST(node) ((mudobj(node)->type!=CHORD)||((mudobj(node)->type==CHORD && ((chord *)(mudobj(node)->object))->is_grace)))
17
17
/**
18
18
 *  Check to see if there is any more music in 
19
19
 *  the datastructures
202
202
          while (this_staff_obj_node)
203
203
            {
204
204
              curobj = (DenemoObject *) this_staff_obj_node->data;
205
 
              while (non_chords_node && curobj->type == CHORD
 
205
 
 
206
              while (non_chords_node && 
 
207
                     !CHORDTEST(this_staff_obj_node)
206
208
                     && (starts_at_tick
207
209
                         >=
208
210
                         ((list_info *) non_chords_node->data)->
213
215
                  non_chords_node = non_chords_node->next;
214
216
                }
215
217
 
216
 
              if (curobj->type != CHORD)
 
218
                if (CHORDTEST(this_staff_obj_node))
217
219
                {
218
220
                  curobj->x = *base_x + extra_advance + non_chord_pixels
219
221
                    + ((starts_at_tick - *base_tick) * block_width
220
222
                       / (ticks_in_block ? ticks_in_block : 1));
221
223
 
222
 
#ifndef GRACE_NOTES_BUG_FIXED
223
 
                  if (curobj->type==GRACE_START) {
224
 
                    curobj->x -= 10;
225
 
                    non_chord_pixels -=10;
226
 
                  }
227
 
                  if (curobj->type==GRACE_END) {
228
 
                    curobj->x -= 15;
229
 
                    non_chord_pixels -=15;
230
 
                  }
231
 
#endif
 
224
 
232
225
                    
233
226
                  non_chord_pixels += curobj->minpixelsalloted;
234
227
                   /*g_print("*curobj->x %d *base %d, *base_tick %d, extra %d non chord %d\n", curobj->x, *base_x,*base_tick, extra_advance, non_chord_pixels);*/
240
233
                       / (ticks_in_block ? ticks_in_block : 1));
241
234
                  non_chord_pixels = 0;
242
235
 
243
 
#ifndef GRACE_NOTES_BUG_FIXED
244
 
                  
245
 
                  //need to shift note after grace
246
 
                  if(this_staff_obj_node->prev){
247
 
                    DenemoObject *last = (DenemoObject*)(this_staff_obj_node->prev->data);
248
 
                    if(last->type==GRACE_END)
249
 
                      /* g_print("shifted %d\n", curobj->x),*/ last->x -=10,curobj->x -= 5;
250
 
                  }
251
 
                  if( ((chord*)curobj->object)->is_grace)
252
 
                    /* g_print("shifted grace %d\n", curobj->x),*/ curobj->x -= 15;
253
 
 
254
 
#endif
255
 
                  /*base_tick is getting bigger every note for grace but not for tuplet...
256
 
no 0, 384,640, 896 for triplet, 0, 384, 768, 1152 for grace
257
 
curobj->starttickofnextnot is one ahead of these for grace & triplet, as is Max advance
258
 
 
259
 
 */
260
 
                  /*g_print("chord *curobj->starttickofnextnote %d extra %d starts_at_tick %d, base_x %d *base_tick %d\n", curobj->starttickofnextnote, extra_advance,
261
 
                    starts_at_tick, *base_x, *base_tick );*/
 
236
 
 
237
                
262
238
                }
263
239
              starts_at_tick = curobj->starttickofnextnote;
 
240
 
 
241
 
264
242
              if (this_staff_obj_node == block_end_obj_nodes[i])
265
243
                break;
266
244
              else
289
267
  g_list_free (non_chords);
290
268
}
291
269
 
 
270
 
 
271
 
 
272
 
292
273
/**
293
274
 * This function calculates the horizontal position of every chord in
294
275
 * the measure.  I'm foreseeing only some minor complications
307
288
  start_tick = 0;\
308
289
  if (cur_obj_nodes[i])  \
309
290
    start_tick = mudobj (cur_obj_nodes[i])->starttick;  \
310
 
  while (cur_obj_nodes[i] && mudobj (cur_obj_nodes[i])->type != CHORD)  \
 
291
  while (cur_obj_nodes[i] && CHORDTEST(cur_obj_nodes[i])/*mudobj (cur_obj_nodes[i])->type != CHORD*/) \
311
292
    {  \
312
293
      curobj = (DenemoObject *)cur_obj_nodes[i]->data;  \
313
294
      accumulator += curobj->minpixelsalloted;  \
378
359
    (objnode **) g_malloc (sizeof (objnode *) * num_staffs);
379
360
  cur_obj_nodes = (objnode **) g_malloc (sizeof (objnode *) * num_staffs);
380
361
 
 
362
 
381
363
  for (i = 0, cur_staff = si->thescore;
382
364
       cur_staff; i++, cur_staff = cur_staff->next)
383
365
    {
431
413
              if (cur_obj_nodes[i]
432
414
                  && ((mudobj (cur_obj_nodes[i])->starttickofnextnote
433
415
                       < max_advance_ticks)
434
 
                      || mudobj (cur_obj_nodes[i])->type != CHORD))
 
416
                      || CHORDTEST(cur_obj_nodes[i])
 
417
 
 
418
 
 
419
                      //mudobj (cur_obj_nodes[i])->type != CHORD
 
420
 
 
421
 
 
422
))
435
423
                {
436
424
                  cur_obj_nodes[i] = cur_obj_nodes[i]->next;
437
425
                  fxim_utility;