TODO
This doth suck. We should have PS output, and read spacing info from TFMs
- Glissando, bracket
+ Glissando,
*/
#include "tex.hh"
#include "scalar.hh"
#include "paper-def.hh"
+#include "main.hh"
Lookup::Lookup()
{
}
Atom
-Lookup::hairpin (Real &wid, bool decresc) const
+Lookup::hairpin (Real &wid, bool decresc, bool continued) const
{
- int idx = int (rint (wid / 6 PT));
- if (!idx) idx ++;
- wid = idx*6 PT;
- String idxstr = (decresc)? "decrescendosym" : "crescendosym";
- Atom ret=(*symtables_p_)("param")->lookup (idxstr);
-
- Array<String> a;
- a.push (idx);
- ret.tex_ = substitute_args (ret.tex_, a);
+ bool embedded_b = postscript_global_b;
+ String embed;
+ Atom ret;
+ if (embedded_b)
+ {
+ Real height = paper_l_->get_var ("barsize") / 6;
+ embed = "\\embeddedps{\n" ;
+ embed += String (wid) + " "
+ + String (height) + " "
+ + String (continued ? height/2 : 0) +
+ + " draw_" + String(decresc ? "de" : "") + "cresc}\n";
+ ret.tex_ = embed;
+ }
+ else
+ {
+ if (wid > 32 * 6 PT)
+ {
+ warning (_("Crescendo too long (") + print_dimen (wid)
+ +_( ") shrinking (ugh)"));
+ wid = 32*6 PT;
+ }
+ int idx = int (rint (wid / 6 PT));
+ if (!idx) idx ++;
+ wid = idx*6 PT;
+ String idxstr = (decresc)? "decrescendosym" : "crescendosym";
+ ret=(*symtables_p_)("param")->lookup (idxstr);
+
+ Array<String> a;
+ a.push (idx);
+ ret.tex_ = substitute_args (ret.tex_, a);
+ }
+
ret.dim_.x() = Interval (0,wid);
+ // ret.translate_axis (-ret.dim_[Y_AXIS][DOWN], Y_AXIS);
return ret;
}
Atom
Lookup::vbrace (Real &y) const
{
- if (y < 2* 20 PT)
+ Atom brace = (*symtables_p_)("param")->lookup ("brace");
+ Interval ydims = brace.dim_[Y_AXIS];
+ Real min_y = ydims[LEFT];
+ Real max_y = ydims[RIGHT];
+ Real step = 1.0 PT;
+
+ if (y < min_y)
{
warning (_("piano brace too small (") + print_dimen (y)+ ")");
- y = 2*20 PT;
+ y = min_y;
}
- if (y > 67 * 2 PT)
+ if (y > max_y)
{
warning (_("piano brace too big (") + print_dimen (y)+ ")");
- y = 67 *2 PT;
+ y = max_y;
}
- int idx = int (rint ((y/2.0 - 20) + 148));
-
- Atom s = (*symtables_p_)("param")->lookup ("brace");
+
+ int idx = int (rint ((y- min_y)/step)) + 1;
+
{
Array<String> a;
a.push (idx);
- s.tex_ = substitute_args (s.tex_,a);
- s.dim_.y() = Interval (-y/2,y/2);
+ brace.tex_ = substitute_args (brace.tex_,a);
+ brace.dim_[Y_AXIS] = Interval (-y/2,y/2);
}
-
- return s;
+ return brace;
}