+++ /dev/null
-\score
-{
- \context StaffGroup = a <
- \context PianoStaff = b <
- \context Staff = "c" \notes\relative c'' { b1 \break b }
- \context Staff = "d" \notes\relative c'' { b1 \break b }
- >
- >
-
- \paper {
- indent=100.0\mm;
- linewidth=150.0\mm;
- \translator
- {
- \StaffContext
- \consists "Staff_margin_engraver";
- numberOfStaffLines = #1
- marginScriptPadding = #30 % urg: this is in PT
- instrument = #"Foo"
- instr = #"Bar"
- }
- }
-}
+++ /dev/null
-/*
- align-elem.cc -- implement Align_elem
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include "align-element.hh"
-#include "interval.hh"
-#include "direction.hh"
-#include "debug.hh"
-#include "dimension-cache.hh"
-#include "axis-group-interface.hh"
-
-/*
- This callback is set in the children of the align element. It does
- not compute anything, but a side effect of a->do_side_processing ()
- is that the elements are placed correctly. */
-Real
-Align_element::alignment_callback (Dimension_cache const *c)
-{
- Axis ax = c->axis ();
- Score_element * sc = c->element_l ()->parent_l (ax);
- Align_element * a = dynamic_cast<Align_element*> (sc);
- if (a && a->get_elt_property ("alignment-done") == SCM_UNDEFINED)
- {
- a->do_side_processing (ax);
- }
- return 0.0;
-}
-
-void
-Align_element::add_element (Score_element* s)
-{
- s->add_offset_callback (alignment_callback, axis ());
- axis_group (this).add_element (s);
-}
-
-/*
- Hairy function to put elements where they should be. Can be tweaked
- from the outside by setting minimum-space and extra-space in its
- children */
-void
-Align_element::do_side_processing (Axis a)
-{
- set_elt_property ("alignment-done", SCM_BOOL_T);
-
- SCM d = get_elt_property ("stacking-dir");
- Direction stacking_dir = gh_number_p(d) ? to_dir (d) : CENTER;
- if (!stacking_dir)
- stacking_dir = DOWN;
-
-
- Array<Interval> dims;
-
- Link_array<Score_element> elems;
- Link_array<Score_element> all_elts
- = Group_interface__extract_elements (this, (Score_element*) 0, "elements");
- for (int i=0; i < all_elts.size(); i++)
- {
- Interval y = all_elts[i]->extent(a) + all_elts[i]->relative_coordinate (this, a);
- if (!y.empty_b())
- {
- Score_element *e =dynamic_cast<Score_element*>(all_elts[i]);
-
- // todo: fucks up if item both in Halign & Valign.
- SCM min_dims = e->remove_elt_property ("minimum-space");
- if (gh_pair_p (min_dims) &&
- gh_number_p (gh_car (min_dims))
- && gh_number_p (gh_cdr (min_dims)))
- {
- y.unite (Interval (gh_scm2double (gh_car (min_dims)),
- gh_scm2double (gh_cdr (min_dims))));
- }
-
- SCM extra_dims = e->remove_elt_property ("extra-space");
- if (gh_pair_p (extra_dims) &&
- gh_number_p (gh_car (extra_dims))
- && gh_number_p (gh_cdr (extra_dims)))
- {
- y[LEFT] += gh_scm2double (gh_car (extra_dims));
- y[RIGHT] += gh_scm2double (gh_cdr (extra_dims));
- }
-
- elems.push (e);
- dims.push (y);
- }
- }
-
-
- Interval threshold = Interval (0, Interval::infinity ());
- SCM thr = get_elt_property ("threshold");
- if (gh_pair_p (thr))
- {
- threshold[SMALLER] = gh_scm2double (gh_car (thr));
- threshold[BIGGER] = gh_scm2double (gh_cdr (thr));
- }
-
- Real where_f=0;
- for (int i=0 ; i < elems.size(); i++)
- {
- Real dy = - stacking_dir * dims[i][-stacking_dir];
- if (i)
- dy += stacking_dir * dims[i-1][stacking_dir];
-
- if (i)
- {
- dy = (dy >? threshold[SMALLER] )
- <? threshold[BIGGER];
- }
-
- where_f += stacking_dir * dy;
- elems[i]->translate_axis (where_f, a);
- }
-}
-
-
-int
-Align_element::get_count (Score_element*s)const
-{
- SCM e = get_elt_property ("elements");
- int c =0;
- while (gh_pair_p (e))
- {
- if (gh_car (e) == s->self_scm_)
- break;
- c++;
- e = gh_cdr (e);
- }
- return c;
-}
-
-Axis
-Align_element::axis () const
-{
- return Axis (gh_scm2int (gh_car (get_elt_property ("axes"))));
-}
-
-void
-Align_element::set_axis (Axis a)
-{
- axis_group (this).set_axes (a, a);
-}
-
-Align_element::Align_element ()
-{
- axis_group (this).set_interface ();
-}
+++ /dev/null
-/*
- axis-align-item.cc -- implement Axis_align_item
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
-
-#include "axis-align-item.hh"
-
-Axis_align_item::Axis_align_item ()
-{
-}
-
-void
-Axis_align_item::do_print () const
-{
- Axis_group_item::do_print ();
-}
+++ /dev/null
-/*
- axis-align-spanner.cc -- implement Axis_align_spanner
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
-#include "axis-align-spanner.hh"
-
-Axis_align_spanner::Axis_align_spanner()
-{
-}
+++ /dev/null
-/*
- axis-group-item.cc -- implement Axis_group_interface
-
- source file of the GNU LilyPond music typesetter
-
- (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
-
-#include "axis-group-item.hh"
-#include "axis-group-interface.hh"
-
-Axis_group_item ::Axis_group_item ()
-{
- axis_group (this).set_interface ();
-}
+++ /dev/null
-/*
- axis-group-spanner.cc -- implement Axis_group_spanner
-
- source file of the GNU LilyPond music typesetter
-
- (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
-
-#include "axis-group-spanner.hh"
-#include "axis-group-interface.hh"
-
-Axis_group_spanner::Axis_group_spanner()
-{
- axis_group (this).set_interface ();
-}
+++ /dev/null
-/*
- align-item.hh -- declare Align_elem
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef VERTICAL_ALIGN_ITEM_HH
-#define VERTICAL_ALIGN_ITEM_HH
-
-#include "score-element.hh"
-
-/**
- Order elements top to bottom/left to right/right to left etc..
-
- TODO: implement padding.
-
- document usage of this.
-
-
-
- *******
-
- element properties
-
- stacking-dir
-
- Which side to align? -1: left side, 0: centered (around
- center_l_ if not nil, or around center of width), 1: right side
-
-
-*/
-class Align_element : public virtual Score_element {
-public:
- Axis axis () const;
-
- Align_element ();
- void set_axis (Axis);
- int get_count (Score_element*)const;
- void add_element (Score_element *);
- static Real alignment_callback (Dimension_cache const *);
-protected:
- virtual void do_side_processing (Axis);
-
-};
-#endif // VERTICAL_ALIGN_ITEM_HH
+++ /dev/null
-/*
- axis-align-item.hh -- declare Axis_align_item
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
- */
-
-#ifndef AXIS_ALIGN_ITEM_HH
-#define AXIS_ALIGN_ITEM_HH
-
-#include "align-element.hh"
-#include "axis-group-item.hh"
-
-/*
- UGH. FIXME: multiple inheritance.
- */
-class Axis_align_item : public virtual Align_element, public virtual Axis_group_item
-{
-public:
- Axis_align_item ();
-protected:
- virtual void do_print ()const;
-
-};
-#endif /* AXIS_ALIGN_ITEM_HH */
-
+++ /dev/null
-/*
- vertical-align-spanner.hh -- declare Vertical_align_spanner
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef VERTICAL_ALIGN_SPANNER_HH
-#define VERTICAL_ALIGN_SPANNER_HH
-
-#include "spanner.hh"
-#include "align-element.hh"
-#include "axis-group-spanner.hh"
-
-/*
- FIXME: multiple inheritance
- */
-class Axis_align_spanner : public virtual Align_element, public virtual Axis_group_spanner
-{
-public:
- VIRTUAL_COPY_CONS(Score_element);
- Axis_align_spanner ();
- virtual void do_print() const {}
-};
-#endif // VERTICAL_ALIGN_SPANNER_HH
+++ /dev/null
-/*
- vertical-align-engraver.hh -- declare Vertical_align_engraver
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef VERTICAL_ALIGN_GRAV_HH
-#define VERTICAL_ALIGN_GRAV_HH
-
-#include "engraver.hh"
-class Axis_align_spanner;
-class Vertical_align_engraver : public Engraver {
- Axis_align_spanner * valign_p_;
- bool qualifies_b (Score_element_info) const;
-public:
- VIRTUAL_COPY_CONS(Translator);
-
- Vertical_align_engraver();
-protected:
-
- virtual void acknowledge_element (Score_element_info);
- virtual void do_creation_processing();
- virtual void do_removal_processing();
-};
-
-#endif // VERTICAL_ALIGN_GRAV_HH
+++ /dev/null
-/*
- super-elem.cc -- implement Super_elem
-
- source file of the LilyPond music typesetter
-
- (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include "super-element.hh"
-#include "line-of-score.hh"
-#include "paper-score.hh"
-#include "string.hh"
-#include "paper-outputter.hh"
-
-
-/**
- for administration of what was done already
- */
-enum Score_element_status {
- ORPHAN=0, // not yet added to pstaff
- VIRGIN, // added to pstaff
- PREBROKEN,
- PREBROKEN_SECOND,
- PRECALCING,
- PRECALCED, // calcs before spacing done
- SPACING,
- SPACED,
- BROKEN,
- BROKEN_SECOND,
- POSTCALCING, // busy calculating. This is used to trap cyclic deps.
- POSTCALCED, // after spacing calcs done
- BREWING,
- BREWED,
-};
-
-void
-Super_element::pre_processing ()
-{
- calculate_dependencies (PRECALCED, PRECALCING, &Score_element::before_line_breaking);
-}
-
-void
-Super_element::space_processing ()
-{
- calculate_dependencies (SPACED, SPACING, &Score_element::do_space_processing);
-}
-
-/* for break processing, use only one status, because copies have to
- have correct status. (Previously,
- Score_element::handle_[pre]broken_dependencies assigned to status_i_
- */
-void
-Super_element::breakable_col_processing ()
-{
- calculate_dependencies (PREBROKEN, PREBROKEN, &Score_element::do_breakable_col_processing);
- // calculate_dependencies (PREBROKEN_SECOND, PREBROKEN_SECOND, &Score_element::handle_prebroken_dependents);
-}
-
-
-void
-Super_element::post_processing ()
-{
- // calculate_dependencies (BROKEN_SECOND, BROKEN_SECOND,
- // &Score_element::handle_broken_dependents);
- calculate_dependencies (POSTCALCED, POSTCALCING, &Score_element::after_line_breaking);
-}
-
-void
-Super_element::output_all ()
-{
- calculate_dependencies (BREWED, BREWING, &Score_element::output_processing);
-}
-
-
-
-