From 20af8c0e3126b8aff80ad6e1edeb7dfd1b05bc82 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 25 Feb 1997 01:15:13 +0100 Subject: [PATCH] release: 0.0.35 --- Documentation/index.pod | 13 ++++ Documentation/make_website | 19 ++++-- Generate.make | 7 +- Makefile | 12 ++-- NEWS | 5 ++ Sources.make | 30 +++++---- TODO | 37 +++++++---- Variables.make | 4 +- configure | 3 + flower/NEWS | 14 ++-- flower/Sources.make | 2 +- flower/Variables.make | 2 +- flower/pqueue.hh | 46 +++++++++++++ flower/string.cc | 2 +- flower/stringconversion.cc | 14 ++++ flower/stringconversion.hh | 3 +- flower/stringutil.cc | 7 ++ hdr/clefreg.hh | 2 +- hdr/commandrequest.hh | 25 ++++--- hdr/complexstaff.hh | 1 - hdr/complexwalker.hh | 10 +-- hdr/keyreg.hh | 1 + hdr/localkeyreg.hh | 5 +- hdr/midiwalker.hh | 2 - hdr/proto.hh | 4 +- hdr/register.hh | 10 +-- hdr/registergroup.hh | 38 +++++++++++ hdr/request.hh | 2 +- hdr/{sccol.hh => scorecolumn.hh} | 0 hdr/{stcol.hh => staffcolumn.hh} | 9 +-- hdr/voicegroup.hh | 51 -------------- hdr/voicegroupregs.hh | 27 ++++++++ hdr/voiceregs.hh | 27 ++++++++ hdr/walkregs.hh | 20 ++++++ init/table_sixteen.ini | 4 +- input/maartje.ly | 1 + input/wohltemperirt.ly | 4 +- src/barreg.cc | 6 +- src/calcideal.cc | 2 +- src/clefreg.cc | 12 ++-- src/commandrequest.cc | 17 ++--- src/complexstaff.cc | 2 +- src/complexwalker.cc | 72 +++++--------------- src/inputmusic.cc | 6 +- src/keyreg.cc | 24 ++++--- src/localkeyreg.cc | 22 ++++++- src/lyricitem.cc | 2 +- src/lyricwalker.cc | 2 +- src/meterreg.cc | 4 +- src/midioutput.cc | 3 +- src/midiwalker.cc | 6 +- src/register.cc | 27 ++------ src/registergroup.cc | 88 +++++++++++++++++++++++++ src/score.cc | 7 +- src/{sccol.cc => scorecolumn.cc} | 4 +- src/scorewalker.cc | 2 +- src/staff.cc | 20 +++--- src/{stcol.cc => staffcolumn.cc} | 26 ++++---- src/staffeleminfo.cc | 32 +++++++++ src/staffwalker.cc | 6 +- src/template2.cc | 12 +++- src/template4.cc | 8 +++ src/template6.cc | 4 +- src/voice.cc | 2 +- src/voicegroup.cc | 110 ------------------------------- src/voicegroupregs.cc | 70 ++++++++++++++++++++ src/voiceregs.cc | 61 ++++------------- src/walkregs.cc | 23 +++++++ 68 files changed, 691 insertions(+), 454 deletions(-) create mode 100644 flower/pqueue.hh create mode 100644 hdr/registergroup.hh rename hdr/{sccol.hh => scorecolumn.hh} (100%) rename hdr/{stcol.hh => staffcolumn.hh} (88%) delete mode 100644 hdr/voicegroup.hh create mode 100644 hdr/voicegroupregs.hh create mode 100644 hdr/voiceregs.hh create mode 100644 hdr/walkregs.hh create mode 100644 src/registergroup.cc rename src/{sccol.cc => scorecolumn.cc} (94%) rename src/{stcol.cc => staffcolumn.cc} (84%) create mode 100644 src/staffeleminfo.cc delete mode 100644 src/voicegroup.cc create mode 100644 src/voicegroupregs.cc create mode 100644 src/walkregs.cc diff --git a/Documentation/index.pod b/Documentation/index.pod index 06364733d4..f473d9c456 100644 --- a/Documentation/index.pod +++ b/Documentation/index.pod @@ -74,3 +74,16 @@ PS output +=item * + +MIDI output + + +=item * + +The DOC++ documentation of the C++ sources. + \ No newline at end of file diff --git a/Documentation/make_website b/Documentation/make_website index 1aede35367..d1ec8d4a26 100755 --- a/Documentation/make_website +++ b/Documentation/make_website @@ -25,12 +25,17 @@ foreach $a (<*.html>) foreach $a (@examples) { $texfile="test"; - system "cd ..; lilypond input/$a; tex $texfile;"; - system "dvips -o $texfile.ps $texfile;"; - system "mv ../$texfile.ps $a.ps;". - "gs -q -sDEVICE=ppmraw -sOutputFile=- -r200 -dNOPAUSE $a.ps -c quit |pnmscale 0.5| ppmtogif > $a.gif" + system "ln ../input/$a.ly ./$a.ly.txt"; + system "cd ..; lilypond input/$a; tex $texfile;". + "dvips -o $texfile.ps $texfile;"; + + # generate the pixmap at twice the size, then rescale (for antialiasing) + if ( ! -f "$a.gif" ) { + system "mv ../$texfile.ps $a.ps; ". + "mv ../lelie.midi $a.midi; ". + "gs -q -sDEVICE=ppmraw -sOutputFile=- -r200 -dNOPAUSE $a.ps -c quit |pnmscale 0.5| ppmtogif > $a.gif"; + } } -system "mkdir docxx; make -C.. docxx; ln ../docxx/* ./docxx/;" . - "tar cf website.tar *.html *.gif *.png *.ps docxx/;" . - "gzip -9 website.tar;" +system "tar hcf website.tar *.html *.gif lelie_logo.png *.ps *.ly.txt *.midi docxx/;" . + "gzip -f9 website.tar;" diff --git a/Generate.make b/Generate.make index 0b1e6c490d..5be1641e1e 100644 --- a/Generate.make +++ b/Generate.make @@ -1,20 +1,19 @@ # Generate.make ? -# -> Rules.make: containing all compile/flex/bison/... rules (jcn) parsheadorig=$(CCDIR)/parser.tab.h parsheadnew=$(HEADERDIR)/parser.hh # -# take some trouble to avoid overwriting the old y.tab.h -# why? (jcn) +# take some trouble to avoid overwriting the old y.tab.h, +# because otherwise all dependants would be remade. $(CCDIR)/parser.cc: $(CCDIR)/parser.y $(BISON) -d $< + mv $(CCDIR)/parser.tab.c $@ (if diff $(parsheadorig) $(parsheadnew)>/dev/null; then \ echo Ignoring $(parsheadorig); \ else \ mv $(parsheadorig) $(parsheadnew); \ fi ) - mv $(CCDIR)/parser.tab.c $@ $(parsheadnew): $(CCDIR)/parser.cc diff --git a/Makefile b/Makefile index 3e4a16e511..c990a7246c 100644 --- a/Makefile +++ b/Makefile @@ -17,18 +17,18 @@ $(m2m): $(m2mobs) .PHONY: clean docxx clean: - rm -f $(allexe) $(DOCDIR)/* core $(allobs) $(ALLDEPS) + rm -f $(allexe) $(DOCDIR)/* core $(allobs) for SUBDIR in $(SUBDIRS); \ do \ $(MAKE) SUBDIR=$$SUBDIR -C $$SUBDIR clean;\ done distclean: clean - rm -f version.hh $(gencc) .GENERATE *~ $(ALLDEPS) + rm -f version.hh $(gencc) .GENERATE *~ $(ALLDEPS) all: $(exe) $(m2m) doc -# value of $(OSTYPE) on windhoos; "make $OSTYPE" if u use bash :-) +# value of $(OSTYPE) on windhoos; "make $OSTYPE" if you use bash :-) win32: $(MAKE) -C . CXX=g++ @@ -39,13 +39,13 @@ doc: docxx: $(progdocs) doc++ -kp -d $(DOCDIR) $^ + +include $(DEPDIR)/*.dep + $(OBJECTDIR)/%.o: $(CCDIR)/%.cc $(DODEP)\ $(CXX) -c $(CXXFLAGS) $(OUTPUT_OPTION) - -include $(DEPDIR)/*.dep - $(OBJECTDIR)/version.o: $(obs) $(HEADERDIR)/version.hh include Generate.make diff --git a/NEWS b/NEWS index 9e99b19fe0..bd29eda5ce 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +pl 35 + - Register_group +Bugfix + - alignment of breakable items. + ******* pl 34 - better midi syntax. diff --git a/Sources.make b/Sources.make index ba5833629c..b255d37e54 100644 --- a/Sources.make +++ b/Sources.make @@ -1,11 +1,11 @@ # Sources.make # sourcefiles to be shipped. Also used for dependencies -hdr= bar.hh barreg.hh beam.hh boxes.hh break.hh clefreg.hh clefitem.hh\ +hdr=bar.hh barreg.hh beam.hh boxes.hh break.hh clefreg.hh clefitem.hh\ colhpos.hh commandrequest.hh \ complexwalker.hh complexstaff.hh\ const.hh debug.hh dimen.hh directionalspanner.hh\ - glob.hh grouping.hh headreg.hh idealspacing.hh\ + glob.hh grouping.hh headreg.hh idealspacing.hh\ identifier.hh identparent.hh \ inputmusic.hh inputscore.hh inputstaff.hh\ inputfile.hh\ @@ -20,23 +20,23 @@ hdr= bar.hh barreg.hh beam.hh boxes.hh break.hh clefreg.hh clefitem.hh\ misc.hh\ molecule.hh moment.hh musicalrequest.hh\ notehead.hh notename.hh offset.hh paperdef.hh\ - parseconstruct.hh pcol.hh proto.hh\ + parseconstruct.hh pcol.hh proto.hh\ pscore.hh pstaff.hh qlp.hh\ - qlpsolve.hh register.hh reqtodo.hh request.hh rest.hh \ - sccol.hh score.hh\ + qlpsolve.hh register.hh registergroup.hh reqtodo.hh \ + request.hh rest.hh scorecolumn.hh score.hh\ scoreline.hh scorewalker.hh script.hh scriptdef.hh scriptreg.hh \ slur.hh slurreg.hh source.hh sourcefile.hh\ spanner.hh staff.hh\ staffelem.hh staffeleminfo.hh staffline.hh staffsym.hh stembeamreg.hh\ - stcol.hh stem.hh staffwalker.hh symbol.hh symtable.hh\ + staffcolumn.hh stem.hh staffwalker.hh symbol.hh symtable.hh\ tex.hh textdef.hh \ textitem.hh textreg.hh textspanner.hh timedescription.hh \ tstream.hh voice.hh\ - voicegroup.hh + voiceregs.hh voicegroupregs.hh walkregs.hh mycc=bar.cc barreg.cc beam.cc boxes.cc break.cc calcideal.cc clefreg.cc\ clefitem.cc colhpos.cc commandrequest.cc\ - complexstaff.cc complexwalker.cc \ + complexstaff.cc complexwalker.cc \ debug.cc dimen.cc\ directionalspanner.cc\ grouping.cc groupregs.cc headreg.cc\ @@ -53,19 +53,21 @@ mycc=bar.cc barreg.cc beam.cc boxes.cc break.cc calcideal.cc clefreg.cc\ mididef.cc midiitem.cc midioutput.cc midistream.cc\ midiwalker.cc misc.cc molecule.cc mylexer.cc note.cc\ notehead.cc notename.cc\ - paperdef.cc pcol.cc pscore.cc pstaff.cc qlp.cc qlpsolve.cc\ - register.cc request.cc rest.cc sccol.cc score.cc\ + paperdef.cc pcol.cc pscore.cc pstaff.cc qlp.cc qlpsolve.cc\ + register.cc registergroup.cc request.cc rest.cc\ + scorecolumn.cc score.cc\ scoreline.cc scores.cc scorewalker.cc script.cc\ scriptdef.cc scriptreg.cc slur.cc\ slurreg.cc source.cc sourcefile.cc\ spanner.cc staff.cc\ staffelem.cc staffline.cc staffsym.cc\ - stembeamreg.cc stcol.cc stem.cc\ - staffwalker.cc symbol.cc symtable.cc tex.cc texbeam.cc\ + stembeamreg.cc staffcolumn.cc stem.cc\ + staffeleminfo.cc staffwalker.cc symbol.cc\ + symtable.cc tex.cc texbeam.cc\ texslur.cc textdef.cc textitem.cc textreg.cc textspanner.cc\ timedescription.cc tstream.cc voice.cc voiceelt.cc \ - voiceregs.cc voicegroup.cc\ - warn.cc windhoos-suck-suck-suck-thank-you-cygnus.cc wordwrap.cc\ + voiceregs.cc voicegroupregs.cc\ + walkregs.cc warn.cc windhoos-suck-suck-suck-thank-you-cygnus.cc wordwrap.cc\ template1.cc template2.cc template3.cc template4.cc\ template5.cc template6.cc version.cc diff --git a/TODO b/TODO index 341f837438..a00bad0be1 100644 --- a/TODO +++ b/TODO @@ -1,35 +1,36 @@ - before 0.1 - - * create libmudela, libmidi, or liblily_frontend - - * Register_groups as a baseclass. + * remove spurious/outdated comments in .ly + + * more control in Register_groups * pushgroup, popgroup. * basic dynamics + * basic syntax + * decent TeX page layout - - * < .. > vs. { .. } syntax? ! + + * clean split for m2m of sources. This is an assorted collection of stuff that will be done, might be done, or is an idea that I want to think about BUGS + + * key at clef change. + * key undo - * c8. c32 c32 + * key at broken :||: - * key print if clef change. + * [c8. c32 c32] * $cis ( | ) cis$ * Group_feature at start of music. - * size of Key_item - SEVERELY LACKING: * grace notes @@ -46,17 +47,21 @@ INPUTLANGUAGE * rest name configurable + * < .. > vs. { .. } syntax? ! + * '*' vs. '/' SMALLISH PROJECTS + * fix Staff_elem::width() derivs to use offset_ + * parshape * bar numbers/repetition marks * read from mmap directly: study yy_scan_buffer - * binsearch/hash for notenames + * binsearch/hash for notenames, id. for identifiers * stafftypes: voice names/ instrument names. @@ -128,6 +133,12 @@ FUTURE IDEAS + * create libmudela, or liblily_frontend + + * move MIDI io to a ANSI C libmidi library. + + * fold indentifiers and notenames? + * enter Requests directly * itemcolumns: Use dummy items. @@ -158,4 +169,4 @@ IDEAS * caching breakpoints - * use exceptions? \ No newline at end of file + * use exceptions iso assert? \ No newline at end of file diff --git a/Variables.make b/Variables.make index cc697d7c3c..ea71398c05 100644 --- a/Variables.make +++ b/Variables.make @@ -3,7 +3,7 @@ # version info MAJVER=0 MINVER=0 -PATCHLEVEL=34 +PATCHLEVEL=35 @@ -124,4 +124,4 @@ STRIPDEBUG=true #replace to do stripping of certain objects LINKER=$(CXX) include Site.make -include Site.make + diff --git a/configure b/configure index 45a8f9b13a..1c611713a5 100755 --- a/configure +++ b/configure @@ -53,3 +53,6 @@ echo '#define LIBDIR "'$PREFIX'/"'> hdr/config.hh touch Site.make $MAKE -f Initial.make +echo "The sources are ready for compiling. " +echo "To make sure that you don't have any stale dependencies: do" +echo " make clean" diff --git a/flower/NEWS b/flower/NEWS index 4e397700ca..a01d6a140b 100644 --- a/flower/NEWS +++ b/flower/NEWS @@ -1,10 +1,11 @@ +pl 1.1.2 + - StringConversio::bin2int_i + - dumb prioq + pl 1.1.1 - separated StringHandle and StringData -(JCN pl 27-3) - - debug memmove code - - StringData bugfix - - old String::String( char, int ) bugfix + - String::compare 1.1.0: @@ -12,6 +13,11 @@ pl 1.1.1 ------------------ 1.0: +pl 27-3 + - debug memmove code + - StringData bugfix + - old String::String( char, int ) bugfix + pl 27-1,2 (not released) patches by JCN - stringutils.cc included again diff --git a/flower/Sources.make b/flower/Sources.make index bfffc6084b..3964ba9be5 100644 --- a/flower/Sources.make +++ b/flower/Sources.make @@ -12,7 +12,7 @@ hh=assoc.hh associter.hh choleski.hh compare.hh cursor.hh dstream.hh\ fproto.hh handle.hh interval.hh iterate.hh lgetopt.hh link.hh list.hh\ matrix.hh path.hh pcursor.hh plist.hh rational.hh real.hh scalar.hh\ smat.hh string.hh stringconversion.hh stringhandle.hh stringdata.hh\ -textdb.hh textstream.hh unionfind.hh\ +textdb.hh textstream.hh unionfind.hh pqueue.hh\ varray.hh vector.hh vsmat.hh datafile.hh extra=stringtest.cc diff --git a/flower/Variables.make b/flower/Variables.make index 91802a52e8..4e40f2453d 100644 --- a/flower/Variables.make +++ b/flower/Variables.make @@ -1,6 +1,6 @@ MAJVER=1 MINVER=1 -PATCHLEVEL=1 +PATCHLEVEL=2 PACKAGENAME=flower diff --git a/flower/pqueue.hh b/flower/pqueue.hh new file mode 100644 index 0000000000..195232317e --- /dev/null +++ b/flower/pqueue.hh @@ -0,0 +1,46 @@ +/* + pqueue.hh -- declare + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef PQUEUE_HH +#define PQUEUE_HH + +#include "varray.hh" + +/** + Stupid Prioq. Should use Lists and STL. + Smallest is put at the front. + */ + +template +struct PQueue +{ + Array value_arr_; + Array indices_arr_; + + void enter(V v, I idx) { + int j=0; + for (; j < value_arr_.size(); j++) + if (indices_arr_[j] > idx) + break; + + value_arr_.insert(v, j); + indices_arr_.insert(idx, j); + } + int size() { return value_arr_.size(); } + V front_val() { return value_arr_[0]; } + I front_idx() { return indices_arr_[0]; } + V get() { + V retval = front_val(); + value_arr_.del(0); + indices_arr_.del(0); + return retval; + } + +}; +#endif // PQUEUE_HH diff --git a/flower/string.cc b/flower/string.cc index 1e532a2fad..6e7378fdcc 100644 --- a/flower/string.cc +++ b/flower/string.cc @@ -92,7 +92,7 @@ String::String( char const* source ) String::String( Byte const* byte_l, int length_i ) { - assert( !length_i || byte_l ); +// assert( !length_i || byte_l );// ugh. Storing null pointers? strh_.set( byte_l, length_i ); } diff --git a/flower/stringconversion.cc b/flower/stringconversion.cc index 55ea29ade4..8b9144a9a7 100644 --- a/flower/stringconversion.cc +++ b/flower/stringconversion.cc @@ -20,6 +20,20 @@ StringConversion::bin2hex_str( String bin_str ) return str; } +int +StringConversion::bin2int_i( String bin_str ) +{ + assert( bin_str.length_i() <= 4 ); + + int result_i = 0; + for ( int i = 0; i < bin_str.length_i(); i++ ) { + result_i <<= 8; + result_i |= bin_str[ i ]; + } + return result_i; +} + + int StringConversion::hex2bin_i( String hex_str, String& bin_str_r ) { diff --git a/flower/stringconversion.hh b/flower/stringconversion.hh index 3ad9bbea4b..0bcd7f5c4c 100644 --- a/flower/stringconversion.hh +++ b/flower/stringconversion.hh @@ -17,8 +17,9 @@ class StringConversion { static Byte nibble2hex_by( Byte by ); public: static String bin2dec_str( String dec_str ); -static String bin2hex_str( String bin_str ); + static String bin2hex_str( String bin_str ); static String dec2bin_str( String str ); + static int bin2int_i( String str ); static int dec2int_i( String str ); static int hex2int_i( String str ); static String hex2bin_str( String str ); diff --git a/flower/stringutil.cc b/flower/stringutil.cc index 0596c458ad..9adcd2ea1d 100644 --- a/flower/stringutil.cc +++ b/flower/stringutil.cc @@ -6,6 +6,13 @@ (c) 1997 Han-Wen Nienhuys */ +#ifdef STRING_DEBUG +void* mymemmove( void* dest, void* src, size_t n ) +{ + return memmove( dest, src, n ); // wohltempererit: 69006 +} +#define memmove mymemmove +#endif #ifdef STRING_UTILS_INLINED #undef STRING_UTILS_INLINED diff --git a/hdr/clefreg.hh b/hdr/clefreg.hh index ff9e5903a7..8f9e25042c 100644 --- a/hdr/clefreg.hh +++ b/hdr/clefreg.hh @@ -20,7 +20,7 @@ public: /* ************** */ virtual void process_request(); virtual void do_pre_move_process(); - virtual bool try_request(Nonmusical_req*); + virtual bool try_request(Request*); Clef_register(Complex_walker*); void read_req(Clef_change_req*); bool set_type(String); diff --git a/hdr/commandrequest.hh b/hdr/commandrequest.hh index f9eef852fd..71b8331661 100644 --- a/hdr/commandrequest.hh +++ b/hdr/commandrequest.hh @@ -13,11 +13,10 @@ #include "request.hh" #include "varray.hh" -/** - Request assumed to be "happening" before the musical requests - */ -struct Nonmusical_req : virtual Request { - REQUESTMETHODS(Nonmusical_req, nonmus); +/** Request which are assumed to be "happening" before the + musical requests. */ +struct Command_req : virtual Request { + REQUESTMETHODS(Command_req, command); virtual Measure_grouping_req * measuregrouping() { return 0; } virtual Clef_change_req * clefchange() { return 0; } @@ -32,7 +31,7 @@ struct Nonmusical_req : virtual Request { /** Baseclass for meter/partial req. It has to be handled by Staff_{walker,column} baseclass. */ -struct Timing_req : Nonmusical_req { +struct Timing_req : Command_req { REQUESTMETHODS(Timing_req, timing); }; @@ -58,7 +57,7 @@ struct Meter_change_req : Timing_req { /// toggle Cadenza mode struct Cadenza_req : Timing_req { /// turn on? - bool on_b; + bool on_b_; Cadenza_req(bool); REQUESTMETHODS(Cadenza_req,cadenza); }; @@ -76,31 +75,31 @@ struct Measure_grouping_req: Timing_req { REQUESTMETHODS(Measure_grouping_req, measuregrouping); }; -struct Group_change_req : Nonmusical_req { +struct Group_change_req : Command_req { String newgroup_str_; REQUESTMETHODS(Group_change_req, groupchange); }; /** draw a (repeat)-bar. This something different than #Barcheck_req#, the latter should only happen at the start of a measure. */ -struct Bar_req : Nonmusical_req { +struct Bar_req : Command_req { String type_str_; Bar_req(String); int compare(const Bar_req&)const; REQUESTMETHODS(Bar_req,bar); }; -struct Terminate_voice_req : Nonmusical_req { +struct Terminate_voice_req : Command_req { REQUESTMETHODS(Terminate_voice_req,terminate); }; -struct Group_feature_req : Nonmusical_req { +struct Group_feature_req : Command_req { int stemdir_i_; Group_feature_req(); REQUESTMETHODS(Group_feature_req, groupfeature); }; -struct Key_change_req : Nonmusical_req { +struct Key_change_req : Command_req { Array melodic_p_arr_; Key_change_req(); @@ -109,7 +108,7 @@ struct Key_change_req : Nonmusical_req { REQUESTMETHODS(Key_change_req, keychange); }; -struct Clef_change_req : Nonmusical_req { +struct Clef_change_req : Command_req { String clef_str_; Clef_change_req(String); REQUESTMETHODS(Clef_change_req, clefchange); diff --git a/hdr/complexstaff.hh b/hdr/complexstaff.hh index b7d0c714d9..74ecef4732 100644 --- a/hdr/complexstaff.hh +++ b/hdr/complexstaff.hh @@ -9,7 +9,6 @@ #include "key.hh" -#include "stcol.hh" #include "staff.hh" #include "staffwalker.hh" diff --git a/hdr/complexwalker.hh b/hdr/complexwalker.hh index 5f0a808450..a67d5b881a 100644 --- a/hdr/complexwalker.hh +++ b/hdr/complexwalker.hh @@ -8,7 +8,6 @@ #define COMPLEXWALKER_HH #include "proto.hh" -#include "voicegroup.hh" #include "assoc.hh" #include "staffwalker.hh" #include "staffeleminfo.hh" @@ -18,7 +17,7 @@ A staff walker which uses registers to decide what to print */ class Complex_walker: public Staff_walker { - bool try_command_request(Nonmusical_req *req_l); + bool try_command_request(Command_req *req_l); void do_change_group( Voice * v, String group_id_str); void do_announces(); void try_request(Request*req); @@ -33,14 +32,9 @@ public: IPointerList voice_reg_list_; IPointerList group_reg_list_; Assoc voice_group_map_; - - Clef_register *clef_reg_p_; - Local_key_register *local_key_reg_p_; - Key_register *key_reg_p_; - Bar_register *bar_reg_p_; - Meter_register *meter_reg_p_; Array announce_info_arr_; + Walker_registers *walk_regs_p_; /* *************** */ diff --git a/hdr/keyreg.hh b/hdr/keyreg.hh index cf1923134d..6cf6a37242 100644 --- a/hdr/keyreg.hh +++ b/hdr/keyreg.hh @@ -24,6 +24,7 @@ struct Key_register : Request_register { virtual void process_request(); virtual void do_pre_move_process(); virtual void do_post_move_process(); + virtual void acknowledge_element(Staff_elem_info); Key_register(Complex_walker*); private: diff --git a/hdr/localkeyreg.hh b/hdr/localkeyreg.hh index 48a9b5cbd2..07c016678c 100644 --- a/hdr/localkeyreg.hh +++ b/hdr/localkeyreg.hh @@ -1,5 +1,5 @@ /* - localkeyreg.hh -- part of LilyPond + localkeyreg.hh -- declare Local_key_register (c) 1997 Han-Wen Nienhuys */ @@ -13,8 +13,9 @@ struct Local_key_register : Request_register { Local_key local_key_; Local_key_item* key_item_p_; - + const Key *key_c_l_; /* *************** */ + virtual void process_request(); virtual void acknowledge_element(Staff_elem_info); virtual void do_pre_move_process(); Local_key_register(Complex_walker*); diff --git a/hdr/midiwalker.hh b/hdr/midiwalker.hh index 2121f57d3a..3673ae080b 100644 --- a/hdr/midiwalker.hh +++ b/hdr/midiwalker.hh @@ -25,8 +25,6 @@ class Midi_walker : public PCursor { Moment last_moment_; /* *************** */ - - /// output notestop events void do_stop_notes(Moment); public: diff --git a/hdr/proto.hh b/hdr/proto.hh index cfedd6b30f..8146e81a63 100644 --- a/hdr/proto.hh +++ b/hdr/proto.hh @@ -84,7 +84,7 @@ struct Molecule; struct Musical_req; struct Music_general_chord; struct Music_voice; -struct Nonmusical_req; +struct Command_req; struct Note_req; struct Notehead; struct Notehead_register; @@ -98,6 +98,7 @@ struct PStaff; struct Paperdef; struct Partial_measure_req; struct Rational; +struct Register_group; struct Request; struct Request_register; struct Rest; @@ -151,5 +152,6 @@ struct Voice_group_registers; struct Voice_list; struct Voice_registers; struct Voicegroup; +struct Walker_registers; typedef Rational Moment; #endif // PROTO_HH diff --git a/hdr/register.hh b/hdr/register.hh index 922d874644..95dfe1e67b 100644 --- a/hdr/register.hh +++ b/hdr/register.hh @@ -18,14 +18,14 @@ Hungarian postfix: reg */ class Request_register { -public: - Complex_walker * walk_l_; - Array accepted_req_arr_; - /** Warning: you can't copy a #Request_register# */ Request_register(Request_register const &); +public: + Complex_walker * walk_l_; + Array accepted_req_arr_; + Request_register(Complex_walker*); Request_register(); virtual ~Request_register(){} @@ -59,7 +59,7 @@ public: void pre_move_processing(); /// reset any appropriate data. void post_move_processing(); - + virtual bool acceptable_request_b(Request*) const; virtual void set_dir(int){} protected: /// utility diff --git a/hdr/registergroup.hh b/hdr/registergroup.hh new file mode 100644 index 0000000000..c3a4df4a62 --- /dev/null +++ b/hdr/registergroup.hh @@ -0,0 +1,38 @@ +/* + registergroup.hh -- declare + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef REGISTERGROUP_HH +#define REGISTERGROUP_HH + + +#include "plist.hh" +#include "staffeleminfo.hh" +/** + Group a number of registers. Usually delegates everything to its contents. + */ +class Register_group { +public: + IPointerList reg_list_; + + void set_dir(int i); + bool acceptable_request_b(Request*); + void pre_move_processing(); + void post_move_processing(); + void acknowledge_element(Staff_elem_info info); + bool try_request(Request*); + void process_requests(); + virtual ~Register_group(); + void add(Request_register* reg_p); + bool contains_b(Request_register*); +// bool contains_b(Register_group*); +}; + +#endif // REGISTERGROUP_HH + + diff --git a/hdr/request.hh b/hdr/request.hh index bf94d1a02e..63929a923b 100644 --- a/hdr/request.hh +++ b/hdr/request.hh @@ -56,7 +56,7 @@ struct Request { virtual Spacing_req * spacing() { return 0; } virtual Blank_req * blank() { return 0; } virtual Musical_req *musical() { return 0; } - virtual Nonmusical_req * nonmus() { return 0; } + virtual Command_req * command() { return 0; } protected: virtual void do_print()const ; }; diff --git a/hdr/sccol.hh b/hdr/scorecolumn.hh similarity index 100% rename from hdr/sccol.hh rename to hdr/scorecolumn.hh diff --git a/hdr/stcol.hh b/hdr/staffcolumn.hh similarity index 88% rename from hdr/stcol.hh rename to hdr/staffcolumn.hh index b6ecdb18a6..d80b6fa7b3 100644 --- a/hdr/stcol.hh +++ b/hdr/staffcolumn.hh @@ -1,11 +1,11 @@ /* - stcol.hh -- declare Staff_column + staffcolumn.hh -- declare Staff_column (c) 1996,97 Han-Wen Nienhuys */ -#ifndef STCOL_HH -#define STCOL_HH +#ifndef STAFFCOLUMN_HH +#define STAFFCOLUMN_HH #include "proto.hh" #include "varray.hh" #include "moment.hh" @@ -42,5 +42,6 @@ protected: }; -#endif // STCOL_HH + +#endif // STAFFCOLUMN_HH diff --git a/hdr/voicegroup.hh b/hdr/voicegroup.hh deleted file mode 100644 index 2240433c46..0000000000 --- a/hdr/voicegroup.hh +++ /dev/null @@ -1,51 +0,0 @@ -/* - voicegroup.hh -- part of LilyPond - - (c) 1996,1997 Han-Wen Nienhuys -*/ - -#ifndef VOICEGROUP_HH -#define VOICEGROUP_HH - -#include "proto.hh" -#include "string.hh" - -struct Voice_registers { - Notehead_register *head_reg_; - Slur_register *slur_reg_; - Voice *voice_l_; - - /* *************** */ - void set_dir(int i); - static bool acceptable_request(Request*); - void pre_move_processing(); - void post_move_processing(); - void acknowledge_element(Staff_elem_info info); - Voice_registers(Complex_walker*,Voice*); - ~Voice_registers(); - bool try_request(Request*); - void process_requests(); -}; - - -struct Voice_group_registers { - String group_id_str_; - Text_register* text_reg_; - Stem_beam_register* stem_beam_reg_; - Script_register *script_reg_; - Complex_walker * walk_l_; - int dir_i_; - - /* *************** */ - void set_dir(int i); - static bool acceptable_request(Request*); - void pre_move_processing(); - void post_move_processing(); - void acknowledge_element(Staff_elem_info info); - Voice_group_registers(Complex_walker*, String id = ""); - ~Voice_group_registers(); - void process_requests(); - bool try_request(Request*); -}; - -#endif diff --git a/hdr/voicegroupregs.hh b/hdr/voicegroupregs.hh new file mode 100644 index 0000000000..649be8e600 --- /dev/null +++ b/hdr/voicegroupregs.hh @@ -0,0 +1,27 @@ +/* + voicegroupregs.hh -- declare + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef VOICEGROUPREGS_HH +#define VOICEGROUPREGS_HH + +#include "registergroup.hh" + +struct Voice_group_registers : Register_group { + String group_id_str_; + Complex_walker * walk_l_; + + /* *************** */ + void set_dir(int i); + static bool acceptable_request_b(Request*); + + void acknowledge_element(Staff_elem_info info); + Voice_group_registers(Complex_walker*, String id = ""); + bool try_request(Request*); +}; +#endif // VOICEGROUPREGS_HH diff --git a/hdr/voiceregs.hh b/hdr/voiceregs.hh new file mode 100644 index 0000000000..c9e809b618 --- /dev/null +++ b/hdr/voiceregs.hh @@ -0,0 +1,27 @@ +/* + voiceregs.hh -- declare Voice_registers + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef VOICEREGS_HH +#define VOICEREGS_HH + +#include "registergroup.hh" + +struct Voice_registers : Register_group { + Voice *voice_l_; + + /* *************** */ + + static bool acceptable_request_b(Request*); + virtual void acknowledge_element(Staff_elem_info info); + + Voice_registers(Complex_walker*,Voice*); +}; + + +#endif // VOICEREGS_HH diff --git a/hdr/walkregs.hh b/hdr/walkregs.hh new file mode 100644 index 0000000000..93801d0717 --- /dev/null +++ b/hdr/walkregs.hh @@ -0,0 +1,20 @@ +/* + walkregs.hh -- declare Walker_registers + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef WALKREGS_HH +#define WALKREGS_HH + + +#include "registergroup.hh" + +struct Walker_registers : Register_group { + Walker_registers(Complex_walker *w); +}; + +#endif // WALKREGS_HH diff --git a/init/table_sixteen.ini b/init/table_sixteen.ini index 689f935b0f..1b7b379f67 100644 --- a/init/table_sixteen.ini +++ b/init/table_sixteen.ini @@ -39,11 +39,11 @@ symboltables { "clefs" = table { "violin" "\violinclef" 0pt 12.8pt -10pt 18pt - "bass" "\bassclef" 0pt 11.2pt 0pt 16pt + "bass" "\bassclef" 0pt 12.8pt 0pt 16pt "alto" "\altoclef" 0pt 12.8pt 0pt 16pt "tenor" "\altoclef" 0pt 12.8pt 0pt 16pt "violin_change" "\cviolinclef" 0pt 11.2pt -12pt 12pt - "bass_change" "\cbassclef" 0pt 12.8pt 0pt 16pt + "bass_change" "\cbassclef" 0pt 11.2pt 0pt 16pt "alto_change" "\caltoclef" 0pt 11.2pt 0pt 16pt "tenor_change" "\caltoclef" 0pt 11.2pt 0pt 16pt } diff --git a/input/maartje.ly b/input/maartje.ly index 7f35583ae2..cf77a62bcc 100644 --- a/input/maartje.ly +++ b/input/maartje.ly @@ -39,6 +39,7 @@ staff { \music { a () bes eis8 eis8 } \music { fis () g gis8 gis8 } } + \clef\tenor { c4 'c4 } [d8 e8 'f8 g8] d8 e8 f8 g8 diff --git a/input/wohltemperirt.ly b/input/wohltemperirt.ly index b5ea0f6654..7d615a4d1b 100644 --- a/input/wohltemperirt.ly +++ b/input/wohltemperirt.ly @@ -47,7 +47,7 @@ bassdux = music { $ [G c16 B] [c8 d] [F16 G] As4 [G16 F] | $} -trebstaf = staff { melodic +trebstaf = staff { melodic % every "music {} " in a staff has its own "voicegroup" music { dux } music { comes } @@ -59,8 +59,8 @@ basstaf = staff { melodic } score { - staff { basstaf } staff { trebstaf } + staff { basstaf } commands { meter {4*4} diff --git a/src/barreg.cc b/src/barreg.cc index 9a10f913b5..f0b32fd3df 100644 --- a/src/barreg.cc +++ b/src/barreg.cc @@ -10,7 +10,7 @@ #include "bar.hh" #include "commandrequest.hh" #include "complexwalker.hh" -#include "sccol.hh" +#include "scorecolumn.hh" Bar_register::Bar_register(Complex_walker*w) @@ -22,11 +22,11 @@ Bar_register::Bar_register(Complex_walker*w) bool Bar_register::try_request(Request*r_l) { - if (!r_l->nonmus()->bar()) + if (!r_l->command()->bar()) return false; assert(!bar_req_l_); - bar_req_l_ = r_l->nonmus()->bar(); + bar_req_l_ = r_l->command()->bar(); return true; } diff --git a/src/calcideal.cc b/src/calcideal.cc index 08180c64fb..1a96243426 100644 --- a/src/calcideal.cc +++ b/src/calcideal.cc @@ -2,7 +2,7 @@ #include "score.hh" #include "pscore.hh" #include "paperdef.hh" -#include "sccol.hh" +#include "scorecolumn.hh" #include "dimen.hh" diff --git a/src/clefreg.cc b/src/clefreg.cc index 81c87e953a..ed6f78073b 100644 --- a/src/clefreg.cc +++ b/src/clefreg.cc @@ -13,7 +13,7 @@ #include "commandrequest.hh" #include "timedescription.hh" #include "complexwalker.hh" -#include "stcol.hh" +#include "staffcolumn.hh" Clef_register::Clef_register(Complex_walker*w) : Request_register(w) @@ -48,14 +48,16 @@ Clef_register::read_req(Clef_change_req*c_l) } bool -Clef_register::try_request(Nonmusical_req* r_l) +Clef_register::try_request(Request * r_l) { - if (!r_l->clefchange()) + + Command_req* creq_l= r_l->command(); + if (!creq_l || !creq_l->clefchange()) return false; - accepted_req_arr_.push(r_l); + accepted_req_arr_.push(creq_l); // do it now! Others have to read c0_pos. - read_req(r_l->clefchange()); + read_req(creq_l->clefchange()); return true; } diff --git a/src/commandrequest.cc b/src/commandrequest.cc index 9af17503f3..5cf0912417 100644 --- a/src/commandrequest.cc +++ b/src/commandrequest.cc @@ -14,9 +14,16 @@ void Cadenza_req::do_print()const { - mtor << on_b; + mtor << on_b_; } +Cadenza_req::Cadenza_req(bool b) +{ + on_b_ =b; +} +/* *************** */ + + int Bar_req::compare(const Bar_req &c1)const { @@ -39,12 +46,6 @@ Partial_measure_req::Partial_measure_req(Moment m) duration_ =m; } /* *************** */ -Cadenza_req::Cadenza_req(bool b) -{ - on_b =b; -} -/* *************** */ - Meter_change_req::Meter_change_req() { beats_i_ = 0; @@ -61,7 +62,7 @@ void Timing_req::do_print()const{} void -Nonmusical_req::do_print()const{} +Command_req::do_print()const{} /* *************** */ void Barcheck_req::do_print() const{} diff --git a/src/complexstaff.cc b/src/complexstaff.cc index 9eb84cb59a..627b5745e2 100644 --- a/src/complexstaff.cc +++ b/src/complexstaff.cc @@ -7,7 +7,7 @@ #include "pscore.hh" #include "bar.hh" #include "meter.hh" -#include "sccol.hh" +#include "scorecolumn.hh" #include "commandrequest.hh" const NO_LINES = 5; diff --git a/src/complexwalker.cc b/src/complexwalker.cc index f85abe8f21..e3bcade138 100644 --- a/src/complexwalker.cc +++ b/src/complexwalker.cc @@ -9,19 +9,17 @@ #include "associter.hh" #include "script.hh" #include "musicalrequest.hh" +#include "staffcolumn.hh" #include "voice.hh" #include "pscore.hh" #include "complexstaff.hh" #include "debug.hh" -#include "voicegroup.hh" +#include "voicegroupregs.hh" +#include "voiceregs.hh" #include "complexwalker.hh" #include "misc.hh" #include "commandrequest.hh" -#include "clefreg.hh" -#include "localkeyreg.hh" -#include "keyreg.hh" -#include "meterreg.hh" -#include "barreg.hh" +#include "walkregs.hh" void @@ -37,21 +35,17 @@ Complex_walker::do_announces() Request dummy_req; for (int i = 0; i < announce_info_arr_.size(); i++){ Staff_elem_info info = announce_info_arr_[i]; + if (!info.req_l_) info.req_l_ = &dummy_req; - + + walk_regs_p_->acknowledge_element(info); for (iter_top(voice_reg_list_,j); j.ok(); j++) { j->acknowledge_element(info); } for (iter_top ( group_reg_list_, j); j.ok(); j++) { j->acknowledge_element(info); } - bar_reg_p_->acknowledge_element(info); - clef_reg_p_->acknowledge_element(info); - key_reg_p_->acknowledge_element(info); - meter_reg_p_->acknowledge_element(info); - - local_key_reg_p_->acknowledge_element(info); } } @@ -127,7 +121,7 @@ Complex_walker::do_change_group(Voice * v, String group_id_str) } bool -Complex_walker::try_command_request(Nonmusical_req *req_l) +Complex_walker::try_command_request(Command_req *req_l) { bool b=false; Voice *voice_l = (Voice*)req_l->elt_l_->voice_l_; // ugh @@ -138,13 +132,7 @@ Complex_walker::try_command_request(Nonmusical_req *req_l) Voice_group_registers* reg_l = get_voice_group(voice_l); b |= reg_l->try_request(req_l); } else { - if (!b) - b |= bar_reg_p_->try_request(req_l); - b |= clef_reg_p_->try_request(req_l); - if (!b) - b |= key_reg_p_->try_request(req_l); - if (!b) - b |= meter_reg_p_->try_request(req_l); + b |= walk_regs_p_->try_request(req_l); } return b; } @@ -155,12 +143,12 @@ Complex_walker::try_request(Request*req) bool b=false; Voice *voice_l = (Voice*)req->elt_l_->voice_l_; // ahh. This sux - if (req->nonmus()) { - b = try_command_request(req->nonmus()); - } else if (Voice_registers::acceptable_request(req)) { + if (req->command()) { + b = try_command_request(req->command()); + } else if (Voice_registers::acceptable_request_b(req)) { Voice_registers *vregs_l = get_voice_reg(voice_l); b = vregs_l->try_request(req); - } else if (Voice_group_registers::acceptable_request(req)){ + } else if (Voice_group_registers::acceptable_request_b(req)){ Voice_group_registers* reg_l = get_voice_group(voice_l); b = reg_l->try_request(req); } @@ -190,18 +178,12 @@ Complex_walker::process_requests() void Complex_walker::regs_process_requests() { + walk_regs_p_->process_requests(); for (iter_top(voice_reg_list_, j); j.ok(); j++) { j->process_requests(); } for (iter_top(group_reg_list_, j); j.ok(); j++) j->process_requests(); - - - bar_reg_p_->process_request(); - clef_reg_p_->process_request(); - key_reg_p_->process_request(); - meter_reg_p_->process_request(); - local_key_reg_p_->process_request(); } void @@ -218,23 +200,13 @@ Complex_walker::typeset_element(Staff_elem *elem_p) Complex_walker::Complex_walker(Complex_staff*s) : Staff_walker(s, s->pstaff_l_->pscore_l_) { - local_key_reg_p_= new Local_key_register(this); - clef_reg_p_= new Clef_register(this); - key_reg_p_ = new Key_register(this); - bar_reg_p_ = new Bar_register(this); - meter_reg_p_ = new Meter_register(this); - + walk_regs_p_ = new Walker_registers(this); do_post_move(); } Complex_walker::~Complex_walker() { - delete local_key_reg_p_; - delete clef_reg_p_; - delete meter_reg_p_; - delete bar_reg_p_; - delete key_reg_p_; } int @@ -259,16 +231,12 @@ Complex_walker::staff() void Complex_walker::do_pre_move() { + walk_regs_p_->pre_move_processing(); for (iter_top(voice_reg_list_,i); i.ok(); i++) { i->pre_move_processing(); } for (iter_top (group_reg_list_, j); j.ok(); j++) j->pre_move_processing(); - local_key_reg_p_->pre_move_processing(); - bar_reg_p_->pre_move_processing(); - clef_reg_p_->pre_move_processing(); - key_reg_p_->pre_move_processing(); - meter_reg_p_->pre_move_processing(); ptr()->typeset_breakable_items(prebreak_item_p_arr_, nobreak_item_p_arr_, @@ -278,19 +246,13 @@ Complex_walker::do_pre_move() void Complex_walker::do_post_move() { + walk_regs_p_->post_move_processing(); for (iter_top(voice_reg_list_,i); i.ok(); i++) { i->post_move_processing(); } announce_info_arr_.set_size(0); for (iter_top (group_reg_list_, j); j.ok(); j++) j->post_move_processing(); - - local_key_reg_p_->post_move_processing(); - bar_reg_p_->post_move_processing(); - clef_reg_p_->post_move_processing(); - key_reg_p_->post_move_processing(); - meter_reg_p_->post_move_processing(); - } Array diff --git a/src/inputmusic.cc b/src/inputmusic.cc index 8f3ca2cb93..b7ad70b0ab 100644 --- a/src/inputmusic.cc +++ b/src/inputmusic.cc @@ -8,12 +8,12 @@ Input_music::check_plet(Voice_element* velt_l) { for (iter_top(velt_l->reqs,i); i.ok(); i++) if ( i->plet() ) { - Moment start_moment = 0.0; + Moment start_moment = 0; if ( !find_plet_start_bo( i->plet()->type_c_, start_moment ) ) { error( "begin of plet not found", i->defined_ch_c_l_ ); break; } - Moment moment = 0.0; + Moment moment = 0; set_plet_backwards( moment, start_moment, i->plet()->dur_i_, i->plet()->type_i_ ); i.del(); break; @@ -209,7 +209,7 @@ Music_general_chord::translate_time(Moment t) Moment Music_general_chord::length()const { - Moment l =0.0; + Moment l =0; for (iter_top(elts,i); i.ok(); i++) l = l >? i->length(); diff --git a/src/keyreg.cc b/src/keyreg.cc index 963ebaf649..197a8f6b31 100644 --- a/src/keyreg.cc +++ b/src/keyreg.cc @@ -13,7 +13,7 @@ #include "keyitem.hh" #include "complexwalker.hh" #include "commandrequest.hh" -#include "stcol.hh" +#include "staffcolumn.hh" #include "localkeyreg.hh" #include "musicalrequest.hh" @@ -27,15 +27,25 @@ Key_register::Key_register(Complex_walker*w) bool Key_register::try_request(Request * req_l) { - if (!req_l->nonmus()->keychange()) + if (!req_l->command()->keychange()) return false; assert(!keyreq_l_); // todo - keyreq_l_ = req_l->nonmus()->keychange(); + keyreq_l_ = req_l->command()->keychange(); read_req(keyreq_l_); - walk_l_->local_key_reg_p_->local_key_.reset(key_); // ugh return true; } +void +Key_register::acknowledge_element(Staff_elem_info info) +{ + Command_req * r_l = info.req_l_->command() ; + if (r_l && r_l->clefchange() && !kit_p_) { + kit_p_ = new Key_item(walk_l_->c0_position_i()); + kit_p_->read(*this); + announce_element(Staff_elem_info(kit_p_, keyreq_l_, this)); + } +} + void Key_register::process_request() { @@ -46,7 +56,7 @@ Key_register::process_request() default_key_b_ = true; } - if (default_key_b_ || keyreq_l_) { + if ( default_key_b_ || keyreq_l_) { kit_p_ = new Key_item(walk_l_->c0_position_i()); kit_p_->read(*this); announce_element(Staff_elem_info(kit_p_, keyreq_l_, this)); @@ -57,7 +67,7 @@ void Key_register::do_pre_move_process() { if (kit_p_) { - if (default_key_b_) + if (default_key_b_) typeset_breakable_item(0,0,kit_p_); else typeset_breakable_item( @@ -85,6 +95,4 @@ Key_register::do_post_move_process() keyreq_l_ = 0; default_key_b_ = false; kit_p_ = 0; - if (!walk_l_->time_.whole_in_measure_) - walk_l_->local_key_reg_p_->local_key_.reset(key_); // ugh } diff --git a/src/localkeyreg.cc b/src/localkeyreg.cc index 5669109786..3817a36ba2 100644 --- a/src/localkeyreg.cc +++ b/src/localkeyreg.cc @@ -4,14 +4,18 @@ (c) 1997 Han-Wen Nienhuys */ #include "musicalrequest.hh" +#include "commandrequest.hh" #include "localkeyreg.hh" #include "localkeyitem.hh" #include "complexwalker.hh" +#include "keyreg.hh" +#include "debug.hh" Local_key_register::Local_key_register(Complex_walker*w) : Request_register(w) { - key_item_p_ = 0; + key_item_p_ = 0; + key_c_l_ = 0; } void @@ -43,5 +47,21 @@ Local_key_register::acknowledge_element(Staff_elem_info info) local_key_.oct(melodic_l_->octave_i_) .set(melodic_l_->notename_i_, melodic_l_->accidental_i_); } + } else if (info.req_l_->command() && + info.req_l_->command()->keychange()) { + Key_register * key_reg_l = (Key_register*)info.origin_reg_l_; + key_c_l_ = &key_reg_l->key_; + local_key_.reset(*key_c_l_); + } +} + +void +Local_key_register::process_request() +{ + if (!walk_l_->time_.whole_in_measure_) { + if (key_c_l_) + local_key_.reset(*key_c_l_); + else if( walk_l_->when() >0) + warning ("Help me! can't figure current key", 0); } } diff --git a/src/lyricitem.cc b/src/lyricitem.cc index f8ec193be0..30f49e5bf4 100644 --- a/src/lyricitem.cc +++ b/src/lyricitem.cc @@ -13,7 +13,7 @@ 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 + pos_i_ = -voice_count_i * 4 ; // 4 fontsize dependant. TODO dir_i_ = -1; } diff --git a/src/lyricwalker.cc b/src/lyricwalker.cc index fbff9a8cd5..c77b716ec2 100644 --- a/src/lyricwalker.cc +++ b/src/lyricwalker.cc @@ -13,7 +13,7 @@ #include "lyricwalker.hh" #include "debug.hh" #include "lyricitem.hh" -#include "stcol.hh" +#include "staffcolumn.hh" void Lyric_walker::process_requests() diff --git a/src/meterreg.cc b/src/meterreg.cc index e7d8b8e973..3aab0fb291 100644 --- a/src/meterreg.cc +++ b/src/meterreg.cc @@ -19,11 +19,11 @@ Meter_register::Meter_register(Complex_walker*w) bool Meter_register::try_request(Request*r_l) { - if (!r_l->nonmus()->meterchange()) + if (!r_l->command()->meterchange()) return false; assert(!meter_req_l_); - meter_req_l_ = r_l->nonmus()->meterchange(); + meter_req_l_ = r_l->command()->meterchange(); return true; } diff --git a/src/midioutput.cc b/src/midioutput.cc index b17486e970..d84649fd49 100644 --- a/src/midioutput.cc +++ b/src/midioutput.cc @@ -5,6 +5,7 @@ (c) 1997 Han-Wen Nienhuys , Jan Nieuwehuizen */ + #include "plist.hh" #include "debug.hh" #include "score.hh" @@ -14,7 +15,7 @@ #include "midioutput.hh" #include "midiwalker.hh" #include "midiitem.hh" -#include "stcol.hh" +#include "staffcolumn.hh" #include "musicalrequest.hh" diff --git a/src/midiwalker.cc b/src/midiwalker.cc index f1d74d87e4..036a227686 100644 --- a/src/midiwalker.cc +++ b/src/midiwalker.cc @@ -9,11 +9,11 @@ #include "musicalrequest.hh" #include "pscore.hh" #include "staff.hh" -#include "stcol.hh" #include "midiwalker.hh" #include "midiitem.hh" #include "midistream.hh" #include "debug.hh" +#include "staffcolumn.hh" Midi_walker::Midi_walker(Staff *st_l, Midi_track* track_l) : PCursor(st_l->cols_) @@ -21,7 +21,9 @@ Midi_walker::Midi_walker(Staff *st_l, Midi_track* track_l) track_l_ = track_l; last_moment_= 0; } - +/** + output notestop events for all notes which end before #max_moment# + */ void Midi_walker::do_stop_notes(Moment max_moment) { diff --git a/src/register.cc b/src/register.cc index d58f262295..a1b45a96a5 100644 --- a/src/register.cc +++ b/src/register.cc @@ -1,5 +1,5 @@ /* - register.cc -- implement Staff_elem_info, Request_register + register.cc -- implement Request_register Sourcefile of LilyPond musictypesetter @@ -14,27 +14,7 @@ #include "localkeyitem.hh" #include "complexstaff.hh" -Staff_elem_info::Staff_elem_info(Staff_elem*s_l, Request*r_l, - Request_register *reg_l) -{ - elem_p_ = s_l; - voice_l_ = (r_l)?r_l->elt_l_->voice_l_:0; - req_l_ = r_l; - group_regs_l_ = 0; - origin_reg_l_ = reg_l; -} - -Staff_elem_info::Staff_elem_info() -{ - elem_p_ = 0; - voice_l_ = 0; - - group_regs_l_ = 0; - origin_reg_l_ = 0; - req_l_ = 0; -} -/* *************** */ bool Request_register::try_request(Request*) { @@ -93,3 +73,8 @@ Request_register::typeset_breakable_item(Item * pre_p , Item * nobreak_p, walk_l_->typeset_breakable_item(pre_p, nobreak_p,post_p); } +bool +Request_register::acceptable_request_b(Request*)const +{ + return false; +} diff --git a/src/registergroup.cc b/src/registergroup.cc new file mode 100644 index 0000000000..c1bb809be8 --- /dev/null +++ b/src/registergroup.cc @@ -0,0 +1,88 @@ +/* + registergroup.cc -- implement Register_group + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "registergroup.hh" +#include "register.hh" + +bool +Register_group::acceptable_request_b(Request* r) +{ + for (iter_top(reg_list_, i); i.ok(); i++) { + if (i->acceptable_request_b(r)) + return true; + } + return false; +} + +void +Register_group::set_dir(int d) +{ + for (iter_top(reg_list_, i); i.ok(); i++) { + i->set_dir(d); + } +} + +void +Register_group::pre_move_processing() +{ + for (iter_top(reg_list_, i); i.ok(); i++) + i->pre_move_processing(); +} + +void +Register_group::process_requests() +{ + for (iter_top(reg_list_, i); i.ok(); i++) + i->process_request(); +} + +void +Register_group::post_move_processing() +{ + for (iter_top(reg_list_, i); i.ok(); i++) + i->post_move_processing(); +} + +void +Register_group::acknowledge_element(Staff_elem_info info) +{ + for (iter_top(reg_list_, i); i.ok(); i++) + i->acknowledge_element(info); +} + + +bool +Register_group::contains_b(Request_register* reg_l) +{ + for (iter_top(reg_list_, i); i.ok(); i++) + if (i.ptr() == reg_l) + return true; + return false; +} + + +bool +Register_group::try_request(Request*req_l) +{ + for (iter_top(reg_list_, i); i.ok(); i++) + if (i->try_request(req_l)) + return true; + return false; +} + + + +void +Register_group::add(Request_register *reg_p) +{ + reg_list_.bottom().add(reg_p); +} + +Register_group::~Register_group() +{ +} diff --git a/src/score.cc b/src/score.cc index 83bffd72f7..4d8ac63296 100644 --- a/src/score.cc +++ b/src/score.cc @@ -7,7 +7,7 @@ */ #include "tstream.hh" #include "score.hh" -#include "sccol.hh" +#include "scorecolumn.hh" #include "pscore.hh" #include "staff.hh" #include "debug.hh" @@ -159,15 +159,12 @@ Score::find_col(Moment w, bool mus) } void -Score::do_cols() - +Score::do_cols() { - iter_top(cols_,i); for (; i.ok(); i++) { pscore_p_->add(i->pcol_l_); } - } Moment diff --git a/src/sccol.cc b/src/scorecolumn.cc similarity index 94% rename from src/sccol.cc rename to src/scorecolumn.cc index 43d549b175..80fc804f0c 100644 --- a/src/sccol.cc +++ b/src/scorecolumn.cc @@ -1,5 +1,5 @@ /* - sccol.cc -- implement Score_column + scorecolumn.cc -- implement Score_column source file of the LilyPond music typesetter @@ -8,7 +8,7 @@ #include "debug.hh" #include "pcol.hh" -#include "sccol.hh" +#include "scorecolumn.hh" int Score_column::compare(Score_column & c1, Score_column &c2) diff --git a/src/scorewalker.cc b/src/scorewalker.cc index 1cd9339ce9..c79031ab9a 100644 --- a/src/scorewalker.cc +++ b/src/scorewalker.cc @@ -11,7 +11,7 @@ #include "score.hh" #include "staffwalker.hh" #include "staff.hh" -#include "sccol.hh" +#include "scorecolumn.hh" Score_walker::Score_walker(Score *s) :PCursor (s->cols_) diff --git a/src/staff.cc b/src/staff.cc index a996964661..d5c08487ab 100644 --- a/src/staff.cc +++ b/src/staff.cc @@ -2,8 +2,8 @@ #include "score.hh" #include "voice.hh" #include "staffwalker.hh" -#include "stcol.hh" -#include "sccol.hh" +#include "staffcolumn.hh" +#include "scorecolumn.hh" #include "debug.hh" #include "musicalrequest.hh" @@ -57,17 +57,17 @@ Staff::get_col(Moment w, PCursor *last) } - PCursor sccols(score_l_->find_col(w, false)); - Staff_column* stcol_p = new Staff_column; - stcol_p->staff_l_ = this; - Score_column* comcol_l = sccols++; - stcol_p->set_cols(comcol_l, sccols); + PCursor scorecolumns(score_l_->find_col(w, false)); + Staff_column* staffcolumn_p = new Staff_column; + staffcolumn_p->staff_l_ = this; + Score_column* comcol_l = scorecolumns++; + staffcolumn_p->set_cols(comcol_l, scorecolumns); if (!i.ok()) { - cols_.bottom().add( stcol_p); + cols_.bottom().add( staffcolumn_p); i = cols_.bottom(); } else { - i.insert(stcol_p); + i.insert(staffcolumn_p); i--; } if (last) @@ -117,7 +117,7 @@ Staff::OK() const Moment Staff::last() const { - Moment l = 0.0; + Moment l = 0; for (iter_top(voice_list_,i); i.ok(); i++) { l = l >? i->last(); } diff --git a/src/stcol.cc b/src/staffcolumn.cc similarity index 84% rename from src/stcol.cc rename to src/staffcolumn.cc index c12a0d898f..229ab69933 100644 --- a/src/stcol.cc +++ b/src/staffcolumn.cc @@ -1,5 +1,5 @@ /* - stcol.cc -- implement Staff_column + staffcolumn.cc -- implement Staff_column source file of the LilyPond music typesetter @@ -8,8 +8,8 @@ #include "staff.hh" #include "voice.hh" #include "timedescription.hh" -#include "sccol.hh" -#include "stcol.hh" +#include "scorecolumn.hh" +#include "staffcolumn.hh" #include "commandrequest.hh" #include "musicalrequest.hh" #include "interval.hh" @@ -37,10 +37,10 @@ void Staff_column::add(Voice_element*ve) { for (iter_top(ve->reqs,j); j.ok(); j++) { - if (j->nonmus()) { - Nonmusical_req * c_l = j->nonmus(); + if (j->command()) { + Command_req * c_l = j->command(); if (c_l->timing()) { - timing_req_l_arr_.push(j->nonmus()->timing()); + timing_req_l_arr_.push(j->command()->timing()); } if (!c_l->barcheck() && !c_l->partial() && !c_l->measuregrouping()) @@ -79,7 +79,7 @@ Staff_column::set_cols(Score_column*c1, Score_column*c2) void Staff_column::setup_one_request(Request * j) { - if (j->nonmus()) // ugh + if (j->command()) // ugh commandreq_l_arr_.push(j); else if (j->musical()) musicalreq_l_arr_.push(j); @@ -89,13 +89,15 @@ void Staff_column::typeset_musical_item(Item*i) { assert(i); - Score_column * sccol_l = musical_column_l_; - musical_column_l_->pcol_l_->pscore_l_->typeset_item(i, sccol_l->pcol_l_, + Score_column * scorecolumn_l = musical_column_l_; + musical_column_l_->pcol_l_->pscore_l_->typeset_item(i, scorecolumn_l->pcol_l_, staff_l_->pstaff_l_); } /** - align items in #item_l_arr#, return the width. + align items in #item_l_arr#, + + @return the width of the items after aligning. */ Interval align_items(Array item_l_arr) @@ -103,7 +105,9 @@ align_items(Array item_l_arr) Interval wid(0,0); for (int i =0; i < item_l_arr.size(); i++) { Interval item_width= item_l_arr[i]->width(); - item_l_arr[i]->translate(Offset( wid.right - item_width.left ,0)); + Real dx =wid.right - item_width.left; + item_width += dx; + item_l_arr[i]->translate(Offset(dx ,0)); wid.unite(item_width); } return wid; diff --git a/src/staffeleminfo.cc b/src/staffeleminfo.cc new file mode 100644 index 0000000000..611000541d --- /dev/null +++ b/src/staffeleminfo.cc @@ -0,0 +1,32 @@ +/* + staffeleminfo.cc -- implement Staff_elem_info + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "staffeleminfo.hh" +#include "request.hh" +#include "voice.hh" + +Staff_elem_info::Staff_elem_info(Staff_elem*s_l, Request*r_l, + Request_register *reg_l) +{ + elem_p_ = s_l; + voice_l_ = (r_l)?r_l->elt_l_->voice_l_:0; + req_l_ = r_l; + group_regs_l_ = 0; + origin_reg_l_ = reg_l; +} + +Staff_elem_info::Staff_elem_info() +{ + elem_p_ = 0; + voice_l_ = 0; + + group_regs_l_ = 0; + origin_reg_l_ = 0; + req_l_ = 0; +} + diff --git a/src/staffwalker.cc b/src/staffwalker.cc index bba82e38b8..c3900d35f2 100644 --- a/src/staffwalker.cc +++ b/src/staffwalker.cc @@ -10,8 +10,8 @@ #include "staff.hh" #include "musicalrequest.hh" #include "staffwalker.hh" -#include "stcol.hh" -#include "sccol.hh" +#include "staffcolumn.hh" +#include "scorecolumn.hh" #include "debug.hh" #include "timedescription.hh" #include "commandrequest.hh" @@ -69,7 +69,7 @@ Staff_walker::process_timing_reqs() } else if (tr_l->barcheck() && time_.whole_in_measure_) { warning( "Barcheck failed", tr_l->defined_ch_c_l_ ); } else if (tr_l->cadenza()) { - time_.set_cadenza(tr_l->cadenza()->on_b); + time_.set_cadenza(tr_l->cadenza()->on_b_); } else if (tr_l->measuregrouping()) { *default_grouping = parse_grouping( tr_l->measuregrouping()->beat_i_arr_, diff --git a/src/template2.cc b/src/template2.cc index 29d4b1eaf3..b3b8624ef0 100644 --- a/src/template2.cc +++ b/src/template2.cc @@ -1,9 +1,17 @@ +/* + template2.cc -- instantiate some list templates. + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + #include "symbol.hh" #include "voice.hh" #include "musicalrequest.hh" #include "staff.hh" -#include "sccol.hh" -#include "stcol.hh" +#include "scorecolumn.hh" +#include "staffcolumn.hh" #include "spanner.hh" #include "plist.tcc" #include "pcursor.tcc" diff --git a/src/template4.cc b/src/template4.cc index 69f7513390..d26e748e6f 100644 --- a/src/template4.cc +++ b/src/template4.cc @@ -1,3 +1,11 @@ +/* + template4.cc -- instantiate PointerList baseclass. + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + #include "proto.hh" #include "list.tcc" #include "cursor.tcc" diff --git a/src/template6.cc b/src/template6.cc index 1f94149abf..e85062003e 100644 --- a/src/template6.cc +++ b/src/template6.cc @@ -1,8 +1,10 @@ #include "proto.hh" #include "plist.tcc" #include "register.hh" -#include "voicegroup.hh" +#include "voicegroupregs.hh" +#include "voiceregs.hh" IPL_instantiate(Voice_registers); IPL_instantiate(Voice_group_registers); +IPL_instantiate(Request_register); diff --git a/src/voice.cc b/src/voice.cc index 718e7cb6d1..ad07cf2040 100644 --- a/src/voice.cc +++ b/src/voice.cc @@ -48,7 +48,7 @@ Voice::Voice(Voice const&src) Voice::Voice() { - start = 0.0; + start = 0; } void diff --git a/src/voicegroup.cc b/src/voicegroup.cc deleted file mode 100644 index 0674ee08c8..0000000000 --- a/src/voicegroup.cc +++ /dev/null @@ -1,110 +0,0 @@ -/* - voicegroup.cc -- implement Voice_group_registers - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#include "plist.hh" -#include "musicalrequest.hh" -#include "voicegroup.hh" -#include "register.hh" -#include "textreg.hh" -#include "stembeamreg.hh" -#include "scriptreg.hh" -#include "complexwalker.hh" -#include "commandrequest.hh" - -static int temp_id_count; - -Voice_group_registers::Voice_group_registers(Complex_walker*w_l, String id) -{ - walk_l_ = w_l; - text_reg_=new Text_register(w_l); - stem_beam_reg_= new Stem_beam_register(w_l); - script_reg_ = new Script_register(w_l); - if (id=="") - id = __FUNCTION__ + String(temp_id_count++); - group_id_str_ = id; - dir_i_ = 0; -} - -Voice_group_registers::~Voice_group_registers() -{ - delete text_reg_; - delete stem_beam_reg_; - delete script_reg_; -} - -void -Voice_group_registers::pre_move_processing() -{ - stem_beam_reg_->pre_move_processing(); - script_reg_->pre_move_processing(); - text_reg_->pre_move_processing(); -} - -void -Voice_group_registers::post_move_processing() -{ - stem_beam_reg_->post_move_processing(); - text_reg_->post_move_processing(); - script_reg_->post_move_processing(); -} - -bool -Voice_group_registers::try_request(Request*r_l) -{ - if (r_l->groupfeature()) { - set_dir(r_l->groupfeature()->stemdir_i_); - return true; - } - bool b = stem_beam_reg_->try_request(r_l); - if (!b) - b|= script_reg_->try_request(r_l); - if (!b) - b|= text_reg_->try_request(r_l); - - return b; -} - -void -Voice_group_registers::acknowledge_element(Staff_elem_info i) -{ - if (i.group_regs_l_!= this) - return; - - stem_beam_reg_->acknowledge_element(i); - script_reg_->acknowledge_element(i); - text_reg_->acknowledge_element(i); -} - -void -Voice_group_registers::set_dir(int i) -{ - stem_beam_reg_->set_dir(i); - script_reg_->set_dir(i); - text_reg_->set_dir(i); - - Array vr_arr (walk_l_->get_voice_regs(this)); - for (int j=0; jset_dir(i); -} -} -void -Voice_group_registers::process_requests() -{ - stem_beam_reg_->process_request(); - script_reg_->process_request(); - text_reg_->process_request(); -} - - -bool -Voice_group_registers::acceptable_request(Request*r) -{ - return (r->stem() || r->beam() || r->text() || r->script() || - r->groupfeature()); -} diff --git a/src/voicegroupregs.cc b/src/voicegroupregs.cc new file mode 100644 index 0000000000..d23b58ac70 --- /dev/null +++ b/src/voicegroupregs.cc @@ -0,0 +1,70 @@ +/* + voicegroup.cc -- implement Voice_group_registers + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "plist.hh" +#include "musicalrequest.hh" +#include "voiceregs.hh" +#include "voicegroupregs.hh" +#include "register.hh" +#include "textreg.hh" +#include "stembeamreg.hh" +#include "scriptreg.hh" +#include "complexwalker.hh" +#include "commandrequest.hh" + +static int temp_id_count; + +Voice_group_registers::Voice_group_registers(Complex_walker*w_l, String id) +{ + walk_l_ = w_l; + add(new Text_register(w_l)); + add(new Stem_beam_register(w_l)); + add(new Script_register(w_l)); + + if (id=="") // UGH + id = __FUNCTION__ + String(temp_id_count++); + group_id_str_ = id; +} + +bool +Voice_group_registers::try_request(Request*r_l) +{ + if (r_l->groupfeature()) { + set_dir(r_l->groupfeature()->stemdir_i_); + return true; + } + return Register_group::try_request(r_l); +} + +void +Voice_group_registers::acknowledge_element(Staff_elem_info i) +{ + if (i.group_regs_l_!= this) + return; + Register_group::acknowledge_element(i); +} +#if 1 +void +Voice_group_registers::set_dir(int i) +{ + Register_group::set_dir(i); + + // ughh + Array vr_arr (walk_l_->get_voice_regs(this)); + for (int j=0; jset_dir(i); + } +} +#endif +bool +Voice_group_registers::acceptable_request_b(Request*r) +{ + return (r->stem() || r->beam() || r->text() || r->script() || + r->groupfeature()); +} diff --git a/src/voiceregs.cc b/src/voiceregs.cc index d6c24cd674..ea56a5da46 100644 --- a/src/voiceregs.cc +++ b/src/voiceregs.cc @@ -1,5 +1,13 @@ +/* + voiceregs.cc -- implement Voice_registers + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + #include "musicalrequest.hh" -#include "voicegroup.hh" +#include "voiceregs.hh" #include "register.hh" #include "slurreg.hh" #include "headreg.hh" @@ -7,21 +15,8 @@ Voice_registers::Voice_registers(Complex_walker*c_l, Voice *v_p) { voice_l_ = v_p; - head_reg_ = new Notehead_register(c_l); - slur_reg_ = new Slur_register(c_l); -} -Voice_registers::~Voice_registers() -{ - delete head_reg_; - delete slur_reg_; -} -bool -Voice_registers::try_request(Request * r_l) -{ - bool b = head_reg_->try_request(r_l); - if (!b) - b = slur_reg_->try_request(r_l); - return b; + add(new Notehead_register(c_l)); + add(new Slur_register(c_l)); } void @@ -29,41 +24,11 @@ Voice_registers::acknowledge_element(Staff_elem_info i) { if (i.voice_l_ != voice_l_) return; - if (i.origin_reg_l_ != slur_reg_) - slur_reg_->acknowledge_element(i); -} - -void -Voice_registers::pre_move_processing() -{ - head_reg_->pre_move_processing(); - slur_reg_->pre_move_processing(); -} -void -Voice_registers::post_move_processing() -{ - head_reg_->post_move_processing(); - slur_reg_->post_move_processing(); -} - -void -Voice_registers::process_requests() -{ - head_reg_->process_request(); - slur_reg_->process_request(); + Register_group::acknowledge_element(i); } bool -Voice_registers::acceptable_request(Request*r) +Voice_registers::acceptable_request_b(Request*r) { return (r->rest() || r->note() || r->slur()); - -} - -void -Voice_registers::set_dir(int i) -{ - head_reg_->set_dir(i); - slur_reg_->set_dir(i); } - diff --git a/src/walkregs.cc b/src/walkregs.cc new file mode 100644 index 0000000000..4381688398 --- /dev/null +++ b/src/walkregs.cc @@ -0,0 +1,23 @@ +/* + walkregs.cc -- implement Walker_registers + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "clefreg.hh" +#include "localkeyreg.hh" +#include "keyreg.hh" +#include "meterreg.hh" +#include "barreg.hh" +#include "walkregs.hh" + +Walker_registers::Walker_registers(Complex_walker *w) +{ + add( new Bar_register(w)); + add( new Meter_register(w)); + add( new Clef_register(w)); + add( new Key_register(w)); + add( new Local_key_register(w)); +} -- 2.39.5