source file of the GNU LilyPond music typesetter
- (c) 1996--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ (c) 1996--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
#include "system.hh"
#include "pointer-group-interface.hh"
#include "spacing-interface.hh"
#include "staff-symbol-referencer.hh"
-#include "tweak-registration.hh"
#include "warn.hh"
#include "lookup.hh"
extern bool debug_skylines;
-System::System (System const &src, int count)
- : Spanner (src, count)
+System::System (System const &src)
+ : Spanner (src)
{
all_elements_ = 0;
pscore_ = 0;
init_elements ();
}
-System::System (SCM s, Object_key const *key)
- : Spanner (s, key)
+System::System (SCM s)
+ : Spanner (s)
{
all_elements_ = 0;
rank_ = 0;
}
Grob *
-System::clone (int index) const
+System::clone () const
{
- return new System (*this, index);
+ return new System (*this);
}
int
{
for (vsize i = 0; i < breaking.size (); i++)
{
- System *system = dynamic_cast<System *> (clone (broken_intos_.size ()));
+ System *system = dynamic_cast<System *> (clone ());
system->rank_ = broken_intos_.size ();
vector<Grob*> c (breaking[i].cols_);
Axis_group_interface::add_element (this, p);
}
-void
-apply_tweaks (Grob *g, bool broken)
-{
- if (bool (g->original ()) == broken)
- {
- SCM tweaks = global_registry_->get_tweaks (g);
- for (SCM s = tweaks; scm_is_pair (s); s = scm_cdr (s))
- {
- SCM proc = scm_caar (s);
- SCM rest = scm_cdar (s);
- scm_apply_1 (proc, g->self_scm (), rest);
- }
- }
-}
-
void
System::pre_processing ()
{
fixup_refpoints (all_elements_->array ());
- for (vsize i = 0; i < all_elements_->size (); i++)
- apply_tweaks (all_elements_->grob (i), false);
-
for (vsize i = 0; i < all_elements_->size (); i++)
{
Grob *g = all_elements_->grob (i);
{
Grob *g = all_elements_->grob (i);
- apply_tweaks (g, true);
(void) g->get_property ("after-line-breaking");
}
extract_grob_set (this, "columns", cols);
- vsize i = binary_search (cols, (Grob *) left,
- Paper_column::less_than);
-
+ vsize i = Paper_column::get_rank (left);
int end_rank = Paper_column::get_rank (right);
if (i < cols.size ())
i++;
/** Return all columns, but filter out any unused columns , since they might
disrupt the spacing problem. */
vector<Grob*>
-System::columns () const
+System::used_columns () const
{
extract_grob_set (this, "columns", ro_columns);
return columns;
}
-Grob*
-System::column (int which) const
+Paper_column *
+System::column (vsize which) const
{
extract_grob_set (this, "columns", columns);
- for (vsize i = 0; i < columns.size (); i++)
- if (dynamic_cast<Paper_column*> (columns[i])->get_rank () == which)
- return columns[i];
- programming_error ("couldn't find the column of the requested index");
- return columns[0];
+ if (which >= columns.size ())
+ return 0;
+
+ return dynamic_cast<Paper_column*> (columns[which]);
}
Paper_score*