+2001-12-14 Han-Wen <hanwen@cs.uu.nl>
+
+ * scripts/lilypond-book.py (LatexPaper.set_geo_option):
+ Convert strings with dimensions to numbers.
+
+ * lily/volta-engraver.cc: only make a bracket for the top staff,
+ as found in stavesFound.
+
+ * lily/bar-number-engraver.cc: remove staff administration.
+
+ * lily/mark-engraver.cc (acknowledge_grob): remove staff
+ administration. This breaks support for invisible-staff.
+
+ * lily/staff-collecting-engraver.cc: new engraver. Collects staff
+ symbols into stavesFound.
+
+ * lily/score-engraver.cc (acknowledge_grob): Acknowledge spacing
+ grobs, and put them into columns.
+
+ * lily/engraver-group-engraver.cc (acknowledge_grobs): Include the
+ Engraver_group_engraver as a potential candidate for ack'ing grobs.
+
+2001-12-13 Heikki Junes <hjunes@cc.hut.fi>
+
+ * lilypond-mode.el (LilyPond-command-next-midi): Play next (or last)
+ midi section in the Emacs-mode, so it is possible to play certain
+ score in a multiscore lilypond-file.
+
+2001-12-09 Rune Zedeler <rune@zedeler.dk>
+ * lily/lily-guile.cc: Added ly_assoc_front_x() and ly_assoc_cdr()
+ (FIXME: not accessible from guile)
+
+ * lily/accidental-engraver.cc: rewrote accidental-routines to get
+ better support for Kurt Stone's suggestions.
+ Removed properties: noResetKey, forgetAccidentals, autoReminders,
+ lazyKeySignature.
+ Changed property: localKeySignature.
+ Added properties: extraNatural, autoAccidentals,
+ autoCautionaries.
+ (BUGFIX: broken-tie-support destroyed in 1.5.16)
+
+ * ly/property-init.ly: added commands
+ \defaultAccidentals \modernAccidentals \modernCautionaries
+ \noResetKey \forgetAccidentals
+
+ * ly/engraver-init.ly: Correct initialization of new accidentals.
+
+ * scm/translator-property-description.scm: The new properties
+ added.
+
+ * input/: Some examples added, some changed.
+
+ * Documentation/regression-test.tely: Added quick test of new
+ accidentals.
+
+2001-12-13 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ * scripts/lilypond-book.py (scan_latex_preamble): don't crash if
+ header not found
+
+2001-12-07 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ * lily/beam.cc (before_line_breaking): Make beams without stems
+ or with only one stem disappear.
+
2001-12-05 Han-Wen Nienhuys <hanwen@cs.uu.nl>
* bibtools/bib2html.py: Add simple bib2html convertor, and .bst
@code{whichBar} property. If it has no bar line to create, it will forbid a linebreak at this point",
/* creats*/ "BarLine",
/* acks */ "",
-/* reads */ "whichBar stavesFound",
+/* reads */ "whichBar",
/* write */ "");
#include "paper-column.hh"
#include "paper-def.hh"
#include "side-position-interface.hh"
-#include "staff-symbol.hh"
#include "item.hh"
#include "moment.hh"
#include "engraver.hh"
protected:
virtual void stop_translation_timestep ();
virtual void acknowledge_grob (Grob_info);
- virtual void initialize ();
virtual void create_grobs ();
void create_items ();
TRANSLATOR_DECLARATIONS( Bar_number_engraver );
text_p_ =0;
}
-void
-Bar_number_engraver::initialize ()
-{
- /*
- ugh: need to share code with mark_engraver
- */
- daddy_trans_l_->set_property ("stavesFound", SCM_EOL);
-}
-
-
void
Bar_number_engraver::acknowledge_grob (Grob_info inf)
{
Grob * s = inf.grob_l_;
- if (Staff_symbol::has_interface (s))
- {
- SCM sts = get_property ("stavesFound");
- SCM thisstaff = inf.grob_l_->self_scm ();
- if (scm_memq (thisstaff, sts) == SCM_BOOL_F)
- daddy_trans_l_->set_property ("stavesFound", gh_cons (thisstaff, sts));
- }
- else if (text_p_
- && dynamic_cast<Item*> (s)
- && s->get_grob_property ("break-align-symbol") == ly_symbol2scm ("Left_edge_item"))
+ if (text_p_
+ && dynamic_cast<Item*> (s)
+ && s->get_grob_property ("break-align-symbol") == ly_symbol2scm ("Left_edge_item"))
{
/*
By default this would land on the Paper_column -- so why
/* descr */ "A bar number is created whenever measurePosition is zero. It is
put on top of all staves, and appears only at left side of the staff.",
/* creats*/ "BarNumber",
-/* acks */ "staff-symbol-interface break-aligned-interface",
-/* reads */ "currentBarNumber",
+/* acks */ "break-aligned-interface",
+/* reads */ "currentBarNumber stavesFound" ,
/* write */ "");
void
-Engraver_group_engraver::create_grobs ()
+Engraver_group_engraver::create_grobs_in_simple_children ()
{
-
for (SCM p = simple_trans_list_; gh_pair_p (p); p = ly_cdr (p))
{
Translator * t = unsmob_translator (ly_car (p));
}
}
+/*
+ TODO: use this mechanism for the current Engraver_group_engraver as well.
+
+ */
SCM find_acknowledge_engravers (SCM gravlist, SCM meta);
void
Engraver_group_engraver::acknowledge_grobs ()
SCM acklist = scm_hashq_ref (tab, nm, SCM_UNDEFINED);
if (acklist == SCM_BOOL_F)
{
- acklist= find_acknowledge_engravers (simple_trans_list_, meta);
+ acklist= find_acknowledge_engravers (gh_cons (self_scm (), simple_trans_list_), meta);
scm_hashq_set_x (tab, nm, acklist);
}
dynamic_cast<Engraver_group_engraver*> (t)->do_announces ();
}
- create_grobs ();
+ create_grobs_in_simple_children ();
while (announce_info_arr_.size ())
{
acknowledge_grobs ();
announce_info_arr_.clear ();
- create_grobs ();
+ create_grobs_in_simple_children ();
}
}
}
}
-void find_all_acknowledge_engravers (SCM tab, SCM gravlist, SCM allgrobs);
-
void
Engraver_group_engraver::initialize ()
{
ENTER_DESCRIPTION(Engraver_group_engraver,
/* descr */ "A group of engravers taken together",
/* creats*/ "",
-/* acks */ "grob-interface",
+/* acks */ "",
/* reads */ "",
/* write */ "");
virtual void announce_grob (Grob_info);
virtual void process_music ();
private:
- void create_grobs ();
- void acknowledge_grobs ();
+ virtual void acknowledge_grobs ();
+ virtual void create_grobs_in_simple_children ();
};
#endif // ENGRAVERGROUP_HH
protected:
/* Engraver_group_engraver interface */
+ virtual void acknowledge_grob (Grob_info);
virtual bool try_music (Music*);
virtual void initialize ();
virtual void finalize ();
virtual void announce_grob (Grob_info);
- virtual void do_announces ();
virtual void typeset_grob (Grob*elem_p);
virtual void stop_translation_timestep ();
-
};
#endif // SCORE_GRAV_HH
#define STAFF_SYMBOL_HH
#include "lily-guile.hh"
+#include "lily-proto.hh"
/**
TODO: add stafflinethickness as parameter.
Item * right = 0;
while (1)
{
-
SCM between = loose->get_grob_property ("between-cols");
if (!gh_pair_p (between))
break;
#include "lily-guile.hh"
#include "paper-column.hh"
#include "paper-def.hh"
-
#include "side-position-interface.hh"
#include "staff-symbol-referencer.hh"
#include "item.hh"
void create_items (Request*);
virtual bool try_music (Music *req_l);
virtual void start_translation_timestep ();
- virtual void initialize ();
virtual void process_music ();
private:
mark_req_l_ = 0;
}
-void
-Mark_engraver::initialize ()
-{
- daddy_trans_l_->set_property ("stavesFound", SCM_EOL); // ugh: sharing with barnumber grav.
-}
-
-
-
-
-/*
-
-which grobs carry INVISIBLE-STAFF ?
-
-*/
-
void
Mark_engraver::acknowledge_grob (Grob_info inf)
{
Grob * s = inf.grob_l_;
- if (Staff_symbol::has_interface (s)
- || to_boolean (s->get_grob_property ("invisible-staff")))
- {
- SCM sts = get_property ("stavesFound");
- SCM thisstaff = inf.grob_l_->self_scm ();
- if (scm_memq (thisstaff, sts) == SCM_BOOL_F)
- daddy_trans_l_->set_property ("stavesFound", gh_cons (thisstaff, sts));
- }
- else if (text_p_ && Bar::has_interface (s))
+ if (text_p_ && Bar::has_interface (s))
{
/*
Ugh. Figure out how to do this right at beginning of line, (without
ENTER_DESCRIPTION(Mark_engraver,
/* descr */ "",
/* creats*/ "RehearsalMark",
-/* acks */ "grob-interface",
+/* acks */ "bar-line-interface",
/* reads */ "rehearsalMark stavesFound",
/* write */ "");
typeset_grob (note_column_);
note_column_ =0;
}
+
+ if (spacing_)
+ {
+ typeset_grob (spacing_);
+ last_spacing_ = spacing_;
+ spacing_ =0;
+ }
}
void
#include "axis-group-interface.hh"
#include "translator-def.hh"
+#include "staff-spacing.hh"
+#include "note-spacing.hh"
/*
TODO: the column creation logic is rather hairy. Revise it.
ugh.
*/
if (!command_column_l_)
- // || *unsmob_moment (command_column_l_->get_grob_property ("when")) != w)
{
set_columns (new Paper_column (get_property ("NonMusicalPaperColumn")),
new Paper_column (get_property ("PaperColumn")));
{
announce_info_arr_.push (info);
pscore_p_->line_l_->typeset_grob (info.grob_l_);
-}
-/* All elements are propagated to the top upon announcement. If
- something was created during one run of
- Engraver_group_engraver::do_announces, then
- announce_info_arr_.size () will be nonzero again
-*/
-/* junkme? Done by Engraver_group_engraver::do_announces ()?
- */
-
-void
-Score_engraver::do_announces ()
-{
- Engraver_group_engraver::do_announces ();
+
}
*/
command_column_l_->remove_grob_property ("breakable");
}
-
+
+void
+Score_engraver::acknowledge_grob (Grob_info gi)
+{
+ if (Staff_spacing::has_interface (gi.grob_l_))
+ {
+ Pointer_group_interface::add_element (command_column_l_,
+ ly_symbol2scm ("spacing-wishes"),
+ gi.grob_l_);
+ }
+ if (Note_spacing::has_interface (gi.grob_l_))
+ {
+ Pointer_group_interface::add_element (musical_column_l_,
+ ly_symbol2scm ("spacing-wishes"),
+ gi.grob_l_);
+ }
+}
",
/* creats*/ "LineOfScore PaperColumn NonMusicalPaperColumn",
-/* acks */ "grob-interface",
+/* acks */ "note-spacing-interface staff-spacing-interface",
/* reads */ "currentMusicalColumn currentCommandColumn",
/* write */ "");
Item * musical_malt_p_;
Item * last_musical_malt_p_;
- Grob * last_note_spacing_;
- Grob * current_note_spacing_;
- Grob * staff_spacing_;
+ Item * last_note_spacing_;
+ Item * current_note_spacing_;
+ Item * staff_spacing_;
Spanner * sep_span_p_;
--- /dev/null
+/*
+staff-collecting-engraver.cc -- implement Staff_collecting_engraver
+
+source file of the GNU LilyPond music typesetter
+
+(c) 2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+#include "staff-symbol.hh"
+#include "engraver.hh"
+#include "grob.hh"
+#include "translator-group.hh"
+
+class Staff_collecting_engraver : public Engraver
+{
+public:
+ TRANSLATOR_DECLARATIONS(Staff_collecting_engraver);
+ virtual void acknowledge_grob (Grob_info);
+};
+
+Staff_collecting_engraver::Staff_collecting_engraver ()
+{
+
+}
+
+void
+Staff_collecting_engraver::acknowledge_grob (Grob_info gi)
+{
+ if (Staff_symbol::has_interface (gi.grob_l_))
+ {
+ SCM staffs = get_property ("stavesFound");
+ staffs = gh_cons (gi.grob_l_->self_scm (), staffs);
+
+ daddy_trans_l_->set_property ("stavesFound", staffs);
+ }
+}
+
+
+ENTER_DESCRIPTION(Staff_collecting_engraver,
+/* descr */ "Maintain the stavesFound variable",
+
+/* creats*/ "",
+/* acks */ "staff-symbol-interface",
+/* reads */ "stavesFound",
+/* write */ "stavesFound");
/*
- spacing-spanner.cc -- implement Spacing_spanner
+ spacing-spanner.cc -- implement Spacing_spanner
source file of the GNU LilyPond music typesetter
*/
+
+#include "paper-column.hh"
+
+
class Third_spacing_spanner
{
public:
void find_loose_columns () {}
-
+ void prune_loose_colunms (Link_array<Grob> *cols);
+ void find_loose_columns (Link_array<Grob> cols);
};
+
+
+
+static bool
+fixed_neighbor (Grob *col, SCM nm)
+{
+ SCM l = col->internal_get_grob_property (nm);
+
+ if (!gh_pair_p (l))
+ return false;
+
+ Item * left = dynamic_cast<Item*> (unsmob_grob (gh_car (l)));
+ return abs (Paper_column::rank_i (left->column_l ()) - Paper_column::rank_i (col)) == 1 ;
+}
+
+void
+Third_spacing_spanner::prune_loose_colunms (Link_array<Grob> *cols)
+{
+ for (int i=cols->size (); i--; )
+ {
+
+ if (Item::breakable_b (cols->elem(i)))
+ continue;
+
+ if (!fixed_neighbor (cols->elem(i), ly_symbol2scm ("left-neighbors"))
+ || !fixed_neighbor (cols->elem(i), ly_symbol2scm ("right-neighbors")))
+ cols->del (i);
+ }
+}
+
+void
+Third_spacing_spanner::find_loose_columns (Link_array<Grob> cols)
+{
+ for (int i=0; i< cols.size(); i++)
+ {
+ SCM right_neighbors = SCM_EOL;
+ int min_rank = 100000; // inf.
+
+ for (SCM s = cols[i]-> get_grob_property ("spacing-wishes");
+ gh_pair_p (s); s = gh_cdr (s))
+ {
+ Grob * wish = unsmob_grob (gh_car (s));
+
+ Grob * left = unsmob_grob (wish->get_grob_property ("left-item"));
+ Grob * right = unsmob_grob (wish->get_grob_property ("right-item"));
+
+ Item * li = dynamic_cast<Item*> (left);
+ Item * ri = dynamic_cast<Item*> (right);
+
+ assert (li->column_l () == cols[i]);
+
+ Item * rc = ri->column_l ();
+ Item * lc = li->column_l ();
+ int newrank = Paper_column::rank_i (lc);
+
+ SCM neighbors = rc->get_grob_property ("left-neighbors");
+ Item * left_neighbor = gh_pair_p (neighbors)
+ ? dynamic_cast<Item*> (unsmob_grob (gh_car (neighbors))) : 0;
+
+ left_neighbor = left_neighbor->column_l ();
+ if (left_neighbor)
+ {
+ int oldrank = Paper_column::rank_i (left_neighbor->column_l ());
+
+ if (newrank > oldrank)
+ {
+ neighbors= gh_cons (wish->self_scm (), SCM_EOL);
+ }
+ else if (newrank == oldrank)
+ {
+ neighbors = gh_cons (wish->self_scm (), neighbors);
+ }
+ }
+
+ if (newrank < min_rank)
+ {
+ right_neighbors = gh_cons (wish->self_scm(), SCM_EOL);
+ min_rank = newrank;
+ }
+ else if (newrank == min_rank)
+ {
+ right_neighbors = gh_cons (wish->self_scm (), right_neighbors);
+ }
+ }
+
+ cols[i]->set_grob_property ("right-neighbors", right_neighbors);
+ }
+}
#include "note-column.hh"
#include "bar.hh"
#include "side-position-interface.hh"
+#include "staff-symbol.hh"
/*
Create Volta spanners, by reading repeatCommands property, usually
Moment started_mom_;
Spanner *volta_span_p_;
Spanner *end_volta_span_p_;
-
+ SCM staff_;
SCM start_str_;
};
Volta_engraver::Volta_engraver ()
{
+ staff_ = SCM_EOL;
volta_span_p_ = 0;
end_volta_span_p_ = 0;
}
void
Volta_engraver::process_music ()
{
+ if (unsmob_grob (staff_))
+ {
+ /*
+ TODO: this does weird things when you open a piece with a
+ volta spanner.
+
+ */
+ SCM staffs = get_property ("stavesFound");
+
+ /*
+ only put a volta on the top staff.
+
+ May be this is a bit convoluted, and we should have a single
+ volta engraver in score context or somesuch.
+
+ */
+ if (ly_car (scm_last_pair (staffs)) != staff_)
+ return ;
+ }
+
+
SCM cs = get_property ("repeatCommands");
bool end = false;
Volta_spanner::add_bar (end_volta_span_p_ , item);
}
}
+ else if (Staff_symbol::has_interface (i.grob_l_))
+ {
+ /*
+ We only want to know about a single staff: then we add to the
+ support. */
+ if (staff_ != SCM_EOL)
+ staff_ = SCM_UNDEFINED;
+
+ if (staff_ != SCM_UNDEFINED)
+ staff_ = i.grob_l_->self_scm();
+ }
}
void
{
if (end_volta_span_p_)
{
- Side_position_interface::add_staff_support (end_volta_span_p_);
-
typeset_grob (end_volta_span_p_);
end_volta_span_p_ =0;
}
ENTER_DESCRIPTION(Volta_engraver,
/* descr */ "Make volta brackets",
/* creats*/ "VoltaBracket",
-/* acks */ "bar-line-interface note-column-interface",
-/* reads */ "repeatCommands voltaSpannerDuration",
+/* acks */ "bar-line-interface staff-symbol-interface note-column-interface",
+/* reads */ "repeatCommands voltaSpannerDuration stavesFound",
/* write */ "");
\name Score
\consists "Repeat_acknowledge_engraver"
+ \consists "Staff_collecting_engraver"
\consists "Timing_engraver"
\consists "Output_property_engraver"
\consists "System_start_delimiter_engraver"
tupletNumberFormatFunction = #denominator-tuplet-formatter
subdivideBeams = ##f
+ extraNatural = ##t
+ autoAccidentals = #'((measure-same-octave . 0))
+ autoCautionaries = #'()
+
keyAccidentalOrder = #'(
(6 . -1) (2 . -1) (5 . -1 ) (1 . -1) (4 . -1) (0 . -1) (3 . -1)
self.m_geo_x_marginparsep = None
self.__body = None
def set_geo_option(self, name, value):
+
+ if type(value) == type(""):
+ m = re.match ("([0-9.]+)(cm|in|pt|mm|em|ex)",value)
+ if m:
+ unit = m.group (2)
+ num = string.atof(m.group (1))
+ conv = dimension_conversion_dict[m.group(2)]
+
+ value = conv(num)
+
if name == 'body' or name == 'text':
if type(value) == type(""):
self.m_geo_textwidth = value
dimension_conversion_dict ={
'mm': mm2pt,
+ 'cm': lambda x: mm2pt(10*x),
'in': in2pt,
'em': em2pt,
'ex': ex2pt,
idx = idx + 1
continue
m = get_re ('header').match(chunks[idx][1])
- if m.group (1):
+ if m <> None and m.group (1):
options = re.split (',[\n \t]*', m.group(1)[1:-1])
else:
options = []
m = re.match("(\d\d)pt", o)
if m:
paperguru.m_fontsize = int(m.group(1))
-
break
+
while chunks[idx][0] != 'preamble-end':
if chunks[idx] == 'ignore':
idx = idx + 1