+2004-04-29 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * lily/page.cc: Remove paper var caching.
+
2004-04-28 Jan Nieuwenhuizen <janneke@gnu.org>
+ * Documentation/user/music-glossary.tely: Add name to @top node.
+ Remove comment from @table definitions (workaround for makinfo
+ bug).
+
* lily/stencil-scheme.cc (ly:stencil-expr): Rename (was:
ly:stencil-get-expr). Update callers.
(ly:stencil-align-to!): Return stencil too.
-\input texinfo @c -*-texinfo-*-
+ \input texinfo @c -*-texinfo-*-
@settitle Music Glossary
@setfilename music-glosssary.info
@ifnottex
@node Top
-@top
+@top Music Glossary
@chapter Music Glossary
@menu
@end menu
@end ifnottex
@ifnottex
-@table @code
+@table @samp
@item Adrian Mariano
Italian glossary,
@item Bjoern Jacke
This is an example reference, that points you to the @aref{accent}
entry.
-@c All `@table @strong' replaced by `@table @samp @c @strong'
+@c All `@table @strong' replaced by `@table @samp'
@c @strong{note xxx} breaks for info with makeinfo CVS <= 2004-04-26
-@table @samp @c @strong
+@table @samp
@aitem{A}
ES: la,
@page
-@table @samp @c @strong
+@table @samp
@item DURATION NAMES, NOTES AND RESTS
@end table
@page
-@table @samp @c @strong
+@table @samp
@item PITCH NAMES
@end table
@
-@table @samp @c @strong
+@table @samp
@item ---------------------
: Input ()
{
header_ = SCM_EOL;
+ assert (!scores_.size ());
smobify_self ();
}
-#if 0
-Book::Book (Book const &src)
- : Input (src)
-{
- header_ = SCM_EOL;
- smobify_self ();
-
- int score_count = src.scores_.size ();
- for (int i = 0; i < score_count; i++)
- scores_.push (src.scores_[i]->clone ());
-
-#if 0
- header_ = ly_make_anonymous_module ();
- if (is_module (src.header_))
- ly_import_module (header_, src.header_);
-#endif
-}
-#endif
-
Book::~Book ()
{
}
}
SCM pages = paper_book->pages ();
- scm_gc_unprotect_object (paper_book->self_scm ());
+ paper_book = 0;
if (pages != SCM_EOL)
{
progress_indication (_f ("paper output to `%s'...", "<markup>"));
- return unsmob_page (ly_car (pages))->to_stencil ();
+ return (unsmob_page (ly_car (pages)))->to_stencil ();
}
return SCM_EOL;
}
Link_array<Score> scores_;
Book ();
- Book (Book const&);
+
void process (String outname, Music_output_def*, SCM header);
SCM to_stencil (Music_output_def*, SCM header);
};
Real height_;
// HMMM all this size stuff to paper/paper-outputter?
- Real hsize_;
Real vsize_;
- Real left_margin_;
Real top_margin_;
Real bottom_margin_;
- Real foot_sep_;
- Real head_sep_;
- Real text_width_;
Page (Paper_def*, int);
Page::Page (Paper_def *paper, int number)
{
- paper_ = paper;
- number_ = number;
-
copyright_ = SCM_EOL;
footer_ = SCM_EOL;
header_ = SCM_EOL;
lines_ = SCM_EOL;
tagline_ = SCM_EOL;
+ paper_ = paper;
+ number_ = number;
+
height_ = 0;
line_count_ = 0;
page_count_++;
- hsize_ = paper->get_dimension (ly_symbol2scm ("hsize"));
- vsize_ = paper->get_dimension (ly_symbol2scm ("vsize"));
- top_margin_ = paper->get_dimension (ly_symbol2scm ("top-margin"));
- bottom_margin_ = paper->get_dimension (ly_symbol2scm ("bottom-margin"));
- head_sep_ = paper->get_dimension (ly_symbol2scm ("head-sep"));
- foot_sep_ = paper->get_dimension (ly_symbol2scm ("foot-sep"));
- text_width_ = paper->get_dimension (ly_symbol2scm ("linewidth"));
- left_margin_ = (hsize_ - text_width_) / 2;
-
SCM make_header = ly_scheme_function ("make-header");
SCM make_footer = ly_scheme_function ("make-footer");
Page::mark_smob (SCM smob)
{
Page *p = (Page*) SCM_CELL_WORD_1 (smob);
- scm_gc_mark (p->lines_);
scm_gc_mark (p->header_);
scm_gc_mark (p->footer_);
scm_gc_mark (p->copyright_);
scm_gc_mark (p->tagline_);
+ //scm_gc_mark (p->lines_);
return p->lines_;
}
return scm_call_1 (proc, self_scm ());
}
+Real
+Page::left_margin () const
+{
+ return (paper_->get_dimension (ly_symbol2scm ("hsize"))
+ - paper_->get_dimension (ly_symbol2scm ("linewidth"))) / 2;
+}
+
LY_DEFINE (ly_page_header_lines_footer_stencil, "ly:page-header-lines-footer-stencil",
1, 0, 0, (SCM page),
"Simple header, lines, footer stencil from PAGE.")
SCM_ASSERT_TYPE (p, page, SCM_ARG1, __FUNCTION__, "page");
Stencil stencil;
- Offset o (p->left_margin_, p->top_margin_);
+ Offset o (p->paper_->get_dimension (ly_symbol2scm ("left-margin")),
+ p->paper_->get_dimension (ly_symbol2scm ("top-margin")));
+
Real vfill = (p->line_count_ > 1
? (p->text_height () - p->height_) / (p->line_count_ - 1)
: 0);
if (Stencil *s = unsmob_stencil (p->header_))
{
stack_stencils (stencil, s, &o);
- o[Y_AXIS] += p->head_sep_;
+ o[Y_AXIS] += p->paper_->get_dimension (ly_symbol2scm ("head-sep"));
}
for (SCM s = p->lines_; s != SCM_EOL; s = ly_cdr (s))
o[Y_AXIS] += vfill;
}
- o[Y_AXIS] = p->vsize_ - p->bottom_margin_;
+ o[Y_AXIS] = p->paper_->get_dimension (ly_symbol2scm ("vsize"))
+ - p->paper_->get_dimension (ly_symbol2scm ("bottom-margin"));
if (unsmob_stencil (p->copyright_))
o[Y_AXIS] -= unsmob_stencil (p->copyright_)->extent (Y_AXIS).length ();
if (unsmob_stencil (p->tagline_))
Real
Page::text_height () const
{
- Real h = vsize_ - top_margin_ - bottom_margin_;
+ Real h = paper_->get_dimension (ly_symbol2scm ("vsize"))
+ - paper_->get_dimension (ly_symbol2scm ("top-margin"))
+ - paper_->get_dimension (ly_symbol2scm ("bottom-margin"));
if (unsmob_stencil (header_))
- h -= unsmob_stencil (header_)->extent (Y_AXIS).length () + head_sep_;
- if (unsmob_stencil (copyright_) || unsmob_stencil (tagline_) || unsmob_stencil (footer_))
- h -= foot_sep_;
+ h -= unsmob_stencil (header_)->extent (Y_AXIS).length ()
+ + paper_->get_dimension (ly_symbol2scm ("head-sep"));
+ if (unsmob_stencil (copyright_)
+ || unsmob_stencil (tagline_)
+ || unsmob_stencil (footer_))
+ h -= paper_->get_dimension (ly_symbol2scm ("foot-sep"));
if (unsmob_stencil (copyright_))
h -= unsmob_stencil (copyright_)->extent (Y_AXIS).length ();
if (unsmob_stencil (tagline_))
extern Music_output_def* get_paper (My_lily_parser *parser);
Music_output_def *paper = get_paper (THIS);
SCM s = book->to_stencil (paper, THIS->header_);
- $$ = scm_list_2 (ly_scheme_function ("stencil-markup"), s);
scm_gc_unprotect_object (score->self_scm ());
scm_gc_unprotect_object (book->self_scm ());
+ $$ = scm_list_2 (ly_scheme_function ("stencil-markup"), s);
}
;
Protected_scm::Protected_scm (SCM s)
{
- object_ = SCM_NIMP (s) ? scm_gc_protect_object (s): s;
+ object_ = SCM_NIMP (s) ? scm_gc_protect_object (s): s;
}
Protected_scm::Protected_scm (Protected_scm const &s)
{
- object_ = SCM_NIMP (s.object_) ? scm_gc_protect_object (s.object_) : s.object_;
+ object_ = (SCM_NIMP (s.object_) ? scm_gc_protect_object (s.object_)
+ : s.object_);
+}
+
+Protected_scm::~Protected_scm ()
+{
+ if (SCM_NIMP (object_))
+ scm_gc_unprotect_object (object_);
}
Protected_scm &
if (SCM_NIMP (object_))
scm_gc_unprotect_object (object_);
- object_ = SCM_NIMP (s) ? scm_gc_protect_object (s): s;
+ object_ = SCM_NIMP (s) ? scm_gc_protect_object (s) : s;
return *this;
}
return operator= (s.object_);
}
-
-Protected_scm::~Protected_scm ()
-{
- if (SCM_NIMP (object_))
- {
- scm_gc_unprotect_object (object_);
- }
-}
-
Protected_scm::operator SCM () const
{
return object_;
smobify_self ();
- Music * m =unsmob_music (s.music_);
- music_ = m?m->clone ()->self_scm () : SCM_EOL;
+ Music *m =unsmob_music (s.music_);
+ music_ = m ? m->clone ()->self_scm () : SCM_EOL;
scm_gc_unprotect_object (music_);
for (int i = 0; i < s.defs_.size (); i++)
Cpu_timer timer;
- Global_context * trans = new Global_context (odef,
- music->get_length ()
- );
+ Global_context * trans = new Global_context (odef, music->get_length ());
if (!trans)
{
iter->construct_children ();
- if (! iter->ok ())
+ if (!iter->ok ())
{
warning (_ ("Need music in a score"));
- return SCM_BOOL_F; // todo: should throw exception.
+ /* todo: should throw exception. */
+ return SCM_BOOL_F;
}
trans->run_iterator_on_me (iter);
if (verbose_global_b)
progress_indication (_f ("elapsed time: %.2f seconds", timer.read ()));
-
return scm_gc_unprotect_object (trans->self_scm ());
}
return lines;
}
-
-
-
/* Find the loose columns in POSNS, and drape them around the columns
specified in BETWEEN-COLS. */
static void
void
System::break_into_pieces (Array<Column_x_positions> const &breaking)
{
- for (int i=0; i < breaking.size (); i++)
+ for (int i = 0; i < breaking.size (); i++)
{
System *system = dynamic_cast <System*> (clone ());
system->rank_ = i;
system->set_bound (LEFT,c[0]);
system->set_bound (RIGHT,c.top ());
- for (int j=0; j < c.size (); j++)
+ for (int j = 0; j < c.size (); j++)
{
- c[j]->translate_axis (breaking[i].config_[j],X_AXIS);
+ c[j]->translate_axis (breaking[i].config_[j], X_AXIS);
dynamic_cast<Paper_column*> (c[j])->system_ = system;
}
set_loose_columns (system, &breaking[i]);
{
Grob *me = this;
SCM cs = me->get_property ("columns");
- Grob * prev = ly_c_pair_p (cs) ? unsmob_grob (ly_car (cs)) : 0;
+ Grob *prev = ly_c_pair_p (cs) ? unsmob_grob (ly_car (cs)) : 0;
p->rank_ = prev ? Paper_column::get_rank (prev) + 1 : 0;
- me->set_property ("columns", scm_cons (p->self_scm (), cs));
+ me->set_property ("columns", scm_cons (p->self_scm (), cs));
Axis_group_interface::add_element (me, p);
}
unsmob_grob (ly_car (s))->discretionary_processing ();
if (verbose_global_b)
- progress_indication (_f ("Grob count %d", element_count ()));
+ progress_indication (_f ("Grob count %d", element_count ()));
for (SCM s = get_property ("all-elements"); ly_c_pair_p (s); s = ly_cdr (s))
progress_indication ("\n" + _ ("Calculating line breaks...") + " ");
for (SCM s = get_property ("all-elements"); ly_c_pair_p (s); s = ly_cdr (s))
{
- Grob * e = unsmob_grob (ly_car (s));
+ Grob *e = unsmob_grob (ly_car (s));
SCM proc = e->get_property ("spacing-procedure");
if (ly_c_procedure_p (proc))
scm_call_1 (proc, e->self_scm ());
}
Link_array<Item>
-System::broken_col_range (Item const*l, Item const*r) const
+System::broken_col_range (Item const *left, Item const *right) const
{
Link_array<Item> ret;
- l = l->get_column ();
- r = r->get_column ();
+ left = left->get_column ();
+ right = right->get_column ();
SCM s = get_property ("columns");
- while (ly_c_pair_p (s) && ly_car (s) != r->self_scm ())
+ while (ly_c_pair_p (s) && ly_car (s) != right->self_scm ())
s = ly_cdr (s);
if (ly_c_pair_p (s))
s = ly_cdr (s);
- while (ly_c_pair_p (s) && ly_car (s) != l->self_scm ())
+ while (ly_c_pair_p (s) && ly_car (s) != left->self_scm ())
{
Paper_column*c = dynamic_cast<Paper_column*> (unsmob_grob (ly_car (s)));
if (Item::is_breakable (c) && !c->system_)
return ret;
}
-/**
- Return all columns, but filter out any unused columns , since they might
- disrupt the spacing problem.
- */
+/** Return all columns, but filter out any unused columns , since they might
+ disrupt the spacing problem. */
Link_array<Grob>
-System::columns ()const
+System::columns () const
{
Link_array<Grob> acs
= Pointer_group_interface__extract_grobs (this, (Grob*) 0, "columns");
- bool bfound = false;
- for (int i= acs.size (); i -- ;)
+ bool found = false;
+ for (int i = acs.size (); i--;)
{
bool brb = Item::is_breakable (acs[i]);
- bfound = bfound || brb;
+ found = found || brb;
/*
the last column should be breakable. Weed out any columns that
seem empty. We need to retain breakable columns, in case
someone forced a breakpoint.
*/
- if (!bfound || !Paper_column::is_used (acs[i]))
+ if (!found || !Paper_column::is_used (acs[i]))
acs.del (i);
}
return acs;
LY_DEFINE (ly_make_virtual_font, "ly:make-virtual-font", 0, 0, 1,
(SCM args),
- "Make a virtual font metric from @var{args}, a list of font objects.")
+ "Make a virtual font metric from @var{args}, "
+ "a list of font objects.")
{
- Virtual_font_metric *fm = new Virtual_font_metric (args);
-
+ Virtual_font_metric *fm = new Virtual_font_metric (args);
return scm_gc_unprotect_object (fm->self_scm ());
}