a.clear ();
}
+
+
+/*
+ lookup with binsearch, return tokencode.
+*/
+template<class T>
+int
+binsearch_array (Array<T> const &arr, T t, int (*compare)(T const&,T const&))
+{
+ int lo;
+ int hi;
+ int cmp;
+ int result;
+ lo = 0;
+ hi = maxkey;
+
+ /* binary search */
+ do
+ {
+ cmp = (lo + hi) / 2;
+
+ result = compare (t, arr[cmp]);
+
+ if (result < 0)
+ hi = cmp;
+ else
+ lo = cmp;
+ }
+ while (hi - lo > 1);
+ if (!compare (t, arr[lo]))
+ return lo;
+ else
+ return -1; /* not found */
+}
+
+
+template<class T>
+int
+binsearch_link_array (Link_array<T> const &arr, T *t,
+ int (*compare)(T *const&,T *const&))
+{
+ int lo;
+ int hi;
+ int cmp;
+ int result;
+ lo = 0;
+ hi = arr.size();
+
+ if (hi == 0)
+ return -1;
+
+ /* binary search */
+ do
+ {
+ cmp = (lo + hi) / 2;
+
+ result = compare (t, arr[cmp]);
+
+ if (result < 0)
+ hi = cmp;
+ else
+ lo = cmp;
+ }
+ while (hi - lo > 1);
+ if (!compare (t, arr[lo]))
+ return lo;
+ else
+ return -1; /* not found */
+}
+
+
#endif // PARRAY_HH
melody = \notes \relative c' {
\partial 8;
g8 |
- c4 c8 d [es () d] c4 | f4 f8 g [es() d] c g |
- c4 c8 d [es () d] c4 | d4 es8 d c4.
+
+
\bar "|.";\clef bass;
}
-text = \lyrics {
- The ri -- ver is flo -- wing, flo -- wing and gro -- wing, the
- ri -- ver is flo -- wing down to the sea.
-}
+
accompaniment =\chords \sequential {
r8
- c2-min f-min 7 d-min es4 c8-min r8
- c2-min f-min 7 g c-min
+ c2-min f-min 7
}
\score {
\simultaneous {
\context ChordNames \accompaniment
- \addlyrics
\context Staff {
- \property Voice.beamAuto = "0"
- \property Staff.automaticMelismas = "1"
\melody }
- \context LyricVoice \text
}
\paper { }
\midi { }
if (f)
return f;
- warning (_f("Can't find font `%s', loading default font.", name.ch_C()));
+ warning (_f ("Can't find font: `%s'", name.ch_C ()));
+ warning (_ ("Loading default font"));
f = find_tfm (default_font_sz_);
if (f)
return f;
- String s = _f("Can't find default font `%s\', giving up.", default_font_sz_);
- s += String ("\n") + _f ("(search path: `%s)'", search_path_.str ());
- error (s);
+ error (_f ("Can't find default font: `%s'", default_font_sz_));
+ error (_f ("(search path: `%s'", search_path_.str ()));
+ error (_ ("Giving up"));
}
do
{
Axis_group_item * my_brok
- = dynamic_cast<Axis_group_item*> (find_prebroken_piece(j));
- Item *new_l = it_l->find_prebroken_piece (j);
+ = dynamic_cast<Axis_group_item*> (find_broken_piece(j));
+ Item *new_l = it_l->find_broken_piece (j);
my_brok->add_element (new_l);
}
while (flip(&j)!=LEFT);
&& item_l->break_status_dir() == 0)
{
// last two checks are paranoia
- Item * broken_item_l =
- item_l->find_prebroken_piece (my_line);
+ Score_element * broken_item_l =
+ item_l->find_broken_piece (my_line);
add_element (broken_item_l);
}
Spanner *spanner_l = dynamic_cast<Spanner*> (elems[i]);
if (spanner_l)
{
- Spanner *broken_spanner_l =
+ Score_element *broken_spanner_l =
spanner_l->find_broken_piece (my_line);
add_element (broken_spanner_l);
}
break_into_pieces ();
Link_array<Score_element> loose_elems = elem_l_arr ();
+
+ Array<int> axeses;
+
+ for (int i=0; i < loose_elems.size (); i++)
+ {
+ Score_element* elt = loose_elems[i];
+ /*
+ with which axes do we have to meddle?
+ */
+ int j =0;
+ int as [2];
+ for (int a = X_AXIS; a < NO_AXES; ++a)
+ if (elt->parent_l (Axis (a)) == this)
+ as[j++] = a;
+ if (j == 1)
+ as[j++] = as[0];
+
+ axeses.push (as[0]);
+ axeses.push (as[1]);
+ }
+
remove_all();
for (int i=0; i < loose_elems.size(); i++)
{
Score_element * elt = loose_elems[i];
Line_of_score *elt_line = elt->line_l();
-
+
+ Axis a1= (Axis)axeses[2*i]; // ugh.
+ Axis a2= (Axis)axeses[2*i+1]; // ugh.
if (! elt_line)
{
/* this piece doesn't know where it belongs.
Find out if it was broken, and use the broken remains
*/
+
Item *it = dynamic_cast <Item *> (elt) ;
if (Spanner * sp =dynamic_cast <Spanner *> (elt))
{
Axis_group_spanner * my_broken_l
= dynamic_cast<Axis_group_spanner*>(find_broken_piece (l));
- Spanner * broken_span_l
+ Score_element * broken_span_l
= sp->find_broken_piece (l);
-
+
if (broken_span_l)
- my_broken_l->add_element (broken_span_l);
+ my_broken_l->add_element (broken_span_l, a1, a2);
}
}
else if (it && it->broken_original_b ())
Direction j=LEFT;
do
{
- Item * broken_item = it->find_prebroken_piece (j);
+ Item * broken_item = it->find_broken_piece (j);
Line_of_score * item_line_l = broken_item->line_l() ;
if (! item_line_l)
continue;
Axis_group_spanner * v
= dynamic_cast<Axis_group_spanner*>(find_broken_piece (item_line_l));
if (v)
- v->add_element (broken_item);
+ v->add_element (broken_item, a1, a2);
else
{
broken_item->set_elt_property (transparent_scm_sym, SCM_BOOL_T);
*/
Axis_group_spanner * my_broken_l
= dynamic_cast<Axis_group_spanner*> (find_broken_piece (elt->line_l()));
- my_broken_l->add_element (elt);
+ my_broken_l->add_element (elt, a1, a2);
}
}
#include "simple-spacer.hh"
-String
-Col_stats::str () const
-{
- String s;
- if (!count_i_)
- s = _ ("0 lines");
- else if (count_i_ == 1)
- s = _f ("1 line (of %.0f columns)", (Real)cols_i_/count_i_);
- else
- s = _f ("%d lines (with an average of %.1f columns)",
- count_i_, (Real)cols_i_/count_i_);
- return s;
-}
-void
-Col_stats::add (Line_of_cols const& line)
-{
- count_i_++;
- cols_i_ += line.size ();
-}
-
-
-Col_stats::Col_stats ()
-{
- count_i_ =0;
- cols_i_ =0;
-}
-
-/* **************************************************************** */
Array<int>
Break_algorithm::problem_OK () const
{
if (pscore_l_->col_l_arr_.empty ())
- error (_("score does not have any columns"));
+ error (_("Score does not have any columns"));
OK ();
}
Array<Column_x_positions>
Break_algorithm::solve () const
{
- Cpu_timer timer;
-
Array<Column_x_positions> h= do_solve ();
-
- if (approx_stats_.count_i_)
- *mlog << '\n' << _f ("approximated %s", approx_stats_.str ()) << endl;
- if (exact_stats_.count_i_)
- *mlog << _f ("calculated %s exactly", exact_stats_.str ()) << endl;
- *mlog << _f ("elapsed time %.2f seconds", timer.read ()) << endl;
-
+
return h;
}
--- /dev/null
+#include "item.hh"
+#include "spanner.hh"
+
+// thanks to GDBs wonderful casting abilities, we need these:
+Item*
+to_item (Graphical_element* g)
+{
+ return dynamic_cast<Item*>(g);
+}
+Spanner*
+to_spanner (Graphical_element*g)
+{
+ return dynamic_cast<Spanner*>(g);
+}
}
void
-Graphical_axis_group::add_element (Graphical_element*e)
+Graphical_axis_group::add_element (Graphical_element*e, Axis a1 , Axis a2)
{
used_b_ =true;
e->used_b_ = true;
+
+ Axis as[2] = {
+ (a1 == NO_AXES) ? axes_[0] : a1,
+ (a2 == NO_AXES) ? axes_[1] : a2,
+ };
+
+
+
for (int i = 0; i < 2; i++)
{
- Axis a = axes_[i];
- assert (a>=0);
- assert (!e->parent_l (a) || this == e->parent_l (a));
- e->set_parent (this, a);
+ if (e->parent_l (as[i]))
+ continue;
+
+ e->set_parent (this, as[i]);
- e->dim_cache_[a]->dependencies_l_arr_.push (dim_cache_[a]);
+ e->dim_cache_[as[i]]->dependencies_l_arr_.push (dim_cache_[as[i]]);
}
-
+ assert (e->parent_l(Y_AXIS) == this || e->parent_l (X_AXIS) == this);
elem_l_arr_.push (e);
}
-
+/**
+ ugr. duplication of functionality with remove_all ()
+ */
void
Graphical_axis_group::remove_element (Graphical_element*e)
{
elem_l_arr_.substitute (e,0);
else
elem_l_arr_.unordered_substitute (e,0);
-
+
+ do_remove (e);
+}
+
+void
+Graphical_axis_group::do_remove (Graphical_element *e)
+{
for (int i=0; i< 2; i++)
{
Axis a=axes_[i];
- Dimension_cache * d = e->dim_cache_[a];
- d->parent_l_ = 0;
- d->dependencies_l_arr_.unordered_substitute (dim_cache_[a], 0);
+ if (e->parent_l (a) != this)
+ continue;
+ e->set_parent (0, a);
+ e->dim_cache_[a]->dependencies_l_arr_.clear ();
}
}
Graphical_axis_group::remove_all ()
{
for (int i=0; i < elem_l_arr_.size(); i++)
- {
- Graphical_element*e=elem_l_arr_[i];
- for (int i=0; i< 2; i++)
- {
- Axis a=axes_[i];
- Dimension_cache * d = e->dim_cache_[a];
- d->parent_l_ = 0;
- d->dependencies_l_arr_.clear ();
- }
-
- }
+ do_remove (elem_l_arr_[i]);
+
elem_l_arr_.clear ();
}
#include "lily-proto.hh"
#include "column-x-positions.hh"
-/**
- Statistics for the number of columns calced.
- */
-struct Col_stats
-{
- int count_i_;
- int cols_i_;
-
- Col_stats();
- void add (Line_of_cols const&l);
- String str() const;
-};
/** Class representation of an algorithm which decides where to put
the column, and where to break lines.
virtual void do_set_pscore();
public:
- Col_stats approx_stats_;
- Col_stats exact_stats_;
Line_spacer* (*get_line_spacer)();
Treat a group of graphical elements as an aggegrate.
*/
class Graphical_axis_group : public virtual Graphical_element {
+private:
+
+ /// modify fields of E for removal.
+ void do_remove (Graphical_element*e);
public:
// keep array in order.
bool ordered_b_;
void remove_all ();
bool contains_b (Graphical_element const *) const;
- void add_element (Graphical_element*);
+ void add_element (Graphical_element*, Axis = NO_AXES, Axis = NO_AXES);
void remove_element (Graphical_element*);
};
Direction break_status_dir () const;
- Item * find_prebroken_piece (Direction) const;
- Item * find_prebroken_piece (Line_of_score*) const;
+ Item * find_broken_piece (Direction) const;
+ Score_element * find_broken_piece (Line_of_score*) const;
Item();
Real hpos_f() const;
{
public:
Link_array<Paper_column> cols_;
-
+ int rank_i_;
+
Line_of_score();
/// is #c# contained in #*this#?
bool contains_b (Paper_column const *c) const;
Line_of_score * set_breaking (Array<Column_x_positions> const&, int j);
-
+ static int compare (Line_of_score* const &,Line_of_score* const &);
void output_all (bool last_line);
void add_column (Paper_column*);
*/
void calculate_dependencies (int final, int busy, Score_element_method_pointer funcptr);
+
+ virtual Score_element *find_broken_piece (Line_of_score*) const;
protected:
Score_element* dependency (int) const;
int dependency_size () const;
virtual void output_processing ();
virtual Interval do_height () const;
virtual Interval do_width () const;
-
+
+
/// do printing of derived info.
virtual void do_print () const;
/// generate the molecule
/// generate rods & springs
virtual void do_space_processing ();
+ /// do postbreak substs on array of pointers.
+ virtual void do_substitute_arrays ();
+
virtual void do_breakable_col_processing ();
/// do calculations after determining horizontal spacing
virtual void do_post_processing ();
};
+template<class T>
+void
+substitute_element_array (Link_array<T> &arr, Line_of_score * to)
+{
+ Link_array<T> newarr;
+ for (int i =0; i < arr.size (); i++)
+ {
+ T * t = arr[i];
+ if (t->line_l () != to)
+ {
+ t = dynamic_cast<T*> (t->find_broken_piece (to));
+ }
+
+ if (t)
+ newarr.push (t);
+ }
+ arr = newarr;
+}
+
+
+
#endif // STAFFELEM_HH
#include "drul-array.hh"
#include "rod.hh"
-struct Breaking_information
-{
- Line_of_score *line_l_;
- Spanner * broken_spanner_l_;
- Drul_array<Item*> bounds_;
- Breaking_information ()
- {
- line_l_ =0;
- broken_spanner_l_ =0;
- bounds_[LEFT] = bounds_[RIGHT] =0;
- }
-};
class Axis_group_spanner;
/** A symbol which is attached between two columns. A spanner is a
Spanner (Spanner const &);
bool broken_b () const;
+ static int compare (Spanner * const &,Spanner * const &);
virtual Array<Rod> get_rods () const;
virtual Array<Spring> get_springs () const;
- virtual Spanner* find_broken_piece (Line_of_score*) const;
+ virtual Score_element* find_broken_piece (Line_of_score*) const;
protected:
void set_my_columns ();
VIRTUAL_COPY_CONS(Score_element);
else
try_visibility_lambda ();
}
-Item*
-Item::find_prebroken_piece (Line_of_score*l) const
+
+Score_element*
+Item::find_broken_piece (Line_of_score*l) const
{
if (line_l() == l)
return (Item*)(this);
}
Item*
-Item::find_prebroken_piece (Direction d) const
+Item::find_broken_piece (Direction d) const
{
if (!d)
return (Item *) (this); // ugh
Direction d = LEFT;
do
{
- Item * broken_self = find_prebroken_piece (d);
- Item * broken_parent = parent->find_prebroken_piece (d);
+ Item * broken_self = find_broken_piece (d);
+ Item * broken_parent = parent->find_broken_piece (d);
broken_self->set_parent (broken_parent, X_AXIS);
Score_element * yparent =dynamic_cast<Score_element*>(parent_l (Y_AXIS));
Item *yparenti = dynamic_cast<Item*> (yparent);
Item *broken_yparent = yparenti ?
- yparenti->find_prebroken_piece (d) : 0;
+ yparenti->find_broken_piece (d) : 0;
if (!yparent)
programming_error ("Vertical refpoint lost!");
else
return CENTER;
}
+
Line_of_score::Line_of_score()
{
- set_axes (Y_AXIS,Y_AXIS);
+ set_axes (Y_AXIS,X_AXIS);
}
bool
Line_of_score *line_l=0;
line_l = dynamic_cast <Line_of_score*> (clone());
-
+ line_l->rank_i_ = j;
+
line_l->cols_ = curline;
line_l->set_bounds(LEFT,curline[0]);
line_l->set_bounds(RIGHT,curline.top());
for (int i=0; i < curline.size(); i++)
{
curline[i]->translate_axis (config[i],X_AXIS);
- curline[i]->line_l_ = dynamic_cast<Line_of_score*>(line_l);
+ curline[i]->line_l_ = dynamic_cast<Line_of_score*> (line_l);
}
- Breaking_information b;
- b.bounds_ = line_l->spanned_drul_;
- b.broken_spanner_l_ = line_l;
- b.line_l_ = line_l;
-
broken_into_l_arr_.push (line_l);
-
return line_l;
}
Line_of_score::add_column (Paper_column*p)
{
cols_.push (p);
+ add_element (p);
}
void
{
Interval i(extent(Y_AXIS));
if (i.empty_b())
- warning ("Huh? Empty Line_of_score?");
+ warning (_ ("Huh? Empty Line_of_score?"));
else
translate_axis (- i[MAX], Y_AXIS);
else
pscore_l_->outputter_l_->stop_line ();
}
+
+int
+Line_of_score::compare (Line_of_score* const &p1,Line_of_score* const &p2)
+{
+ return p1->rank_i_ - p2->rank_i_;
+}
Internationalisation kludge in two steps:
* use _i () to get entry in POT file
* call gettext () explicitely for actual "translation"
+
+ Note: these messages all start with lower case (ie, don't
+ follow regular localisation guidelines).
*/
Long_option_init theopts[] = {
- {_i ("BASENAME"), "output", 'o', _i ("write output to BASENAME[-x].extension")},
- {0, "warranty", 'w', _i ("show warranty and copyright")},
- {0, "help", 'h', _i ("this help")},
- {0, "test", 't', _i ("switch on experimental features")},
{0, "debug", 'd', _i ("enable debugging output")},
- {_i ("FILE"), "init", 'i', _i ("use FILE as init file")},
+ {_i ("EXT"), "output-format", 'f', _i ("use output format EXT")},
+ {0, "help", 'h', _i ("this help")},
{_i ("DIR"), "include", 'I', _i ("add DIR to search path")},
- {0, "no-paper", 'm', _i ("produce midi output only")},
+ {_i ("FILE"), "init", 'i', _i ("use FILE as init file")},
{0, "dependencies", 'M', _i ("write Makefile dependencies for every input file")},
+ {0, "no-paper", 'm', _i ("produce MIDI output only")},
+ {_i ("BASENAME"), "output", 'o', _i ("write output to BASENAME[-x].extension")},
+ {0, "find-old-relative", 'Q', _i ("show all changes in relative syntax")},
+ {0, "safe", 's', _i ("inhibit file output naming and exporting")},
{0, "no-timestamps", 'T', _i ("don't timestamp the output")},
- {0, "find-old-relative", 'Q', _i ("show all changes in relative syntax")},
+ {0, "test", 't', _i ("switch on experimental features")},
{0, "ignore-version", 'V', _i ("ignore mudela version")},
{0, "version", 'v', _i ("print version number")},
- {_i ("EXT"), "output-format", 'f', _i ("use output format EXT")},
- {0, "safe", 's', _i ("inhibit file output naming and exporting")},
+ {0, "warranty", 'w', _i ("show warranty and copyright")},
{0,0,0, 0}
};
{
cout << _f ("Usage: %s [OPTION]... [FILE]...", "lilypond");
cout << "\n\n";
- cout << _ ("Typeset music and or play MIDI from FILE.");
+ cout << _ ("Typeset music and or play MIDI from FILE");
cout << "\n\n";
cout <<
#include "BLURB.hh"
"STRING_UTILS_INLINED "
#endif
"\n"
- "datadir =" DIR_DATADIR
- "\n"
- "localedir =" DIR_LOCALEDIR
-
- "\n\n";
-
- cout << _("Report bugs to") << " bug-gnu-music@gnu.org" << endl;
+ "datadir: `" DIR_DATADIR "'\n"
+ "localedir: `" DIR_LOCALEDIR "'\n"
+ "\n";
print_mudela_versions (cout);
+ cout << endl;
+
+ cout << _f ("Report bugs to %s", "bug-gnu-music@gnu.org") << endl;
}
void
/*
need to do this first. Engravers use lily.scm contents.
*/
- extern void ly_init_protection();
- ly_init_protection();
init_lily_guile ();
read_lily_scm_file ( "lily.scm");
cout << endl;
Item * l = spanned_drul_[LEFT]->column_l ();
Item * r = spanned_drul_[RIGHT]->column_l ();
- Item * lb = l->find_prebroken_piece (RIGHT);
- Item * rb = r->find_prebroken_piece (LEFT);
+ Item * lb = l->find_broken_piece (RIGHT);
+ Item * rb = r->find_broken_piece (LEFT);
Item* combinations[4][2]={{l,r}, {lb,r}, {l,rb},{lb,rb}};
for (int i=0; i < 4; i++)
return 0;
}
-/*
-
- DEPENDENCIES
-
- */
-
-void
-Score_element::remove_dependency (Score_element*e)
-{
- int i;
- while ((i = dependency_arr_.find_i (e)) >=0 )
- dependency_arr_.unordered_del (i);
-
- substitute_dependency (e, 0);
-}
-
void
Score_element::add_dependency (Score_element*e)
{
if (!line)
return;
- Link_array<Score_element> remove_us_arr;
+ do_substitute_arrays ();
+
+ Link_array<Score_element> new_deps;
+
for (int i=0; i < dependency_size(); i++)
{
Score_element * elt = dependency (i);
if (elt->line_l() != line)
{
- if (Spanner *sp = dynamic_cast<Spanner *> (elt))
- {
- Spanner * broken = sp->find_broken_piece (line);
- substitute_dependency (sp, broken);
-
- if (broken)
- add_dependency (broken);
- }
- else if (Item *original = dynamic_cast <Item *> (elt))
- {
- Item * my_item = original->find_prebroken_piece (line);
-
- substitute_dependency (elt, my_item);
- if (my_item)
- add_dependency (my_item);
- }
- remove_us_arr.push (elt);
+ Score_element * broken = elt->find_broken_piece (line);
+ substitute_dependency (elt, broken);
+ elt = broken ;
}
+ if (elt)
+ new_deps.push (elt);
}
+ dependency_arr_ = new_deps;
- remove_us_arr.default_sort();
- remove_us_arr.uniq();
- for (int i=0; i <remove_us_arr.size(); i++)
- remove_dependency (remove_us_arr[i]);
}
+
/*
This sux.
span: item1 item2 item3
How to let span (a derived class) know that this happened?
+
+
+ TODO: cleanify.
*/
void
Score_element::handle_prebroken_dependencies()
if (it_l && it_l->broken_original_b ())
if (Item *me = dynamic_cast<Item*> (this) )
{
- Score_element *new_l = it_l->find_prebroken_piece (me->break_status_dir ());
+ Score_element *new_l = it_l->find_broken_piece (me->break_status_dir ());
if (new_l != elt)
{
new_arr.push (new_l);
Direction d = LEFT;
do {
old_arr.push (0);
- new_arr.push (it_l->find_prebroken_piece (d));
+ new_arr.push (it_l->find_broken_piece (d));
} while (flip(&d)!= LEFT);
}
}
Score_element::do_print () const
{
}
+
+void
+Score_element::do_substitute_arrays ()
+{
+}
+
+
+Score_element*
+Score_element::find_broken_piece (Line_of_score*) const
+{
+ return 0;
+}
Score_engraver::do_creation_processing ()
{
scoreline_l_ = pscore_p_->line_l_;
- scoreline_l_->set_bounds(LEFT,command_column_l_);
+
+ scoreline_l_->set_bounds(LEFT, command_column_l_);
+
command_column_l_->set_elt_property (breakable_scm_sym, SCM_BOOL_T);
Engraver_group_engraver::do_creation_processing();
if (!s->spanned_drul_[d])
{
s->set_bounds(d, command_column_l_);
- ::warning (_f ("Unbound spanner `%s\'", classname(s)));
+ ::warning (_f ("unbound spanner `%s'", classname(s)));
}
} while (flip(&d) != LEFT);
}
{
Single_malt_grouping_item *l =spacing_unit_l_arr_[i];
Single_malt_grouping_item *lb
- = dynamic_cast<Single_malt_grouping_item*>(l->find_prebroken_piece (RIGHT));
+ = dynamic_cast<Single_malt_grouping_item*>(l->find_broken_piece (RIGHT));
Single_malt_grouping_item *r = spacing_unit_l_arr_[i+1];
Single_malt_grouping_item *rb
- = dynamic_cast<Single_malt_grouping_item*>(r->find_prebroken_piece (LEFT));
+ = dynamic_cast<Single_malt_grouping_item*>(r->find_broken_piece (LEFT));
a.push (make_rod(spacing_unit_l_arr_[i], spacing_unit_l_arr_[i+1]));
if (lb)
{
Item * l = scol(i);
Item * r = scol(i+1);
- Item * lb = l->find_prebroken_piece (RIGHT);
- Item * rb = r->find_prebroken_piece (LEFT);
+ Item * lb = l->find_broken_piece (RIGHT);
+ Item * rb = r->find_broken_piece (LEFT);
Item* combinations[4][2]={{l,r}, {lb,r}, {l,rb},{lb,rb}};
Moment shortest_playing_len = lc->shortest_playing_mom_;
if (! shortest_playing_len)
{
- programming_error ("can't find a ruling note at " + lc->when_mom ().str ());
+ programming_error ("Can't find a ruling note at " + lc->when_mom ().str ());
shortest_playing_len = 1;
}
if (left == right)
{
- warning (_ ("left spanpoint is right spanpoint\n"));
+ warning (_ ("Left spanpoint is right spanpoint"));
return;
}
for (int i=1; i < break_points.size(); i++)
{
- Breaking_information info;
- info.bounds_[LEFT] = break_points[i-1];
- info.bounds_[RIGHT] = break_points[i];
+ Drul_array<Item*> bounds;
+ bounds[LEFT] = break_points[i-1];
+ bounds[RIGHT] = break_points[i];
Direction d = LEFT;
do
{
- Item *&pc_l = info.bounds_[d] ;
+ Item *&pc_l = bounds[d] ;
if (!pc_l->line_l())
- pc_l = pc_l->find_prebroken_piece(- d);
+ pc_l = pc_l->find_broken_piece(- d);
assert (pc_l);
- if (!info.line_l_)
- info.line_l_ = pc_l-> line_l ();
- else
- assert( info.line_l_ = pc_l->line_l ());
-
}
while ((flip(&d))!= LEFT);
Spanner *span_p = dynamic_cast<Spanner*>(clone ());
- span_p->set_bounds(LEFT,info.bounds_[LEFT]);
- span_p->set_bounds(RIGHT,info.bounds_[RIGHT]);
+ span_p->set_bounds(LEFT,bounds[LEFT]);
+ span_p->set_bounds(RIGHT,bounds[RIGHT]);
+
pscore_l_->typeset_element (span_p);
-
- info.broken_spanner_l_ = span_p;
span_p->handle_broken_dependencies();
broken_into_l_arr_.push (span_p);
}
+
+ broken_into_l_arr_.sort (Spanner::compare);
}
void
do
{
if (!spanned_drul_[i]->line_l())
- set_bounds(i,spanned_drul_[i]->find_prebroken_piece((Direction)-i));
+ set_bounds(i,spanned_drul_[i]->find_broken_piece((Direction)-i));
}
while (flip(&i) != 1);
}
i->used_b_ = true;
}
- if (d== LEFT)
+ /**
+ Prevent the column -> line_of_score -> column -> line_of_score -> etc situation
+ */
+ if (d== LEFT && !dynamic_cast<Line_of_score*> (this))
{
- set_parent ( i, X_AXIS);
+ set_parent (i, X_AXIS);
}
if (spanned_drul_[Direction(-d)] == spanned_drul_[d]
&& i)
- warning (_f ("Spanner `%s\' with equal left and right spanpoints", classname (this)));
+ warning (_f ("Spanner `%s' has equal left and right spanpoints", classname (this)));
}
void
Real r = spanned_drul_[RIGHT]->relative_coordinate (0, X_AXIS);
if (r< l)
- warning ("Spanner with negative length");
+ warning (_ ("spanner with negative length"));
return Interval (0, r-l);
}
{
if (!spanned_drul_[LEFT] || !spanned_drul_[RIGHT])
return 0;
- if (spanned_drul_[LEFT]->line_l() != spanned_drul_[RIGHT]->line_l())
+ if (spanned_drul_[LEFT]->line_l () != spanned_drul_[RIGHT]->line_l ())
return 0;
return spanned_drul_[LEFT]->line_l();
}
-Spanner*
+Score_element*
Spanner::find_broken_piece (Line_of_score*l) const
{
+ int idx = binsearch_link_array (broken_into_l_arr_, (Spanner*)l, Spanner::compare);
+ if (idx < 0)
+ return 0;
+ else
+ return broken_into_l_arr_ [idx];
+}
+
+/*
for (int i=0; i < broken_into_l_arr_.size (); i++)
{
if (broken_into_l_arr_[i]->line_l () == l)
return broken_into_l_arr_[i];
}
+ return 0;
+*/
+
- return 0;
+int
+Spanner::compare (Spanner * const &p1, Spanner * const &p2)
+{
+ return p1->line_l ()->rank_i_ - p2->line_l ()->rank_i_;
}
bool
if (refpoint)
{
- Spanner * broken_refpoint = refpoint->find_broken_piece (line_l ());
+ Score_element * broken_refpoint = refpoint->find_broken_piece (line_l ());
if (broken_refpoint)
- set_parent ( broken_refpoint,Y_AXIS);
+ set_parent (broken_refpoint,Y_AXIS);
else
programming_error ("Spanner y -refpoint lost.");
}
}
-// If this is a broken spanner, return the amount the left end is to
-// be shifted horizontally so that the spanner starts after the
-// initial clef and key on the staves. This is necessary for ties,
-// slurs, crescendo and decrescendo signs, for example.
+/*
+ If this is a broken spanner, return the amount the left end is to be
+ shifted horizontally so that the spanner starts after the initial
+ clef and key on the staves. This is necessary for ties, slurs,
+ crescendo and decrescendo signs, for example.
+*/
Real
Spanner::get_broken_left_end_align () const
{
int i;
- Line_of_score *l;
+
Score_column *sc = dynamic_cast<Score_column*> (spanned_drul_[LEFT]->column_l());
// Relevant only if left span point is first column in line
Molecule*
Staff_symbol::do_brew_molecule_p() const
{
- Real w = extent (X_AXIS).length ();
- Paper_def * p = paper_l ();
- Real t = p->get_var ("rulethickness");
- Molecule rule = lookup_l ()->filledbox (Box (Interval (0,w),
+ Graphical_element * common
+ = spanned_drul_[LEFT]->common_refpoint (spanned_drul_[RIGHT], X_AXIS);
+
+#if 0
+ Interval r = spanned_drul_[RIGHT]->extent (X_AXIS);
+ Interval l = spanned_drul_[LEFT]->extent (X_AXIS);
+
+ Real left_shift =l.empty_b () ? 0.0: l[LEFT];
+ Real right_shift =r.empty_b () ? 0.0: r[RIGHT];
+#endif
+ Real width =
+ // right_shift - left_shift
+ + spanned_drul_[RIGHT]->relative_coordinate (common , X_AXIS)
+ - spanned_drul_[LEFT]->relative_coordinate (common, X_AXIS)
+ ;
+
+ Real t = paper_l ()->get_var ("rulethickness");
+ Molecule rule = lookup_l ()->filledbox (Box (Interval (0,width),
Interval (-t/2, t/2)));
Real height = (no_lines_i_-1) * staff_line_leading_f_ /2;
m->add_molecule (a);
}
+ // m->translate_axis (left_shift, X_AXIS);
return m;
}
$(outdir)/%.txt: $(outdir)/%.1
troff -man -Tascii $< | grotty -b -u -o > $@
-include $(stepdir)/yodl-rules.make
include $(stepdir)/texinfo-rules.make
$(EXECUTABLE): $(depth)/config.h $(O_FILES) $(outdir)/version.hh
$(foreach a, $(MODULE_LIBS), $(MAKE) -C $(a) && ) true
- $(LD_COMMAND) $(O_FILES) $(LOADLIBES)
+ $(LD_COMMAND) $(O_FILES) $(LOADLIBES) $(USER_LDFLAGS)
exe: $(EXECUTABLE)
# empty
-LDFLAGS = $(ILDFLAGS) $(USER_LDFLAGS) $(EXTRA_LDFLAGS) $(MODULE_LDFLAGS) $($(PACKAGE)_LDFLAGS)
+LDFLAGS = $(ILDFLAGS) $(EXTRA_LDFLAGS) $(MODULE_LDFLAGS) $($(PACKAGE)_LDFLAGS)
MODULE_LIBES =$(addsuffix /$(outdir)/library.a, $(MODULE_LIBS))
LOADLIBES = $(MODULE_LIBES) $($(PACKAGE)_LIBES) $(EXTRA_LIBES)