From: Han-Wen Nienhuys Date: Fri, 24 Jan 1997 10:35:22 +0000 (+0100) Subject: release: 0.0.24 X-Git-Tag: release/0.0.24 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=6587665e0339fc9e8dfcff6e6d6289c459cc7130;p=lilypond.git release: 0.0.24 --- diff --git a/.dstreamrc b/.dstreamrc index 12afafc563..85ab21bde2 100644 --- a/.dstreamrc +++ b/.dstreamrc @@ -12,10 +12,12 @@ PScore 1 Idealspacing 1 # yydebug -Parser 0 +InitParser 1 +Parser 1 + # FlexLexer debug -Lexer 0 +Lexer 1 parse_duration 1 parse_pitchmod 1 diff --git a/Documentation/Makefile b/Documentation/Makefile index 618bd6f111..ab7466ffe5 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -2,6 +2,7 @@ PODS=README.pod CodingStyle.pod lilygut.pod lilyinput.pod error.pod\ faq.pod TXTS=$(PODS:.pod=.txt) MANS=$(PODS:.pod=.1) +HTMLS=$(PODS:.pod=.html) DISTFILES=$(PODS) Makefile @@ -22,3 +23,5 @@ clean: pod2man --center="LilyPond documentation" --section="0"\ --release="LilyPond $(MAJVER).$(MINVER).$(PATCHLEVEL)" $< > $@ +html: + pod2html \ No newline at end of file diff --git a/Documentation/README.pod b/Documentation/README.pod index 491c18e06a..cc82b196bb 100644 --- a/Documentation/README.pod +++ b/Documentation/README.pod @@ -17,7 +17,8 @@ music. LilyPond has these features: =over 5 -=item * ASCII script input, with identifiers (for music reuse), +=item * +ASCII script input, with identifiers (for music reuse), customizable notenames, customizable fontset =item * @@ -28,13 +29,18 @@ multiple stafftypes (melodic, rhythmic) =item * beams, slurs, chords, super/subscripts (accents and text), -triplets, clef changes, meter changes, general n-plet (triplet, +triplets, general n-plet (triplet, quadruplets, etc.) =item * multiple scores within one input file. Each score is output to a different file. +=item * +clef changes, meter changes, cadenza-mode, declaring markings +in the music, repeat bars + + =back =head1 DESIGN CONSIDERATIONS @@ -162,10 +168,12 @@ flex (2.5.1 or better) =item * Bison or YACC. -=item * The "Flower" library, which should be available from the same +=item * +The "Flower" library, which should be available from the same source you got this from. -=item * perl. The Makefile uses perl for trivial operations, and you +=item * +perl. The Makefile uses perl for trivial operations, and you could tinker with it to use sed or awk. =back @@ -227,7 +235,8 @@ named return values Han-Wen Nienhuys , Main author =item * -Jan Nieuwenhuizen , bits of FlowerLib, general comments. +Jan Nieuwenhuizen , Lyrics, bits of +FlowerLib, general comments. =item * Mats Bengtsson , bugfixes, testing, general comments. @@ -293,15 +302,19 @@ This is a beta version of LilyPond. Please send your helpful comments and patches to me (see AUTHORS section) LilyPond is updated very frequently, the latest version is always available at: - -F +ftp://pcnov095.win.tue.nl/pub/lilypond. =head1 FILES -F The initialisation file with symbol tables etc. It +=over 5 + +=item F +The initialisation file with symbol tables etc. It includes files from the directory F. +=back + =head1 SEE ALSO There are some documentation files in the subdirectory F, diff --git a/Documentation/lilyinput.pod b/Documentation/lilyinput.pod index d359bb39bd..4e8367d3d0 100644 --- a/Documentation/lilyinput.pod +++ b/Documentation/lilyinput.pod @@ -30,13 +30,18 @@ In musicmode, eg, ''!c8.-"text"_v +and in lyricmode, eg, + + Twink- le, twink- le litt- le star,2 + a lot of characters parse differently than in "command" mode, eg, identifier = score { .. } So you have to signal that to the tokenizer. This is done with -'$'. '$' is a delimiter, which used by the tokenizer only. +'$'. '$' is a delimiter, which used by the tokenizer only. The same +goes for lyrics, it has a '@' delimiter. =item * musicmode: The brace still is used to group grammatical groups. diff --git a/Makefile b/Makefile index 584d0dc60c..c2b59dc66a 100644 --- a/Makefile +++ b/Makefile @@ -3,33 +3,30 @@ include Variables.make .SUFFIXES: .SUFFIXES: .cc .o .hh .y .l .pod .txt .1 .dep + $(exe): $(obs) $(CXX) -o $@ $^ $(LOADLIBES) -depend: ; # automatically by gnu make. clean: - rm -f $(exe) objects/*.o $(DOCDIR)/* core - $(MAKE) -C $(CCDIR) clean - $(MAKE) -C $(HEADERDIR) clean + rm -f $(exe) $(DOCDIR)/* core $(obs) + for SUBDIR in $(SUBDIRS); \ + do \ + $(MAKE) SUBDIR=$$SUBDIR -C $$SUBDIR clean;\ + done distclean: clean rm -f version.hh $(gencc) .GENERATE *~ deps/*.dep all: kompijl doc -# doc++ documentation of classes doc: $(MAKE) -C Documentation doc +# doc++ documentation of classes docpp: $(progdocs) -mkdir $(DOCDIR) doc++ -p -I -d $(DOCDIR) $^ -%.o: $(CCDIR)/%.cc - $(DODEP)\ - $(CXX) -c $(CXXFLAGS) $^ -o $(OBJECTDIR)/$@ - - $(OBJECTDIR)/%.o: $(CCDIR)/%.cc $(DODEP)\ $(CXX) -c $(CXXFLAGS) $(OUTPUT_OPTION) diff --git a/NEWS b/NEWS index 93baaa2807..696755258e 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +pl 24: + - Lyrics + - Commands in music-mode (an input feature) (there you are, Mats) pl 23: - TODO file inc'd @@ -6,9 +9,10 @@ pl 23: - error.pod,faq.pod - Markers - configure script - - scrapped VPATH - inputfile name in output. Internal changes: + - scrapped VPATH + - Make dependencies per .o - Split Input_* parsing steps to enable marking Bugfixes: - unconnected columns diff --git a/Sources.make b/Sources.make index afadfff786..573861e9b7 100644 --- a/Sources.make +++ b/Sources.make @@ -6,14 +6,16 @@ hdr= accidental.hh bar.hh beam.hh boxes.hh break.hh clef.hh clefitem.hh\ getcommand.hh glob.hh globvars.hh grouping.hh idealspacing.hh\ identifier.hh identparent.hh inputcommand.hh inputcommands.hh\ inputmusic.hh inputscore.hh inputstaff.hh item.hh key.hh keyitem.hh\ - keyword.hh leastsquares.hh lexer.hh linespace.hh linestaff.hh\ - localkeyitem.hh lookup.hh main.hh melodicstaff.hh meter.hh misc.hh\ + keyword.hh leastsquares.hh lexer.hh linespace.hh linepstaff.hh\ + localkeyitem.hh lookup.hh \ + lyriccolumn.hh lyricitem.hh lyricstaff.hh lyricwalker.hh\ + main.hh melodicstaff.hh meter.hh misc.hh\ molecule.hh moment.hh notehead.hh notename.hh offset.hh paper.hh\ parseconstruct.hh pcol.hh proto.hh pscore.hh pstaff.hh qlp.hh\ qlpsolve.hh request.hh rest.hh rhythmstaff.hh sccol.hh score.hh\ scoreline.hh script.hh scriptdef.hh simplestaff.hh simplewalker.hh\ slur.hh spanner.hh staff.hh staffcommands.hh staffelem.hh staffline.hh\ - stcol.hh stem.hh swalker.hh symbol.hh symtable.hh tex.hh textdef.hh\ + stcol.hh stem.hh staffwalker.hh symbol.hh symtable.hh tex.hh textdef.hh\ textitem.hh textspanner.hh timedescription.hh tstream.hh voice.hh mycc=bar.cc beam.cc boxes.cc break.cc calcideal.cc clef.cc\ @@ -21,15 +23,17 @@ mycc=bar.cc beam.cc boxes.cc break.cc calcideal.cc clef.cc\ getcommands.cc grouping.cc idealspacing.cc identifier.cc\ inputcommand.cc inputcommands.cc inputmusic.cc inputscore.cc\ inputstaff.cc item.cc key.cc keyitem.cc keyword.cc\ - leastsquares.cc lexerinit.cc linespace.cc linestaff.cc\ - localkeyitem.cc lookup.cc main.cc melodicstaff.cc meter.cc\ + leastsquares.cc lexerinit.cc linespace.cc linepstaff.cc\ + localkeyitem.cc lookup.cc\ + lyriccolumn.cc lyricitem.cc lyricstaff.cc lyricwalker.cc\ + main.cc melodicstaff.cc meter.cc\ misc.cc molecule.cc mylexer.cc note.cc notehead.cc notename.cc\ paper.cc pcol.cc pscore.cc pstaff.cc qlp.cc qlpsolve.cc\ request.cc rest.cc rhythmstaff.cc sccol.cc score.cc\ scoreline.cc scores.cc script.cc scriptdef.cc simpleprint.cc\ simplestaff.cc simplewalker.cc slur.cc spanner.cc staff.cc\ staffcommands.cc staffelem.cc staffline.cc stcol.cc stem.cc\ - swalker.cc symbol.cc symtable.cc table.cc tex.cc texbeam.cc\ + staffwalker.cc symbol.cc symtable.cc table.cc tex.cc texbeam.cc\ texslur.cc textdef.cc textitem.cc textspanner.cc\ timedescription.cc tstream.cc voice.cc warn.cc wordwrap.cc\ template1.cc template2.cc template3.cc template4.cc\ diff --git a/TODO b/TODO index 70e3590b8a..9b81ff8667 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,4 @@ + BUGS * first clef @@ -9,6 +10,10 @@ SEVERELY LACKING: INPUTLANGUAGE + * lexer condition stack + + * lose the $ and @? + * figured bass? * transposition @@ -19,6 +24,10 @@ INPUTLANGUAGE SMALLISH PROJECTS + * make spanner for staffsym + + * Lyric_req : Text_req, Rhythmic_req + * Lookup::tex_glissando, Lookup::tex_bracket, Lookup::tex_cresc, Lookup::tex_decresc (use texbeam.cc as an example.) @@ -45,7 +54,7 @@ SMALLISH PROJECTS * fix symbols in parser.o: `Warning: size of symbol' - * Viola clef (->jan?!) + * Viola clef DOC @@ -54,6 +63,9 @@ DOC * all errors FUTURE + * Command_req + + * scrap stem_request? * Text_pstaff/Lyric_staff @@ -71,6 +83,8 @@ FUTURE * Implement all requests + * merge key{item} & localkey{item} + * QLP for beams? * stacked slurs. diff --git a/Variables.make b/Variables.make index 768dcc5adb..8d7ce55b66 100644 --- a/Variables.make +++ b/Variables.make @@ -7,7 +7,7 @@ OPTIFLAG=-DNDEBUG -DNPRINT -O2 DEBUGFLAG=-g # turn off -pipe if linker doesn't support it -#EXTRACXXFLAGS=-pipe -Wall -W -Wmissing-prototypes +EXTRACXXFLAGS=-pipe -Wall -W -Wmissing-prototypes # # -lefence = ElectricFence. @@ -37,7 +37,7 @@ endif # version info MAJVER=0 MINVER=0 -PATCHLEVEL=23 +PATCHLEVEL=24 VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL) CXXVER=`$(CXX) --version` @@ -80,7 +80,7 @@ DNAME=$(PACKAGENAME)-$(VERSION) # distribution files. othersrc=lexer.l parser.y -SCRIPTS=make_version make_patch genheader clean +SCRIPTS=make_version make_patch genheader clearlily MAKFILES=Makefile Variables.make Sources.make Initial.make Generate.make \ configure OFILES=COPYING README NEWS TODO diff --git a/clean b/clean deleted file mode 100755 index 34eb6c982d..0000000000 --- a/clean +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -# unclobber current dir. -rm -v *.aux *.log `grep -li "^% Creator: LilyPond" *.out` *.orig *~ \ No newline at end of file diff --git a/clearlily b/clearlily new file mode 100755 index 0000000000..34eb6c982d --- /dev/null +++ b/clearlily @@ -0,0 +1,4 @@ +#!/bin/sh + +# unclobber current dir. +rm -v *.aux *.log `grep -li "^% Creator: LilyPond" *.out` *.orig *~ \ No newline at end of file diff --git a/configure b/configure index 37d5742e10..603a202fe6 100755 --- a/configure +++ b/configure @@ -1,7 +1,29 @@ #!/bin/sh + +NEEDFLOWERVER=1.0.21 +flowertar=flower-$NEEDFLOWERVER +here=`pwd` +if [ -x ../flower ] +then + echo Found flowerdir +else + cd ../ + if [ ! -f $flowertar ] + then + echo can't find $flowertar + exit 1; + fi + rm flower + ln -s $flowertar flower + +fi +echo Compiling Library +cd flower; make +cd $here + PREFIX="." echo '#define LIBDIR "'$PREFIX'/"'> hdr/config.hh touch depend -make -f Initial.make \ No newline at end of file +make -f Initial.make diff --git a/deps/Makefile b/deps/Makefile index 0d303b3d38..00140e7826 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -1,4 +1,6 @@ DISTFILES=Makefile dist: ln $(DISTFILES) $(DDIR)/$(SUBDIR) - \ No newline at end of file + +clean: + rm *.dep diff --git a/hdr/bar.hh b/hdr/bar.hh index 2a360b0d73..2df42d6503 100644 --- a/hdr/bar.hh +++ b/hdr/bar.hh @@ -13,7 +13,7 @@ struct Bar: Item { Bar(String type); - Molecule*brew_molecule()const; + Molecule*brew_molecule_p()const; }; #endif // BAR_HH diff --git a/hdr/beam.hh b/hdr/beam.hh index 96c65b12b0..548641aecb 100644 --- a/hdr/beam.hh +++ b/hdr/beam.hh @@ -38,7 +38,7 @@ struct Beam: public Directional_spanner { private: Molecule stem_beams(Stem *here, Stem *next, Stem *prev)const; void solve_slope(); - Molecule*brew_molecule()const; + Molecule*brew_molecule_p()const; }; /** Beam adjusts the stems its owns to make sure that they reach the beam and that point in the correct direction */ diff --git a/hdr/clefitem.hh b/hdr/clefitem.hh index ccedc4e9a7..9dbfffe5cd 100644 --- a/hdr/clefitem.hh +++ b/hdr/clefitem.hh @@ -21,7 +21,7 @@ struct Clef_item : Item { Clef_item(); void read(Clef); void read(String); - Molecule* brew_molecule()const; + Molecule* brew_molecule_p()const; }; #endif // CLEFITEM_HH diff --git a/hdr/keyitem.hh b/hdr/keyitem.hh index 72f9680e1a..05a6cf79c2 100644 --- a/hdr/keyitem.hh +++ b/hdr/keyitem.hh @@ -25,7 +25,7 @@ struct Keyitem : Item { void preprocess(); - Molecule* brew_molecule()const; + Molecule* brew_molecule_p()const; }; /** An item which places accidentals at the start of the line diff --git a/hdr/linepstaff.hh b/hdr/linepstaff.hh new file mode 100644 index 0000000000..3e88f8c915 --- /dev/null +++ b/hdr/linepstaff.hh @@ -0,0 +1,11 @@ +#include "pstaff.hh" + +struct Linestaff : PStaff { + + int nolines; + +/****************/ + + void brew_molecule_p(Real width); + Linestaff(int, PScore*); +}; diff --git a/hdr/linestaff.hh b/hdr/linestaff.hh deleted file mode 100644 index c11d781a14..0000000000 --- a/hdr/linestaff.hh +++ /dev/null @@ -1,11 +0,0 @@ -#include "pstaff.hh" - -struct Linestaff : PStaff { - - int nolines; - -/****************/ - - void brew_molecule(Real width); - Linestaff(int, PScore*); -}; diff --git a/hdr/localkeyitem.hh b/hdr/localkeyitem.hh index c8cca9d7c1..b4cf832c3e 100644 --- a/hdr/localkeyitem.hh +++ b/hdr/localkeyitem.hh @@ -25,7 +25,7 @@ struct Local_key_item : Item { void add(int oct, int pitch, int acc, Notehead*); void do_pre_processing(); - Molecule* brew_molecule()const; + Molecule* brew_molecule_p()const; }; #endif // LOCALKEYITEM_HH diff --git a/hdr/meter.hh b/hdr/meter.hh index 11166232ad..1557ce4709 100644 --- a/hdr/meter.hh +++ b/hdr/meter.hh @@ -14,7 +14,7 @@ struct Meter: Item { /****************/ Meter(Array args) ; - Molecule*brew_molecule() const; + Molecule*brew_molecule_p() const; }; #endif // METER_HH diff --git a/hdr/notehead.hh b/hdr/notehead.hh index 18612b06c6..a032ca1273 100644 --- a/hdr/notehead.hh +++ b/hdr/notehead.hh @@ -30,7 +30,7 @@ struct Notehead : public Item void print()const; static int compare(Notehead*&a, Notehead*&b) ; - Molecule* brew_molecule()const; + Molecule* brew_molecule_p()const; }; /** takes care of: diff --git a/hdr/parseconstruct.hh b/hdr/parseconstruct.hh index 6a22127a38..9bc9434ffc 100644 --- a/hdr/parseconstruct.hh +++ b/hdr/parseconstruct.hh @@ -17,7 +17,9 @@ void set_plet(int,int); Staff * get_new_rhythmstaff(); Voice_element * get_note_element(String,int * ,int *); Voice_element* get_rest_element(String,int *); +Voice_element* get_word_element(Text_def*, int*); Staff * get_new_melodicstaff(); +Staff * get_new_lyricstaff(); void add_requests( Voice_element*v, Array&req); Request* get_request(char); void set_text_style(String); @@ -25,7 +27,7 @@ Script_def* get_scriptdef(char); Text_def*get_text(String s); Request*get_script_req(int d , Script_def*def); Request*get_text_req(int d , Text_def*def); - - +Voice_element*get_command_element(Input_command*); +Voice_element*get_barcheck_element(); #endif // PARSECONSTRUCT_HH diff --git a/hdr/pcol.hh b/hdr/pcol.hh index a0f2a87624..1d3ff34ca8 100644 --- a/hdr/pcol.hh +++ b/hdr/pcol.hh @@ -79,7 +79,7 @@ private: */ #include "compare.hh" -instantiate_compare(const PCol &, PCol::compare); +instantiate_compare(PCol &, PCol::compare); #endif diff --git a/hdr/proto.hh b/hdr/proto.hh index 8be03e72f7..0d32486ed4 100644 --- a/hdr/proto.hh +++ b/hdr/proto.hh @@ -11,7 +11,6 @@ #include "fproto.hh" #include "real.hh" - struct Absdynamic_req; struct Accidental; struct Atom; @@ -69,6 +68,7 @@ struct Slur_req; struct Span_req; struct Spanner; struct Staff; +struct Staff_command_req; struct Col_configuration; struct Staff_column; struct Stem; @@ -103,5 +103,6 @@ struct Time_description; struct Script_def; struct Text_def; struct Text_req; +struct Lyric_req; struct Melodic_req; #endif // PROTO_HH diff --git a/hdr/pstaff.hh b/hdr/pstaff.hh index 78a68fb306..87bd919c67 100644 --- a/hdr/pstaff.hh +++ b/hdr/pstaff.hh @@ -15,7 +15,7 @@ struct PStaff { PointerList its; /****************/ - virtual void brew_molecule(Real width)=0; // maybe overkill + virtual void brew_molecule_p(Real width)=0; // maybe overkill void add(Item*i); PStaff(PScore*); virtual ~PStaff(); diff --git a/hdr/request.hh b/hdr/request.hh index 12382d0bf7..c401fcdd9d 100644 --- a/hdr/request.hh +++ b/hdr/request.hh @@ -6,7 +6,7 @@ #include "string.hh" #include "moment.hh" -/// a voice element wants something printed +/// Hungarian postfix: req struct Request { Voice_element*elt_l_; @@ -31,11 +31,14 @@ struct Request { virtual Beam_req *beam() { return 0 ; } virtual Slur_req *slur() { return 0 ; } virtual Rhythmic_req*rhythmic() { return 0; } + virtual Lyric_req* lreq_l() { return 0; } virtual Melodic_req *melodic() { return 0; } virtual Mark_req * mark() { return 0; } + virtual Staff_command_req* command() { return 0;} }; /** + a voice element wants something printed. see lilygut page */ @@ -60,6 +63,30 @@ struct Rhythmic_req : virtual Request { }; +///Put a text above or below (?) this staff. +struct Text_req : virtual Request { + int dir_i_; + Text_def *tdef_p_; + /****************/ + Text_req* text() { return this; } + virtual void print() const; + Request *clone()const; + + Text_req(int d, Text_def*); + ~Text_req(); + Text_req(Text_req const&); +}; + + +struct Lyric_req : public Rhythmic_req, Text_req { + + Lyric_req(Text_def* t_p); + void print() const; + Lyric_req* lreq_l() { return this; } + Request* clone() const; +}; + + struct Melodic_req :virtual Request { /// 0 is c @@ -167,19 +194,6 @@ struct Script_req : Request { slurs and brackets, so this also a request */ -///Put a text above or below (?) this staff. -struct Text_req : Request { - int dir; - Text_def *spec; - /****************/ - Text_req*text() { return this; } - virtual void print() const; - Request *clone()const; - Text_req(int d, Text_def*); - ~Text_req(); - Text_req(Text_req const&); -}; - /// designate this spot with a name. struct Mark_req : Request { String mark_str_; @@ -190,6 +204,15 @@ struct Mark_req : Request { Request *clone() const; }; +struct Staff_command_req : Request { + Input_command * com_p_; + Staff_command_req* command() { return this;} + Staff_command_req(Staff_command_req const&); + ~Staff_command_req(); + Staff_command_req(Input_command*); + Request*clone()const; + void print()const; +}; #if 0 @@ -285,6 +308,10 @@ struct Spacing_req { struct Glissando_req : Span_req { }; - +struct Stemdir_req : Request { + int which; +}; +struct Group_change_req : Request { +}; #endif #endif diff --git a/hdr/rest.hh b/hdr/rest.hh index e13c540212..d3f944f57e 100644 --- a/hdr/rest.hh +++ b/hdr/rest.hh @@ -20,7 +20,7 @@ struct Rest : public Item Rest(int dur,int dots); void print()const; - Molecule* brew_molecule()const; + Molecule* brew_molecule_p()const; }; /** takes care of: diff --git a/hdr/script.hh b/hdr/script.hh index 7b6cf37b24..be21a60829 100644 --- a/hdr/script.hh +++ b/hdr/script.hh @@ -25,7 +25,7 @@ struct Script : Item{ void set_default_dir(); void set_default_pos(); Symbol symbol()const; - Molecule* brew_molecule()const; + Molecule* brew_molecule_p()const; virtual void do_post_processing(); virtual void do_pre_processing(); Script(Script_req*, Item*,int,Stem*p=0); diff --git a/hdr/simplestaff.hh b/hdr/simplestaff.hh index bdd1f06136..531f994d6e 100644 --- a/hdr/simplestaff.hh +++ b/hdr/simplestaff.hh @@ -10,7 +10,7 @@ #include "key.hh" #include "stcol.hh" #include "staff.hh" -#include "swalker.hh" +#include "staffwalker.hh" /* mega-stupido staffs and cols: they do notes one at each moment. @@ -34,6 +34,7 @@ struct Simple_column : Staff_column { Beam_req *beam_; Simple_staff* staff_l_; Text_req *text_; + Lyric_req* lreq_p_; /****************/ Slur_req * find_slur(Voice *); @@ -52,7 +53,7 @@ struct Simple_column : Staff_column { /// Simple staff: one voicegroup at a time struct Simple_staff : Staff { /// indirection to the PStaff. - PStaff *theline; + PStaff *theline_l_; /****************/ Staff_column*create_col(Score_column*); diff --git a/hdr/slur.hh b/hdr/slur.hh index 8c0cbd4ebe..26bb2ff36e 100644 --- a/hdr/slur.hh +++ b/hdr/slur.hh @@ -30,7 +30,7 @@ struct Slur : Directional_spanner { Spanner* do_break_at( PCol*, PCol*) const; void process(); private: -Molecule*brew_molecule()const; +Molecule*brew_molecule_p()const; }; #endif // SLUR_HH diff --git a/hdr/staffelem.hh b/hdr/staffelem.hh index e48170d4d2..3eed7dfba7 100644 --- a/hdr/staffelem.hh +++ b/hdr/staffelem.hh @@ -43,7 +43,7 @@ struct Staff_elem { protected: /// generate the molecule - virtual Molecule* brew_molecule()const=0; + virtual Molecule* brew_molecule_p()const=0; ///executed directly after the item is added to the PScore virtual void do_add_processing(); /// do calculations before determining horizontal spacing diff --git a/hdr/staffwalker.hh b/hdr/staffwalker.hh new file mode 100644 index 0000000000..d9945229f2 --- /dev/null +++ b/hdr/staffwalker.hh @@ -0,0 +1,47 @@ + +/* + staffwalker.hh -- part of LilyPond + + (c) 1996,97 Han-Wen Nienhuys +*/ + +#ifndef STAFFWALKER_HH +#define STAFFWALKER_HH + +#include "staff.hh" + +struct Staff_walker : public PCursor { + Staff * staff_; + PScore * pscore_; + + int break_status; + + /****************/ + + int priority() const; // Command + Moment when() const; + virtual ~Staff_walker(); + Staff_walker(Staff*, PScore*); + void process() ; + void process_command(Command *); + void operator++(int); + + /**************** + VIRTUAL + ****************/ + + /// every time ++ is called + virtual void reset(){} + virtual void process_requests()=0; + virtual void do_TYPESET_command(Command*)=0; + virtual void do_INTERPRET_command(Command*)=0 ; +private: + Staff_walker(Staff_walker const&); +}; +/** + manage run-time info when walking staffcolumns such as: key, + meter, pending beams & slurs + */ + +#endif // STAFFWALKER_HH + diff --git a/hdr/stem.hh b/hdr/stem.hh index 977a719ae9..8788d5a53d 100644 --- a/hdr/stem.hh +++ b/hdr/stem.hh @@ -67,7 +67,7 @@ struct Stem : public Item { Interval width() const; - Molecule* brew_molecule() const; + Molecule* brew_molecule_p() const; }; /** takes care of: diff --git a/hdr/swalker.hh b/hdr/swalker.hh deleted file mode 100644 index d224477b60..0000000000 --- a/hdr/swalker.hh +++ /dev/null @@ -1,42 +0,0 @@ - -/* - swalker.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef SWALKER_HH -#define SWALKER_HH - -#include "staff.hh" - -struct Staff_walker : public PCursor { - Staff * staff_; - PScore * pscore_; - - int break_status; - - /****************/ - - int priority() const; // Command - Moment when() const; - virtual ~Staff_walker(); - Staff_walker(Staff*, PScore*); - void process() ; - void process_command(Command *); - void operator++(int); - /// every time ++ is called - virtual void reset()=0; - virtual void process_requests()=0; - virtual void do_TYPESET_command(Command*)=0; - virtual void do_INTERPRET_command(Command*)=0 ; -private: - Staff_walker(Staff_walker const&); -}; -/** - manage run-time info when walking staffcolumns such as: key, - meter, pending beams & slurs - */ - -#endif // SWALKER_HH - diff --git a/hdr/textdef.hh b/hdr/textdef.hh index 2befb6bb4d..6682221761 100644 --- a/hdr/textdef.hh +++ b/hdr/textdef.hh @@ -8,17 +8,20 @@ #define TEXTDEF_HH #include "string.hh" +#include "proto.hh" + +struct Text_def { + int align_i_; + String text_str_; + String style_str_; -struct Text_def { - int align; - String text; - String style; /*****************/ Text_def(); - void print()const; - Atom create(Paperdef*)const; + virtual void print() const; + virtual Atom create_atom(Paperdef*) const; }; + #endif // TEXTDEF_HH diff --git a/hdr/textitem.hh b/hdr/textitem.hh index ffeeafbb82..bd4ea924d2 100644 --- a/hdr/textitem.hh +++ b/hdr/textitem.hh @@ -10,16 +10,16 @@ #include "textdef.hh" #include "item.hh" -struct Text_item : Item{ - int pos; - int staffsize; - int dir; - Text_def*specs; +struct Text_item : Item { + int pos_i_; + int staffsize_i_; + int dir_i_; + Text_def* tdef_l_; /****************/ - void set_default_pos(); - Molecule* brew_molecule()const; + virtual void set_default_pos(); + Molecule* brew_molecule_p() const; void do_pre_processing(); Text_item(Text_req*,int); diff --git a/hdr/textspanner.hh b/hdr/textspanner.hh index 4baf832a39..81c8b87c32 100644 --- a/hdr/textspanner.hh +++ b/hdr/textspanner.hh @@ -19,7 +19,7 @@ struct Text_spanner : Spanner { /****************/ virtual void do_pre_processing(); virtual void do_post_processing(); - Molecule* brew_molecule()const; + Molecule* brew_molecule_p()const; virtual Interval height() const ; void print() const; virtual Spanner* do_break_at(PCol*,PCol*)const; diff --git a/input/Makefile b/input/Makefile index 439a77eddc..cf9a3c5d6a 100644 --- a/input/Makefile +++ b/input/Makefile @@ -1,7 +1,7 @@ default: ; DISTFILES=Makefile kortjakje.ly pavane.ly maartje.ly\ - cadenza.ly scales.ly standchen.lily + cadenza.ly scales.ly standchen.lily twinkle.ly dist: ln $(DISTFILES) $(DDIR)/$(SUBDIR) diff --git a/input/kortjakje.ly b/input/kortjakje.ly index fa54120b50..9b2054f83d 100644 --- a/input/kortjakje.ly +++ b/input/kortjakje.ly @@ -1,6 +1,7 @@ -% "Ah, je vous dirai, maman" (Mozart) +% "Ah, vous dirais-je, maman" (Mozart, KV 265) % % bare bones version. (written down from memory :-) +% for lyrics, see twinkle.ly % the % is a comment. diff --git a/input/pavane.ly b/input/pavane.ly index ec31ea1aa0..b820506b60 100644 --- a/input/pavane.ly +++ b/input/pavane.ly @@ -33,8 +33,8 @@ staff {melodic e4 fis4 () [fis e fis gis] | cis4 `b4()`b8 r8 r4^"tr\`es soutenu" | - r4 r4 | %2/4 meter - + \command { \meter 2 *4 } r4 r4 | + \command { \meter 4 *4 } 'cis4_"\dyn ppp" 'd4 () ['d 'cis 'd 'e] | a4 gis2. | a4 b4()[b a b 'cis] | @@ -70,7 +70,9 @@ staff {melodic | [f a 'c] \plet{1/1} 'e4-^ () ['e f-> a-> 'c->] | 'e4._"sf" 'e8()'c4 r4 | r1 | - r4 r4-\fermata + \command { \meter 2 *4 } r4 r4-\fermata + \command { \meter 4 *4 } + \octave { ' } |d2( [)d e cis `b] | `a4 [`b cis] [cis `b] `b4 | @@ -104,13 +106,10 @@ score { commands { meter 4 *4 skip 18:0 - meter 2 *4 skip 1:0 - meter 4 *4 skip 20:0 bar "|:" skip 9:0 - meter 2* 4 skip 1:0 bar ":|" meter 4* 4 diff --git a/input/standchen.lily b/input/standchen.lily index 9af02f0a5d..a7e4d370eb 100644 --- a/input/standchen.lily +++ b/input/standchen.lily @@ -30,9 +30,9 @@ %%1 melodie = music { $ \duration{ 8 } - r_"pp" { [ d `a-^ } f-^ { d `a-^ } f-^ { d `a-^ ] } + r_"pp" { [ d `a-| } f-| { d `a-| } f-| { d `a-| ] } %%2 - r { [ d `bes-^ } f-^ { d `bes-^ } f-^ { d `bes-^ ] } + r { [ d `bes-| } f-| { d `bes-| } f-| { d `bes-| ] } %%3 r_"simile" { [ d `bes } e { d `bes } e { d `bes ] } %%4 @@ -365,7 +365,7 @@ score { } } commands { - meter 3 4 + meter 3*4 skip 4:0 bar ":|" skip 32:0 diff --git a/input/twinkle.ly b/input/twinkle.ly new file mode 100644 index 0000000000..2cd786c3d6 --- /dev/null +++ b/input/twinkle.ly @@ -0,0 +1,159 @@ +% "Ah, vous dirais-je, maman" +% "Altijd is Kortjakje ziek" +% "Twinkle twinkle little star" +% + + +melodie = music { + $ + c c | g g | a a | g g | + f f | e e | d d8.( e16 | )c2 | % :| + + g g | f f | e e | d d | +% g g | f f | e( [f0*32 e0*32 d0*32] e8. f16 | e )d | c c | + g g | f f | e( e8. f16 | e )d | + + c c | g g | a a | g g | + f f | e e | d d8.( e16 | )c2 % :| + $ +} + +begeleiding = music { + $ + \octave{`} + c 'c | 'e 'c | 'f 'c | 'e 'c | + 'd b | 'c a | f g | c2 | + + 'e g | d g | 'c g | b g | +% 'e g | 'd g | 'c 'c8.( 'd16 | \voice{ 'c )b } \voice{ g2 } | + 'e g | 'd g | 'c 'c8.( 'd16 | 'c )b | + + c 'c | 'e 'c | 'f 'c | 'e 'c | + 'd b | 'c a | f g | c2 + $ +} + +tekst = music { + @ + Al- tijd is Kort- jak- je ziek,2 + midden in_de week maar 's_zon- dags niet.2 + 's_Zon- dags gaat ze naar de kerk,2 + met een boek vol zil- ver werk.2 + Al- tijd is Kort- jak- je ziek,2 + midden in_de week maar 's_zon- dags niet.2 + @ +} + +he_gedraagje_tekst = music { + @ + Al- tijd zuigt Bill Gates mijn piek,2 + "\TeX" is slecht- ser dan mu- ziek.2 + 's_Zon- dags gaat het door een raam,2 + Weet dat ik me er- voor schaam.2 + Al- tijd zuigt Bill Gates mijn piek,2 + "\TeX" is slecht- ser dan mu- ziek.2 + @ +} + +texte = music { + @ + \textstyle "italic" + Ah! vous dir- ai_- je ma man2 + Ce qui cau- se mon tour- ment2 + Pa- pa veut que je rai- sonne2 + Comme un- e grand- e per- sonne2 + Moi je dis que les bon- bons2 + Val- ent mieux que la rai- son2 + @ +} + +text1 = music { + @ + \textstyle "roman" + Twin- kle, twin- kle, lit- tle star,2 + How I won- der what you are.2 + Up a- bove the world so high,2 + Like a dia- mond in the sky.2 + Twin- kle, twin- kle, lit- tle star,2 + How I won- der what you are!2 + @ +} + +text2 = music { + @ + \textstyle "roman" + When the bla- zing sun is gone,2 + When he no- thing shine- s upon,2 + Then you show your lit- tle light,2 + Twin- kle, twin- kle, all the night.2 + Twin- kle, twin- kle, lit- tle star,2 + How I won- der what you are!2 + @ +} + +text3 = music { + @ + \textstyle "roman" + Then the tra- veler in the dark2 + Thanks you for your ti- ny spark;2 + He could not see which way to_go,2 + If you did not twin- kle so.2 + Twin- kle, twin- kle, lit- tle star,2 + How I won- der what you are!2 + @ +} + +mstaf = staff { + melodic + music { melodie } + commands { clef violin } +} + +bass_staf = staff { + melodic + music { begeleiding } + commands { clef bass } +} + + +dutch_staf = staff { + lyric + music { tekst } + music {he_gedraagje_tekst} +} + +french_staf = staff { + lyric + music { texte } +} + +english_staf = staff { + lyric + music { text1 } + music { text2 } + music { text3 } +} + +tstaf = staff { + lyric + music { tekst } + music { texte } +} + + +score { + staff { mstaf } + staff { dutch_staf } + staff { french_staf } + staff { english_staf } + staff { bass_staf } + paper { + unitspace 2.5cm % a whole note takes 2.5 cm ideally. + } + commands { + meter 2 * 4 + skip 24:0 + bar "||" + } +} + diff --git a/objects/Makefile b/objects/Makefile index 228fde37ed..479dbfe1c2 100644 --- a/objects/Makefile +++ b/objects/Makefile @@ -1,3 +1,6 @@ DISTFILES=Makefile dist: - ln $(DISTFILES) $(DDIR)/$(SUBDIR) \ No newline at end of file + ln $(DISTFILES) $(DDIR)/$(SUBDIR) + +clean: + rm *.o \ No newline at end of file diff --git a/src/bar.cc b/src/bar.cc index edfd6a8e3c..b18c500e62 100644 --- a/src/bar.cc +++ b/src/bar.cc @@ -10,7 +10,7 @@ Bar::Bar( String t) type = t; } Molecule* -Bar::brew_molecule()const +Bar::brew_molecule_p()const { Symbol s = paper()->lookup_p_->bar(type); Molecule* output = new Molecule(Atom(s)); diff --git a/src/beam.cc b/src/beam.cc index c65dc58115..c36ca67436 100644 --- a/src/beam.cc +++ b/src/beam.cc @@ -255,7 +255,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const Molecule* -Beam::brew_molecule() const return out; +Beam::brew_molecule_p() const return out; { Real inter=paper()->internote(); out = new Molecule; diff --git a/src/clefitem.cc b/src/clefitem.cc index c6b8f09d0b..d5237513a2 100644 --- a/src/clefitem.cc +++ b/src/clefitem.cc @@ -26,7 +26,7 @@ Clef_item::read(Clef k) } Molecule* -Clef_item::brew_molecule()const +Clef_item::brew_molecule_p()const { String t = type; if (change) diff --git a/src/inputcommands.cc b/src/inputcommands.cc index 968d29c9a9..ef2014604c 100644 --- a/src/inputcommands.cc +++ b/src/inputcommands.cc @@ -118,6 +118,11 @@ Input_cursor::find_moment(Moment w) /****************/ +void +Input_commands::find_moment(Moment m) +{ + ptr.find_moment(m); +} Input_commands::Input_commands(Input_commands const&src) : ptr(src.ptr) @@ -155,7 +160,7 @@ Input_commands::add(Input_command c, Assoc &marks_assoc_r) { String s(c.args[0]); if (s == "CADENZA") { - ptr->tdescription_.set_cadenza(c.args[1]); + ptr->tdescription_.set_cadenza((int)c.args[1]); } if (s == "PARTIAL") { ptr->setpartial(c.args[1]); } else if (s == "GROUPING") { diff --git a/src/inputstaff.cc b/src/inputstaff.cc index c121984cd0..70d91c669f 100644 --- a/src/inputstaff.cc +++ b/src/inputstaff.cc @@ -7,6 +7,7 @@ #include "staffcommands.hh" #include "melodicstaff.hh" #include "rhythmstaff.hh" +#include "lyricstaff.hh" #include "staff.hh" void @@ -38,6 +39,8 @@ Input_staff::parse(Score*score_l) p = new Melodic_staff; else if (type == "rhythmic") p = new Rhythmic_staff; + else if (type == "lyric") + p = new Lyric_staff; p->score_l_ = score_l; p->define_spot_str_ = define_spot_str_; diff --git a/src/keyitem.cc b/src/keyitem.cc index 29b1f25e5c..3a80c28e1f 100644 --- a/src/keyitem.cc +++ b/src/keyitem.cc @@ -31,7 +31,7 @@ Keyitem::add(int p, int a) Molecule* -Keyitem::brew_molecule()const +Keyitem::brew_molecule_p()const { Molecule*output = new Molecule; Real inter = paper()->interline()/2; diff --git a/src/lexer.l b/src/lexer.l index 2b15b352e8..1d758796b2 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -20,6 +20,7 @@ %x notes %x incl %x quote +%x lyrics @@ -27,6 +28,9 @@ A [a-zA-Z] AA {A}|_ N [0-9] AN {AA}|{N} +PUNCT [?!,.:;] +ACCENT [\\'"^] +TEX {AA}|-|{PUNCT}|{ACCENT} WORD {A}{AN}* ALPHAWORD {A}+ @@ -39,6 +43,8 @@ RESTNAME r|s|p NOTECOMMAND \\{WORD} NOTENAME {ALPHAWORD} DOTS \.+ +LYRICS {TEX}+ +COMMENT [%#].*\n %% @@ -46,6 +52,10 @@ DOTS \.+ BEGIN(notes); } +\@ { + BEGIN(lyrics); +} + {RESTNAME} { const char *s = YYText(); yylval.string = new String (s); @@ -95,8 +105,7 @@ DOTS \.+ yylval.i = String(YYText()).value(); return INT; } -[%#].*\n { - +{COMMENT} { } [ \t\n]+ { @@ -114,13 +123,8 @@ DOTS \.+ yylval.string = new String(s); return STRING; } -[()\[\]|/.^>_-] { - return yylval.c = YYText()[0]; - -} . { - String s("lexer error: illegal character found: " + String(YYText())); - yyerror(s); + return yylval.c = YYText()[0]; } \" { @@ -135,6 +139,61 @@ DOTS \.+ return STRING; } +{DOTS} { + yylval.i = strlen(YYText()); + return DOTS; +} +{INT} { + yylval.i = String(YYText()).value(); + return INT; +} +{NOTECOMMAND} { + String c = YYText() +1; + mtor << "\\word: " << YYText()+1<\"[^\"]*\" { + String s (YYText()+1); + s = s.left(s.len()-1); + yylval.string = new String(s); + return STRING; +} +{LYRICS} { + String s (YYText()); + int i = 0; + while ((i=s.pos("_")) != 0)// ugh. Whats this. + *((char*)s.cptr() + i - 1) = ' '; + if ((i=s.pos("\\,")) !=0) + { + *((char*)s.cptr() + i) = 'c'; + s = s.left(i+1) + " " + s.right(s.len()-i-1); + } + yylval.string = new String(s); + return STRING; +} +\| { + return YYText()[0]; +} +{COMMENT} { + +} +[ \t\n]+ { +} +@ { + BEGIN(INITIAL); +} + <> { mtor << "<>"; @@ -193,7 +252,7 @@ include { BEGIN(incl); } } -%.* { +{COMMENT} { //ignore } . { diff --git a/src/linepstaff.cc b/src/linepstaff.cc new file mode 100644 index 0000000000..ef2c55dfbc --- /dev/null +++ b/src/linepstaff.cc @@ -0,0 +1,27 @@ +#include "linepstaff.hh" +#include "molecule.hh" +#include "symbol.hh" +#include "lookup.hh" +#include "dimen.hh" +#include "paper.hh" +#include "pscore.hh" + +Linestaff::Linestaff(int l, PScore *s) + : PStaff(s) +{ + nolines = l; +} + +void +Linestaff::brew_molecule_p(Real width) +{ + Atom a = pscore_l_->paper_l_->lookup_p_->linestaff(nolines,width); + stafsym_p_ = new Molecule(a); +} + + + + + + + diff --git a/src/linestaff.cc b/src/linestaff.cc deleted file mode 100644 index f9430e9b73..0000000000 --- a/src/linestaff.cc +++ /dev/null @@ -1,27 +0,0 @@ -#include "linestaff.hh" -#include "molecule.hh" -#include "symbol.hh" -#include "lookup.hh" -#include "dimen.hh" -#include "paper.hh" -#include "pscore.hh" - -Linestaff::Linestaff(int l, PScore *s) - : PStaff(s) -{ - nolines = l; -} - -void -Linestaff::brew_molecule(Real width) -{ - Atom a = pscore_l_->paper_l_->lookup_p_->linestaff(nolines,width); - stafsym_p_ = new Molecule(a); -} - - - - - - - diff --git a/src/localkeyitem.cc b/src/localkeyitem.cc index d23b26277f..b210dbdac3 100644 --- a/src/localkeyitem.cc +++ b/src/localkeyitem.cc @@ -27,7 +27,7 @@ Local_key_item::do_pre_processing() accs.sort(Local_acc::compare); } Molecule* -Local_key_item::brew_molecule()const +Local_key_item::brew_molecule_p()const { Molecule* output = new Molecule; diff --git a/src/lookup.cc b/src/lookup.cc index 200ae0994b..befa542706 100644 --- a/src/lookup.cc +++ b/src/lookup.cc @@ -29,7 +29,7 @@ Lookup::add(String s, Symtable*p) } Symbol -Lookup::text( String style, String text , int dir) +Lookup::text(String style, String text, int dir) { Array a; @@ -66,6 +66,7 @@ Lookup::rest(int j) { return (*symtables_)("rests")->lookup(String(j)); } + Symbol Lookup::fill(Box b) { @@ -73,6 +74,7 @@ Lookup::fill(Box b) s.dim = b; return s; } + Symbol Lookup::accidental(int j) { @@ -143,7 +145,7 @@ Lookup::linestaff(int lines, Real wid) { Symbol s; s.dim.x = Interval(0,wid); - Real dy=(lines-1)*internote()*2; + Real dy = (lines >0) ? (lines-1)*internote()*2 : 0; s.dim.y = Interval(0,dy); Array a; @@ -152,7 +154,7 @@ Lookup::linestaff(int lines, Real wid) s.tex = (*symtables_)("param")->lookup("linestaf").tex; s.tex = substitute_args(s.tex, a); - + return s; } diff --git a/src/lyriccolumn.cc b/src/lyriccolumn.cc new file mode 100644 index 0000000000..6420c4b3d9 --- /dev/null +++ b/src/lyriccolumn.cc @@ -0,0 +1,77 @@ +#include "request.hh" +#include "voice.hh" +#include "staffwalker.hh" +#include "debug.hh" +#include "staff.hh" +#include "command.hh" +//#include "simplestaff.hh" +#include "lyricstaff.hh" +#include "lyriccolumn.hh" +#include "sccol.hh" +//#include "simplewalker.hh" +#include "pscore.hh" +#include "paper.hh" + + +Lyric_column::Lyric_column(Score_column*s, Lyric_staff* lstaff_l) + : Staff_column(s) +{ + lstaff_l_ = lstaff_l; +} + +void +Lyric_column::process_requests() +{ + for (int i = 0 ; i < v_elts.size(); i ++) { + for (iter_top(v_elts[i]->reqs,j); j.ok(); j++) { + Request* req_l = j; + if (req_l->barcheck()) { + if (tdescription_->whole_in_measure) { + error("Barcheck failed, " + tdescription_->str()); + } + } +#if 0 + if (req_l->rhythmic()){ + notes.add(rq->rhythmic()); + } +#endif + if (req_l->lreq_l()) { + winfo_array_.add(req_l->lreq_l()); + } + } + } +} + +Interval itemlist_width(const Array &its); + +void +Lyric_column::typeset_item(Item *i, int breakst) +{ + assert(i); + + lstaff_l_->pscore_l_->typeset_item(i, score_column_l_->pcol_l_, + lstaff_l_->line_pstaff_p_,breakst); + + if (breakst == BREAK_PRE - BREAK_PRE) { + + Array to_move( + lstaff_l_->pscore_l_->select_items(lstaff_l_->line_pstaff_p_, + score_column_l_->pcol_l_->prebreak_p_)); + Interval column_wid = itemlist_width(to_move); + assert(!column_wid.empty()); + + for (int j=0; j < to_move.size(); j++) { + to_move[j]->translate(Offset(-column_wid.right, 0)); + } + } +} + +Word_info::Word_info() +{ + lreq_l_ = 0; +} + +Word_info::Word_info(Lyric_req* lreq_l) +{ + lreq_l_ = lreq_l; +} diff --git a/src/lyricitem.cc b/src/lyricitem.cc new file mode 100644 index 0000000000..b0afc3000b --- /dev/null +++ b/src/lyricitem.cc @@ -0,0 +1,20 @@ +#include "request.hh" +#include "paper.hh" +#include "lyricitem.hh" +#include "stem.hh" +#include "molecule.hh" +#include "lookup.hh" +#include "textdef.hh" + +Lyric_item::Lyric_item(Lyric_req* lreq_l, int voice_count_i) + : Text_item(lreq_l,0) +{ + pos_i_ = voice_count_i * -4 ; // fontsize dependant. TODO + dir_i_ = -1; +} + +void +Lyric_item::do_pre_processing() +{ + // override Text_item +} diff --git a/src/lyricstaff.cc b/src/lyricstaff.cc new file mode 100644 index 0000000000..51b802e077 --- /dev/null +++ b/src/lyricstaff.cc @@ -0,0 +1,47 @@ +#include "request.hh" +#include "voice.hh" +#include "staffwalker.hh" +#include "debug.hh" +#include "staff.hh" +#include "command.hh" +#include "lyricstaff.hh" +#include "lyriccolumn.hh" +#include "linepstaff.hh" +#include "sccol.hh" +#include "lyricwalker.hh" +#include "pscore.hh" + + + +Lyric_staff::Lyric_staff() +{ + line_pstaff_p_ = 0; +} + +Staff_column* +Lyric_staff::create_col(Score_column*s) +{ + return new Lyric_column(s,this); +} + +void +Lyric_staff::set_output(PScore*ps) +{ + line_pstaff_p_ = new Linestaff(0,ps); + pscore_l_ = ps; + pscore_l_->add(line_pstaff_p_); +} + +void +Lyric_staff::walk() +{ + for (Lyric_walker lcols(this); lcols.ok(); lcols++) { + lcols.lcol_l()->process_requests();// TODO + lcols.process(); + } +} +Staff * +get_new_lyricstaff() +{ + return new Lyric_staff; +} diff --git a/src/lyricwalker.cc b/src/lyricwalker.cc new file mode 100644 index 0000000000..bd8ac0e40d --- /dev/null +++ b/src/lyricwalker.cc @@ -0,0 +1,72 @@ +// +// what about +// #include "flower.hh" +// #include "lily.hh" +// +// or should we first devide lily/src up ? +// HWN: huh? + +#include "textspanner.hh" +#include "script.hh" +#include "request.hh" +#include "voice.hh" +#include "pscore.hh" +#include "lyricstaff.hh" +#include "lyricwalker.hh" +#include "sccol.hh" +#include "debug.hh" +#include "lyricitem.hh" + +void +Lyric_walker::do_word(Word_info) +{ +} + +void +Lyric_walker::do_INTERPRET_command(Command* ) +{ +// WARN << "command for Lyrics found\n"; +} + +void +Lyric_walker::do_TYPESET_command(Command* ) +{ +// WARN << "command for Lyrics found\n"; +} + +void +Lyric_walker::process_requests() +{ + Lyric_column* lcol_l = Lyric_walker::lcol_l(); + + for (int i = 0; i < lcol_l->winfo_array_.size(); i++) { + lcol_l->typeset_item(new Lyric_item(lcol_l->winfo_array_[i].lreq_l_, i)); + } + +} + +Lyric_walker::Lyric_walker(Lyric_staff* lstaff_l) + : Staff_walker(lstaff_l, lstaff_l->line_pstaff_p_->pscore_l_) +{ + reset(); +} + + + +Lyric_staff* +Lyric_walker::lstaff_l() +{ + return (Lyric_staff*)staff_; +} + +Lyric_column* +Lyric_walker::lcol_l() +{ + return (Lyric_column*) *(*this); +} + +void +Lyric_walker::reset() +{ +} + diff --git a/src/melodicstaff.cc b/src/melodicstaff.cc index b20e3a6bf2..e533fd3143 100644 --- a/src/melodicstaff.cc +++ b/src/melodicstaff.cc @@ -5,7 +5,7 @@ #include "notehead.hh" #include "paper.hh" #include "molecule.hh" -#include "linestaff.hh" +#include "linepstaff.hh" #include "rhythmstaff.hh" #include "sccol.hh" #include "localkeyitem.hh" @@ -17,7 +17,7 @@ const int NO_LINES=5; void Melodic_staff::set_output(PScore*ps) { - theline = new Linestaff(NO_LINES,ps); + theline_l_ = new Linestaff(NO_LINES,ps); // theline_l_ is added to pscore later. Simple_staff::set_output(ps); } diff --git a/src/meter.cc b/src/meter.cc index fb8224ec07..ba653dae2a 100644 --- a/src/meter.cc +++ b/src/meter.cc @@ -10,7 +10,7 @@ Meter::Meter(Arraya) } Molecule* -Meter::brew_molecule()const +Meter::brew_molecule_p()const { Symbol s = paper()->lookup_p_->meter(args); return new Molecule(Atom(s)); diff --git a/src/mylexer.cc b/src/mylexer.cc index 824a1ac809..42da95740b 100644 --- a/src/mylexer.cc +++ b/src/mylexer.cc @@ -16,12 +16,14 @@ static Keyword_ent the_key_tab[]={ "cadenza", CADENZA, "clef", CLEF, "cm", CM, + "command", COMMAND, "commands", COMMANDS, "duration", DURATIONCOMMAND, "geometric", GEOMETRIC, "goto", GOTO, "in", IN, "key", KEY, + "lyric", LYRIC, "mark", MARK, "melodic", MELODIC, "meter", METER, diff --git a/src/note.cc b/src/note.cc index 5c132038bc..0cd2c478a6 100644 --- a/src/note.cc +++ b/src/note.cc @@ -10,6 +10,7 @@ #include "varray.hh" #include "textdef.hh" + int default_duration = 4, default_dots=0, default_octave=0; int default_plet_type = 1, default_plet_dur = 1; String textstyle="roman"; // in lexer? @@ -26,8 +27,8 @@ Text_def* get_text(String s) return t; { t= new Text_def; - t->text= s; - t->style = textstyle; + t->text_str_= s; + t->style_str_ = textstyle; return t; } @@ -106,6 +107,27 @@ get_note_element(String pitch, int * notename, int * duration ) return v; } +Voice_element* +get_word_element(Text_def* tdef_p, int* duration) +{ + Voice_element* velt_p = new Voice_element; + + + int dur = duration[0]; + int dots=duration[1]; + + Lyric_req* lreq_p = new Lyric_req(tdef_p); + + lreq_p->balltype = dur; + lreq_p->dots = dots; + lreq_p->plet_factor = Moment(default_plet_dur, default_plet_type); + lreq_p->print(); + + velt_p->add(lreq_p); + + return velt_p; +} + Voice_element * get_rest_element(String, int * duration ) { @@ -229,7 +251,6 @@ get_script_req(int d , Script_def*def) return new Script_req(d, def); } - Request* get_text_req(int d , Text_def*def) { @@ -244,3 +265,18 @@ get_mark_element(String s) return v_p; } +Voice_element* +get_command_element(Input_command*com_p) +{ + Voice_element *v_p = new Voice_element; + v_p->add(new Staff_command_req(com_p)); + return v_p; +} +Voice_element* +get_barcheck_element() +{ + Voice_element*v_p = new Voice_element; + v_p->add( new Barcheck_req); + + return v_p; +} diff --git a/src/notehead.cc b/src/notehead.cc index f6521a58fe..859e41fad9 100644 --- a/src/notehead.cc +++ b/src/notehead.cc @@ -35,7 +35,7 @@ Notehead::compare(Notehead*&a, Notehead*&b) } Molecule* -Notehead::brew_molecule() const return out; +Notehead::brew_molecule_p() const return out; { Paperdef *p = paper(); diff --git a/src/parser.y b/src/parser.y index c11143f0d1..771734025b 100644 --- a/src/parser.y +++ b/src/parser.y @@ -61,10 +61,10 @@ Paperdef*default_paper(); } %token VOICE STAFF SCORE TITLE BAR NOTENAME OUTPUT -%token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS +%token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS COMMAND %token GEOMETRIC START_T DURATIONCOMMAND OCTAVECOMMAND %token KEY CLEF VIOLIN BASS MULTI TABLE CHORD VOICES -%token PARTIAL RHYTHMIC MELODIC MUSIC GROUPING CADENZA +%token PARTIAL RHYTHMIC MELODIC MUSIC LYRIC GROUPING CADENZA %token END SYMBOLTABLES TEXID TABLE NOTENAMES SCRIPT TEXTSTYLE PLET %token MARK GOTO @@ -85,8 +85,8 @@ Paperdef*default_paper(); %type dim %type duration %type duration_length -%type voice_elt full_element -%type score_command staff_command skipcommand +%type voice_elt full_element lyrics_elt +%type score_command staff_command position_command %type score_block score_body %type staff_block staff_init staff_body %type int @@ -98,7 +98,7 @@ Paperdef*default_paper(); %type music %type music_chord music_chord_body -%type music_voice_body music_voice +%type music_voice_body music_voice %type dinterval %type box @@ -214,6 +214,9 @@ score_commands_body: { $$ = new Array; } | score_commands_body score_command { $$->add($2); } + | score_commands_body position_command { + $$->add($2); + } ; staff_commands_block: COMMANDS '{' staff_commands_body '}' { @@ -225,11 +228,13 @@ staff_commands_body: | staff_commands_body staff_command { $$->add($2); } + | staff_commands_body position_command { + $$->add($2); + } ; staff_command: - skipcommand - | KEY pitch_list {/*UGH*/ + KEY pitch_list {/*UGH*/ $$ = get_key_interpret_command(*$2); delete $2; } @@ -248,7 +253,7 @@ duration_length: } ; -skipcommand: +position_command: SKIP int ':' duration_length { $$ = get_skip_command($2, *$4); delete $4; @@ -257,10 +262,10 @@ skipcommand: $$ = get_goto_command(*$2); delete $2; } + ; score_command: - skipcommand - | BAR STRING { + BAR STRING { $$ = get_bar_command(*$2); delete $2; } @@ -325,6 +330,9 @@ staff_init: | MELODIC { $$ = new Input_staff( "melodic"); } + | LYRIC { + $$ = new Input_staff( "lyric"); + } ; staff_body: @@ -365,7 +373,6 @@ music_voice_body: { } ; - music_chord: '{' music_chord_body '}' { $$ = $2; } ; @@ -393,8 +400,16 @@ full_element: pre_requests voice_elt post_requests { add_requests($2, post_reqs); $$ = $2; } + | MARK STRING { + $$ = get_mark_element(*$2); + delete $2; + } + | COMMAND '{' staff_command '}' { $$=get_command_element($3); } + | COMMAND '{' score_command '}' { $$=get_command_element($3); } + | '|' { $$ = get_barcheck_element(); } + | lyrics_elt ; - + post_requests: { assert(post_reqs.empty()); @@ -415,8 +430,7 @@ close_request_parens: ; open_request_parens: - '|' {$$='|'} - |')' {$$=')'} + ')' {$$=')'} |'[' {$$='['} ; @@ -526,12 +540,13 @@ voice_elt: delete $1; } - | MARK STRING { - $$ = get_mark_element(*$2); - delete $2; - } ; +lyrics_elt: + mudela_text duration { + $$ = get_word_element($1, $2); + }; + /* UTILITIES */ @@ -648,12 +663,17 @@ parse_file(String s) *mlog << "Parsing ... "; #ifdef YYDEBUG - yydebug = !monitor.silence("Parser") && check_debug; + yydebug = !monitor.silence("InitParser") && check_debug; #endif set_lexer(); lexer->new_input("symbol.ini"); yyparse(); + +#ifdef YYDEBUG + yydebug = !monitor.silence("Parser") && check_debug; +#endif + lexer->new_input(s); yyparse(); kill_lexer(); @@ -666,3 +686,5 @@ default_paper() return new Paperdef( lexer->lookup_identifier("default_table")->lookup(true)); } + + diff --git a/src/request.cc b/src/request.cc index 8cc3bf1495..c6ff787c66 100644 --- a/src/request.cc +++ b/src/request.cc @@ -4,6 +4,8 @@ #include "scriptdef.hh" #include "textdef.hh" +#include "inputcommand.hh" + #define VIRTUALCONS(T,R) R *T::clone() const { return new T(*this); } struct T #define RCONS(T) VIRTUALCONS(T, Request) @@ -11,6 +13,7 @@ RCONS(Rest_req); RCONS(Barcheck_req); RCONS(Text_req); RCONS(Rhythmic_req); +RCONS(Lyric_req); RCONS(Mark_req); RCONS(Stem_req); RCONS(Script_req); @@ -19,11 +22,14 @@ RCONS(Melodic_req); RCONS(Span_req); RCONS(Slur_req); RCONS(Beam_req); +RCONS(Staff_command_req); + void Stem_req::print() const { mtor << "Stem\n"; } +/****************/ void Barcheck_req::print() const { @@ -31,7 +37,7 @@ Barcheck_req::print() const mtor << "Barcheck\n"; #endif } - +/****************/ void Request::print() const { @@ -56,6 +62,7 @@ Request::Request(Request const&) { elt_l_ = 0; } +/****************/ Melodic_req::Melodic_req() { name = 0; @@ -64,12 +71,19 @@ Melodic_req::Melodic_req() forceacc = false; } +void +Melodic_req::print() const +{ + mtor << "note: " << name << " oct: "<< octave; +} + int Melodic_req::height() const { return name + octave*7; } +/****************/ Rhythmic_req::Rhythmic_req() { plet_factor = 1; @@ -88,42 +102,52 @@ Rhythmic_req::print() const mtor<<", plet factor"<align_i_ = 1; // raggedright + dir_i_ = -1; // lyrics below (invisible) staff } +void +Lyric_req::print() const +{ + mtor << "lyric: "; + Rhythmic_req::print(); + Text_req::print(); +} +/****************/ void Note_req::print() const { Melodic_req::print(); Rhythmic_req::print(); } - +/****************/ void Rest_req::print() const { mtor << "rest, " ; Rhythmic_req::print(); } - - -Moment -Rhythmic_req::duration() const { - return wholes(balltype,dots)*plet_factor; -} - +/****************/ Beam_req::Beam_req() { nplet = 0; } - +/****************/ Span_req::Span_req() { spantype = NOSPAN; } - +/****************/ Script_req::Script_req(int d , Script_def*def) { dir = d; @@ -148,30 +172,36 @@ Script_req::~Script_req() { delete scriptdef; } +/****************/ -Text_req::Text_req(Text_req const& s) +Text_req::~Text_req() { - spec = new Text_def(*s.spec); - dir = s.dir; + delete tdef_p_; + tdef_p_ = 0; +} + +Text_req::Text_req(Text_req const& src) +{ + tdef_p_ = new Text_def(*src.tdef_p_); + dir_i_ = src.dir_i_; } -Text_req::Text_req(int d , Text_def*def) + +Text_req::Text_req(int dir_i, Text_def* tdef_p) { - dir = d; - spec = def; + dir_i_ = dir_i; + tdef_p_ = tdef_p; } void Text_req::print() const { - mtor << " dir " << dir ; - spec->print(); + mtor << " dir " << dir_i_ ; + tdef_p_->print(); } -Text_req::~Text_req() -{ - delete spec; -} + +/****************/ Mark_req::Mark_req(String s) { @@ -185,3 +215,24 @@ Mark_req::print()const mtor<< "Mark `" << mark_str_ << "\'\n"; #endif } +/****************/ +Staff_command_req::Staff_command_req(Input_command * p) +{ + com_p_ = p; +} +Staff_command_req::~Staff_command_req() +{ + delete com_p_; +} +Staff_command_req::Staff_command_req(Staff_command_req const&src) +{ + com_p_ = new Input_command(*src.com_p_); +} +void +Staff_command_req::print()const +{ + mtor << "Command request: " ; + com_p_->print(); +} + + diff --git a/src/rest.cc b/src/rest.cc index d06489507c..215b102fed 100644 --- a/src/rest.cc +++ b/src/rest.cc @@ -20,7 +20,7 @@ Rest::print()const } Molecule* -Rest::brew_molecule()const +Rest::brew_molecule_p()const { Paperdef *p =paper(); diff --git a/src/rhythmstaff.cc b/src/rhythmstaff.cc index c78eedb256..5f5df7e361 100644 --- a/src/rhythmstaff.cc +++ b/src/rhythmstaff.cc @@ -3,7 +3,7 @@ #include "request.hh" #include "notehead.hh" #include "stem.hh" -#include "linestaff.hh" +#include "linepstaff.hh" #include "rhythmstaff.hh" #include "paper.hh" #include "sccol.hh" @@ -12,7 +12,7 @@ void Rhythmic_staff::set_output(PScore*ps) { - theline = new Linestaff(1,ps); + theline_l_ = new Linestaff(1,ps); Simple_staff::set_output(ps); } diff --git a/src/script.cc b/src/script.cc index 54e6d652fa..eab30f9cbb 100644 --- a/src/script.cc +++ b/src/script.cc @@ -99,7 +99,7 @@ Script::do_post_processing() } Molecule* -Script::brew_molecule() const +Script::brew_molecule_p() const { Real dy = paper()->internote(); diff --git a/src/simpleprint.cc b/src/simpleprint.cc index e5b992ec3f..7ded4a9c90 100644 --- a/src/simpleprint.cc +++ b/src/simpleprint.cc @@ -50,12 +50,12 @@ Simple_column::typeset_item(Item *i, int breakst) assert(i); staff_l_->pscore_l_->typeset_item(i, score_column_l_->pcol_l_, - staff_l_->theline,breakst); + staff_l_->theline_l_,breakst); if (breakst == BREAK_PRE - BREAK_PRE) { Array to_move( - staff_l_->pscore_l_->select_items(staff_l_->theline, + staff_l_->pscore_l_->select_items(staff_l_->theline_l_, score_column_l_->pcol_l_->prebreak_p_)); Interval column_wid = itemlist_width(to_move); assert(!column_wid.empty()); @@ -76,7 +76,7 @@ Simple_column::typeset_item_directional(Item *i, int dir, int breakst) // UGH! else if (breakst == 2) c = c->postbreak_p_; - Array to_move(staff_l_->pscore_l_->select_items(staff_l_->theline, + Array to_move(staff_l_->pscore_l_->select_items(staff_l_->theline_l_, c)); typeset_item(i, breakst); @@ -90,7 +90,7 @@ void Simple_staff::set_output(PScore* ps ) { pscore_l_ = ps; - pscore_l_->add(theline); + pscore_l_->add(theline_l_); } diff --git a/src/simplestaff.cc b/src/simplestaff.cc index 83bce6d7e4..e4e4986ef1 100644 --- a/src/simplestaff.cc +++ b/src/simplestaff.cc @@ -1,6 +1,6 @@ #include "request.hh" #include "voice.hh" -#include "swalker.hh" +#include "staffwalker.hh" #include "debug.hh" #include "clef.hh" #include "staff.hh" @@ -19,11 +19,12 @@ Simple_column::Simple_column(Score_column*s, Simple_staff *rs) staff_l_ = rs; beam_ = 0; text_=0; + lreq_p_ = 0; } Simple_staff::Simple_staff() { - theline = 0; + theline_l_ = 0; } /** @@ -60,6 +61,11 @@ Simple_column::process_requests() if (rq->text()) { text_ = rq->text(); } +#if 0 + if (rq->lreq_l()) { + lreq_p_ = rq->lreq_l(); + } +#endif if (rq->beam()) { beam_ = rq->beam(); } diff --git a/src/simplewalker.cc b/src/simplewalker.cc index 33ddf1ea69..78ec2b00da 100644 --- a/src/simplewalker.cc +++ b/src/simplewalker.cc @@ -21,6 +21,7 @@ #include "slur.hh" #include "localkeyitem.hh" #include "textitem.hh" +#include "lyricitem.hh" Rhythmic_grouping parse_grouping(Array a, Moment one_beat) @@ -195,6 +196,10 @@ Simple_walker::process_requests() c->typeset_item(new Text_item(c->text_, 10)); // UGR } +// if (c->lreq_p_) { +// c->typeset_item(new Lyric_item(c->lreq_p_, 10)); // UGR +// } + if (c->stem_) { stem_ = s->get_stem(c->stem_->stem(), c->stem_requester_len); } @@ -221,13 +226,13 @@ Simple_walker::process_requests() if (c->beam_&& c->beam_->spantype == Span_req::STOP) { default_grouping.extend(current_grouping->interval()); beam_->set_grouping(default_grouping, *current_grouping); - pscore_->typeset_spanner(beam_, s->theline); + pscore_->typeset_spanner(beam_, s->theline_l_); if (c->beam_->nplet) { Text_spanner* t = new Text_spanner(beam_); - t->spec.align = 0; - t->spec.text = c->beam_->nplet; - pscore_->typeset_spanner(t, s->theline); + t->spec.align_i_ = 0; + t->spec.text_str_ = c->beam_->nplet; + pscore_->typeset_spanner(t, s->theline_l_); } beam_ = 0; @@ -255,7 +260,7 @@ Simple_walker::process_requests() error_t("can't find slur to end; ", *c->tdescription_); pscore_->typeset_spanner(pending_slurs[idx], - s->theline); + s->theline_l_); pending_slurs.del(idx); pending_slur_reqs.del(idx); } @@ -264,7 +269,7 @@ Simple_walker::process_requests() } Simple_walker::Simple_walker(Simple_staff*s) - : Staff_walker(s, s->theline->pscore_l_) + : Staff_walker(s, s->theline_l_->pscore_l_) { stem_ = 0; beam_ =0; diff --git a/src/slur.cc b/src/slur.cc index e5dbf385ac..d4a3d0d96d 100644 --- a/src/slur.cc +++ b/src/slur.cc @@ -90,7 +90,7 @@ Slur::do_post_processing() } Molecule* -Slur::brew_molecule() const +Slur::brew_molecule_p() const { Molecule*output = new Molecule; @@ -112,7 +112,7 @@ Slur::brew_molecule() const if (!rnote_p->extremal) right_off+= Offset(-0.5, -dir); - int dy = right_off.y - left_off.y; + int dy = int(right_off.y - left_off.y); Real nw_f = paper()->note_width(); Real nh_f = paper()->internote(); diff --git a/src/staff.cc b/src/staff.cc index c6a65e016e..69fc3123b8 100644 --- a/src/staff.cc +++ b/src/staff.cc @@ -1,7 +1,7 @@ #include "staff.hh" #include "score.hh" #include "voice.hh" -#include "swalker.hh" +#include "staffwalker.hh" #include "stcol.hh" #include "sccol.hh" #include "staffcommands.hh" @@ -15,10 +15,25 @@ Staff::do_commands(PointerList score_wide, PointerList staff_wide) { Input_commands commands; + + // bring in commands from voices. + for (iter_top(voices, i); i.ok(); i++) { + Moment here = i->start; + for (iter_top(i->elts, j); j.ok(); j++) { + for (iter_top(j->reqs, k); k.ok(); k++) { + if (k->command()){ + commands.find_moment(here); + commands.add(*k->command()->com_p_, + score_l_->markers_assoc_); + } + } + here += j->duration; + } + } for (iter_top(score_wide,i); i.ok(); i++) commands.add(**i, score_l_->markers_assoc_); for (iter_top(staff_wide,i); i.ok(); i++) - commands.add(**i,score_l_->markers_assoc_); + commands.add(**i, score_l_->markers_assoc_); commands.parse(this); } diff --git a/src/staffelem.cc b/src/staffelem.cc index e1b5e4228b..4be3cee0bf 100644 --- a/src/staffelem.cc +++ b/src/staffelem.cc @@ -36,11 +36,10 @@ Staff_elem::translate(Offset O) Interval Staff_elem::width() const { - Molecule*m= brew_molecule(); Interval r; if (!output){ - Molecule*m = brew_molecule(); + Molecule*m = brew_molecule_p(); r = m->extent().x; delete m; } else @@ -57,7 +56,7 @@ Staff_elem::height() const Interval r; if (!output){ - Molecule*m = brew_molecule(); + Molecule*m = brew_molecule_p(); r = m->extent().y; delete m; } else @@ -140,7 +139,7 @@ Staff_elem::molecule_processing() if (dependencies[i]) dependencies[i]->molecule_processing(); if (!calc_children) - output= brew_molecule(); + output= brew_molecule_p(); status = OUTPUT; } diff --git a/src/staffline.cc b/src/staffline.cc index 1eacf8cb65..429874410e 100644 --- a/src/staffline.cc +++ b/src/staffline.cc @@ -10,9 +10,10 @@ static String make_vbox(Interval i) -{ +{ + Real r = (i.empty()) ? 0.0 : i.length(); String s("\\vbox to "); - s += print_dimen(i.length()); + s += print_dimen(r); s += "{\\vskip "+print_dimen(i.right)+" "; return s; } @@ -27,7 +28,7 @@ Line_of_staff::TeXstring() const s += "\\hbox{"; { ((PStaff*)pstaff_l_)-> - brew_molecule(line_of_score_l_->pscore_l_->paper_l_->linewidth); + brew_molecule_p(line_of_score_l_->pscore_l_->paper_l_->linewidth); s+=pstaff_l_->stafsym_p_->TeXstring(); iter_top(line_of_score_l_->cols,cc); @@ -43,7 +44,6 @@ Line_of_staff::TeXstring() const s +=String( "\\kern ") + print_dimen(delta); // now output the items. - for (iter_top(cc->its,i); i.ok(); i++) { if (i->pstaff_l_ == pstaff_l_) s += i->TeXstring(); @@ -106,6 +106,6 @@ void Line_of_staff::process() { if (!pstaff_l_->stafsym_p_) - pstaff_l_->brew_molecule(line_of_score_l_->pscore_l_-> - paper_l_->linewidth); + pstaff_l_->brew_molecule_p(line_of_score_l_->pscore_l_-> + paper_l_->linewidth); } diff --git a/src/staffwalker.cc b/src/staffwalker.cc new file mode 100644 index 0000000000..5967242dbb --- /dev/null +++ b/src/staffwalker.cc @@ -0,0 +1,69 @@ +#include "request.hh" +#include "staffwalker.hh" +#include "stcol.hh" +#include "sccol.hh" + +Staff_walker::~Staff_walker() {} +Staff_walker::Staff_walker(Staff_walker const &s) + :PCursor (s) +{ + assert(false); +} + +Staff_walker::Staff_walker(Staff * s, PScore*ps ) + : PCursor (s->cols) +{ + staff_ = s; + pscore_ = ps; + break_status = BREAK_END - BREAK_PRE; +} + +Moment +Staff_walker::when() const +{ + return (* (PCursor *) this)->when(); +} + +void +Staff_walker::process() +{ + break_status = BREAK_END - BREAK_PRE; + if (ptr()->staff_commands_p_) + for (iter_top(*ptr()->staff_commands_p_,i); i.ok(); i++) { + process_command(i); + } + + process_requests(); +} + + +void +Staff_walker::process_command(Command*com) +{ + switch (com->code){ + case BREAK_PRE: + case BREAK_MIDDLE: + case BREAK_POST: + case BREAK_END: + (*this)->score_column_l_->set_breakable(); + break_status = com->code- BREAK_PRE; + break; + case INTERPRET: + do_INTERPRET_command(com); + break; + + case TYPESET: + do_TYPESET_command(com); + break; + + default : + break; + } +} + +void +Staff_walker::operator++(int i) +{ + PCursor::operator++(i); + reset(); +} diff --git a/src/stem.cc b/src/stem.cc index 66b1aadb33..85c4c15e2b 100644 --- a/src/stem.cc +++ b/src/stem.cc @@ -154,7 +154,7 @@ Stem::width()const } Molecule* -Stem::brew_molecule()const return out; +Stem::brew_molecule_p()const return out; { assert(bot!=top); diff --git a/src/swalker.cc b/src/swalker.cc deleted file mode 100644 index 34afa0ee40..0000000000 --- a/src/swalker.cc +++ /dev/null @@ -1,69 +0,0 @@ -#include "request.hh" -#include "swalker.hh" -#include "stcol.hh" -#include "sccol.hh" - -Staff_walker::~Staff_walker() {} -Staff_walker::Staff_walker(Staff_walker const &s) - :PCursor (s) -{ - assert(false); -} - -Staff_walker::Staff_walker(Staff * s, PScore*ps ) - : PCursor (s->cols) -{ - staff_ = s; - pscore_ = ps; - break_status = BREAK_END - BREAK_PRE; -} - -Moment -Staff_walker::when() const -{ - return (* (PCursor *) this)->when(); -} - -void -Staff_walker::process() -{ - break_status = BREAK_END - BREAK_PRE; - if (ptr()->staff_commands_p_) - for (iter_top(*ptr()->staff_commands_p_,i); i.ok(); i++) { - process_command(i); - } - - process_requests(); -} - - -void -Staff_walker::process_command(Command*com) -{ - switch (com->code){ - case BREAK_PRE: - case BREAK_MIDDLE: - case BREAK_POST: - case BREAK_END: - (*this)->score_column_l_->set_breakable(); - break_status = com->code- BREAK_PRE; - break; - case INTERPRET: - do_INTERPRET_command(com); - break; - - case TYPESET: - do_TYPESET_command(com); - break; - - default : - break; - } -} - -void -Staff_walker::operator++(int i) -{ - PCursor::operator++(i); - reset(); -} diff --git a/src/textdef.cc b/src/textdef.cc index 26dee59a71..e3829c65db 100644 --- a/src/textdef.cc +++ b/src/textdef.cc @@ -6,19 +6,19 @@ Text_def::Text_def() { - align = 1; // right - style = "roman"; + align_i_ = 1; // right + style_str_ = "roman"; } Atom -Text_def::create(Paperdef*p) const +Text_def::create_atom(Paperdef*p) const { - return p->lookup_p_->text(style, text, -align); + return p->lookup_p_->text(style_str_, text_str_, -align_i_); } void Text_def::print() const { - mtor << "Text `" << text << "\', style " << - style << "align " <dir; - if (!dir) - dir = -1; - - specs = r->spec; - staffsize = s; - pos = 0; + staffsize_i_ = staffsize_i; + dir_i_ = treq_l->dir_i_; + if (!dir_i_) + dir_i_ = -1; + tdef_l_ = treq_l->tdef_p_; } void Text_item::set_default_pos() { - pos = (dir > 0) ? staffsize + 2: -4; + pos_i_ = (dir_i_ > 0) ? staffsize_i_ + 2: -4; } + void Text_item::do_pre_processing() { @@ -29,12 +28,13 @@ Text_item::do_pre_processing() Molecule* -Text_item::brew_molecule() const +Text_item::brew_molecule_p() const { - Molecule* output = new Molecule(specs->create(paper())); - if(dir <0) - output->translate(Offset(0, -output->extent().y.length() )); + Molecule* mol_p = new Molecule(tdef_l_->create_atom(paper())); + mol_p->translate(Offset(0, pos_i_ * paper()->internote())); + + if(dir_i_<0) + mol_p->translate(Offset(0, -mol_p->extent().y.length() )); - output->translate(Offset(0, pos * paper()->internote())); - return output; + return mol_p; } diff --git a/src/textspanner.cc b/src/textspanner.cc index 43cfda3f35..86eac612cb 100644 --- a/src/textspanner.cc +++ b/src/textspanner.cc @@ -13,7 +13,7 @@ Text_spanner::Text_spanner(Directional_spanner*d) void Text_spanner::do_post_processing() { - switch(spec.align) { + switch(spec.align_i_) { case 0: tpos = support->center(); break; @@ -25,9 +25,9 @@ Text_spanner::do_post_processing() } Molecule* -Text_spanner::brew_molecule() const +Text_spanner::brew_molecule_p() const { - Atom tsym (spec.create(paper())); + Atom tsym (spec.create_atom(paper())); tsym.translate(tpos); Molecule*output = new Molecule; @@ -54,7 +54,7 @@ Text_spanner::do_pre_processing() Interval Text_spanner::height()const { - return brew_molecule()->extent().y; + return brew_molecule_p()->extent().y; } Spanner* diff --git a/src/timedescription.cc b/src/timedescription.cc index 9ffb981c85..275a47f0d9 100644 --- a/src/timedescription.cc +++ b/src/timedescription.cc @@ -68,7 +68,7 @@ Time_description::set_meter(int l, int o) one_beat = 1/Moment(o); whole_per_measure = Moment(l) * one_beat; if(whole_in_measure) - error_t("Meterchange should be at start of measure", when); + error_t("Meterchange should be at start of measure", *this); } void diff --git a/src/warn.cc b/src/warn.cc index 82a004875a..87f7152e41 100644 --- a/src/warn.cc +++ b/src/warn.cc @@ -27,8 +27,8 @@ error(String s) void error_t(const String& s, const Moment& r) { - String t_mom = String(trunc(r)) + (r - Moment(trunc(r))); - String e=s+ "(t = " + t_mom + ")"; + String t_mom = String(trunc(r)) + String(r - Moment(trunc(r))); + String e=s+ " (t = " + t_mom + ")"; error(e); } @@ -36,6 +36,6 @@ error_t(const String& s, const Moment& r) void error_t(const String& s, Time_description const &t_tdes) { - String e=s+ "(at " + t_tdes.bars + ": " + t_tdes.whole_in_measure + ")\n"; + String e=s+ " (at t=" + t_tdes.bars + ": " + t_tdes.whole_in_measure + ")\n"; error(e); }