From bf5277e6bc6f6a1308e74cb10e32b555e4842500 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:57:49 +0000 Subject: [PATCH] lilypond-0.1.14 --- lily/include/score-elem.hh | 103 +++++++++---------------------------- lily/include/spanner.hh | 2 +- lily/p-score.cc | 53 ++++++++----------- 3 files changed, 47 insertions(+), 111 deletions(-) diff --git a/lily/include/score-elem.hh b/lily/include/score-elem.hh index c67510040a..64ec7fcbe1 100644 --- a/lily/include/score-elem.hh +++ b/lily/include/score-elem.hh @@ -8,14 +8,14 @@ #define STAFFELEM_HH #include "parray.hh" -#include "lily-proto.hh" -#include "offset.hh" #include "virtual-methods.hh" #include "directed-graph.hh" +#include "graphical-element.hh" #define SCORE_ELEM_CLONE(T) VIRTUAL_COPY_CONS(T, Score_elem) +typedef void (Score_elem::*Score_elem_method_pointer)(void); /** Both Spanner and Item are Score_elem's. Most Score_elem's depend on other Score_elem's, eg, Beam needs to know and set direction of @@ -25,94 +25,25 @@ form an acyclic graph. (elem) */ -class Score_elem : private Directed_graph_node { - - /// member: the symbols - Molecule *output; // should scrap, and use temp var? - - - - /** - for administration of what was done already - */ - enum Status { - ORPHAN, // not yet added to pstaff - VIRGIN, // added to pstaff - PREBREAKING, - PREBROKEN, - PRECALCING, - PRECALCED, // calcs before spacing done - BREAKING, - BROKEN, - POSTCALCING, // busy calculating. This is used to trap cyclic deps. - POSTCALCED, // after spacing calcs done - BREWED, - TEXOUTPUT, // molecule has been output - DELETED, // to catch malloc mistakes. - }; - - Status status_; - - Score_elem* dependency (int) const; - Score_elem* dependent (int) const; - int dependent_size() const; - int dependency_size() const; +class Score_elem : private Directed_graph_node, public Graphical_element { public: - /** - This is needed, because #output# may still be - NULL. - */ - Offset offset_; - - - - Paper_score *pscore_l_; - Axis_group_element * axis_group_l_a_[NO_AXES]; + Score_elem(); Score_elem (Score_elem const&); - virtual String TeX_output_str () const ; - virtual void print() const; + virtual void print() const; Paper_def *paper() const; virtual ~Score_elem(); - Score_elem(); DECLARE_MY_RUNTIME_TYPEINFO; - - Interval extent (Axis) const; - Interval width() const; - Interval height() const; - Status status() const; - - /** - translate the symbol. The symbol does not have to be created yet. - */ - void translate (Offset); - /** - translate in one direction - */ - - void translate (Real, Axis); - Real relative_coordinate (Axis_group_element*, Axis) const; - Offset absolute_offset() const; - Real absolute_coordinate (Axis) const; - Axis_group_element*common_group (Score_elem const* s, Axis a) const; void add_processing(); - void OK() const; - void pre_processing(); - void breakable_col_processing(); - void break_processing(); - - void post_processing(); - void molecule_processing(); /** Remove all links (dependencies, dependents, Axis_group_elements. */ void unlink(); - void unlink_all(); void substitute_dependency (Score_elem*,Score_elem*); void remove_dependency (Score_elem*); /** @@ -130,12 +61,30 @@ public: virtual bool linked_b() const; SCORE_ELEM_CLONE(Score_elem); - /// no dimension, translation is noop - bool empty_b_; /// do not print anything black bool transparent_b_; + + // ugh: no protection. Denk na, Vrij Veilig + void calcalute_dependencies (int final, int busy, Score_elem_method_pointer funcptr); + protected: + /** + Administration: Where are we?. This is mainly used by Super_elem and + Score_elem::calcalute_dependencies () + + 0 means ORPHAN, + -1 means deleted + + */ + int status_i_; + Score_elem* dependency (int) const; + Score_elem* dependent (int) const; + int dependent_size() const; + int dependency_size() const; + + virtual void do_brew_molecule (); + void junk_links(); virtual Interval do_height() const; virtual Interval do_width() const; @@ -151,7 +100,6 @@ protected: virtual void do_breakable_col_processing(); /// do calculations after determining horizontal spacing virtual void do_post_processing(); - virtual String do_TeX_output_str () const; virtual void do_substitute_dependency (Score_elem * , Score_elem *); virtual void do_substitute_dependent (Score_elem *, Score_elem *); @@ -161,7 +109,6 @@ protected: virtual Link_array get_extra_dependencies() const; virtual void do_unlink(); virtual void do_junk_links(); - String make_TeX_string (Offset) const; }; diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index 44529faaf0..ad205fcbf0 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -56,7 +56,7 @@ protected: virtual void do_unlink(); virtual void do_junk_links(); - virtual String do_TeX_output_str () const; + virtual void do_brew_molecule (); virtual void do_break_processing(); virtual Interval do_width() const; virtual void do_print() const; diff --git a/lily/p-score.cc b/lily/p-score.cc index 986d3665ba..0591e5cc1e 100644 --- a/lily/p-score.cc +++ b/lily/p-score.cc @@ -18,9 +18,11 @@ #include "header.hh" #include "word-wrap.hh" #include "gourlay-breaking.hh" +#include "outputter.hh" Paper_score::Paper_score () { + outputter_l_ =0; super_elem_l_ = new Super_elem; typeset_element (super_elem_l_); } @@ -54,7 +56,6 @@ Paper_score::typeset_unbroken_spanner (Spanner*span_p) span_p_list_.bottom ().add (span_p); span_p->pscore_l_=this; - // do not init start/stop fields. These are for broken spans only. span_p->add_processing (); } @@ -80,15 +81,6 @@ Paper_score::add_column (Paper_column *p) -void -Paper_score::OK () const -{ -#ifndef NDEBUG - for (PCursor i (elem_p_list_.top ()); i.ok (); i++) - i->OK (); -#endif -} - void Paper_score::print () const { @@ -107,20 +99,6 @@ Paper_score::print () const #endif } -void -Paper_score::preprocess () -{ - super_elem_l_->breakable_col_processing (); - super_elem_l_->pre_processing (); -} - -void -Paper_score::postprocess () -{ - super_elem_l_->post_processing (); - super_elem_l_->molecule_processing (); -} - PCursor Paper_score::find_col (Paper_column const *c) const { @@ -197,12 +175,19 @@ Paper_score::process () clean_cols (); print (); *mlog << "Preprocessing elements... " <breakable_col_processing (); + super_elem_l_->pre_processing (); *mlog << "\nCalculating column positions ... " <post_processing (); + tex_output (); +} + +void +Paper_score::tex_output () +{ // output String outname = paper_l_->outfile_str_ ; if (!outname) @@ -210,17 +195,21 @@ Paper_score::process () *mlog << "TeX output to " << outname << " ...\n"; - Tex_stream the_output (outname); + Tex_stream tex_out (outname); + Tex_outputter interfees (&tex_out); + + outputter_l_ = &interfees; - the_output << "% outputting Score, defined at: " << origin_str_ << "\n"; + tex_out << "% outputting Score, defined at: " << origin_str_ << "\n"; if (header_l_) { - the_output << header_l_->TeX_string(); + tex_out << header_l_->TeX_string(); } - the_output << "\n "<< paper_l_->lookup_l ()->texsetting << "%(Tex id)\n"; - the_output<< super_elem_l_->TeX_output_str (); - the_output << "\n\\EndLilyPondOutput"; + tex_out << "\n "<< paper_l_->lookup_l ()->texsetting << "%(Tex id)\n"; + super_elem_l_->output_all (); + tex_out << "\n\\EndLilyPondOutput"; + outputter_l_ = 0; } /** Get all breakable columns between l and r, (not counting l and r). */ -- 2.39.5