Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2124)

Side by Side Diff: lily/note-collision.cc

Issue 579240043: Issue 4550: Avoid "using namespace std;" in included files (Take 2) (Closed)
Patch Set: Created 5 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 This file is part of LilyPond, the GNU music typesetter. 2 This file is part of LilyPond, the GNU music typesetter.
3 3
4 Copyright (C) 1997--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> 4 Copyright (C) 1997--2020 Han-Wen Nienhuys <hanwen@xs4all.nl>
5 5
6 LilyPond is free software: you can redistribute it and/or modify 6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or 8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
(...skipping 15 matching lines...) Expand all
26 #include "note-head.hh" 26 #include "note-head.hh"
27 #include "output-def.hh" 27 #include "output-def.hh"
28 #include "pointer-group-interface.hh" 28 #include "pointer-group-interface.hh"
29 #include "item.hh" 29 #include "item.hh"
30 #include "rhythmic-head.hh" 30 #include "rhythmic-head.hh"
31 #include "staff-symbol-referencer.hh" 31 #include "staff-symbol-referencer.hh"
32 #include "side-position-interface.hh" 32 #include "side-position-interface.hh"
33 #include "stem.hh" 33 #include "stem.hh"
34 #include "warn.hh" 34 #include "warn.hh"
35 35
36 using std::vector;
37
36 Real 38 Real
37 check_meshing_chords (Grob *me, 39 check_meshing_chords (Grob *me,
38 Grob *clash_up, Grob *clash_down) 40 Grob *clash_up, Grob *clash_down)
39 41
40 { 42 {
41 /* Every note column should have a stem, but avoid a crash. */ 43 /* Every note column should have a stem, but avoid a crash. */
42 if (!Note_column::get_stem (clash_up) || !Note_column::get_stem (clash_down)) 44 if (!Note_column::get_stem (clash_up) || !Note_column::get_stem (clash_down))
43 return 0.0; 45 return 0.0;
44 46
45 Drul_array<Grob *> stems (Note_column::get_stem (clash_down), 47 Drul_array<Grob *> stems (Note_column::get_stem (clash_down),
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 && extents[d][i][DOWN] < extents[d][i - 1][UP]) 519 && extents[d][i][DOWN] < extents[d][i - 1][UP])
518 offset += 1.0; // fully clear the previous-notecolumn heads 520 offset += 1.0; // fully clear the previous-notecolumn heads
519 else if (d * extents[d][i][-d] >= d * extents[d][i - 1][d]) 521 else if (d * extents[d][i][-d] >= d * extents[d][i - 1][d])
520 offset += Stem::is_valid_stem (stems[d][i - 1]) 522 offset += Stem::is_valid_stem (stems[d][i - 1])
521 ? 1.0 : 0.5; // we cross the previous notecolumn 523 ? 1.0 : 0.5; // we cross the previous notecolumn
522 else if (Stem::is_valid_stem (stems[d][i])) 524 else if (Stem::is_valid_stem (stems[d][i]))
523 offset += 0.5; 525 offset += 0.5;
524 526
525 // check if we cross the opposite-stemmed voices 527 // check if we cross the opposite-stemmed voices
526 if (d * extents[d][i][-d] < d * extent_union[-d][d]) 528 if (d * extents[d][i][-d] < d * extent_union[-d][d])
527 offset = max (offset, 0.5); 529 offset = std::max (offset, 0.5);
528 if (extents[-d].size () 530 if (extents[-d].size ()
529 && extents[d][i][UP] > extents[-d][0][DOWN] 531 && extents[d][i][UP] > extents[-d][0][DOWN]
530 && extents[d][i][DOWN] < extents[-d][0][UP]) 532 && extents[d][i][DOWN] < extents[-d][0][UP])
531 offset = max (offset, 1.0); 533 offset = std::max (offset, 1.0);
532 } 534 }
533 offsets[d].push_back (d * offset); 535 offsets[d].push_back (d * offset);
534 } 536 }
535 } 537 }
536 538
537 /* 539 /*
538 see input/regression/dot-up-voice-collision.ly 540 see input/regression/dot-up-voice-collision.ly
539 */ 541 */
540 for (vsize i = 0; i < clash_groups[UP].size (); i++) 542 for (vsize i = 0; i < clash_groups[UP].size (); i++)
541 { 543 {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 { 590 {
589 vector<int> out; 591 vector<int> out;
590 extract_grob_set (me, "elements", elts); 592 extract_grob_set (me, "elements", elts);
591 for (vsize i = 0; i < elts.size (); i++) 593 for (vsize i = 0; i < elts.size (); i++)
592 if (Grob *stem = unsmob<Grob> (elts[i]->get_object ("stem"))) 594 if (Grob *stem = unsmob<Grob> (elts[i]->get_object ("stem")))
593 { 595 {
594 vector<int> nhp = Stem::note_head_positions (stem); 596 vector<int> nhp = Stem::note_head_positions (stem);
595 out.insert (out.end (), nhp.begin (), nhp.end ()); 597 out.insert (out.end (), nhp.begin (), nhp.end ());
596 } 598 }
597 599
598 vector_sort (out, less<int> ()); 600 vector_sort (out, std::less<int> ());
599 return out; 601 return out;
600 } 602 }
601 603
602 ADD_INTERFACE (Note_collision_interface, 604 ADD_INTERFACE (Note_collision_interface,
603 "An object that handles collisions between notes with" 605 "An object that handles collisions between notes with"
604 " different stem directions and horizontal shifts. Most of" 606 " different stem directions and horizontal shifts. Most of"
605 " the interesting properties are to be set in" 607 " the interesting properties are to be set in"
606 " @ref{note-column-interface}: these are @code{force-hshift}" 608 " @ref{note-column-interface}: these are @code{force-hshift}"
607 " and @code{horizontal-shift}.", 609 " and @code{horizontal-shift}.",
608 610
609 /* properties */ 611 /* properties */
610 "merge-differently-dotted " 612 "merge-differently-dotted "
611 "merge-differently-headed " 613 "merge-differently-headed "
612 "note-collision-threshold " 614 "note-collision-threshold "
613 "positioning-done " 615 "positioning-done "
614 "prefer-dotted-right " 616 "prefer-dotted-right "
615 ); 617 );
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b