#include <iostream.h>
// mmm
-#define MUDELA_VERSION "0.1.8"
+#define MUDELA_VERSION "0.1.9"
#include "scalar.hh"
#include "translation-property.hh"
%token E_EXCLAMATION E_SMALLER E_BIGGER E_CHAR
%type <i> dots
-%token <i> INT
+%token <i> DIGIT
%token <melreq> NOTENAME_ID
%token <id> DURATION_IDENTIFIER
%token <id> IDENTIFIER
%token <real> REAL
%token <string> DURATION RESTNAME
%token <string> STRING
+%token <i> UNSIGNED
%token <i> POST_QUOTES
%token <i> PRE_QUOTES
%type <i> open_plet_parens close_plet_parens
%type <music> simple_element music_elt full_element lyrics_elt command_elt
%type <i> abbrev_type
-%type <i> int
+%type <i> int unsigned
%type <i> script_dir
%type <id> identifier_init
%type <duration> explicit_steno_duration notemode_duration
%type <real> dim real
%type <real> unit
%type <request> abbrev_command_req
-%type <request> post_request command_req verbose_command_req
+%type <request> post_request structured_post_request
+%type <request> command_req verbose_command_req
%type <request> script_req dynamic_req
%type <score> score_block score_body
%type <intarr> shape_array
%type <script> script_definition script_body mudela_script gen_script_def
-%type <textdef> text_def
+%type <textdef> text_def finger
%type <string> script_abbreviation
%type <symbol> symboldef
%type <symtable> symtable symtable_body
$4->set_spot (THIS->pop_spot ());
}
;
+
identifier_init:
score_block {
$$ = new Score_id ($1, SCORE_IDENTIFIER);
}
| int {
$$ = new Int_id (new int ($1), INT_IDENTIFIER);
-
}
| post_request {
$$ = new Request_id ($1, POST_REQUEST_IDENTIFIER);
-
}
| melodic_request {
$$ = new Request_id ($1, MELODIC_REQUEST_IDENTIFIER);
;
tempo_request:
- TEMPO entered_notemode_duration '=' int {
+ TEMPO entered_notemode_duration '=' unsigned {
$$ = new Tempo_req;
$$->dur_ = *$2;
delete $2;
Chord:
'<' Chord_body '>' { $$ = $2; }
- | MULTI INT Chord {
+ | MULTI unsigned Chord {
$$ = $3;
$$->multi_level_i_=$2;
}
$$ = new Bar_req (*$2);
delete $2;
}
- | METER int '/' int {
+ | METER unsigned '/' unsigned {
Meter_change_req *m = new Meter_change_req;
m->set ($2,$4);
$$ = m;
| tempo_request {
$$ = $1;
}
- | CADENZA int {
+ | CADENZA unsigned {
$$ = new Cadenza_req ($2);
}
| PARTIAL duration_length {
{
assert (THIS->post_reqs.empty ());
}
- | post_requests post_request {
+ | post_requests structured_post_request {
$2->set_spot (THIS->here_input ());
THIS->post_reqs.push ($2);
}
}
;
+structured_post_request:
+ script_req
+ | post_request
+ ;
post_request:
POST_REQUEST_IDENTIFIER {
$$ = (Request*)$1->request ();
}
- | script_req
- | dynamic_req
+ | dynamic_req {
+ $$ = $1;
+ }
| abbrev_type {
Abbreviation_req* a = new Abbreviation_req;
a->type_i_ = $1;
;
explicit_duration:
- DURATION '{' int int '}' {
+ DURATION '{' int unsigned '}' {
$$ = new Duration;
$$-> durlog_i_ = $3;
$$-> dots_i_ = $4;
;
dynamic_req:
- ABSDYNAMIC '{' int '}' {
+ ABSDYNAMIC '{' unsigned '}' {
Absolute_dynamic_req *ad_p = new Absolute_dynamic_req;
ad_p ->loudness_ = (Dynamic_req::Loudness)$3;
$$ =ad_p;
;
close_plet_parens:
- ']' INT '/' INT {
+ ']' unsigned '/' unsigned {
$$ = MAEBTELP;
THIS->plet_.type_i_ = $4;
THIS->plet_.iso_i_ = $2;
THIS->default_duration_.plet_.iso_i_ = 1;
THIS->default_duration_.plet_.type_i_ = 1;
}
- | TELP INT '/' INT {
+ | TELP unsigned '/' unsigned {
$$ = TELP;
THIS->plet_.type_i_ = $4;
THIS->plet_.iso_i_ = $2;
;
open_abbrev_parens:
- '[' ':' INT {
+ '[' ':' unsigned {
$$ = '[';
if (!Duration::duration_type_b ($3))
- THIS->parser_error ("Not a duration");
+ THIS->parser_error ("1:Not a duration");
else if ($3 < 8)
THIS->parser_error ("Can't abbreviate");
else
;
open_plet_parens:
- '[' INT '/' INT {
+ '[' unsigned '/' unsigned {
$$ = BEAMPLET;
THIS->plet_.type_i_ = $4;
THIS->plet_.iso_i_ = $2;
THIS->default_duration_.plet_.type_i_ = $4;
THIS->default_duration_.plet_.iso_i_ = $2;
}
- | PLET INT '/' INT {
+ | PLET unsigned '/' unsigned {
$$ = PLET;
THIS->plet_.type_i_ = $4;
THIS->plet_.iso_i_ = $2;
;
script_req:
- script_dir gen_script_def {
+ script_dir gen_script_def {
Musical_script_req *m = new Musical_script_req;
$$ = m;
- m-> scriptdef_p_ = $2;
- m-> set_spot (THIS->here_input ());
- m-> dir_ = $1;
+ m->scriptdef_p_ = $2;
+ m->set_spot (THIS->here_input ());
+ if (!m->dir_)
+ m->dir_ = $1;
}
;
gen_script_def:
- text_def { $$ = $1;
+ text_def {
+ $$ = $1;
((Text_def*) $$)->align_i_ = CENTER; /* UGH */
}
- | mudela_script { $$ = $1;
+ | mudela_script {
+ $$ = $1;
$$-> set_spot (THIS->here_input ());
}
+ | finger {
+ $$ = $1;
+ ((Text_def*)$$)->align_i_ = CENTER;
+ }
;
text_def:
}
;
+finger:
+ DIGIT {
+ Text_def* t = new Text_def;
+ $$ = t;
+ t->text_str_ = String ($1);
+ t->style_str_ = "finger";
+ $$->set_spot (THIS->here_input ());
+ }
+ ;
+
script_abbreviation:
'^' { $$ = get_scriptdef ('^'); }
| '+' { $$ = get_scriptdef ('+'); }
script_dir:
'_' { $$ = -1; }
- |'^' { $$ = 1; }
- |'-' { $$ = 0; }
+ | '^' { $$ = 1; }
+ | '-' { $$ = 0; }
;
pre_requests:
;
explicit_steno_duration:
- int {
+ unsigned {
$$ = new Duration;
if (!Duration::duration_type_b ($1))
- THIS->parser_error ("Not a duration");
+ THIS->parser_error ("2:Not a duration");
else {
$$->durlog_i_ = Duration_convert::i2_type ($1);
$$->set_plet (THIS->default_duration_);
| explicit_steno_duration '.' {
$$->dots_i_ ++;
}
- | explicit_steno_duration '*' int {
+ | explicit_steno_duration '*' unsigned {
$$->plet_.iso_i_ = $3;
}
- | explicit_steno_duration '/' int {
+ | explicit_steno_duration '/' unsigned {
$$->plet_.type_i_ = $3;
}
;
':' {
$$ =0;
}
- | ':' int {
+ | ':' unsigned {
if (!Duration::duration_type_b ($2))
- THIS->parser_error ("Not a duration");
+ THIS->parser_error ("3:Not a duration");
else if ($2 < 8)
THIS->parser_error ("Can't abbreviate");
$$ = $2;
}
;
+unsigned:
+ UNSIGNED {
+ $$ = $1;
+ }
+ | DIGIT {
+ $$ = $1;
+ };
+
int:
- INT {
+ unsigned {
$$ = $1;
}
+ | '-' unsigned {
+ $$ = -$2;
+ }
| INT_IDENTIFIER {
int *i_p = $1->intid ();
$$ = *i_p;
}
;
-
real:
REAL {
$$ = $1;
#include "plet-engraver.hh"
#include "plet-spanner.hh"
#include "text-def.hh"
+#include "beam.hh"
+#include "score-column.hh"
#include "stem.hh"
IMPLEMENT_IS_TYPE_B1 (Plet_engraver,Engraver);
Plet_engraver::Plet_engraver ()
{
+ beam_mom_drul_[LEFT] = span_mom_drul_[LEFT] = INT_MAX;
+ beam_mom_drul_[RIGHT] = span_mom_drul_[LEFT] = -INT_MAX;
plet_spanner_p_ = 0;
span_reqs_drul_[RIGHT] = span_reqs_drul_[LEFT] = 0;
}
if (!mus_l)
return false;
+ Beam_req* b = mus_l->beam ();
+ if (b)
+ {
+ if (b->spantype)
+ {
+ Direction d = (Direction)(((int)(b->spantype - 1)) * 2 - 1);
+ beam_mom_drul_[d] = get_staff_info ().musical_l ()->when ();
+ }
+ return false;
+ }
+
Plet_req* p = mus_l->plet ();
if (!p)
return false;
return false;
span_reqs_drul_[d] = p;
+ span_mom_drul_[d] = get_staff_info ().musical_l ()->when ();
return true;
}
plet_spanner_p_->unlink ();
delete plet_spanner_p_;
plet_spanner_p_ = 0;
+ span_reqs_drul_[RIGHT] = span_reqs_drul_[LEFT] = 0;
}
}
if (!plet_spanner_p_ || !span_reqs_drul_[RIGHT])
return;
- typeset_element (plet_spanner_p_);
+ Scalar prop = get_property ("pletvisibility");
+ if (prop.isnum_b ())
+ plet_spanner_p_->visibility_i_ = prop;
+
+ if ((beam_mom_drul_[LEFT] <= span_mom_drul_[LEFT])
+ && (beam_mom_drul_[RIGHT] >= span_mom_drul_[RIGHT]))
+ plet_spanner_p_->visibility_i_ &= ~2;
+
+ if (plet_spanner_p_->visibility_i_)
+ typeset_element (plet_spanner_p_);
+ else
+ plet_spanner_p_->unlink ();
+
plet_spanner_p_ = 0;
span_reqs_drul_[RIGHT] = span_reqs_drul_[LEFT] = 0;
}
{
stem_l_drul_[RIGHT] =0;
stem_l_drul_[LEFT] =0;
+ visibility_i_ = 3;
tdef_p_ = new Text_def;
tdef_p_->align_i_ = CENTER;
{
tdef_p_ = new Text_def (*c.tdef_p_);
stem_l_drul_ = c.stem_l_drul_;
+ visibility_i_ = c.visibility_i_;
}
Plet_spanner::~Plet_spanner ()
Plet_spanner::brew_molecule_p () const
{
Molecule* mol_p = new Molecule;
+
Real w = width ().length ();
Real dy_f = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT];
Atom a = paper ()->lookup_l ()->plet (dy_f, w, dir_);
a.translate (Offset (dx_f_drul_[LEFT], dy_f_drul_[LEFT]));
- mol_p->add (a);
+
+ if (visibility_i_ >= 2)
+ mol_p->add (a);
Real interline_f = paper ()->interline_f ();
Real numy_f = (dir_ > 0 ? 0 : -interline_f) + dir_ * interline_f / 2;
Atom num (tdef_p_->get_atom (paper (), CENTER));
num.translate (Offset (width ().length ()/ 2 + dx_f_drul_[LEFT],
dy_f_drul_[LEFT] + dy_f / 2 + numy_f));
- mol_p->add (num);
+
+ if (visibility_i_ >= 1)
+ mol_p->add (num);
return mol_p;
}