]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.67
authorfred <fred>
Sun, 24 Mar 2002 19:45:17 +0000 (19:45 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:45:17 +0000 (19:45 +0000)
lily/include/script-def.hh
lily/include/text-spanner.hh
lily/text-item.cc
lily/text-spanner.cc

index d45e459d84fe1b3bd619a927ec23bec4ebeaaac1..8313abad46b48475d1f201b2dc09a5ece2e231f8 100644 (file)
@@ -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
 
index a91d8d96910d3c49e1afe7cb4400ab4645823360..c7e6ca9a9275999db5847d9696f8e0593beb94fb 100644 (file)
 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();
index cc6f7f9b1313a28a447444df9db12179488cd0e4..9d661f405f2153bdff6dd3f5b7e0d26b3f888297 100644 (file)
 #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.
index 6883dab0b0d4bcd7fb2a74d5f70846eb7ff78a68..ceaacd8793109ca0c0d0cc159516d86c89637ca4 100644 (file)
@@ -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_;
+}