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

Side by Side Diff: lily/sustain-pedal.cc

Issue 573670043: Refactor get/set_property to take the item as first argument
Patch Set: Manual completion of patch set Created 4 years, 11 months 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
« no previous file with comments | « lily/stream-event.cc ('k') | lily/system.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) 2000--2020 Han-Wen Nienhuys <hanwen@xs4all.nl> 4 Copyright (C) 2000--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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 DECLARE_SCHEME_CALLBACK (print, (SCM)); 46 DECLARE_SCHEME_CALLBACK (print, (SCM));
47 }; 47 };
48 48
49 MAKE_SCHEME_CALLBACK (Sustain_pedal, print, 1); 49 MAKE_SCHEME_CALLBACK (Sustain_pedal, print, 1);
50 SCM 50 SCM
51 Sustain_pedal::print (SCM smob) 51 Sustain_pedal::print (SCM smob)
52 { 52 {
53 Grob *e = unsmob<Grob> (smob); 53 Grob *e = unsmob<Grob> (smob);
54 54
55 Stencil mol; 55 Stencil mol;
56 SCM glyph = e->get_property ("text"); 56 SCM glyph = get_property (e, "text");
57 if (!scm_is_string (glyph)) 57 if (!scm_is_string (glyph))
58 return mol.smobbed_copy (); 58 return mol.smobbed_copy ();
59 59
60 string text = ly_scm2string (glyph); 60 string text = ly_scm2string (glyph);
61 61
62 for (ssize i = 0; i < text.length (); i++) 62 for (ssize i = 0; i < text.length (); i++)
63 { 63 {
64 string idx ("pedal."); 64 string idx ("pedal.");
65 if (text.substr (i, 3) == "Ped") 65 if (text.substr (i, 3) == "Ped")
66 { 66 {
67 idx += "Ped"; 67 idx += "Ped";
68 i += 2; 68 i += 2;
69 } 69 }
70 else 70 else
71 idx += string (&text.c_str ()[i], 1); 71 idx += string (&text.c_str ()[i], 1);
72 Stencil m = Font_interface::get_default_font (e)->find_by_name (idx); 72 Stencil m = Font_interface::get_default_font (e)->find_by_name (idx);
73 if (!m.is_empty ()) 73 if (!m.is_empty ())
74 mol.add_at_edge (X_AXIS, RIGHT, m, 0); 74 mol.add_at_edge (X_AXIS, RIGHT, m, 0);
75 } 75 }
76 76
77 return mol.smobbed_copy (); 77 return mol.smobbed_copy ();
78 } 78 }
79 79
OLDNEW
« no previous file with comments | « lily/stream-event.cc ('k') | lily/system.cc » ('j') | no next file with comments »

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