+++ /dev/null
-/*
- general-script-def.cc -- implement General_script_def
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include "molecule.hh"
-#include "general-script-def.hh"
-#include "debug.hh"
-
-
-Direction
-General_script_def::staff_dir() const
-{
- return DOWN;
-}
-
-Direction
-General_script_def::rel_stem_dir() const
-{
- return CENTER;
-}
-int
-General_script_def::priority_i() const
-{
- return 1000;
-}
-
-bool
-General_script_def::inside_b() const
-{
- return false;
-}
-
-bool
-General_script_def::equal_b (General_script_def const&g) const
-{
- return do_equal_b (&g);
-}
-
-bool
-General_script_def::do_equal_b (General_script_def const*) const
-{
- return true;
-}
-
-
-void
-General_script_def::print() const
-{
- DOUT << classname(this) << "{";
- do_print();
- DOUT << "}";
-}
-
-void
-General_script_def::do_print() const
-{
-}
-
-Molecule
-General_script_def::get_molecule (Paper_def*, Direction) const
-{
- Molecule s;
- return Molecule (s);
-}
-
-
-
-
+++ /dev/null
-/*
- general-script-def.hh -- declare General_script_def
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef GENERAL_SCRIPT_DEF_HH
-#define GENERAL_SCRIPT_DEF_HH
-
-#include "lily-proto.hh"
-#include "input.hh"
-#include "virtual-methods.hh"
-#include "direction.hh"
-
-/**
- Definition of anything that is put aside staff/notes.
- */
-class General_script_def : public Input {
-public:
- VIRTUAL_COPY_CONS(General_script_def);
-
- virtual Direction staff_dir() const;
- void print() const;
- virtual Direction rel_stem_dir() const;
- virtual int priority_i() const;
- virtual bool inside_b() const;
- virtual Molecule get_molecule (Paper_def* p, Direction dir_) const;
- bool equal_b (General_script_def const&) const;
- virtual ~General_script_def() {}
-protected:
- virtual bool do_equal_b (General_script_def const *) const;
- virtual void do_print() const;
-};
-
-#endif // GENERAL_SCRIPT_DEF_HH
+++ /dev/null
-/*
- script-column.hh -- declare Script_column
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef SCRIPT_COLUMN_HH
-#define SCRIPT_COLUMN_HH
-
-#include "axis-group-item.hh"
-
-/** a struct for treating a group of noteheads (noteheads, stem
- (chord) and scripts) as a single entity. */
-class Script_column : public Axis_group_item {
-
-protected:
- virtual void do_print() const;
- virtual void do_substitute_element_pointer (Score_element*, Score_element*);
- virtual void do_pre_processing() ;
-public:
- Link_array<Script> script_l_arr_;
- Link_array<Item> support_l_arr_;
-
-
- virtual void add_script (Script *);
- void add_support (Item*);
- Script_column ();
-};
-
-#endif // SCRIPT_COLUMN_HH
+++ /dev/null
-/*
- script-def.hh -- part of GNU LilyPond
-
- (c) 1996--1999 Han-Wen Nienhuys
-*/
-
-#ifndef SCRIPTDEF_HH
-#define SCRIPTDEF_HH
-#include "string.hh"
-#include "general-script-def.hh"
-
-/** The characteristics of a certain kind of accent. It is not the
- accent itself. */
-class Script_def : public General_script_def {
- /// invert if below staff?
- bool invertsym_b_;
- String symidx_str_;
-
-
- /// on the other side of the stem?
- Direction rel_stem_dir_;
-
- /// below or above staff?
- Direction staff_dir_;
-
- /// how close to the note do we want to be?
- int priority_i_;
-
- /// follow the ball inside staff?
- bool inside_staff_b_;
-
-public:
- virtual Direction staff_dir() const;
- virtual Direction rel_stem_dir() const;
- virtual int priority_i() const;
- virtual bool inside_b() const;
- virtual Molecule get_molecule (Paper_def* p, Direction dir_) const;
-
-
- virtual bool do_equal_b (General_script_def const *) const;
- virtual void do_print() const;
- Script_def();
- void set_from_input (String, bool, int, int ,bool,int);
-protected:
- VIRTUAL_COPY_CONS(General_script_def);
-
-};
-
-
-
-
-
-#endif // SCRIPTDEF_HH
-
+++ /dev/null
-/*
- script-engraver.hh -- part of GNU LilyPond
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef SCRIPTGRAV_HH
-#define SCRIPTGRAV_HH
-
-#include "engraver.hh"
-
-
-class Script_engraver : public Engraver {
- Link_array<Script> script_p_arr_;
- Link_array<Script_req> script_req_l_arr_;
-
-public:
- VIRTUAL_COPY_CONS(Translator);
-
- Script_engraver();
-protected:
- virtual bool do_try_music (Music*);
- virtual void do_process_requests();
- virtual void do_pre_move_processing();
- virtual void do_post_move_processing();
-
-};
-
-#endif // SCRIPTGRAV_HH
+++ /dev/null
-/*
- script.hh -- part of GNU LilyPond
-
- (c) 1996--1999 Han-Wen Nienhuys
-*/
-
-#ifndef SCRIPT_HH
-#define SCRIPT_HH
-
-#include "staff-side.hh"
-#include "item.hh"
-
-/**
- Accents that are put over a note-group.
- */
-class Script : public Item, public Staff_side {
- Stem *stem_l_;
-
-protected:
- Molecule *do_brew_molecule_p() const;
- virtual void do_substitute_element_pointer (Score_element*,Score_element*);
- virtual void do_print() const;
- virtual Interval symbol_height() const;
- virtual void do_pre_processing();
- virtual Interval do_width() const;
- VIRTUAL_COPY_CONS(Score_element);
-private:
-
- void set_default_dir();
-public:
- General_script_def *specs_p_;
-
- static int compare (Script *const&, Script *const&) ;
- Script();
- ~Script ();
- Script (Script const&);
-
- void set_stem (Stem*);
-};
-
-
-#endif // SCRIPT_HH
-
+++ /dev/null
-/*
- text-def.hh -- part of GNU LilyPond
-
- (c) 1996--1999 Han-Wen Nienhuys
-*/
-
-#ifndef TEXT_DEF_HH
-#define TEXT_DEF_HH
-
-#include "general-script-def.hh"
-#include "string.hh"
-#include "lily-proto.hh"
-#include "input.hh"
-
-class Text_def : public General_script_def
-{
-public:
- VIRTUAL_COPY_CONS(General_script_def);
-
- /**
- Alignment of typeset text wrt center.
-
- LEFT = raggedright, CENTER = centered, RIGHT = raggedleft
- */
- Direction align_dir_;
-
- String text_str_;
- String style_str_;
-
- virtual void do_print() const;
- virtual Direction staff_dir() const;
- virtual Molecule get_molecule (Paper_def* p, Direction dir_) const;
- virtual ~Text_def() {};
- virtual bool do_equal_b (const General_script_def*) const;
- Text_def();
- virtual void print() const;
-};
-
-#endif // TEXT_DEF_HH
-
+++ /dev/null
-/*
- textspanner.hh -- part of GNU LilyPond
-
- (c) 1996--1999 Han-Wen Nienhuys
-*/
-
-#ifndef TEXTSPANNER_HH
-#define TEXTSPANNER_HH
-
-#include "string.hh"
-#include "directional-spanner.hh"
-#include "text-def.hh"
-
-/** a spanner which puts texts on top of other spanners. Use for
- triplets, volta, ottava, etc.
-
- (does anyone use this? Junkme?)
-*/
-class Text_spanner : public Spanner {
-public:
- Directional_spanner * support_span_l_;
- General_script_def * spec_p_;
- Offset text_off_;
-
-
- void set_support (Directional_spanner*);
- Text_spanner();
- Text_spanner (Text_spanner const&);
-protected:
- VIRTUAL_COPY_CONS(Score_element);
- ~Text_spanner();
- virtual void do_add_processing ();
- virtual void do_substitute_element_pointer (Score_element*,Score_element*);
- virtual void do_pre_processing();
- virtual void do_post_processing();
- virtual Interval height() const ;
- virtual Molecule* do_brew_molecule_p() const;
- virtual void do_print() const;
-};
-#endif // TEXTSPANNER_HH
-
+++ /dev/null
-/*
- script-column.cc -- implement Script_column
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include "script-column.hh"
-#include "debug.hh"
-#include "script.hh"
-#include "note-head.hh"
-#include "stem.hh"
-#include "general-script-def.hh"
-
-
-
-
-void
-Script_column::add_script (Script*s_l)
-{
- script_l_arr_.push (s_l);
- add_dependency (s_l);
- add_element (s_l);
-}
-
-
-void
-Script_column::do_print() const
-{
-#ifndef NPRINT
- DOUT << "scripts: " << script_l_arr_.size() << '\n';
-#endif
-}
-
-static int
-idx (bool inside, int dir)
-{
- int j = (dir+1);
- if (!inside)
- j ++;
- return j;
-}
-
-
-Script_column::Script_column ()
-{
- set_axes (X_AXIS,X_AXIS);
-}
-
-void
-Script_column::do_pre_processing()
-{
- if (!script_l_arr_.size())
- return;
-
- /* up+inside, up+outside, down+inside, down+outside */
- Array<Script*> placed_l_arr_a[4];
- for (int i=0; i < script_l_arr_.size(); i++)
- {
- Script*s_l = script_l_arr_[i];
- placed_l_arr_a[idx (s_l->specs_p_->inside_b(),
- s_l->dir_) ].push (s_l);
- }
-
- for (int j =0; j <4; j++)
- {
- placed_l_arr_a[j].sort (Script::compare);
- }
-
-
- for (int j =0; j < 4; j++)
- {
- if (placed_l_arr_a[j].size())
- for (int i=0; i < support_l_arr_.size(); i++)
- placed_l_arr_a[j][0]->add_support (support_l_arr_[i]);
- }
-
- Item * support_l=0;
- int j = 0;
- for (; j < 2; j++)
- {
- for (int i=0; i < placed_l_arr_a[j].size(); i++)
- {
- if (support_l)
- placed_l_arr_a[j][i]->add_support (support_l);
- support_l = placed_l_arr_a[j][i];
- }
- }
- support_l = 0;
- for (; j < 4; j++)
- {
- for (int i=0; i < placed_l_arr_a[j].size(); i++)
- {
- if (support_l)
- placed_l_arr_a[j][i]->add_support (support_l);
- support_l = placed_l_arr_a[j][i];
- }
- }
-}
-
-
-void
-Script_column::add_support (Item*i_l)
-{
- support_l_arr_.push (i_l);
- add_dependency (i_l);
- add_element (i_l);
-}
-
-void
-Script_column::do_substitute_element_pointer (Score_element*o,Score_element*n)
-{
- if (dynamic_cast <Item *> (o))
- {
- script_l_arr_.substitute (dynamic_cast<Script *> (o),
- dynamic_cast <Script *> (n));
- support_l_arr_.substitute (dynamic_cast <Item *> (o),
- dynamic_cast <Item *> (n));
- }
-}
+++ /dev/null
-/*
- script-def.cc -- implement
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1996, 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include "debug.hh"
-#include "script-def.hh"
-
-#include "paper-def.hh"
-#include "lookup.hh"
-
-Script_def::Script_def()
-{
- inside_staff_b_ = false;
- symidx_str_ = "unknown" ;
- rel_stem_dir_ =CENTER;
- staff_dir_ = DOWN;
- invertsym_b_ = 0;
- priority_i_ =0;
-}
-
-void
-Script_def::set_from_input (String idx, bool follow, int stem, int staff ,bool invert, int priority_i)
-{
- inside_staff_b_ = follow;
- symidx_str_ = idx ;
- rel_stem_dir_ =Direction(stem);
- staff_dir_ = Direction(staff);
- invertsym_b_ = invert;
- priority_i_ =priority_i;
-}
-
-
-void
-Script_def::do_print() const
-{
-#ifndef NPRINT
- DOUT << "Script_def{ idx: " << symidx_str_
- << " direction, stem: " << rel_stem_dir_ << " staff : " << staff_dir_ << "}\n";
-#endif
-}
-
-bool
-Script_def::do_equal_b (General_script_def const *g) const
-{
- Script_def const * c = dynamic_cast<Script_def const*> (g);
- return c&& (symidx_str_ == c->symidx_str_ &&
- rel_stem_dir_ == c->rel_stem_dir_&&
- staff_dir_ == c->staff_dir_&&
- invertsym_b_ == c->invertsym_b_);
-}
-
-Direction
-Script_def::staff_dir() const
-{
- return staff_dir_;
-}
-
-Direction
-Script_def::rel_stem_dir() const
-{
- return rel_stem_dir_;
-}
-
-bool
-Script_def::inside_b() const
-{
- return inside_staff_b_;
-}
-
-Molecule
-Script_def::get_molecule (Paper_def *p , Direction d) const
-{
- String preidx_str ="";
- if (invertsym_b_)
- preidx_str = (d < 0)? "d" : "u";
-
- return p->lookup_l(0)->script (preidx_str + symidx_str_);
-}
-
-
-
-
-int
-Script_def::priority_i() const
-{
- return priority_i_;
-}
-
-
-
+++ /dev/null
-/*
- script-engraver.cc -- implement Script_engraver
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include "script-engraver.hh"
-#include "script.hh"
-#include "musical-request.hh"
-#include "stem.hh"
-#include "staff-symbol.hh"
-#include "general-script-def.hh"
-#include "text-def.hh"
-
-
-Script_engraver::Script_engraver()
-{
- do_post_move_processing();
-}
-
-bool
-Script_engraver::do_try_music (Music *r_l)
-{
- if (Musical_script_req *mr = dynamic_cast <Musical_script_req *> (r_l))
- {
- for (int i=0; i < script_req_l_arr_.size(); i++)
- {
- if (script_req_l_arr_[i]->equal_b (mr))
- return true;
- }
- script_req_l_arr_.push (mr);
- return true;
- }
- return false;
-}
-
-void
-Script_engraver::do_process_requests()
-{
- if (script_p_arr_.size ())
- return ;
-
- for (int i=0; i < script_req_l_arr_.size(); i++)
- {
- Script_req* l=script_req_l_arr_[i];
- Script *p =new Script;
- p->dir_ = l->dir_;
- p->specs_p_ = l->scriptdef_p_->clone ();
- script_p_arr_.push (p);
- announce_element (Score_element_info (p, l));
- }
-}
-
-void
-Script_engraver::do_pre_move_processing()
-{
- for (int i=0; i < script_p_arr_.size(); i++)
- {
- Script*script_p = script_p_arr_[i];
-
- /*
- UGH. inside_b () for scripts broken for now.
-
- if (!script_p->specs_p_->inside_b())
- script_p->add_support (s_l);
- */
-
- if (Text_def*td_l = dynamic_cast<Text_def *> (script_p->specs_p_)) // UGH
- {
- if (!td_l->style_str_.length_i ())
- {
- Scalar style = get_property ("textstyle", 0);
- if (style.to_bool ())
- td_l->style_str_= style;
- }
-
- // urg, what if this is already set? in-band signaling...
- Scalar alignment = get_property ("textalignment", 0);
- if (alignment.isnum_b())
- {
- td_l->align_dir_= (Direction)(int)alignment;
- }
- }
- typeset_element (script_p);
- }
- script_p_arr_.clear();
-}
-
-void
-Script_engraver::do_post_move_processing()
-{
- script_req_l_arr_.clear();
-}
-
-
-
-ADD_THIS_TRANSLATOR(Script_engraver);
+++ /dev/null
-/*
- script.cc -- implement Script
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-#include "script-def.hh"
-#include "musical-request.hh"
-#include "paper-def.hh"
-#include "script.hh"
-#include "stem.hh"
-#include "molecule.hh"
-#include "lookup.hh"
-
-void
-Script::do_print () const
-{
-#ifndef NPRINT
- specs_p_->print ();
-#endif
-}
-
-void
-Script::do_substitute_element_pointer (Score_element*o,Score_element*n)
-{
- Staff_side::do_substitute_element_pointer (o,n);
- if (o == stem_l_)
- {
- stem_l_ = dynamic_cast<Stem *> (n);
- }
-}
-
-void
-Script::set_stem (Stem*st_l)
-{
- stem_l_ = st_l;
- add_support (st_l);
-}
-
-
-Script::Script ()
-{
- axis_ = Y_AXIS;
- specs_p_ = 0;
- stem_l_ = 0;
- dir_ = CENTER;
-}
-
-void
-Script::set_default_dir ()
-{
- int s_i=specs_p_->rel_stem_dir ();
- if (s_i)
- {
- if (stem_l_)
- dir_ = Direction (stem_l_->dir_ * s_i);
- else
- {
- specs_p_->warning (_ ("script needs stem direction"));
- dir_ = DOWN;
- }
- }
- else
- {
- dir_ =specs_p_->staff_dir ();
- }
- assert (dir_);
-}
-
-
-Interval
-Script::do_width () const
-{
- return specs_p_->get_molecule (paper_l (), dir_).extent ().x ();
-}
-
-void
-Script::do_pre_processing ()
-{
- Staff_side::do_pre_processing ();
- if (axis_ == Y_AXIS && !dir_)
- set_default_dir ();
-}
-
-Interval
-Script::symbol_height () const
-{
- return specs_p_->get_molecule (paper_l (), dir_).extent ().y ();
-}
-
-
-Molecule*
-Script::do_brew_molecule_p () const
-{
- Real dx =0.;
-
- Molecule*mol_p = new Molecule (specs_p_->get_molecule (paper_l (), dir_));
- /*
- ugh, staccato dots are not centred between stafflines (how?)?
- */
- Real correct =0.0;
- if (axis_ == Y_AXIS){
- dx = paper_l ()->note_width ()/2;
- correct = - (Real)dir_ * 2.0 * paper_l ()->rule_thickness ();
- mol_p->translate_axis (dx, X_AXIS); // FIXME! ugh
- }
-
- mol_p->translate_axis (coordinate_offset_f_ + correct, axis_);
-
- return mol_p;
-}
-
-
-
-
-int
-Script::compare (Script *const&l1, Script *const&l2)
-{
- return l1->specs_p_->priority_i() - l2->specs_p_->priority_i ();
-}
-
-Script::~Script ()
-{
- delete specs_p_;
-}
-
-Script::Script (Script const&s)
- : Item (s), Staff_side(s)
-{
- specs_p_ = s.specs_p_ ? s.specs_p_->clone (): 0;
- stem_l_ =s.stem_l_;
-}
-
+++ /dev/null
-/*
- text-def.cc -- implement Text_def
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1996, 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include <ctype.h>
-#include "debug.hh"
-#include "lookup.hh"
-#include "paper-def.hh"
-#include "molecule.hh"
-#include "text-def.hh"
-
-Direction
-Text_def::staff_dir () const
-{
- if (style_str_ == "finger")
- return UP;
- return DOWN;
-}
-
-
-void
-Text_def::do_print() const
-{
-#ifndef NPRINT
- DOUT << "align " << align_dir_ << " `" << text_str_ << "'";
-#endif
-}
-
-Text_def::Text_def()
-{
- align_dir_ = RIGHT;
- style_str_ = "roman";
-}
-
-bool
-Text_def::do_equal_b (General_script_def const *gdef) const
-{
- Text_def const *def= dynamic_cast<Text_def const*>(gdef);
- return def&& align_dir_ == def->align_dir_ && text_str_ == def->text_str_
- && style_str_ == def->style_str_;
-}
-
-Molecule
-Text_def::get_molecule (Paper_def *p, Direction) const
-{
- Molecule a= p->lookup_l(0)->text (style_str_, text_str_);
-
- a.translate_axis (-(align_dir_ + 1)* a.dim_[X_AXIS].center (), X_AXIS);
-
- return a;
-}
-
-void
-Text_def::print() const
-{
- DOUT << "Text `" << text_str_ << "\', style " <<
- style_str_ << "align " << align_dir_ << '\n';
-}
-
-
-
+++ /dev/null
-/*
- text-spanner.cc -- implement Text_spanner
-
- source file of the GNU LilyPond music typesetter
-
- (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include "molecule.hh"
-#include "box.hh"
-#include "text-spanner.hh"
-#include "text-def.hh"
-#include "debug.hh"
-#include "paper-def.hh"
-
-
-
-void
-Text_spanner::set_support (Directional_spanner*d)
-{
- if (support_span_l_)
- remove_dependency (support_span_l_);
-
- support_span_l_ =d;
- add_dependency (d);
-}
-
-void
-Text_spanner::do_add_processing ()
-{
- set_bounds (LEFT, support_span_l_->spanned_drul_[LEFT]);
- set_bounds (RIGHT, support_span_l_->spanned_drul_[RIGHT]);
-}
-
-Text_spanner::Text_spanner()
-{
- spec_p_ = 0;
- support_span_l_ = 0;
-}
-
-void
-Text_spanner::do_print() const
-{
- spec_p_->print();
-}
-
-void
-Text_spanner::do_post_processing()
-{
- text_off_ = support_span_l_->center() +
- Offset (0,support_span_l_->dir_ * paper_l ()->get_realvar(interline_scm_sym)*2.0); // todo
-}
-
-Molecule*
-Text_spanner::do_brew_molecule_p() const
-{
- Molecule tsym (spec_p_->get_molecule (paper_l (),CENTER));
- tsym.translate (text_off_);
-
- Molecule*output = new Molecule;
- output->add_molecule (tsym);
- return output;
-}
-
-void
-Text_spanner::do_pre_processing()
-{
- spanned_drul_ = support_span_l_->spanned_drul_;
-}
-
-Interval
-Text_spanner::height() const
-{
- return do_brew_molecule_p()->extent ().y ();
-}
-
-void
-Text_spanner::do_substitute_element_pointer (Score_element* o, Score_element*n)
-{
- if (support_span_l_ == o)
- support_span_l_ = (Directional_spanner*) (n?dynamic_cast <Spanner *> (n):0);
-}
-
-
-Text_spanner::~Text_spanner()
-{
- delete spec_p_;
-}
-
-Text_spanner::Text_spanner (Text_spanner const&s)
- : Spanner (s)
-{
- support_span_l_ = s.support_span_l_;
- spec_p_ = s.spec_p_? s.spec_p_->clone() : 0;
- text_off_ = s.text_off_;
-}