--- /dev/null
+\header {
+texidoc = "Hara kiri should not upset fixed distance alignment like in pianostaff. In this example the middle staff is harakiried."
+}
+
+
+\score { \notes \transpose c'''
+ \context PianoStaff <
+ \context Staff = up { c c c c \break }
+ \context Staff = mid { s1 \break }
+ \context Staff = down { c4 c c c \break }
+ >
+ \paper {
+ \translator {
+ \HaraKiriStaffContext
+ }
+ }
+}
+
#include "grob.hh"
#include "group-interface.hh"
#include "axis-group-interface.hh"
+#include "hara-kiri-group-spanner.hh"
#include "paper-def.hh"
MAKE_SCHEME_CALLBACK (Align_interface,alignment_callback,2);
me->set_grob_property ("alignment-done", SCM_BOOL_T);
SCM d = me->get_grob_property ("stacking-dir");
-
Direction stacking_dir = gh_number_p (d) ? to_dir (d) : CENTER;
if (!stacking_dir)
stacking_dir = DOWN;
-
SCM force = me->get_grob_property ("forced-distance");
Real dy = 0.0;
v.set_empty ();
Array<Real> translates;
- for (int j=0 ; j < elems.size (); j++)
+ for (int j= elems.size (); j--; )
+ {
+ /*
+ This is not very elegant, in that we need special support for
+ hara kiri. Unfortunately, the generic wiring of
+ force_hara_kiri_callback () (extent and offset callback) is
+ such that we might get into a loop if we call extent() or
+ offset() the elements.
+
+
+ */
+ if (a == Y_AXIS
+ && Hara_kiri_group_spanner::has_interface (elems[j]))
+ Hara_kiri_group_spanner::consider_suicide (elems[j]);
+
+ if (!ly_pair_p (elems[j]-> immutable_property_alist_))
+ elems.del(j);
+ }
+
+ for (int j =0; j < elems.size (); j++)
{
where_f += stacking_dir * dy;
translates.push (where_f);
&& gh_string_p (get_property ("clefGlyph")))
create_clef ();
- if (Key_item::has_interface (item))
- {
- /*
- Key_item adapts its formatting to make sure that the
- accidentals stay in the upper half of the staff. It needs
- to know c0-pos for this. (?)
- */
-
- item->set_grob_property ("c0-position", get_property ("centralCPosition"));
- }
}
}
ENTER_DESCRIPTION(Clef_engraver,
/* descr */ "Determine and set reference point for pitches",
/* creats*/ "Clef OctavateEight",
-/* acks */ "bar-line-interface key-interface",
+/* acks */ "bar-line-interface",
/* reads */ "clefPosition clefGlyph centralCPosition clefOctavation explicitClefVisibility",
/* write */ "");
#include "lily-guile.hh"
#include "lily-proto.hh"
-
class Hara_kiri_group_spanner
{
public:
{
void create_key (bool);
void read_req (Key_change_req const * r);
+ Key_change_req * keyreq_l_;
+ Item * item_p_;
public:
TRANSLATOR_DECLARATIONS(Key_engraver);
- Key_change_req * keyreq_l_;
- Item * item_p_;
- Protected_scm old_accs_; // ugh. -> property
-
protected:
virtual void initialize ();
virtual void finalize ();
void
Key_engraver::finalize ()
{
- old_accs_ = SCM_EOL; // unprotect can not be called from dtor.
}
+
Key_engraver::Key_engraver ()
{
keyreq_l_ = 0;
item_p_ = 0;
}
+
void
Key_engraver::create_key (bool def)
{
{
item_p_ = new Item (get_property ("KeySignature"));
- item_p_->set_grob_property ("c0-position", gh_int2scm (0));
-
+ item_p_->set_grob_property ("c0-position",
+ get_property ("centralCPosition"));
+
// todo: put this in basic props.
- item_p_->set_grob_property ("old-accidentals", old_accs_);
+ item_p_->set_grob_property ("old-accidentals", get_property ("lastKeySignature"));
item_p_->set_grob_property ("new-accidentals", get_property ("keySignature"));
Staff_symbol_referencer::set_interface (item_p_);
Key_item::set_interface (item_p_);
-
-
announce_grob (item_p_,keyreq_l_);
}
-
if (!def)
{
SCM vis = get_property ("explicitKeySignatureVisibility");
return false;
}
+
void
Key_engraver::acknowledge_grob (Grob_info info)
{
{
create_key (true);
}
-
}
+
void
Key_engraver::create_grobs ()
{
- if (keyreq_l_ || old_accs_ != get_property ("keySignature"))
- {
- create_key (false);
- }
+ if (keyreq_l_ ||
+ get_property ("lastKeySignature") != get_property ("keySignature"))
+ create_key (false);
}
+
void
Key_engraver::stop_translation_timestep ()
-{
+{
if (item_p_)
{
typeset_grob (item_p_);
}
}
+
void
Key_engraver::read_req (Key_change_req const * r)
{
n = scm_delete_x (ly_car (s), n);
}
}
+
for (SCM s = n ; gh_pair_p (s); s = ly_cdr (s))
if (gh_scm2int (ly_cdar (s)))
accs = gh_cons (ly_car (s), accs);
- old_accs_ = get_property ("keySignature");
+ daddy_trans_l_->set_property ("lastKeySignature",
+ get_property ("keySignature"));
daddy_trans_l_->set_property ("keySignature", accs);
}
+
void
Key_engraver::start_translation_timestep ()
{
keyreq_l_ = 0;
- old_accs_ = get_property ("keySignature");
+ daddy_trans_l_->set_property ("lastKeySignature", get_property ("keySignature"));
}
+
void
Key_engraver::initialize ()
{
daddy_trans_l_->set_property ("keySignature", SCM_EOL);
- old_accs_ = SCM_EOL;
+ daddy_trans_l_->set_property ("lastKeySignature", SCM_EOL);
}
-
-
ENTER_DESCRIPTION(Key_engraver,
/* descr */ "",
/* creats*/ "KeySignature",
/* acks */ "bar-line-interface clef-interface",
-/* reads */ "keySignature explicitKeySignatureVisibility createKeyOnClefChange keyAccidentalOrder keySignature",
-/* write */ "");
+/* reads */ "keySignature lastKeySignature explicitKeySignatureVisibility createKeyOnClefChange keyAccidentalOrder keySignature",
+/* write */ "lastKeySignature");
SCM newas = me->get_grob_property ("new-accidentals");
Molecule mol;
+
+ SCM c0s = me->get_grob_property ("c0-position");
+ int c0p=0;
+ if (gh_number_p (c0s))
+ c0p = gh_scm2int (c0s);
+
/*
SCM lists are stacks, so we work from right to left, ending with
the cancellation signature.
*/
- int c0p = gh_scm2int (me->get_grob_property ("c0-position"));
for (SCM s = newas; gh_pair_p (s); s = ly_cdr (s))
{
return mol.smobbed_copy ();
}
-
-
-
-
bool
Key_item::has_interface (Grob*m)
{
ENTER_DESCRIPTION(Rhythmic_column_engraver,
/* descr */ "Generates NoteColumn, an objects that groups stems, noteheads and rests.",
/* creats*/ "NoteColumn",
-/* acks */ "stem-interface note-head-interface dot-column-interface",
+/* acks */ "stem-interface rhythmicb-head-interface dot-column-interface",
/* reads */ "",
/* write */ "");
if (rb)
find_rods (rb, ly_cdr (s));
}
-
find_musical_sequences (me);
#if 0
/*
}
stopGraceMusic = {
+ \property Staff.Accidentals \revert #'font-relative-size
\property Voice.Beam \revert #'space-function
\property Voice.Beam \revert #'thickness
% be smaller as well.
\property Voice.fontSize \unset
- \property Staff.LocalKeyItem \revert #'font-relative-size
}
")
(translator-property-description 'keySignature list? "The current key signature. This is an alist containing (NAME . ALTER) or ((OCTAVE . NAME) . ALTER) pairs, where NAME is from 0.. 6 and ALTER from -2,-1,0,1,2 ")
+(translator-property-description 'lastKeySignature list? "Last key
+signature before a key signature change.")
+
(translator-property-description 'localKeySignature list? "the key
signature at this point in the measure. The format is the same as for keySignature. "
)