* scm/define-grobs.scm (all-grob-descriptions): add property break-align-orders
* lily/global-context.cc (get_default_interpreter): new
function. Override from base class, so no new Score contexts are
created.
* ly/engraver-init.ly (breakAlignOrder): put staff-bar behind key-signature.
* lily/paper-outputter.cc (output_line): don't add Stencil::origin.
2004-03-21 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * scripts/convert-ly.py (conv): add rule for breakAlignOrder.
+
+ * scm/define-grobs.scm (all-grob-descriptions): add property break-align-orders
+
+ * lily/global-context.cc (get_default_interpreter): new
+ function. Override from base class, so no new Score contexts are
+ created.
+
+ * lily/include/stencil.hh (class Stencil): document origin field.
+
* lily/staff-symbol.cc (print): span staff-symbol on column
extents for non-broken columns.
@example
\context @{
\ScoreContext
- breakAlignOrder = #'(
+\override BreakAlignment #'break-align-orders = #(make-vector 3 '(
instrument-name
left-edge
span-bar
staff-bar
time-signature
custos
- )
+ ))
@}
@end example
%}
-\version "2.1.30"
+\version "2.1.33"
upper = \notes \relative c {
\clef "treble"
\paper {
\context {
\ScoreContext
- breakAlignOrder = #'(
+\override BreakAlignment #'break-align-orders = #(make-vector 3 '(
instrument-name
left-edge
ambitus
staff-bar
time-signature
custos
- )
+ ))
}
\context {
\VoiceContext
\version "2.1.30"
\header {
- texidoc = "Distances between prefatory items (e.g. clef, bar, etc.)
- are determined by engraving standards. These distances
- depend on which items are combined."
+ texidoc = "Distances between prefatory items (e.g. clef, bar,
+etc.) are determined by engraving standards. These distances depend
+on which items are combined. Mid-line, the order for clef and
+bar-line is different from the start of line.
+"
}
cis4 cis4 cis4 cis4 \clef bass cis,1
\clef treble
\bar ":|"
+ \key g \minor
+ c1
}
\paper { raggedright = ##t}
}
--- /dev/null
+
+\header { texidoc = " Staves starting and ending halfway include clefs
+ and bar lines. " }
+
+\score {
+ \new StaffGroup \notes \relative c'' <<
+ \new Staff { c4 c c c \bar "||" c c c c }
+ { \skip 4 \new Staff { c c c } }
+ >>
+ \paper {}
+ }
void
Break_align_engraver::stop_translation_timestep ()
{
- SCM order = get_property ("breakAlignOrder");
- for (; gh_pair_p (order); order = ly_cdr (order))
- {
- SCM p = scm_assoc (ly_car (order), column_alist_);
- if (gh_pair_p (p))
- {
- add_column (ly_cdr (p));
- column_alist_ = scm_assoc_remove_x (column_alist_, ly_car (order));
- }
- }
-
for (SCM p = column_alist_; gh_pair_p (p); p = ly_cdr (p))
{
SCM pair = ly_car (p);
add_column (ly_cdr (pair));
}
-
-
column_alist_ = SCM_EOL;
if (align_)
/* creats*/ "BreakAlignment BreakAlignGroup LeftEdge",
/* accepts */ "",
/* acks */ "break-aligned-interface"
-,/* reads */ "breakAlignOrder",
+,/* reads */ "",
/* write */ "");
return Self_alignment_interface::aligned_on_self (element_smob, axis);
}
+
+void
+Break_align_interface::order_elements (Grob *grob)
+{
+ Item *me = dynamic_cast<Item*> (grob);
+ SCM elts = me->get_property ("elements");
+ SCM order_vec = me->get_property ("break-align-orders");
+ if (!gh_vector_p (order_vec)
+ || gh_vector_length (order_vec) < 3)
+ return ;
+
+ SCM order = scm_vector_ref (order_vec,
+ gh_int2scm (me->break_status_dir() + 1));
+
+ /*
+ Copy in order specified in BREAK-ALIGN-ORDER. We use
+ Pointer_group_interface__extract_grobs (which reverses the list)
+ down the line, so it's ok to prepend onto newlist.
+ */
+ SCM new_list = SCM_EOL;
+ for (; gh_pair_p (order); order = ly_cdr (order))
+ {
+ SCM sym = gh_car (order);
+
+ SCM *tail = &elts;
+ for (; gh_pair_p (*tail); tail = SCM_CDRLOC(*tail))
+ {
+ Grob * g = unsmob_grob (gh_car (*tail));
+ if (sym == g->get_property ("break-align-symbol"))
+ {
+ SCM new_pair = *tail;
+ *tail = gh_cdr (*tail);
+ if (gh_pair_p (*tail))
+ tail = SCM_CDRLOC(*tail);
+
+ gh_set_cdr_x (new_pair, new_list);
+ new_list = new_pair;
+ break;
+ }
+ }
+ }
+
+ new_list = scm_reverse_x (elts, new_list);
+ me->set_property ("elements", new_list);
+}
+
void
Break_align_interface::add_element (Grob*me, Grob *toadd)
{
}
void
-Break_align_interface::do_alignment (Grob *me)
+Break_align_interface::do_alignment (Grob *grob)
{
- Item * item = dynamic_cast<Item*> (me);
+ Item * me = dynamic_cast<Item*> (grob);
+
+ order_elements (me);
+
Link_array<Grob> elems
= Pointer_group_interface__extract_grobs (me, (Grob*)0,
"elements");
}
- if (item->break_status_dir () == LEFT)
+ if (me->break_status_dir () == LEFT)
{
alignment_off = - total_extent[RIGHT] - extra_right_space;
}
ADD_INTERFACE (Break_align_interface, "break-alignment-interface",
"The object that performs break aligment. See @ref{break-aligned-interface}.",
- "positioning-done");
+ "positioning-done break-align-orders");
{
return prev_mom_;
}
+
+Context *
+Global_context::get_default_interpreter ()
+{
+ if (get_score_context ())
+ return get_score_context ()->get_default_interpreter ();
+ else
+ return Context::get_default_interpreter ();
+}
public:
static void do_alignment (Grob*);
static void new_do_alignment (Grob*);
-
+ static void order_elements (Grob *me);
static bool has_interface (Grob*);
static void add_element (Grob*me, Grob*add);
DECLARE_SCHEME_CALLBACK (alignment_callback, (SCM element, SCM axis));
String id, SCM ops);
Link_array<Context> path_to_acceptable_context (SCM alias,
Music_output_def*) const;
- Context *get_default_interpreter ();
+ virtual Context *get_default_interpreter ();
String id_string_;
SCM implementation_;
virtual void finish ();
virtual Music_output_def* get_output_def () const;
virtual Moment now_mom () const;
+ virtual Context *get_default_interpreter ();
+
Moment previous_moment () const;
protected:
fields);
output_scheme (scm_list_n (ly_symbol2scm ("output-scopes"),
paper->self_scm (),
- scm_list_n (ly_symbol2scm ("quote"),
- scopes, SCM_UNDEFINED),
- scm_list_n (ly_symbol2scm ("quote"),
- fields, SCM_UNDEFINED),
+ ly_quote_scm (scopes),
+ ly_quote_scm (fields),
scm_makfrom0str (basename_.to_str0 ()),
SCM_UNDEFINED));
}
is the proper order.
%}
- breakAlignOrder = #'(
- instrument-name
- left-edge
- ambitus
- breathing-sign
- clef
- key-signature
- staff-bar
- time-signature
- custos
- )
+
barCheckSynchronize = ##f
%% chord names:
"List of beatgroups. Eg. in 5/8 time @code{'(2 3)}.")
- (breakAlignOrder ,list? "Defines the order in which
-prefatory matter (clefs, key signatures) appears, eg. this puts the
-key signatures after the bar lines:
-
-@example
- \\property Score.breakAlignOrder = #'(
- span-bar
- breathing-sign
- clef
- staff-bar
- key
- time-signature
- )
-@end example
-")
(middleCPosition ,number? "Place of the middle C, measured in half
staffspaces. Usually determined by looking at @code{clefPosition} and
(bracket-thick ,number? "width of a system start bracket.")
(break-align-symbol ,symbol? "This key is used for aligning and
spacing breakable items.")
+ (break-align-orders ,vector? " Defines the order in which
+prefatory matter (clefs, key signatures) appears. The format is a
+vector of length 3. Each element is an order for (end-of-line, middle
+of line, and start-of-line). The order is a list of symbols.
+Clefs are put after key signatures by setting
+
+@example
+ \\property Score.breakAlignOrder = #(make-vector 3
+ '(span-bar
+ breathing-sign
+ staff-bar
+ key
+ clef
+ time-signature))
+@end example")
(break-glyph-function ,procedure? "This function determines the
appearance of a barline at the line break. It takes a glyph and
break-direction and returns the glyph at a line break.")
. (
(breakable . #t)
(stacking-dir . 1)
+ (break-align-orders . #((instrument-name left-edge ambitus breathing-sign
+ clef key-signature staff-bar
+ time-signature custos)
+ (instrument-name left-edge ambitus breathing-sign
+ clef staff-bar key-signature
+ staff
+ time-signature custos)
+ (instrument-name left-edge ambitus breathing-sign
+ clef key-signature staff-bar
+ time-signature custos)
+
+ ))
(axes . (0))
(X-extent-callback . ,Axis_group_interface::group_extent_callback)
(meta . ((interfaces . (break-alignment-interface item-interface axis-group-interface)))))
ly:get-stencil-extent -> ly:stencil-extent
'''))
+
def conv (str):
str = re.sub (r'\\alias\s*"?Timing"?', '', str)
return str
conversions.append (((2,1,31), conv,
'''remove \\alias Timing'''))
+def conv (str):
+ str = re.sub (r"(\set)?\s+(?P<context>(Score\.)?)breakAlignOrder\s*=\s*#'(?P<list>[^\)]+)",
+ r"\n\\override \g<context>BreakAlignment #'break-align-orders = "
+ + "#(make-vector 3 '\g<list>)", str)
+
+ return str
+
+conversions.append (((2,1,33), conv,
+ '''breakAlignOrder -> break-align-orders.'''))
+
################################
# END OF CONVERSIONS
################################