Collision::Collision()
{
- axis_group (this).set_axes (X_AXIS, Y_AXIS);
+ Axis_group_interface (this).set_interface ();
+ Axis_group_interface (this).set_axes (X_AXIS, Y_AXIS);
}
void
Collision::add_column (Note_column* ncol_l)
{
- axis_group (this).add_element (ncol_l);
+ Axis_group_interface (this).add_element (ncol_l);
add_dependency (ncol_l);
}
#include "axis-group-interface.hh"
+// todo: dots and elements duplicate each other.
void
Dot_column::add_dots (Dots *d)
{
gi.add_element (d);
add_dependency (d);
- axis_group (this).add_element (d);
+ Axis_group_interface (this).add_element (d);
}
void
{
Group_interface gi (this, "dots");
gi.set_interface ();
-
directional_element (this).set (RIGHT);
- axis_group (this).set_axes(X_AXIS,X_AXIS);
+
+ Axis_group_interface (this).set_interface ();
+ Axis_group_interface (this).set_axes(X_AXIS,X_AXIS);
}
/*
-/*
- axis-item.hh -- declare Axis_group_item
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef AXIS_ITEM_HH
-#define AXIS_ITEM_HH
-
-#include "item.hh"
-
-class Axis_group_item : public virtual Item
-{
-public:
- Axis_group_item ();
- VIRTUAL_COPY_CONS(Score_element);
-};
-
-#endif // AXIS_ITEM_HH
+#error
-/*
- axis-group-spanner.hh -- declare Axis_group_spanner
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef AXIS_GROUP_SPANNER_HH
-#define AXIS_GROUP_SPANNER_HH
-
-#include "spanner.hh"
-
-/**
- An element which groups a line in a certain direction. The most
- useful example of this is the Vertical_group_spanner
-*/
-class Axis_group_spanner : public virtual Spanner
-
-{
-public:
- Axis_group_spanner ();
- VIRTUAL_COPY_CONS(Score_element);
-};
-
-#endif // SPAN_AXIS_GROUP_HH
+#error
#ifndef COLLISION_HH
#define COLLISION_HH
#include "lily-proto.hh"
-#include "axis-group-item.hh"
+#include "item.hh"
#include "tuple.hh"
//junkme, use SCM conses.
multistaff support (see Chlapik: equal noteheads should be on the
same hpos.)
*/
-class Collision : public Axis_group_item {
+class Collision : public Item
+{
protected:
Array<Shift_tup> automatic_shift ();
Array<Shift_tup> forced_shift ();
#ifndef DOT_COLUMN_HH
#define DOT_COLUMN_HH
-#include "axis-group-item.hh"
+#include "item.hh"
/**
Group dots. This is needed because, the dots have to be aligned per voice
*/
-class Dot_column : public Axis_group_item
+class Dot_column : public Item
{
static int compare (Dots * const&,Dots * const&);
void add_dots (Dots*);
#ifndef HARA_KIRI_VERTICAL_GROUP_SPANNER_HH
#define HARA_KIRI_VERTICAL_GROUP_SPANNER_HH
-#include "axis-group-spanner.hh"
+#include "spanner.hh"
/**
As Vertical_group_spanner, but keep track of interesting items. If
we don't contain any interesting items after linebreaking, then
gracefully commit suicide. Objective: don't disgrace Lily by
typesetting empty lines in orchestral scores. */
-class Hara_kiri_group_spanner : public Axis_group_spanner
+class Hara_kiri_group_spanner : public Spanner
{
public:
Hara_kiri_group_spanner ();
NB. This doesn't mean an Item has to initialize the output field before
spacing calculation.
-
- @signature
- visibility_lambda :: int -> (bool . bool)
-
- @in
- break direction
-
- @out
- (transparent, empty) cons
-
- */
-class Item : public virtual Score_element {
- void do_break ();
- void try_visibility_lambda ();
-public:
- /*
- ugh.
+ Element properties
+
+ visibility-lambda -- a function that takes the break
+ direction and returns a (transparent, empty) cons
+
+ breakable -- boolean indicating if this is a breakable item (clef,
+ barline, key sig, etc.)
+
*/
+class Item : public Score_element
+{
Drul_array<Item*> broken_to_drul_;
-
+ void do_break ();
+ void try_visibility_lambda ();
public:
+ VIRTUAL_COPY_CONS(Score_element);
+ Item();
+ Item (Item const &);
- /// I am really to be broken?
bool breakable_b () const;
bool broken_b () const;
Item * find_broken_piece (Direction) const;
Score_element * find_broken_piece (Line_of_score*) const;
- Item();
- Real hpos_f() const;
-
virtual Line_of_score * line_l() const;
virtual Paper_column * column_l () const;
-
- static int left_right_compare (Item const *, Item const*);
-
- Item (Item const &);
protected:
virtual void do_breakable_col_processing();
-
void copy_breakable_items();
};
struct Audio_time_signature;
struct Auto_beam_engraver;
struct Axis_align_item;
-struct Axis_group;
-struct Axis_group_element;
-struct Axis_group_item;
-struct Axis_group_spanner;
struct Bar;
struct Bar_column;
struct Bar_column_engraver;
struct Tuplet_spanner;
struct Unfolded_repeat_iterator;
struct Vertical_brace;
-struct Vertical_spanner;
struct Volta_spanner;
struct Moment;
#define SCORELINE_HH
#include "column-x-positions.hh"
-#include "axis-group-spanner.hh"
-#include "super-element.hh"
+#include "spanner.hh"
/// the columns of a score that form one line. FIXME: multiple inheritance
-class Line_of_score : public Axis_group_spanner, public Super_element
+class Line_of_score : public Spanner
{
public:
+
+
+/*
+ imported the following from Super_element
+
+ The toplevel element. The Paper_score contains this element, and any
+ element shoud be a dependency for the super element.
+
+ It is the entry point for the "constraint solver"/ dependency
+ tracker. Every XXXX_processing () call traverses the entire
+ dependency graph, and calls the appropriate
+ Score_element::do_XXX_processing function on each Score_element it encounters.
+
+
+ FIXME: remove this class, to eliminate multiple inheritance. Merge
+ with Line_of_score ? */
+ void space_processing ();
+ void pre_processing();
+ void breakable_col_processing();
+ void post_processing();
+ void output_all ();
+
int rank_i_;
Line_of_score();
void add_column (Paper_column*);
protected:
- virtual void do_print() const;
VIRTUAL_COPY_CONS(Score_element);
};
#define NOTE_COLUMN_HH
#include "item.hh"
-#include "axis-group-item.hh"
/** a struct for treating a group of noteheads (noteheads, stem
- (chord) and scripts) as a single entity. */
-class Note_column : public Axis_group_item {
+ (chord) and scripts) as a single entity.
+*/
+class Note_column : public Item
+{
protected:
virtual void after_line_breaking () ;
public:
-
static int shift_compare (Note_column *const &, Note_column*const&);
/** The relative position of the "voice" containing this
#ifndef P_COL_HH
#define P_COL_HH
-#include "axis-group-item.hh"
+#include "item.hh"
#include "rod.hh"
#include "spring.hh"
\end{itemize}
*/
-class Paper_column : public Axis_group_item {
+class Paper_column : public Item
+{
public:
VIRTUAL_COPY_CONS(Score_element);
Drul_array<Array<Column_rod> > minimal_dists_arr_drul_;
Examples
- \begin{itemize}
- \item (de)crescendo
- \item slur
- \item beam
- \item bracket
- \end{itemize}
-
+ * (de)crescendo
+ * slur
+ * beam
+ * bracket
Spanner should know about the items which it should consider:
e.g. slurs should be steep enough to "enclose" all those items. This
length of stems of notes they encompass.
*/
-class Spanner : public virtual Score_element {
+class Spanner : public Score_element {
Drul_array<Item*> spanned_drul_;
public:
#ifndef Super_element_HH
#define Super_element_HH
+#error
#include "score-element.hh"
-/** The toplevel element. The Paper_score contains this element, and any
- element shoud be a dependency for the super element.
-
- It is the entry point for the "constraint solver"/ dependency
- tracker. Every XXXX_processing () call traverses the entire
- dependency graph, and calls the appropriate
- Score_element::do_XXX_processing function on each Score_element it encounters.
-
-
- FIXME: remove this class, to eliminate multiple inheritance. Merge
- with Line_of_score ? */
-class Super_element : public virtual Score_element {
-public:
- void space_processing ();
- void pre_processing();
- void breakable_col_processing();
- void post_processing();
- void output_all ();
-};
#endif // Super_element_HH
(c) 1996--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+#include "axis-group-interface.hh"
+#include "debug.hh"
#include "line-of-score.hh"
+#include "main.hh"
+#include "paper-column.hh"
#include "paper-def.hh"
#include "paper-outputter.hh"
-#include "paper-column.hh"
#include "paper-score.hh"
+#include "string.hh"
#include "warn.hh"
-#include "main.hh"
-#include "debug.hh"
-#include "axis-group-interface.hh"
Line_of_score::Line_of_score()
{
set_elt_property ("columns", SCM_EOL);
- axis_group (this).set_axes (Y_AXIS,X_AXIS);
+ Axis_group_interface (this).set_interface ();
+ Axis_group_interface (this).set_axes (Y_AXIS,X_AXIS);
}
{
set_elt_property ("columns",
gh_cons (p->self_scm_, get_elt_property ("columns")));
- axis_group (this).add_element (p);
+ Axis_group_interface (this).add_element (p);
}
-void
-Line_of_score::do_print() const
-{
- Spanner::do_print();
- Axis_group_spanner::do_print ();
-}
void
Line_of_score::output_line (bool last_line)
translate_axis (- i[MAX], Y_AXIS);
pscore_l_->outputter_l_->start_line (i.length ());
- Super_element::output_all ();
+ output_all ();
if (last_line)
pscore_l_->outputter_l_->stop_last_line();
else
{
return p1->rank_i_ - p2->rank_i_;
}
+
+
+
+/**
+ 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
+Line_of_score::pre_processing ()
+{
+ calculate_dependencies (PRECALCED, PRECALCING, &Score_element::before_line_breaking);
+}
+
+void
+Line_of_score::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
+Line_of_score::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
+Line_of_score::post_processing ()
+{
+ // calculate_dependencies (BROKEN_SECOND, BROKEN_SECOND,
+ // &Score_element::handle_broken_dependents);
+ calculate_dependencies (POSTCALCED, POSTCALCING, &Score_element::after_line_breaking);
+}
+
+void
+Line_of_score::output_all ()
+{
+ calculate_dependencies (BREWED, BREWING, &Score_element::output_processing);
+}
+
+
+
+
{
set_elt_property ("rests", SCM_EOL);
set_elt_property ("note-heads", SCM_EOL);
- axis_group (this).set_axes (X_AXIS, Y_AXIS);
+ Axis_group_interface (this).set_interface ();
+ Axis_group_interface (this).set_axes (X_AXIS, Y_AXIS);
}
Stem *
set_elt_property ("stem", stem_l->self_scm_);
add_dependency (stem_l);
- axis_group (this).add_element (stem_l);
+ Axis_group_interface (this).add_element (stem_l);
}
Group_interface gi (this, "note-heads");
gi.add_element (nh);
}
- axis_group (this).add_element (h);
+ Axis_group_interface (this).add_element (h);
}
/**
void
Note_column::set_dotcol (Dot_column *d)
{
- axis_group (this).add_element (d);
+ Axis_group_interface (this).add_element (d);
}
/*
beam_y = gh_scm2double (s);
- Real x0 = b->first_visible_stem ()->hpos_f ();
- Real dx = b->last_visible_stem ()->hpos_f () - x0;
+ Real x0 = b->first_visible_stem ()->relative_coordinate (0, X_AXIS);
+ Real dx = b->last_visible_stem ()->relative_coordinate (0, X_AXIS) - x0;
Real dydx = beam_dy && dx ? beam_dy/dx : 0;
Direction d = stem_l ()->get_direction ();
- Real beamy = (stem_l ()->hpos_f () - x0) * dydx + beam_y;
+ Real beamy = (stem_l ()->relative_coordinate (0, X_AXIS) - x0) * dydx + beam_y;
s = get_elt_property ("rests");
Score_element * se = unsmob_element (gh_car (s));