From: fred Date: Sun, 24 Mar 2002 19:45:17 +0000 (+0000) Subject: lilypond-0.0.67 X-Git-Tag: release/1.5.59~4615 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2b5d5d8adea9f69f95c2126acf11808b39b9a461;p=lilypond.git lilypond-0.0.67 --- diff --git a/lily/include/script-def.hh b/lily/include/script-def.hh index d45e459d84..8313abad46 100644 --- a/lily/include/script-def.hh +++ b/lily/include/script-def.hh @@ -7,10 +7,15 @@ #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. */ -struct Script_def { +class Script_def : public General_script_def { + /// invert if below staff? + bool invertsym_b_; + String symidx; + /// on the other side of the stem? int rel_stem_dir_i_; @@ -24,16 +29,26 @@ struct Script_def { /// follow the ball inside staff? bool inside_staff_b_; - /// invert if below staff? - bool invertsym_b_; - String symidx; +public: + virtual int staff_dir_i()const; + virtual int rel_stem_dir_i()const; + virtual int priority_i()const; + virtual bool inside_b()const; + virtual Atom get_atom(Paper_def* p, int dir_i_)const; + NAME_MEMBERS(); - /* *************** */ - int compare(Script_def const &); + virtual bool do_equal_b(General_script_def const &)const; void print() const; - Script_def(String, bool, int, int ,bool); + Script_def(); + void set_from_input(String, bool, int, int ,bool); +protected: + VIRTUAL_COPY_CONS(Script_def,General_script_def) + }; + + + #endif // SCRIPTDEF_HH diff --git a/lily/include/text-spanner.hh b/lily/include/text-spanner.hh index a91d8d9691..c7e6ca9a92 100644 --- a/lily/include/text-spanner.hh +++ b/lily/include/text-spanner.hh @@ -16,15 +16,15 @@ class Text_spanner : public Spanner { public: Directional_spanner * support; - Text_def spec; + General_script_def * spec_p_; Offset text_off_; - NAME_MEMBERS(Text_spanner); + NAME_MEMBERS(); void set_support(Directional_spanner*); Text_spanner(); protected: SPANNER_CLONE(Text_spanner) - + ~Text_spanner(); virtual void do_substitute_dependency(Score_elem*,Score_elem*); virtual void do_pre_processing(); virtual void do_post_processing(); diff --git a/lily/text-item.cc b/lily/text-item.cc index cc6f7f9b13..9d661f405f 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -14,20 +14,14 @@ #include "molecule.hh" #include "lookup.hh" -Text_item::Text_item(Text_def *tdef_l, int d) +Text_item::Text_item(General_script_def*tdef_l, int d) { dir_i_ = d; fat_b_ = false; - tdef_p_ = new Text_def(*tdef_l); + tdef_p_ = tdef_l->clone(); pos_i_ =0; } -Text_def* -Text_item::tdef_l() -{ - return tdef_p_; -} - Text_item::~Text_item() { delete tdef_p_; @@ -36,7 +30,8 @@ Text_item::~Text_item() void Text_item::set_default_index() { - pos_i_ = get_position_i(tdef_p_->create_atom().extent().y ); + pos_i_ = get_position_i( + tdef_p_->get_atom(paper(), dir_i_).extent().y ); } void @@ -44,7 +39,6 @@ Text_item::do_pre_processing() { if (!dir_i_) dir_i_ = -1; - tdef_p_->pdef_l_ = paper(); } void @@ -57,11 +51,12 @@ Text_item::do_post_processing() Molecule* Text_item::brew_molecule_p() const { - Atom a(tdef_p_->create_atom()); - - if ( fat_b_) - a.sym.dim.x = tdef_p_->width(); + Atom a(tdef_p_->get_atom(paper(), dir_i_)); +/* + if ( fat_b_) + a.sym.dim.x = tdef_p_->width(paper()); + */ Molecule* mol_p = new Molecule(a); if(dir_i_<0 ) // should do something better anyway. diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index 6883dab0b0..ceaacd8793 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -12,7 +12,7 @@ #include "text-def.hh" #include "debug.hh" #include "paper-def.hh" - +#include "symbol.hh" void @@ -27,6 +27,7 @@ Text_spanner::set_support(Directional_spanner*d) Text_spanner::Text_spanner() { + spec_p_ = 0; support = 0; } @@ -35,27 +36,20 @@ IMPLEMENT_STATIC_NAME(Text_spanner); void Text_spanner::do_print() const { - spec.print(); + spec_p_->print(); } void Text_spanner::do_post_processing() { - switch(spec.align_i_) { - case 0: - text_off_ = support->center() + - Offset(0,support->dir_i_ * paper()->internote_f() * 4); // todo - break; - default: - assert(false); - break; - } + text_off_ = support->center() + + Offset(0,support->dir_i_ * paper()->internote_f() * 4); // todo } Molecule* Text_spanner::brew_molecule_p() const { - Atom tsym (spec.create_atom()); + Atom tsym (spec_p_->get_atom(paper(),0)); tsym.translate(text_off_); Molecule*output = new Molecule; @@ -69,7 +63,6 @@ Text_spanner::do_pre_processing() right_col_l_ = support->right_col_l_; left_col_l_ = support->left_col_l_; assert(left_col_l_ && right_col_l_); - spec.pdef_l_ = paper(); } Interval @@ -86,3 +79,8 @@ Text_spanner::do_substitute_dependency(Score_elem* o, Score_elem*n) support = (Directional_spanner*) n->spanner(); } + +Text_spanner::~Text_spanner() +{ + delete spec_p_; +}