+pl 3.hwn2,1
+ - Generic properties and Property_engraver. Moved most of the
+properties.
+
+0.lu1
+ - resurrected midi2ly
+
+0.jcn1
+ - bf: lyrics lexer
+ - reverted mup2ly revert
+
+pl 3.uu1:
+ - frontport of 1.2.17 patches.
+
+**********
+
1.3.0:
pl 15.hwn2
.* TODO
. * make this file understandable for 3rd parties.
. * use Rhythmic_head::position_i () for all Staff_referenced
+. * eradicate all VIRTUAL_COPY_CONS () macros ; use indexed creation,
+ eg.
+
+ ctor_dict["Score_element"]->clone_func (orig);
+ ctor_dict["Score_element"]->create_func ();
+
+
. * note head on stem err msg in dutch.
. * why need to run -C mf twice?
. * fix interstaff stuff
default 5.0 (5.4 is what I was hoping to use), stems miss note heads. So
it's some sort of a numerical (truncation/roundoff) problem.
John
-. * metre -> meter
-. * Fixed size staff heights;
+. * Fixed size staff/system heights;
. * ly2dvi : don't repeat opus if same.
. * breaks before mmrests are favored.
. * hara kiri _8 clef.
C as the root) Cdim7 or Co7.
. * Mondrup:
-
- I would like the possibility of forcing clef- and key- changes to be
printed _after_ the new bar line
--- /dev/null
+\score {
+ \notes \relative c'' \context GrandStaff <
+ \context Staff = up { c4 c4 }
+ \context Staff = down { \property Staff. staffLineLeading = #5.5 c4
+ <c8 d f g>
+ }
+>
+}
--- /dev/null
+
+g''4 \property Voice.stemLength = #14 g4 \property Voice.stemLength = #3 g4 g,,4
*/
SCM grsp = get_property ("graceAccidentalSpace", 0);
- if (SCM_NUMBERP(grsp))
+ if (gh_number_p(grsp))
{
/*
ugh.
if (test_mom.den () != 1)
type_str = type_str + "_" + to_str (test_mom.den ());
+ /*
+ URG
+
+ FIXME: SHOULD USE ALIST
+
+ */
+
/*
Determine end moment for auto beaming (and begin, mostly 0==anywhere)
In order of increasing priority:
beam_p->add_stem ((*stem_l_arr_p_)[i]);
}
- /* urg, copied from Beam_engraver */
- SCM prop = get_property ("beamslopedamping", 0);
- if (SCM_NUMBERP(prop))
- beam_p->set_elt_property (damping_scm_sym, prop);
-
- prop = get_property ("autoKneeGap", 0);
- if (SCM_NUMBERP(prop))
- beam_p->set_elt_property (auto_knee_gap_scm_sym, prop);
-
- prop = get_property ("autoInterstaffKneeGap", 0);
- if (SCM_NUMBERP(prop))
- beam_p->set_elt_property (auto_interstaff_knee_gap_scm_sym, prop);
-
- prop = get_property ("beamquantisation", 0);
- if (SCM_NUMBERP(prop))
- beam_p->quantisation_ = (Beam::Quantisation)(int)prop;
-
- announce_element (Score_element_info (beam_p, 0));
+
return beam_p;
}
{
bar_p_->set_elt_property (at_line_start_scm_sym, SCM_BOOL_T);
}
- prop = get_property ("barSize", 0);
- if (SCM_NUMBERP(prop))
- {
- bar_p_->set_elt_property (bar_size_scm_sym, prop);
- }
announce_element (Score_element_info (bar_p_, 0));
}
}
create_items (0);
text_p_->text_str_ = to_str (time->bars_i_);
- text_p_->style_str_ = "roman";
}
}
*/
void
-Bar_script_engraver::do_acknowledge_element (Item *i)
+Bar_script_engraver::attach_script_to_item (Item *i)
{
Axis other_axis = Axis((axis_ + 1)%2);
if (staff_side_p_ && !staff_side_p_->parent_l(other_axis))
if (inf.origin_trans_l_arr_.size () != 1)
return;
- do_acknowledge_element (i);
+ attach_script_to_item (i);
}
}
staff_side_p_->set_victim(text_p_);
SCM padding = get_property (type_ + "ScriptPadding", 0);
- if (SCM_NUMBERP(padding))
+ if (gh_number_p(padding))
{
staff_side_p_->set_elt_property (padding_scm_sym, padding);
}
/* urg, must copy to Auto_beam_engraver too */
- SCM prop = get_property ("beamslopedamping", 0);
- if (SCM_NUMBERP(prop))
- beam_p_->set_elt_property (damping_scm_sym, prop);
-
- prop = get_property ("autoKneeGap", 0);
- if (SCM_NUMBERP(prop))
- beam_p_->set_elt_property (auto_knee_gap_scm_sym, prop);
-
- prop = get_property ("autoInterstaffKneeGap", 0);
- if (SCM_NUMBERP(prop))
- beam_p_->set_elt_property (auto_interstaff_knee_gap_scm_sym, prop);
-
- prop = get_property ("beamquantisation", 0);
- if (SCM_NUMBERP(prop))
- beam_p_->quantisation_ = (Beam::Quantisation)gh_scm2int(prop);
announce_element (Score_element_info (beam_p_, reqs_drul_[START]));
}
{
slope_f_ = 0;
left_y_ = 0;
- quantisation_ = NORMAL;
multiple_i_ = 0;
}
Direction beam_dir;
Direction neutral_dir = (Direction)(int)paper_l ()->get_var ("stem_default_neutral_direction");
- Dir_algorithm a = (Dir_algorithm)rint(paper_l ()->get_var ("beam_dir_algorithm"));
- switch (a)
+ SCM a = get_elt_property (gh_symbol2scm ("beam_dir_algorithm"));
+ a= gh_cdr (a);
+
+ if (a == gh_symbol2scm ("majority")) // should get default from paper.
+ beam_dir = (count[UP] == count[DOWN]) ? neutral_dir
+ : (count[UP] > count[DOWN]) ? UP : DOWN;
+ else if (a == gh_symbol2scm ("mean"))
+ // mean center distance
+ beam_dir = (total[UP] == total[DOWN]) ? neutral_dir
+ : (total[UP] > total[DOWN]) ? UP : DOWN;
+ else if (a == gh_symbol2scm ("median"))
{
- case MAJORITY:
- beam_dir = (count[UP] == count[DOWN]) ? neutral_dir
- : (count[UP] > count[DOWN]) ? UP : DOWN;
- break;
- case MEAN:
- // mean center distance
- beam_dir = (total[UP] == total[DOWN]) ? neutral_dir
- : (total[UP] > total[DOWN]) ? UP : DOWN;
- break;
- default:
- case MEDIAN:
// median center distance
- if (!count[DOWN] || !count[UP])
- {
- beam_dir = (count[UP] == count[DOWN]) ? neutral_dir
- : (count[UP] > count[DOWN]) ? UP : DOWN;
- }
- else
- {
+ if (count[DOWN] && count[UP])
+ {
beam_dir = (total[UP] / count[UP] == total[DOWN] / count[DOWN])
? neutral_dir
- : (total[UP] / count[UP] > total[DOWN] / count[DOWN]) ? UP : DOWN;
+ : (total[UP] / count[UP] > total[DOWN] / count[DOWN]) ? UP : DOWN;
+ }
+ else
+ {
+ beam_dir = (count[UP] == count[DOWN]) ? neutral_dir
+ : (count[UP] > count[DOWN]) ? UP : DOWN;
}
- break;
}
+
return beam_dir;
}
+ n * interline
*/
- if (quantisation_ <= NONE)
+ SCM q = get_elt_property (gh_symbol2scm ("slope_quantisation"));
+ q = gh_cdr (q);
+
+ if (q == gh_symbol2scm ("none"))
return;
Real interline_f = stems_[0]->staff_line_leading_f ();
Real quanty_f = 0.0;
- /* UGR. ICE in 2.8.1; bugreport filed. */
Array<Real> allowed_fraction (3);
allowed_fraction[0] = 0;
allowed_fraction[1] = (beam_f / 2 + staffline_f / 2);
we only need to quantise the start of the beam as dy is quantised too
if extend_b then stems must *not* get shorter
*/
-
- if (quantisation_ == NONE)
- return;
+ SCM q = get_elt_property (gh_symbol2scm ("slope_quantisation"));
+ q = gh_cdr (q);
/*
----------------------------------------------------------
Real beamdy_f = beamdx_f * slope_f_ * internote_f;
Array<Real> allowed_position;
- if (quantisation_ <= NORMAL)
+ if (q == gh_symbol2scm ("normal"))
{
if ((multiple_i_ <= 2) || (abs (beamdy_f) >= staffline_f / 2))
allowed_position.push (straddle);
allowed_position.push (sit);
allowed_position.push (hang);
}
- else
- // TODO: check and fix TRADITIONAL
+ else if (q == gh_symbol2scm ("traditional"))
{
+ // TODO: check and fix TRADITIONAL
if ((multiple_i_ <= 2) || (abs (beamdy_f) >= staffline_f / 2))
allowed_position.push (straddle);
if ((multiple_i_ <= 1) && (beamdy_f <= staffline_f / 2))
{
dir_ = UP;
set_elt_property (breakable_scm_sym, SCM_BOOL_T);
- set_elt_property (break_priority_scm_sym, gh_int2scm (-4));
set_elt_property (visibility_lambda_scm_sym,
ly_ch_C_eval_scm ("non_postbreak_visibility"));
}
item_p->text_str_ = chord.banter_str (inversion);
- SCM style = get_property ("textStyle", 0);
- if (gh_string_p (style))
- item_p->style_str_ = ly_scm2string (style);
-
text_p_arr_.push (item_p);
announce_element (Score_element_info (item_p, 0));
}
if (!clef_p_)
{
Clef_item *c= new Clef_item;
- c->set_elt_property (break_priority_scm_sym, gh_int2scm (-2)); // ugh
- SCM clefstyle = get_property ("clefStyle", 0);
- if (gh_string_p(clefstyle))
- c->set_elt_property (style_scm_sym, clefstyle);
-
announce_element (Score_element_info (c, clef_req_l_));
clef_p_ = c;
}
pscore_l_->typeset_element (g);
g->text_str_ = "8";
- g->style_str_ = "italic";
+ g->set_elt_property (style_scm_sym, gh_str02scm ("italic"));
g->set_parent (this, Y_AXIS);
g->set_parent (this, X_AXIS);
}
prop = get_property ("dynamicDirection", 0);
- if (SCM_NUMBERP(prop))
+ if (gh_number_p(prop))
{
staff_side_p_->dir_ = to_dir (prop);
}
}
prop = get_property ("dynamicPadding", 0);
- if (SCM_NUMBERP(prop))
+ if (gh_number_p(prop))
{
staff_side_p_->set_elt_property (padding_scm_sym, prop);
}
to_end_ss_span_p_->dir_ = to_dir (prop);
}
prop = get_property ("dynamicPadding", 0);
- if (SCM_NUMBERP(prop))
+ if (gh_number_p(prop))
{
to_end_ss_span_p_->set_elt_property (padding_scm_sym,prop);
}
Font_size_engraver::Font_size_engraver ()
{
- size_i_ = 0;
+ size_ = SCM_EOL;
}
void
{
SCM s (get_property ("fontSize", 0));
- if (SCM_NUMBERP(s))
+ if (gh_number_p(s))
{
- size_i_ = gh_scm2int (s);
+ size_ = gh_scm2int (s);
+ }
+ else
+ {
+ size_ = SCM_EOL;
}
}
void
Font_size_engraver::acknowledge_element (Score_element_info e)
{
- if (size_i_ && e.elem_l_->get_elt_property (fontsize_scm_sym) == SCM_BOOL_F)
+ if (size_ != SCM_EOL
+ && e.elem_l_->get_elt_property (fontsize_scm_sym) == SCM_BOOL_F)
{
- e.elem_l_->set_elt_property (fontsize_scm_sym,
- gh_int2scm (size_i_));
+ e.elem_l_->set_elt_property (fontsize_scm_sym, size_);
}
}
+
ADD_THIS_TRANSLATOR (Font_size_engraver);
/**
Put the script on #it#
*/
- void do_acknowledge_element (Item *it);
+ void attach_script_to_item (Item *it);
/**
Return non-nil if we want to hang something on this.
*/
should beam slope be damped? 0: no, 1: yes, 100000: horizontal beams
+slope_quantisation: 'none, 'normal or 'traditional
*/
class Beam : public Directional_spanner {
/// position of leftmost end of beam
Real left_y_;
- /** should beam pos / slope be quantised? 0: no, 1: yes, 2: traditional
- JUNKME.
- */
- Quantisation quantisation_;
-
+
/// maximum number of beams (for opening-up of beam-spacing)
int multiple_i_;
#define FONT_SIZE_GRAV_HH
#include "engraver.hh"
-
+#include "protected-scm.hh"
/**
Set font size on elements that do not have a fontsize set yet.
Writes element property fontsize
*/
class Font_size_engraver : public Engraver {
- int size_i_;
+ Protected_scm size_;
protected:
virtual void acknowledge_element (Score_element_info);
virtual void do_process_requests ();
#include "lily-proto.hh"
#include "virtual-methods.hh"
#include "dictionary.hh"
+#include "scm-hash.hh"
/**
Definition of how to output mudela.
Scope *scope_p_;
Array<String> filename_str_arr_;
+ Scheme_hash_table default_properties_;
Music_output_def (Music_output_def const&);
Music_output_def ();
Real get_realvar (SCM symbol) const;
Real get_var (String id) const;
- SCM get_scm_var (SCM sym) const;
void reinit ();
Paper_def ();
static scm_sizet free_smob (SCM s); \
static int print_smob (SCM s, SCM p, scm_print_state*); \
static long smob_tag_; \
+ static SCM equal_p (SCM a, SCM b);\
static void init_smobs(); \
void unsmobify_self ();\
void do_smobify_self();\
{
public:
String text_str_;
- String style_str_;
- Text_item ();
VIRTUAL_COPY_CONS (Score_element);
protected:
virtual void do_print () const;
public:
Time_signature () ;
Array<int> args_;
- String time_sig_type_str_;
-
VIRTUAL_COPY_CONS(Score_element);
};
Cons_list<Translator> trans_p_list_;
public:
- SCM get_property (String type_str, Translator_group **where_found_l) const;
+ SCM get_property (SCM name_sym, Translator_group **where_found_l) const;
void set_property (String var_name, SCM value);
+
String id_str_;
ask daddy for a feature
*/
Music_output_def *output_def_l () const;
+
SCM get_property (String, Translator_group **) const;
+ SCM get_property (SCM symbol, Translator_group **) const;
+
virtual Moment now_mom () const;
protected:
SCM
ly_symbol (String name)
{
- return gh_car (scm_intern ((char*)name.ch_C(), name.length_i()));
+ return gh_symbol2scm ((char*)name.ch_C());
}
String
text_p_->text_str_ = req_l_->text_str_;
text_p_->text_str_ += " "; // ugh.
- SCM style = get_property ("textStyle", 0);
- if (gh_string_p(style))
- text_p_->style_str_ = ly_scm2string (style);
-
text_p_->set_elt_property (non_rhythmic_scm_sym, SCM_BOOL_T);
announce_element (Score_element_info (text_p_, req_l_));
{
create_items (mark_req_l_);
text_p_->text_str_ = mark_req_l_->str_;
- text_p_->style_str_ = text_p_->text_str_.index_any_i ("0123456789") >= 0
- ? "mark" : "Large";
+ SCM st = gh_str02scm ((text_p_->text_str_.index_any_i ("0123456789") >= 0 )
+ ? "mark" : "large");
+ text_p_->set_elt_property (style_scm_sym, st);
}
}
}
ADD_SCM_INIT_FUNC(moms,init_moments);
+
+SCM
+Moment::equal_p (SCM a, SCM b)
+{
+ Moment *m1 = SMOB_TO_TYPE(Moment, a);
+ Moment *m2 = SMOB_TO_TYPE(Moment, b);
+
+ return (*m1 == *m2) ? SCM_BOOL_T : SCM_BOOL_F;
+}
}
note_p->position_i_ = note_req_l->pitch_.steps ();
+ /*
+ TODO: transparent note heads.
+ */
+
if (gh_string_p (noteheadstyle))
{
- if (ly_scm2string (noteheadstyle) == "transparent")
- note_p->set_elt_property (transparent_scm_sym, SCM_BOOL_T);
- else
- note_p->set_elt_property (style_scm_sym, noteheadstyle);
+ note_p->set_elt_property (style_scm_sym, noteheadstyle);
}
Score_element_info itinf (note_p,note_req_l);
int transposing_i = 0;
//urg
SCM prop = get_property ("transposing", 0);
- if (SCM_NUMBERP(prop))
+ if (gh_number_p(prop))
transposing_i = gh_scm2int (prop);
while (note_req_l_arr_.size ())
}
}
-SCM
-Paper_def::get_scm_var (SCM s) const
-{
- if (!scope_p_->elem_b (s))
- return SCM_BOOL_F;
-
- Identifier * id = scope_p_->elem (s);
-
- SCM z;
- SCM_NEWCELL (z);
- SCM_SETCAR(z, s);
-
- SCM val;
-
- if (dynamic_cast<Real_identifier*> (id))
- {
- Real r = *id->access_content_Real (false);
- val = gh_double2scm (r);
- }
- else
- {
- return SCM_BOOL_F;
- }
-
- SCM_SETCDR(z,val);
- return z;
-}
Real
Paper_def::get_var (String s) const
$$->set_lookup ($2, l);
}
| paper_def_body assignment semicolon {
-
+
+ }
+ | paper_def_body SCM_T '=' SCM_T {
+ if (!gh_symbol_p ($2))
+ THIS->parser_error ("expect a symbol as lvalue");
+ else
+ $$->default_properties_[$2] = $4;
}
| paper_def_body translator_spec_block {
$$->assign_translator ($2);
--- /dev/null
+/*
+ property-engraver.cc -- implement Property engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "lily-guile.hh"
+#include "engraver.hh"
+#include "protected-scm.hh"
+#include "dictionary.hh"
+#include "score-element.hh"
+
+class Property_engraver : public Engraver
+{
+ Dictionary<Protected_scm> prop_dict_;
+ void apply_properties (SCM, Score_element*);
+
+protected:
+ virtual void acknowledge_element (Score_element_info ei);
+ virtual void do_creation_processing ();
+
+ VIRTUAL_COPY_CONS(Translator);
+};
+
+void
+Property_engraver::do_creation_processing ()
+{
+ SCM plist = get_property ("Generic_property_list", 0);
+ for (; SCM_NIMP (plist); plist = gh_cdr (plist))
+ {
+ SCM elt_props = gh_car (plist);
+ prop_dict_[ly_scm2string (gh_car (elt_props))] = gh_cdr (elt_props);
+ }
+}
+
+void
+Property_engraver::acknowledge_element (Score_element_info i)
+{
+ if (prop_dict_.elem_b (i.elem_l_->name()))
+ {
+ SCM p = prop_dict_[i.elem_l_->name()];
+ apply_properties (p,i.elem_l_);
+ }
+ if (prop_dict_.elem_b ("all"))
+ {
+ apply_properties (prop_dict_["all"], i.elem_l_);
+ }
+}
+
+void
+Property_engraver::apply_properties (SCM p, Score_element *e)
+{
+ for (; SCM_NIMP (p); p = gh_cdr (p))
+ {
+ SCM entry = gh_car (p);
+ SCM prop_sym = gh_car (entry);
+ SCM type_p = gh_cadr (entry);
+ SCM elt_prop_name = gh_caddr (entry);
+
+ if (e->get_elt_property (elt_prop_name) != SCM_BOOL_F)
+ continue;
+
+ SCM val = get_property (prop_sym, 0);
+ if (val != SCM_UNDEFINED
+ && gh_apply (type_p, scm_listify (val, SCM_UNDEFINED))
+ == SCM_BOOL_T)
+ e->set_elt_property (elt_prop_name, val);
+ }
+}
+
+ADD_THIS_TRANSLATOR(Property_engraver);
bool
isdir_b (SCM s)
{
- if (SCM_NUMBERP (s))
+ if (gh_number_p (s))
{
int i = gh_int2scm (s);
return i>= -1 && i <= 1;
dot_p_->dots_i_ = rest_req_l_->duration_.dots_i_;
announce_element (Score_element_info (dot_p_,0));
}
- if (rest_p_->balltype_i_ >= 2)
- {
- SCM reststyle = get_property ("restStyle", 0);
- if (gh_string_p (reststyle))
- rest_p_->set_elt_property (style_scm_sym,reststyle);
- }
+
announce_element (Score_element_info (rest_p_, rest_req_l_));
}
}
String style;
SCM style_sym =get_elt_property (style_scm_sym);
- if (style_sym != SCM_BOOL_F)
+ if (balltype_i_ >= 2 && style_sym != SCM_BOOL_F)
{
style = ly_scm2string (SCM_CDR(style_sym));
}
{
if (ncol_p_)
{
- SCM sh = get_property ("horizontalNoteShift", 0);
- if (SCM_NUMBERP(sh))
- {
- ncol_p_->set_elt_property (horizontal_shift_scm_sym, sh);
- }
-
- sh = get_property ("forceHorizontalShift" ,0);
- if (SCM_NUMBERP(sh))
- {
- ncol_p_->set_elt_property (force_hshift_scm_sym, sh);
- }
-
typeset_element (ncol_p_);
ncol_p_ =0;
}
SCM s = scm_assq(sym, element_property_alist_);
// is this a good idea?
- if (s == SCM_BOOL_F && pscore_l_ && pscore_l_->paper_l_)
- s = pscore_l_->paper_l_->get_scm_var (sym);
+ if (s != SCM_BOOL_F)
+ return s;
- return s;
+ if (pscore_l_)
+ {
+ // should probably check for Type::sym as well.
+ if (pscore_l_->paper_l_->default_properties_.elem_b (sym))
+ return pscore_l_->paper_l_->default_properties_[sym];
+ }
+
+ return SCM_BOOL_F;
}
SCM
}
#include "ly-smobs.icc"
IMPLEMENT_SMOBS(Score_element);
+
+SCM
+Score_element::equal_p (SCM a, SCM b)
+{
+ return SCM_CDR(a) == SCM_CDR(b) ? SCM_BOOL_T : SCM_BOOL_F;
+}
if (item_l->empty_b (X_AXIS) || item_l->parent_l (X_AXIS))
return;
- bool breakable
- = (item_l->remove_elt_property (breakable_scm_sym) != SCM_BOOL_F);
+ SCM bp=item_l->remove_elt_property (breakable_scm_sym);
+ bool breakable = (bp != SCM_BOOL_F);
if (!breakable)
return ;
ss->dir_ = (Direction)force_dir;
SCM dir_prop (get_property ("articulationScriptVerticalDirection", 0));
- if (SCM_NUMBERP(dir_prop))
+ if (gh_number_p(dir_prop))
ss->dir_ = to_dir (dir_prop);
if (l->dir_)
ss->dir_ = l->dir_;
SCM paddingprop = get_property ("articulationScriptPadding", 0);
- if (SCM_NUMBERP(paddingprop))
+ if (gh_number_p(paddingprop))
{
ss->set_elt_property (padding_scm_sym, paddingprop);
}
p->set_staff_side (ss);
ss->set_elt_property (script_priority_scm_sym, priority);
- if (SCM_NUMBERP (paddingprop))
+ if (gh_number_p (paddingprop))
ss->set_elt_property (padding_scm_sym, paddingprop);
Separating_line_group_engraver::do_removal_processing ()
{
SCM sz (get_property ("postBreakPadding", 0));
- if (SCM_NUMBERP(sz))
+ if (gh_number_p(sz))
{
sep_span_p_->padding_f_ = Real(sz);
}
// push a new slur onto stack.
//(use temp. array to wait for all slur STOPs)
Slur * s_p =new Slur;
- SCM prop = get_property ("slurDash", 0);
- if (SCM_NUMBERP(prop))
- s_p->set_elt_property (dashed_scm_sym, prop);
-
requests_arr_.push (slur_req_l);
start_slur_l_arr_.push (s_p);
SCM dir2 (get_property ("verticalDirection", 0));
Direction slurdir = CENTER;
- if (SCM_NUMBERP(dir))
+ if (gh_number_p(dir))
slurdir = to_dir (dir);
else if (gh_number_p (dir2))
slurdir = to_dir (dir2);
Now we've got a fine slur
Catch and correct some ugly cases
*/
-
-
-
String infix = interstaff_b ? "interstaff_" : "";
Real height_damp_f = paper_l ()->get_var ("slur_"+infix +"height_damping");
Real slope_damp_f = paper_l ()->get_var ("slur_"+infix +"slope_damping");
long_name = short_name;
if (gh_string_p (long_name))
- return;
-
- create_items (0);
- text_p_->text_str_ = ly_scm2string (long_name);
- staff_side_p_->dir_ = LEFT;
- Bar_script_engraver::do_acknowledge_element (i);
+ {
+ create_items (0);
+ text_p_->text_str_ = ly_scm2string (long_name);
+ staff_side_p_->dir_ = LEFT;
+ Bar_script_engraver::attach_script_to_item (i);
- /*
+ /*
UGH. ignores font size settings.
*/
- Interval iv(text_p_->extent (Y_AXIS));
- text_p_->translate_axis (- iv.center (), Y_AXIS);
+ Interval iv(text_p_->extent (Y_AXIS));
+ text_p_->translate_axis (- iv.center (), Y_AXIS);
+ }
}
-
Staff_performer::new_instrument_str ()
{
// mustn't ask Score for instrument: it will return piano!
- SCM minstr = get_property ("midiInstrument", 0);
+ SCM minstr = get_property (gh_symbol2scm ("midiInstrument"), 0);
if (!gh_string_p(minstr))
- minstr = get_property ("instrument", 0);
+ minstr = get_property (gh_symbol2scm ("instrument"), 0);
if (ly_scm2string (minstr) == instrument_str_)
return "";
Staff_symbol_engraver::do_removal_processing()
{
SCM l (get_property ("numberOfStaffLines", 0));
- if (SCM_NUMBERP(l))
+ if (gh_number_p(l))
{
span_p_->no_lines_i_ = gh_scm2int (l);
}
SCM sz (get_property ("staffLineLeading", 0));
- if (SCM_NUMBERP(sz))
+ if (gh_number_p(sz))
{
span_p_->staff_line_leading_f_ = gh_scm2double (sz);
}
Stem_engraver::do_creation_processing ()
{
SCM prop = get_property ("abbrev", 0);
- if (SCM_NUMBERP(prop))
+ if (gh_number_p(prop))
{
default_abbrev_i_ = gh_scm2int (prop);
}
if (stem_p_)
{
SCM prop = get_property ("verticalDirection", 0);
- if (SCM_NUMBERP(prop))
+ if (gh_number_p(prop))
{
stem_p_->dir_ = to_dir (prop);
stem_p_->set_elt_property (dir_forced_scm_sym, SCM_BOOL_T);
Translator_group* which;
prop = get_property ("stemLeftBeamCount", &which);
- if (SCM_NUMBERP(prop))
+ if (gh_number_p(prop))
{
stem_p_->beams_i_drul_[LEFT] = gh_scm2int (prop);
((Translator_group*)which)->set_property ("stemLeftBeamCount", SCM_UNDEFINED);
}
prop = get_property ("stemRightBeamCount", &which);
- if (SCM_NUMBERP(prop))
+ if (gh_number_p(prop))
{
stem_p_->beams_i_drul_[RIGHT] = gh_scm2int (prop);
((Translator_group*)which)->set_property ("stemRightBeamCount", SCM_UNDEFINED);
}
-
- prop = get_property ("stemLength", 0);
- if (SCM_NUMBERP(prop))
- {
- stem_p_->set_elt_property (length_scm_sym, prop);
- }
-
- prop = get_property ("stemStyle", 0);
- if (gh_string_p (prop))
- {
- stem_p_->set_elt_property (style_scm_sym, prop);
- }
-
- prop = get_property ("noStemExtend", 0);
- if (gh_boolean_p (prop) && gh_scm2bool (prop))
- {
- stem_p_->set_elt_property (no_stem_extend_scm_sym, prop);
- }
-
typeset_element(stem_p_);
stem_p_ = 0;
}
text->text_str_ = r->text_str_;
- if (r->style_str_.empty_b ())
- {
- SCM p (get_property ("textStyle", 0));
- if (gh_string_p (p))
- text->style_str_ = ly_scm2string(p);
- }
- else
- text->style_str_ = r->style_str_;
+ if (r->style_str_.length_i ())
+ text->set_elt_property (style_scm_sym, ly_ch_C_to_scm (r->style_str_.ch_C()));
- SCM padding = get_property ("textScriptPadding", 0);
- if (SCM_NUMBERP(padding))
- {
- ss->set_elt_property (padding_scm_sym, padding);
- }
-
SCM empty = get_property ("textEmptyDimension", 0);
if (gh_boolean_p (empty) && gh_scm2bool (empty))
{
Molecule*
Text_item::do_brew_molecule_p () const
{
- Molecule a= paper_l ()->lookup_l(0)->text (style_str_,text_str_, paper_l ());
+ SCM style = get_elt_property (style_scm_sym);
+ String st = (style == SCM_BOOL_F) ? "" : ly_scm2string (gh_cdr (style));
+
+ Molecule a= paper_l ()->lookup_l(0)->text (st, text_str_, paper_l ());
return new Molecule (a);
}
-Text_item::Text_item ()
-{
- style_str_ = "roman";
-}
-
void
Text_item::do_print () const
{
SCM dir2 (get_property ("verticalDirection", 0));
Direction tie_dir = CENTER;
- if (SCM_NUMBERP(dir))
+ if (gh_number_p(dir))
tie_dir = to_dir (dir);
else if (isdir_b (dir2))
tie_dir = to_dir (dir2);
{
if (time_signature_p_)
{
- SCM sigstyle = get_property ("timeSignatureStyle", 0);
- if (gh_string_p (sigstyle))
- {
- time_signature_p_->time_sig_type_str_ = ly_scm2string (sigstyle);
- }
typeset_element (time_signature_p_);
time_signature_p_ =0;
Molecule*
Time_signature::do_brew_molecule_p () const
{
- if (time_sig_type_str_.length_i ())
+ SCM st = get_elt_property (style_scm_sym);
+
+ if (st != SCM_BOOL_F)
{
- if (time_sig_type_str_[0]=='1')
+ String style (ly_scm2string (gh_cdr (st)));
+ if (style[0]=='1')
{
Array<int> tmparr = args_;
return new Molecule( lookup_l ()->time_signature (args_[0], 0, paper_l ()));
}
else
{
- return new Molecule( lookup_l ()-> special_time_signature (time_sig_type_str_ ,args_[0], args_[1], paper_l ()));
+ return new Molecule( lookup_l ()-> special_time_signature (style, args_[0], args_[1], paper_l ()));
}
}
else
Translator_group * tr=0;
SCM barn = get_property ("currentBarNumber", &tr);
- if (SCM_NUMBERP(barn))
+ if (gh_number_p(barn))
{
time_.bars_i_ = gh_scm2int (barn);
tr->set_property ("currentBarNumber", SCM_UNDEFINED);
}
SCM
-Translator_group::get_property (String id,
- Translator_group **where_l) const
+Translator_group::get_property (SCM sym, Translator_group **where_l) const
{
- SCM sym = ly_symbol (id);
if (properties_dict_.elem_b (sym))
{
if (where_l)
}
if (daddy_trans_l_)
- return daddy_trans_l_->get_property (id, where_l);
+ return daddy_trans_l_->get_property (sym, where_l);
if (where_l)
*where_l = 0;
SCM
Translator::get_property (String id, Translator_group **where_l) const
{
- return daddy_trans_l_->get_property (id, where_l);
+ return daddy_trans_l_->get_property (ly_symbol (id), where_l);
+}
+
+SCM
+Translator::get_property (SCM sym,
+ Translator_group **where_l) const
+{
+ return daddy_trans_l_->get_property (sym, where_l);
}
dir = to_dir (prop);
int visibility = 3;
prop = get_property ("tupletVisibility", 0);
- if (SCM_NUMBERP(prop))
+ if (gh_number_p(prop))
visibility = gh_scm2int (prop); // bool ?
for (int i= started_span_p_arr_.size ();
Vertical_align_engraver::do_removal_processing()
{
SCM dist (get_property ("maxVerticalAlign", 0));
- if (SCM_NUMBERP(dist))
+ if (gh_number_p(dist))
{
valign_p_->threshold_interval_[BIGGER] = gh_scm2double (dist);
}
dist = get_property ("minVerticalAlign", 0);
- if (SCM_NUMBERP(dist))
+ if (gh_number_p(dist))
{
valign_p_->threshold_interval_[SMALLER] = gh_scm2double (dist);
}
breve = \duration { -1 0 }
longa = \duration { -2 0 }
+#(eval-string (ly-gulp-file "generic-property.scm"))
+
\include "nederlands.ly" % dutch
\include "chord-modifiers.ly"
\include "script.ly"
StaffContext=\translator {
\type "Engraver_group_engraver";
\name Staff ;
+
barAuto = ##t
voltaVisibility = ##t
-
+ Generic_property_list = #generic-staff-properties
+ \consists "Property_engraver";
+
\consists "Multi_measure_rest_engraver";
\consists "Bar_engraver";
% Bar_engraver must be first so default bars aren't overwritten
RhythmicStaffContext=\translator{
\type "Engraver_group_engraver";
numberOfStaffLines = #1
+ \consists "Property_engraver";
+
+ Generic_property_list = #generic-staff-properties
barSize = \staffheight;
\consists "Pitch_squash_engraver";
};
\translator{\RhythmicStaffContext}
VoiceContext = \translator {
+
\type "Engraver_group_engraver";
dynamicPadding = #5.0
+ Generic_property_list = #generic-voice-properties
+
+
\consists "Dynamic_engraver"; % must come before text_engraver.
\name Voice ;
-
-% \consists "Tie_engraver";
+ \consists "Property_engraver";
+
\consists "Breathing_sign_engraver";
\consists "Rest_engraver";
\consists "Dot_column_engraver";
\consists "Auto_beam_engraver";
\include "auto-beam-settings.ly";
\consists "Chord_tremolo_engraver";
-% \consists "Multi_measure_rest_engraver";
- % ugh. Order matters here.
\consists "Melisma_engraver";
textScriptPadding = #3.0
\consists "Text_engraver";
GraceContext=\translator {
\type "Grace_engraver_group";
\name "Grace";
+
+ Generic_property_list = #generic-grace-properties
+
\consists "Note_heads_engraver";
\consists "Local_key_engraver";
\consists "Stem_engraver";
\consists "Auto_beam_engraver";
\include "auto-beam-settings.ly";
\consists "Align_note_column_engraver";
- \consists "Font_size_engraver";
+
\consists "Rhythmic_column_engraver";
\consists "Dynamic_engraver";
+ \consists "Property_engraver";
+
stemStyle = #"grace"
weAreGraceContext = ##t
fontSize = #-1
+
stemLength = #6.0
verticalDirection = \up ;
graceAccidentalSpace= 1.5 * \interline;
ThreadContext = \translator{
\type Engraver_group_engraver;
- \consists "Note_heads_engraver" ;
+ \consists "Note_heads_engraver" ;
+ Generic_property_list = #generic-thread-properties
+ \consists "Property_engraver";
\name Thread;
};
\accepts "GrandStaff";
\accepts "ChoirStaff";
\accepts "PianoStaff";
+
+ clefBreakPriority = #-2
+ breathingSignBreakPriority = #-4
};
\translator { \ScoreContext }
MEAN = 3.0;
MEDIAN = 4.0;
+#'beam_dir_algorithm = #'majority
+#'slope_quantisation = #'normal
+
+
%{
dit(code(beam_dir_algorithm)) Specify algorithm for determining
whether beams go up or down. It is real valued. If set to 2.0 then
--- /dev/null
+
+(define generic-beam-properties
+ (cons "Beam"
+ (list
+ (list 'beamslopedamping number? 'damping)
+ (list 'autoKneeGap number? 'auto_knee_gap)
+ (list 'autoInterstaffKneeGap number? 'auto_interstaff_knee_gap)
+ (list 'beamQuantisation symbol? 'slope_quantisation)
+ (list 'beamDirAlgorithm symbol? 'beam_dir_algorithm)
+ )
+ )
+ )
+
+
+(define generic-stem-properties
+ (cons "Stem"
+ (list
+ (list 'stemLength number? 'length)
+ (list 'stemStyle string? 'style)
+ (list 'noStemExtend boolean? 'no_stem_extend)
+ ))
+ )
+
+(define generic-text-properties
+ (cons "Text_item" (list
+ (list 'textStyle string? 'style)
+ (list 'textScriptPadding number? 'padding)
+ )
+ ))
+
+(define generic-bar-properties
+ (cons "Staff_bar" (list
+ (list 'barSize number? 'bar_size))
+ )
+ )
+(define generic-breathing-sign-properties
+ (cons "Breathing_sign"
+ (list
+ (list 'breathingSignBreakPriority number? 'break_priority
+ ))))
+
+(define generic-clef-properties
+ (cons "Clef_item"
+ (list
+ (list 'clefBreakPriority number? 'break_priority)
+ (list 'clefStyle string? 'style))
+ )
+ )
+
+(define generic-All-properties
+ (cons "all" (list (list 'fontSize number? 'fontsize))))
+
+(define generic-rest-properties
+ (cons "Rest" (list (list 'restStyle string? 'reststyle))))
+
+(define generic-note-column-properties
+ (cons "Note_column"
+ (list
+ (list 'horizontalNoteShift number? 'horizontal_shift)
+ (list 'forceHorizontalShift number? 'force_hshift)
+ )))
+
+(define generic-slur-properties
+ (cons "Slur"
+ (list
+ (list 'slurDash number? 'dashed))))
+
+(define generic-timesig-properties
+ (cons "Time_signature"
+ (list
+ (list 'timeSignatureStyle string? 'sigstyle))))
+
+(define generic-voice-properties
+ (list
+ generic-stem-properties
+ generic-rest-properties
+ generic-slur-properties
+ generic-beam-properties
+ generic-text-properties
+ generic-note-column-properties
+ generic-All-properties
+ ))
+
+(define generic-grace-properties generic-voice-properties)
+(define generic-staff-properties
+ (list
+ generic-bar-properties
+ generic-timesig-properties
+ generic-clef-properties
+ generic-All-properties
+ )
+ )
+
+(define generic-thread-properties
+ (list generic-All-properties))
+