+2002-08-08 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ * scm/grob-description.scm (all-grob-descriptions): set
+ X-offset-callbacks for TextScript
+
+ * lily/stem.cc (invisible_b): don't use support_head(), since it
+ sets stem direction.
+
+ * lily/beam.cc (struct Int_set): don't get stuck inserting
+ interval segments of length 0.0.
+
+ * scripts/convert-ly.py: break-align conversion.
+
+2002-08-06 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ * lily/*.cc (process_music): gh_int2scm -> scm_int2num
+
2002-08-06 Heikki Junes <hjunes@cc.hut.fi>
* lilypond-mode.el: Also "C-xC-s" sets default command to LilyPond.
@code{geometry}.
@item latexoptions
- Specify additional options for the La@TeX{} @code{\documentclass}. You can put any valid value here. This was designed to allow ly2dvi to produce output for double-sided paper, with balanced margins and pagenumbers on alternating sides. To achieve this specify @code{twoside}
+ Specify additional options for the La@TeX{}
+@code{\documentclass}. You can put any valid value here. This was
+designed to allow ly2dvi to produce output for double-sided paper,
+with balanced margins and pagenumbers on alternating sides. To achieve
+this specify @code{twoside}
@item orientation
Set orientation. Choices are @code{portrait} or @code{landscape}. Is
the @code{\paper} block.
@item pagenumber
- If set to @code{no}, no page numbers will be printed.
-
+ If set to @code{no}, no page numbers will be printed. If set to a
+positive integer, start with this value as the first page number.
@item fontenc
{
/* Blunt axe method: every grob gets a propertysetting. */
- i.grob_->set_grob_property ("direction", gh_int2scm (d));
+ i.grob_->set_grob_property ("direction", scm_int2num (d));
}
}
if (state_ == UNIRHYTHM
&& unisilence != SCM_BOOL_T)
{
- i.grob_->set_grob_property ("staff-position", gh_int2scm (d * 6));
+ i.grob_->set_grob_property ("staff-position", scm_int2num (d * 6));
}
}
SCM prev;
if (ignore_octave_b)
- prev = ly_assoc_cdr (gh_int2scm (n), sig);
+ prev = ly_assoc_cdr (scm_int2num (n), sig);
else
- prev = gh_assoc (gh_cons (gh_int2scm (o), gh_int2scm (n)), sig);
+ prev = gh_assoc (gh_cons (scm_int2num (o), scm_int2num (n)), sig);
/* should really be true unless prev == SCM_BOOL_F */
if (gh_pair_p (prev) && gh_pair_p (ly_cdr (prev)))
/* If an accidental was not found or the accidental was too old */
if (prev == SCM_BOOL_F ||
(gh_number_p (lazyness) && curbarnum_i > accbarnum_i + gh_scm2int (lazyness)))
- prev = gh_assoc (gh_int2scm (n), sig);
+ prev = gh_assoc (scm_int2num (n), sig);
- SCM prev_acc = (prev == SCM_BOOL_F) ? gh_int2scm (0) : ly_cdr (prev);
+ SCM prev_acc = (prev == SCM_BOOL_F) ? scm_int2num (0) : ly_cdr (prev);
int p = gh_number_p (prev_acc) ? gh_scm2int (prev_acc) : 0;
announce_grob (a, SCM_EOL);
- SCM accs = gh_cons (gh_int2scm (pitch->alteration_), SCM_EOL);
+ SCM accs = gh_cons (scm_int2num (pitch->alteration_), SCM_EOL);
if (num == 2 && extra_natural_b)
- accs = gh_cons (gh_int2scm (0), accs);
+ accs = gh_cons (scm_int2num (0), accs);
/* TODO:
int n = pitch->notename_;
int o = pitch->octave_;
int a = pitch->alteration_;
- SCM on_s = gh_cons (gh_int2scm (o), gh_int2scm (n));
+ SCM on_s = gh_cons (scm_int2num (o), scm_int2num (n));
/*
TODO: Speed this up!
noteheads with the same notename.
*/
localsig = ly_assoc_front_x
- (localsig, on_s, gh_cons (gh_int2scm (a), barnum));
+ (localsig, on_s, gh_cons (scm_int2num (a), barnum));
}
origin->set_property ("localKeySignature", localsig);
origin = origin->daddy_trans_;
position_accidentals (par);
}
- return gh_int2scm (0);
+ return scm_int2num (0);
}
int n = p->notename_;
SCM accs = me->get_grob_property ("accidental-grobs");
- SCM key = gh_int2scm (n);
+ SCM key = scm_int2num (n);
SCM entry = scm_assq (key, accs);
if (entry == SCM_BOOL_F)
{
SCM ac = Font_interface::font_alist_chain (me);
ac = gh_cons (gh_cons (gh_cons
(ly_symbol2scm ("font-relative-size"),
- gh_int2scm (-1)), SCM_EOL),
+ scm_int2num (-1)), SCM_EOL),
ac);
fm = Font_interface::get_font (me, ac);
}
}
SCM at = (scm_list_n (ly_symbol2scm ("char"),
- gh_int2scm (cm->code),
+ scm_int2num (cm->code),
SCM_UNDEFINED));
// at= fontify_atom ((Font_metric*)this, at);
SCM prev;
if (ignore_octave_b)
- prev = ly_assoc_cdr (gh_int2scm (notename), key_signature);
+ prev = ly_assoc_cdr (scm_int2num (notename), key_signature);
else
- prev = gh_assoc (gh_cons (gh_int2scm (octave), gh_int2scm (notename)),
+ prev = gh_assoc (gh_cons (scm_int2num (octave), scm_int2num (notename)),
key_signature);
/* should really be true unless prev == SCM_BOOL_F */
/* If an accidental was not found */
if (prev == SCM_BOOL_F)
- prev = gh_assoc (gh_int2scm (notename), key_signature);
+ prev = gh_assoc (scm_int2num (notename), key_signature);
- SCM prev_acc = (prev == SCM_BOOL_F) ? gh_int2scm (0) : ly_cdr (prev);
+ SCM prev_acc = (prev == SCM_BOOL_F) ? scm_int2num (0) : ly_cdr (prev);
int sig_alteration = gh_number_p (prev_acc) ? gh_scm2int (prev_acc) : 0;
if (alteration == sig_alteration) // no accidental at all needed
Moment one_beat = *unsmob_moment (get_property ("beatLength"));
int num = int ((*unsmob_moment (get_property ("measureLength")) / one_beat).main_part_);
int den = one_beat.den ();
- SCM time = scm_list_n (gh_int2scm (num), gh_int2scm (den), SCM_UNDEFINED);
+ SCM time = scm_list_n (scm_int2num (num), scm_int2num (den), SCM_UNDEFINED);
- SCM type = scm_list_n (gh_int2scm (test_mom.num ()),
- gh_int2scm (test_mom.den ()), SCM_UNDEFINED);
+ SCM type = scm_list_n (scm_int2num (test_mom.num ()),
+ scm_int2num (test_mom.den ()), SCM_UNDEFINED);
SCM settings = get_property ("autoBeamSettings");
void
Axis_group_interface::set_axes (Grob*me,Axis a1, Axis a2)
{
- SCM sa1= gh_int2scm (a1);
- SCM sa2 = gh_int2scm (a2);
+ SCM sa1= scm_int2num (a1);
+ SCM sa2 = scm_int2num (a2);
SCM axes = me->get_grob_property ("axes");
if (gh_string_p (g) && bsd)
{
SCM proc = me->get_grob_property ("break-glyph-function");
- g = gh_call2 (proc, g, gh_int2scm (bsd));
+ g = gh_call2 (proc, g, scm_int2num (bsd));
}
return gh_double2scm ((Staff_symbol_referencer::line_count (me) -1) * ss);
}
else
- return gh_int2scm (0);
+ return scm_int2num (0);
}
}
stem->set_grob_property ("duration-log",
- gh_int2scm (durlog));
+ scm_int2num (durlog));
Moment stem_location = now - beam_start_mom_ + beam_start_location_;
beam_info_->add_stem (stem_location,
(durlog- 2) >? 0);
// debug quanting
me->set_grob_property ("quant-score",
gh_double2scm (qscores[best_idx].demerits));
- me->set_grob_property ("best-idx", gh_int2scm (best_idx));
+ me->set_grob_property ("best-idx", scm_int2num (best_idx));
#endif
return SCM_UNSPECIFIED;
Beam::get_beam_translation (Grob *me)
{
SCM func = me->get_grob_property ("space-function");
- SCM s = gh_call2 (func, me->self_scm (), gh_int2scm (get_beam_count (me)));
+ SCM s = gh_call2 (func, me->self_scm (), scm_int2num (get_beam_count (me)));
return gh_scm2double (s);
}
for ( SCM s = gh_car (right_beaming); gh_pair_p (s); s = gh_cdr (s))
{
int k = - right_dir * gh_scm2int (gh_car (s)) + i;
- if (scm_memq (gh_int2scm (k), left_beaming) != SCM_BOOL_F)
+ if (scm_memq (scm_int2num (k), left_beaming) != SCM_BOOL_F)
count ++;
}
start_point - this_dir * gh_scm2int (gh_car (s));
new_slice.add_point (new_beam_pos);
- gh_set_car_x (s, gh_int2scm (new_beam_pos));
+ gh_set_car_x (s, scm_int2num (new_beam_pos));
}
for (; gh_pair_p (s); s = gh_cdr (s))
{
int np = - this_dir * gh_scm2int (gh_car(s));
- gh_set_car_x (s, gh_int2scm (np));
+ gh_set_car_x (s, scm_int2num (np));
last_int.add_point (np);
}
}
int t = Stem::duration_log (st);
SCM proc = me->get_grob_property ("flag-width-function");
- SCM result = gh_call1 (proc, gh_int2scm (t));
+ SCM result = gh_call1 (proc, scm_int2num (t));
nw_f = gh_scm2double (result);
}
count[UP] = count[DOWN] = 0;
Direction d = DOWN;
- Link_array<Item> stems=
- Pointer_group_interface__extract_grobs (me, (Item*)0, "stems");
+ Link_array<Grob> stems=
+ Pointer_group_interface__extract_grobs (me, (Grob*)0, "stems");
for (int i=0; i <stems.size (); i++)
do {
SCM func = me->get_grob_property ("dir-function");
SCM s = gh_call2 (func,
- gh_cons (gh_int2scm (count[UP]),
- gh_int2scm (count[DOWN])),
- gh_cons (gh_int2scm (total[UP]),
- gh_int2scm (total[DOWN])));
+ gh_cons (scm_int2num (count[UP]),
+ scm_int2num (count[DOWN])),
+ gh_cons (scm_int2num (total[UP]),
+ scm_int2num (total[DOWN])));
if (gh_number_p (s) && gh_scm2int (s))
return to_dir (s);
void
Beam::set_stem_directions (Grob *me, Direction d)
{
- Link_array<Item> stems
- =Pointer_group_interface__extract_grobs (me, (Item*) 0, "stems");
+ Link_array<Grob> stems
+ =Pointer_group_interface__extract_grobs (me, (Grob*) 0, "stems");
for (int i=0; i <stems.size (); i++)
{
before[RIGHT] = s[LEFT];
after[LEFT] = s[RIGHT];
- if (!before.empty_b())
+ if (before.empty_b() && before.length () > 0.0)
{
allowed_regions_.insert (before, i);
i++;
}
allowed_regions_.del (i);
- if (!after.empty_b ())
+ if (!after.empty_b () && after.length () > 0.0)
{
allowed_regions_.insert (after, i);
i++;
Direction d = (hps.center () < max_gap.center()) ?
UP : DOWN ;
- stem->set_grob_property ("direction", gh_int2scm (d));
+ stem->set_grob_property ("direction", scm_int2num (d));
/*
UGH. Check why we still need dir-forced; I think we can
Real staff_space = Staff_symbol_referencer::staff_space (me);
SCM shorten_elt = scm_list_ref (shorten,
- gh_int2scm (beam_count <? (sz - 1)));
+ scm_int2num (beam_count <? (sz - 1)));
Real shorten_f = gh_scm2double (shorten_elt) * staff_space;
/* your similar cute comment here */
Direction bsd = item->break_status_dir ();
if (bsd == LEFT)
{
- me->set_grob_property ("self-alignment-X", gh_int2scm (RIGHT));
+ me->set_grob_property ("self-alignment-X", scm_int2num (RIGHT));
}
/*
for (int i =0 ; i< l ; i++)
{
- SCM si = gh_int2scm (i);
+ SCM si = scm_int2num (i);
scm_vector_set_x (nv, si, do_break_substitution (scm_vector_ref (src, si)));
}
}
stem_tremolo_ = new Item (get_property ("StemTremolo"));
announce_grob(stem_tremolo_, repeat_->self_scm());
stem_tremolo_->set_grob_property ("flag-count",
- gh_int2scm (flags_));
+ scm_int2num (flags_));
}
}
while (i < 0)
i += 7;
i++;
- return gh_int2scm (i);
+ return scm_int2num (i);
}
/*
{
int third = (unsmob_pitch (last)->notename_
- unsmob_pitch (tonic)-> notename_ + 7) % 7;
- last = ly_pitch_transpose (last, scm_vector_ref (thirds, gh_int2scm (third)));
+ last = ly_pitch_transpose (last, scm_vector_ref (thirds, scm_int2num (third)));
}
if (step > gh_scm2int (step_scm (tonic, last)))
int third = (unsmob_pitch (last)->notename_
- unsmob_pitch (tonic)->notename_ + 7) % 7;
last = ly_pitch_transpose (last, scm_vector_ref (thirds,
- gh_int2scm (third)));
+ scm_int2num (third)));
}
}
else
}
}
- return lower_step (tonic, missing, gh_int2scm (7));
+ return lower_step (tonic, missing, scm_int2num (7));
}
/* Return PITCHES with PITCH added not as lowest note */
}
}
add = transpose_pitches (tonic, add);
- add = lower_step (tonic, add, gh_int2scm (7));
+ add = lower_step (tonic, add, scm_int2num (7));
add = scm_sort_list (add, Pitch::less_p_proc);
add = ly_unique (add);
sub = transpose_pitches (tonic, sub);
- sub = lower_step (tonic, sub, gh_int2scm (7));
+ sub = lower_step (tonic, sub, scm_int2num (7));
sub = scm_sort_list (sub, Pitch::less_p_proc);
/* default chord includes upto 5: <1, 3, 5> */
tmp = ly_snoc (fifth, tmp);
else if (dim_b)
{
- add = lower_step (tonic, add, gh_int2scm (5));
- add = lower_step (tonic, add, gh_int2scm (7));
+ add = lower_step (tonic, add, scm_int2num (5));
+ add = lower_step (tonic, add, scm_int2num (7));
}
/* find missing thirds */
/* if dim modifier is given: lower all missing */
if (dim_b)
- missing = lower_step (tonic, missing, gh_int2scm (0));
+ missing = lower_step (tonic, missing, scm_int2num (0));
/* if additions include any 3, don't add third */
SCM third = ly_cadr (base_pitches (tonic));
g->set_parent (clef_, Y_AXIS);
g->set_parent (clef_, X_AXIS);
- g->set_grob_property ("direction", gh_int2scm (sign (gh_scm2int (oct))));
+ g->set_grob_property ("direction", scm_int2num (sign (gh_scm2int (oct))));
octavate_ = g;
announce_grob(octavate_, SCM_EOL);
}
orig.transpose (p);
- SCM key = gh_cons (gh_int2scm (orig.get_octave ()),
- gh_int2scm (orig.notename_));
+ SCM key = gh_cons (scm_int2num (orig.get_octave ()),
+ scm_int2num (orig.notename_));
- newlist = gh_cons (gh_cons (key, gh_int2scm (orig.alteration_)),
+ newlist = gh_cons (gh_cons (key, scm_int2num (orig.alteration_)),
newlist);
}
else if (gh_number_p (key))
Pitch orig (0, gh_scm2int (key), gh_scm2int (alter));
orig.transpose (p);
- key =gh_int2scm (orig.notename_);
- alter = gh_int2scm (orig.alteration_);
+ key =scm_int2num (orig.notename_);
+ alter = scm_int2num (orig.alteration_);
newlist = gh_cons (gh_cons (key, alter), newlist);
}
}
/*
Note head that determines hshift for upstems
- */
+
+ WARNING: triggers direction
+*/
Grob*
Stem::support_head (Grob*me)
{
/*
The note head which forms one end of the stem.
- */
+
+ WARNING: triggers direction
+*/
Grob*
Stem::first_head (Grob*me)
{
bool
Stem::invisible_b (Grob*me)
{
- return ! (head_count (me) && Note_head::get_balltype (support_head (me)) >= 1);
+ return ! (head_count (me)
+ && gh_scm2int (me->get_grob_property ("duration-log")) >= 1);
}
Direction
. (
(X-extent-callback . ,Axis_group_interface::group_extent_callback)
(left-padding . 0.3)
- (right-padding . 0.3)
+
+ ;; this is quite small, but it is very ugly to have
+ ;; accs closer to the previous note than to the next one.
+ (right-padding . 0.15)
(meta . ((interfaces . (item-interface accidental-placement-interface))))
))
. (
(molecule-callback . ,Text_item::brew_molecule)
(no-spacing-rods . #t)
+ (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
(direction . -1)
(padding . 0.5)
(script-priority . 200)
conversions.append (((1,5,62), conv,
'visibility-lambda -> break-visibility'))
+
+if 1:
+ def conv (str):
+ if re.search (r'\addlyrics',str) \
+ and re.search ('automaticMelismata', str) == None:
+ sys.stderr.write ('automaticMelismata is turned on by default since 1.5.67. Please fix this by hand.')
+ raise FatalConversionError()
+ return str
+
+ conversions.append (((1,5,67), conv,
+ 'automaticMelismata turned on by default'))
+
if 1:
def conv (str):
str = re.sub ('ly-set-grob-property', 'ly-set-grob-property!', str)
conversions.append (((1,5,68), conv, 'ly-set-X-property -> ly-set-X-property!'))
+if 1:
+ def conv (str):
+ break_dict = {
+ "Instrument_name": "instrument-name",
+ "Left_edge_item": "left-edge",
+ "Span_bar": "span-bar",
+ "Breathing_sign": "breathing-sign",
+ "Staff_bar": "staff-bar",
+ "Clef_item": "clef",
+ "Key_item": "key-signature",
+ "Time_signature": "time-signature",
+ "Custos": "custos"
+ }
+ def func(match):
+ props = m.group (1)
+ for (k,v) in break_dict.items():
+ props = re.sub (k, v, props)
+
+
+ return "breakAlignOrder = #'( %s )" % props
+ str = re.sub (r"breakAlignOrder *= *#'\(([a-z_A-Z ]+)\)", func, str)
+ return str
+
+ # 40 ?
+ conversions.append (((1,5,40), conv, 'breakAlignOrder property names'))
+
################################
# END OF CONVERSIONS
#what a name.
def set_setting (dict, key, val):
try:
- val = string.atof (val)
+ val = string.atoi (val)
except ValueError:
#warning (_ ("invalid value: %s") % `val`)
pass
+ if type(val) == type ('hoi'):
+ try:
+ val = string.atof (val)
+ except ValueError:
+ #warning (_ ("invalid value: %s") % `val`)
+ pass
+
try:
dict[key].append (val)
except KeyError:
'''
if extra['pagenumber'] and extra['pagenumber'][-1] and extra['pagenumber'][-1] != 'no':
- s = s + '\setcounter{page}{%s}\n' % (extra['pagenumber'][-1])
+ s = s + '\setcounter{page}{%d}\n' % (extra['pagenumber'][-1])
s = s + '\\pagestyle{plain}\n'
else:
s = s + '\\pagestyle{empty}\n'