lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fix ugly code in ClefModifier alignment (issue 134770043 by address@hidd


From: janek . lilypond
Subject: Fix ugly code in ClefModifier alignment (issue 134770043 by address@hidden)
Date: Wed, 27 Aug 2014 07:39:06 +0000

Reviewers: ,

Message:
Pushed as

commit 54e99169c083ddde748e0f583c2d007cfe937044
Author: Janek WarchoĊ‚ <address@hidden>
Date:   Sun Aug 17 14:59:35 2014 +0200

    Fix ugly code in ClefModifier alignment

Description:
Fix ugly code in ClefModifier alignment

Please review this at https://codereview.appspot.com/134770043/

Affected files (+2, -5 lines):
  M lily/clef-modifier.cc


Index: lily/clef-modifier.cc
diff --git a/lily/clef-modifier.cc b/lily/clef-modifier.cc
index 6d802ad2710948b271a669469f992be44f29dd2c..c56b935a16155eff89655acdd564f213a0ddcad9 100644
--- a/lily/clef-modifier.cc
+++ b/lily/clef-modifier.cc
@@ -25,27 +25,24 @@ struct Clef_modifier
   DECLARE_GROB_INTERFACE ();
 };

 MAKE_SCHEME_CALLBACK (Clef_modifier, calc_parent_alignment, 1)
 SCM
 Clef_modifier::calc_parent_alignment (SCM smob)
 {
   Grob *me = Grob::unsmob (smob);
   Grob *clef = me->get_parent (X_AXIS);
   string full_clef_name = ly_scm2string (clef->get_property ("glyph"));
-
-  int separator_position = full_clef_name.find ('.');
-  string clef_type = full_clef_name.substr (separator_position + 1,
-                                            separator_position + 2);
+  string clef_name = replace_all(&full_clef_name, "clefs.", "");

   // find entry with keyname clef_type in clef-alignments
-  SCM alist_entry = scm_assq (ly_symbol2scm (clef_type.c_str ()),
+  SCM alist_entry = scm_assq (ly_symbol2scm (clef_name.c_str ()),
                               me->get_property ("clef-alignments"));

   if (scm_is_pair (alist_entry))
     {
       SCM entry_value = scm_cdr (alist_entry);
       // the value should be a pair of numbers - first is the alignment
       // for modifiers below the clef, second for those above.
       if (scm_is_pair (entry_value))
         if (robust_scm2dir (me->get_property ("direction"), DOWN) == DOWN)
           return scm_car (entry_value);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]