</a
>
+=item *
+<a href=wohltemperirt.midi
+>
+MIDI output
+</a
+>
+
+=item *
+<a href=docxx/index.html
+>
+The DOC++ documentation of the C++ sources.
+</a
+>
\ No newline at end of file
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;"
# 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
.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++
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
+pl 35
+ - Register_group
+Bugfix
+ - alignment of breakable items.
+
*******
pl 34
- better midi syntax.
# 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\
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\
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
-
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
* 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.
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.
* caching breakpoints
- * use exceptions?
\ No newline at end of file
+ * use exceptions iso assert?
\ No newline at end of file
# version info
MAJVER=0
MINVER=0
-PATCHLEVEL=34
+PATCHLEVEL=35
LINKER=$(CXX)
include Site.make
-include Site.make
+
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"
+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:
------------------
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
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
MAJVER=1
MINVER=1
-PATCHLEVEL=1
+PATCHLEVEL=2
PACKAGENAME=flower
--- /dev/null
+/*
+ pqueue.hh -- declare
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef PQUEUE_HH
+#define PQUEUE_HH
+
+#include "varray.hh"
+
+/**
+ Stupid Prioq. Should use Lists and STL.
+ Smallest is put at the front.
+ */
+
+template<class V, class I>
+struct PQueue
+{
+ Array<V> value_arr_;
+ Array<I> 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
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 );
}
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 )
{
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 );
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
+#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
/* ************** */
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);
#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; }
/** 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);
};
/// toggle Cadenza mode
struct Cadenza_req : Timing_req {
/// turn on?
- bool on_b;
+ bool on_b_;
Cadenza_req(bool);
REQUESTMETHODS(Cadenza_req,cadenza);
};
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_req*> melodic_p_arr_;
Key_change_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);
#include "key.hh"
-#include "stcol.hh"
#include "staff.hh"
#include "staffwalker.hh"
#define COMPLEXWALKER_HH
#include "proto.hh"
-#include "voicegroup.hh"
#include "assoc.hh"
#include "staffwalker.hh"
#include "staffeleminfo.hh"
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);
IPointerList<Voice_registers *> voice_reg_list_;
IPointerList<Voice_group_registers*> group_reg_list_;
Assoc<Voice *, Voice_group_registers *> 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<Staff_elem_info> announce_info_arr_;
+ Walker_registers *walk_regs_p_;
/* *************** */
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:
/*
- localkeyreg.hh -- part of LilyPond
+ localkeyreg.hh -- declare Local_key_register
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
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*);
Moment last_moment_;
/* *************** */
-
- /// output notestop events
void do_stop_notes(Moment);
public:
struct Musical_req;
struct Music_general_chord;
struct Music_voice;
-struct Nonmusical_req;
+struct Command_req;
struct Note_req;
struct Notehead;
struct Notehead_register;
struct Paperdef;
struct Partial_measure_req;
struct Rational;
+struct Register_group;
struct Request;
struct Request_register;
struct Rest;
struct Voice_list;
struct Voice_registers;
struct Voicegroup;
+struct Walker_registers;
typedef Rational Moment;
#endif // PROTO_HH
Hungarian postfix: reg
*/
class Request_register {
-public:
- Complex_walker * walk_l_;
- Array<Request*> accepted_req_arr_;
-
/**
Warning: you can't copy a #Request_register#
*/
Request_register(Request_register const &);
+public:
+ Complex_walker * walk_l_;
+ Array<Request*> accepted_req_arr_;
+
Request_register(Complex_walker*);
Request_register();
virtual ~Request_register(){}
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
--- /dev/null
+/*
+ registergroup.hh -- declare
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#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<Request_register*> 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
+
+
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 ;
};
+++ /dev/null
-/*
- sccol.hh -- part of LilyPond
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef SCCOL_HH
-#define SCCOL_HH
-#include "proto.hh"
-#include "varray.hh"
-#include "moment.hh"
-
-
-/**
-
- When typesetting hasn't started on PScore yet, the columns which
- contain data have a rhythmical position. Score_column is the type
- with a rhythmical time attached to it. The calculation of
- idealspacing is done with data in these columns. (notably: the
- #durations# field)
-
- */
-
-class Score_column {
- friend class Score;
- friend class Score_walker;
-
- bool musical_b_;
- Moment when_;
- void set_breakable();
-public:
- /// indirection to column
- PCol * pcol_l_;
-
- /// length of notes/rests in this column
- Array<Moment> durations;
-
- /* *************** */
-
- Moment when() { return when_; }
- Score_column(Moment when);
- static int compare(Score_column & c1, Score_column &c2);
- void add_duration(Moment );
- void preprocess();
- bool breakable_b();
- bool musical_b() { return musical_b_; }
- bool used_b();
- void print() const;
-
-
-};
-
-instantiate_compare(Score_column&, Score_column::compare);
-
-#endif // SCCOL_HH
-
-
-
-
--- /dev/null
+/*
+ sccol.hh -- part of LilyPond
+
+ (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef SCCOL_HH
+#define SCCOL_HH
+#include "proto.hh"
+#include "varray.hh"
+#include "moment.hh"
+
+
+/**
+
+ When typesetting hasn't started on PScore yet, the columns which
+ contain data have a rhythmical position. Score_column is the type
+ with a rhythmical time attached to it. The calculation of
+ idealspacing is done with data in these columns. (notably: the
+ #durations# field)
+
+ */
+
+class Score_column {
+ friend class Score;
+ friend class Score_walker;
+
+ bool musical_b_;
+ Moment when_;
+ void set_breakable();
+public:
+ /// indirection to column
+ PCol * pcol_l_;
+
+ /// length of notes/rests in this column
+ Array<Moment> durations;
+
+ /* *************** */
+
+ Moment when() { return when_; }
+ Score_column(Moment when);
+ static int compare(Score_column & c1, Score_column &c2);
+ void add_duration(Moment );
+ void preprocess();
+ bool breakable_b();
+ bool musical_b() { return musical_b_; }
+ bool used_b();
+ void print() const;
+
+
+};
+
+instantiate_compare(Score_column&, Score_column::compare);
+
+#endif // SCCOL_HH
+
+
+
+
--- /dev/null
+/*
+ staffcolumn.hh -- declare Staff_column
+
+ (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef STAFFCOLUMN_HH
+#define STAFFCOLUMN_HH
+#include "proto.hh"
+#include "varray.hh"
+#include "moment.hh"
+
+/// store simultaneous requests
+class Staff_column {
+
+ Staff_column(Staff_column const&);
+
+public:
+ Array<Request*> musicalreq_l_arr_;
+ Array<Request*> commandreq_l_arr_;
+ Staff * staff_l_;
+
+ /// fields to collect timing data vertically.
+ Array<Timing_req*> timing_req_l_arr_;
+ Score_column *musical_column_l_, *command_column_l_;
+
+ /* *************** */
+
+ Staff_column();
+
+ Moment when() const;
+ void set_cols(Score_column *c1, Score_column *c2);
+ void add(Voice_element*ve);
+ void OK() const;
+ ~Staff_column();
+ void typeset_breakable_items(Array<Item *> &pre_p_arr,
+ Array<Item *> &nobreak_p_arr,
+ Array<Item *> &post_p_arr);
+ void typeset_musical_item(Item *i);
+protected:
+ void setup_one_request(Request*);
+};
+
+
+
+#endif // STAFFCOLUMN_HH
+
+++ /dev/null
-/*
- stcol.hh -- declare Staff_column
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef STCOL_HH
-#define STCOL_HH
-#include "proto.hh"
-#include "varray.hh"
-#include "moment.hh"
-
-/// store simultaneous requests
-class Staff_column {
-
- Staff_column(Staff_column const&);
-
-public:
- Array<Request*> musicalreq_l_arr_;
- Array<Request*> commandreq_l_arr_;
- Staff * staff_l_;
-
- /// fields to collect timing data vertically.
- Array<Timing_req*> timing_req_l_arr_;
- Score_column *musical_column_l_, *command_column_l_;
-
- /* *************** */
-
- Staff_column();
-
- Moment when() const;
- void set_cols(Score_column *c1, Score_column *c2);
- void add(Voice_element*ve);
- void OK() const;
- ~Staff_column();
- void typeset_breakable_items(Array<Item *> &pre_p_arr,
- Array<Item *> &nobreak_p_arr,
- Array<Item *> &post_p_arr);
- void typeset_musical_item(Item *i);
-protected:
- void setup_one_request(Request*);
-};
-
-
-#endif // STCOL_HH
-
+++ /dev/null
-/*
- voicegroup.hh -- part of LilyPond
-
- (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#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
--- /dev/null
+/*
+ voicegroupregs.hh -- declare
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#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
--- /dev/null
+/*
+ voiceregs.hh -- declare Voice_registers
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#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
--- /dev/null
+/*
+ walkregs.hh -- declare Walker_registers
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef WALKREGS_HH
+#define WALKREGS_HH
+
+
+#include "registergroup.hh"
+
+struct Walker_registers : Register_group {
+ Walker_registers(Complex_walker *w);
+};
+
+#endif // WALKREGS_HH
"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
}
\music { a () bes eis8 eis8 }
\music { fis () g gis8 gis8 }
}
+ \clef\tenor
{ c4 'c4 }
[d8 e8 'f8 g8] d8 e8 f8 g8
[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 }
}
score {
- staff { basstaf }
staff { trebstaf }
+ staff { basstaf }
commands {
meter {4*4}
#include "bar.hh"
#include "commandrequest.hh"
#include "complexwalker.hh"
-#include "sccol.hh"
+#include "scorecolumn.hh"
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;
}
#include "score.hh"
#include "pscore.hh"
#include "paperdef.hh"
-#include "sccol.hh"
+#include "scorecolumn.hh"
#include "dimen.hh"
#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)
}
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;
}
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
{
duration_ =m;
}
/* *************** */
-Cadenza_req::Cadenza_req(bool b)
-{
- on_b =b;
-}
-/* *************** */
-
Meter_change_req::Meter_change_req()
{
beats_i_ = 0;
Timing_req::do_print()const{}
void
-Nonmusical_req::do_print()const{}
+Command_req::do_print()const{}
/* *************** */
void
Barcheck_req::do_print() const{}
#include "pscore.hh"
#include "bar.hh"
#include "meter.hh"
-#include "sccol.hh"
+#include "scorecolumn.hh"
#include "commandrequest.hh"
const NO_LINES = 5;
#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
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);
}
}
}
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
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;
}
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);
}
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
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
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_,
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<Voice_registers*>
{
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;
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();
#include "keyitem.hh"
#include "complexwalker.hh"
#include "commandrequest.hh"
-#include "stcol.hh"
+#include "staffcolumn.hh"
#include "localkeyreg.hh"
#include "musicalrequest.hh"
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()
{
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));
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(
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
}
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
#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
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);
}
}
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;
}
#include "lyricwalker.hh"
#include "debug.hh"
#include "lyricitem.hh"
-#include "stcol.hh"
+#include "staffcolumn.hh"
void
Lyric_walker::process_requests()
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;
}
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>, Jan Nieuwehuizen <jan@digicash.com>
*/
+
#include "plist.hh"
#include "debug.hh"
#include "score.hh"
#include "midioutput.hh"
#include "midiwalker.hh"
#include "midiitem.hh"
-#include "stcol.hh"
+#include "staffcolumn.hh"
#include "musicalrequest.hh"
#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<Staff_column*>(st_l->cols_)
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)
{
/*
- register.cc -- implement Staff_elem_info, Request_register
+ register.cc -- implement Request_register
Sourcefile of LilyPond musictypesetter
#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*)
{
walk_l_->typeset_breakable_item(pre_p, nobreak_p,post_p);
}
+bool
+Request_register::acceptable_request_b(Request*)const
+{
+ return false;
+}
--- /dev/null
+/*
+ registergroup.cc -- implement Register_group
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#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()
+{
+}
+++ /dev/null
-/*
- sccol.cc -- implement Score_column
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#include "debug.hh"
-#include "pcol.hh"
-#include "sccol.hh"
-
-int
-Score_column::compare(Score_column & c1, Score_column &c2)
-{
- return sign(c1.when_ - c2.when_);
-}
-
-void
-Score_column::set_breakable()
-{
- pcol_l_->set_breakable();
-}
-
-Score_column::Score_column(Moment w)
-{
- when_ = w;
- pcol_l_ = new PCol(0);
- musical_b_ = false;
-}
-
-bool
-Score_column::used_b() {
- return pcol_l_->used_b();
-}
-
-void
-Score_column::print() const
-{
-#ifndef NPRINT
- mtor << "Score_column { mus "<< musical_b_ <<" at " << when_<<'\n';
- mtor << "durations: [";
- for (int i=0; i < durations.size(); i++)
- mtor << durations[i] << " ";
- mtor << "]\n";
- pcol_l_->print();
- mtor << "}\n";
-#endif
-}
-
-int
-Moment_compare(Moment &a , Moment& b)
-{
- return sign(a-b);
-}
-
-void
-Score_column::preprocess()
-{
- durations.sort(Moment_compare);
-}
-void
-Score_column::add_duration(Moment d)
-{
- assert(d);
- for (int i = 0; i< durations.size(); i++) {
- if (d == durations[i])
- return ;
- }
- durations.push(d);
-}
-
-bool
-Score_column::breakable_b()
-{
- return pcol_l_->breakable_b();
-}
*/
#include "tstream.hh"
#include "score.hh"
-#include "sccol.hh"
+#include "scorecolumn.hh"
#include "pscore.hh"
#include "staff.hh"
#include "debug.hh"
}
void
-Score::do_cols()
-
+Score::do_cols()
{
-
iter_top(cols_,i);
for (; i.ok(); i++) {
pscore_p_->add(i->pcol_l_);
}
-
}
Moment
--- /dev/null
+/*
+ scorecolumn.cc -- implement Score_column
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "debug.hh"
+#include "pcol.hh"
+#include "scorecolumn.hh"
+
+int
+Score_column::compare(Score_column & c1, Score_column &c2)
+{
+ return sign(c1.when_ - c2.when_);
+}
+
+void
+Score_column::set_breakable()
+{
+ pcol_l_->set_breakable();
+}
+
+Score_column::Score_column(Moment w)
+{
+ when_ = w;
+ pcol_l_ = new PCol(0);
+ musical_b_ = false;
+}
+
+bool
+Score_column::used_b() {
+ return pcol_l_->used_b();
+}
+
+void
+Score_column::print() const
+{
+#ifndef NPRINT
+ mtor << "Score_column { mus "<< musical_b_ <<" at " << when_<<'\n';
+ mtor << "durations: [";
+ for (int i=0; i < durations.size(); i++)
+ mtor << durations[i] << " ";
+ mtor << "]\n";
+ pcol_l_->print();
+ mtor << "}\n";
+#endif
+}
+
+int
+Moment_compare(Moment &a , Moment& b)
+{
+ return sign(a-b);
+}
+
+void
+Score_column::preprocess()
+{
+ durations.sort(Moment_compare);
+}
+void
+Score_column::add_duration(Moment d)
+{
+ assert(d);
+ for (int i = 0; i< durations.size(); i++) {
+ if (d == durations[i])
+ return ;
+ }
+ durations.push(d);
+}
+
+bool
+Score_column::breakable_b()
+{
+ return pcol_l_->breakable_b();
+}
#include "score.hh"
#include "staffwalker.hh"
#include "staff.hh"
-#include "sccol.hh"
+#include "scorecolumn.hh"
Score_walker::Score_walker(Score *s)
:PCursor<Score_column *> (s->cols_)
#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"
}
- PCursor<Score_column*> 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<Score_column*> 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)
Moment
Staff::last() const
{
- Moment l = 0.0;
+ Moment l = 0;
for (iter_top(voice_list_,i); i.ok(); i++) {
l = l >? i->last();
}
--- /dev/null
+/*
+ staffcolumn.cc -- implement Staff_column
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#include "staff.hh"
+#include "voice.hh"
+#include "timedescription.hh"
+#include "scorecolumn.hh"
+#include "staffcolumn.hh"
+#include "commandrequest.hh"
+#include "musicalrequest.hh"
+#include "interval.hh"
+#include "pscore.hh"
+#include "item.hh"
+#include "pcol.hh"
+
+void
+Staff_column::OK() const
+{
+#ifndef NDEBUG
+ assert (command_column_l_->when() == musical_column_l_->when());
+#endif
+}
+
+Moment
+Staff_column::when() const
+{
+ return (command_column_l_)?
+ command_column_l_->when():
+ musical_column_l_->when();
+}
+
+void
+Staff_column::add(Voice_element*ve)
+{
+ for (iter_top(ve->reqs,j); j.ok(); j++) {
+ if (j->command()) {
+ Command_req * c_l = j->command();
+ if (c_l->timing()) {
+ timing_req_l_arr_.push(j->command()->timing());
+ }
+ if (!c_l->barcheck() && !c_l->partial() &&
+ !c_l->measuregrouping())
+ setup_one_request(j); // no need to bother children
+ } else {
+ if (j->rhythmic()) {
+ musical_column_l_->add_duration(j->rhythmic()->duration());
+ }
+ if (!j->musical()->skip())
+ setup_one_request(j);
+ }
+ }
+}
+
+Staff_column::Staff_column()
+{
+ musical_column_l_ = 0;
+ command_column_l_ = 0;
+ staff_l_ = 0;
+}
+
+
+
+
+Staff_column::~Staff_column()
+{
+}
+
+void
+Staff_column::set_cols(Score_column*c1, Score_column*c2)
+{
+ command_column_l_ = c1;
+ musical_column_l_ = c2;
+}
+
+void
+Staff_column::setup_one_request(Request * j)
+{
+ if (j->command()) // ugh
+ commandreq_l_arr_.push(j);
+ else if (j->musical())
+ musicalreq_l_arr_.push(j);
+}
+
+void
+Staff_column::typeset_musical_item(Item*i)
+{
+ assert(i);
+ 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 of the items after aligning.
+ */
+Interval
+align_items(Array<Item*> 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();
+ Real dx =wid.right - item_width.left;
+ item_width += dx;
+ item_l_arr[i]->translate(Offset(dx ,0));
+ wid.unite(item_width);
+ }
+ return wid;
+}
+
+void
+translate_items(Real x, Array<Item*> item_l_arr)
+{
+ for (int i =0; i < item_l_arr.size(); i++)
+ item_l_arr[i]->translate(Offset(x, 0));
+}
+/*
+ UGR
+ This still sux
+ */
+void
+Staff_column::typeset_breakable_items(Array<Item *> &pre_p_arr,
+ Array<Item *> &nobreak_p_arr,
+ Array<Item *> &post_p_arr)
+{
+ PCol * c= command_column_l_->pcol_l_;
+ PScore *ps_l=command_column_l_->pcol_l_->pscore_l_;
+
+ if (!c->breakable_b()) {
+ for (int i =0; i < pre_p_arr.size(); i++)
+ delete pre_p_arr[i];
+ pre_p_arr.set_size(0);
+ for (int i =0; i < post_p_arr.size(); i++)
+ delete post_p_arr[i];
+ post_p_arr.set_size(0);
+ }
+
+
+ for (int i =0; i < pre_p_arr.size(); i++) {
+ ps_l->typeset_item(pre_p_arr[i], c, staff_l_->pstaff_l_,0);
+ }
+ for (int i =0; i < nobreak_p_arr.size(); i++) {
+ ps_l->typeset_item(nobreak_p_arr[i], c, staff_l_->pstaff_l_,1);
+ }
+ for (int i =0; i < post_p_arr.size(); i++) {
+ ps_l->typeset_item(post_p_arr[i], c, staff_l_->pstaff_l_,2);
+ }
+
+ Interval pre_wid= align_items(pre_p_arr);
+ translate_items( -pre_wid.right, pre_p_arr);
+ align_items(nobreak_p_arr);
+ Interval post_wid =align_items(post_p_arr);
+ translate_items (-post_wid.left , post_p_arr);
+
+ pre_p_arr.set_size(0);
+ post_p_arr.set_size(0);
+ nobreak_p_arr.set_size(0);
+}
--- /dev/null
+/*
+ staffeleminfo.cc -- implement Staff_elem_info
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#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;
+}
+
#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"
} 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_,
+++ /dev/null
-/*
- stcol.cc -- implement Staff_column
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-#include "staff.hh"
-#include "voice.hh"
-#include "timedescription.hh"
-#include "sccol.hh"
-#include "stcol.hh"
-#include "commandrequest.hh"
-#include "musicalrequest.hh"
-#include "interval.hh"
-#include "pscore.hh"
-#include "item.hh"
-#include "pcol.hh"
-
-void
-Staff_column::OK() const
-{
-#ifndef NDEBUG
- assert (command_column_l_->when() == musical_column_l_->when());
-#endif
-}
-
-Moment
-Staff_column::when() const
-{
- return (command_column_l_)?
- command_column_l_->when():
- musical_column_l_->when();
-}
-
-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 (c_l->timing()) {
- timing_req_l_arr_.push(j->nonmus()->timing());
- }
- if (!c_l->barcheck() && !c_l->partial() &&
- !c_l->measuregrouping())
- setup_one_request(j); // no need to bother children
- } else {
- if (j->rhythmic()) {
- musical_column_l_->add_duration(j->rhythmic()->duration());
- }
- if (!j->musical()->skip())
- setup_one_request(j);
- }
- }
-}
-
-Staff_column::Staff_column()
-{
- musical_column_l_ = 0;
- command_column_l_ = 0;
- staff_l_ = 0;
-}
-
-
-
-
-Staff_column::~Staff_column()
-{
-}
-
-void
-Staff_column::set_cols(Score_column*c1, Score_column*c2)
-{
- command_column_l_ = c1;
- musical_column_l_ = c2;
-}
-
-void
-Staff_column::setup_one_request(Request * j)
-{
- if (j->nonmus()) // ugh
- commandreq_l_arr_.push(j);
- else if (j->musical())
- musicalreq_l_arr_.push(j);
-}
-
-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_,
- staff_l_->pstaff_l_);
-}
-
-/**
- align items in #item_l_arr#, return the width.
- */
-Interval
-align_items(Array<Item*> 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));
- wid.unite(item_width);
- }
- return wid;
-}
-
-void
-translate_items(Real x, Array<Item*> item_l_arr)
-{
- for (int i =0; i < item_l_arr.size(); i++)
- item_l_arr[i]->translate(Offset(x, 0));
-}
-/*
- UGR
- This still sux
- */
-void
-Staff_column::typeset_breakable_items(Array<Item *> &pre_p_arr,
- Array<Item *> &nobreak_p_arr,
- Array<Item *> &post_p_arr)
-{
- PCol * c= command_column_l_->pcol_l_;
- PScore *ps_l=command_column_l_->pcol_l_->pscore_l_;
-
- if (!c->breakable_b()) {
- for (int i =0; i < pre_p_arr.size(); i++)
- delete pre_p_arr[i];
- pre_p_arr.set_size(0);
- for (int i =0; i < post_p_arr.size(); i++)
- delete post_p_arr[i];
- post_p_arr.set_size(0);
- }
-
-
- for (int i =0; i < pre_p_arr.size(); i++) {
- ps_l->typeset_item(pre_p_arr[i], c, staff_l_->pstaff_l_,0);
- }
- for (int i =0; i < nobreak_p_arr.size(); i++) {
- ps_l->typeset_item(nobreak_p_arr[i], c, staff_l_->pstaff_l_,1);
- }
- for (int i =0; i < post_p_arr.size(); i++) {
- ps_l->typeset_item(post_p_arr[i], c, staff_l_->pstaff_l_,2);
- }
-
- Interval pre_wid= align_items(pre_p_arr);
- translate_items( -pre_wid.right, pre_p_arr);
- align_items(nobreak_p_arr);
- Interval post_wid =align_items(post_p_arr);
- translate_items (-post_wid.left , post_p_arr);
-
- pre_p_arr.set_size(0);
- post_p_arr.set_size(0);
- nobreak_p_arr.set_size(0);
-}
+/*
+ template2.cc -- instantiate some list templates.
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
#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"
+/*
+ template4.cc -- instantiate PointerList baseclass.
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
#include "proto.hh"
#include "list.tcc"
#include "cursor.tcc"
#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);
Voice::Voice()
{
- start = 0.0;
+ start = 0;
}
void
+++ /dev/null
-/*
- voicegroup.cc -- implement Voice_group_registers
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#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<Voice_registers*> vr_arr (walk_l_->get_voice_regs(this));
- for (int j=0; j<vr_arr.size(); j++) {
- if (vr_arr[j])
- vr_arr[j]->set_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());
-}
--- /dev/null
+/*
+ voicegroup.cc -- implement Voice_group_registers
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#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<Voice_registers*> vr_arr (walk_l_->get_voice_regs(this));
+ for (int j=0; j<vr_arr.size(); j++) {
+ if (vr_arr[j])
+ vr_arr[j]->set_dir(i);
+ }
+}
+#endif
+bool
+Voice_group_registers::acceptable_request_b(Request*r)
+{
+ return (r->stem() || r->beam() || r->text() || r->script() ||
+ r->groupfeature());
+}
+/*
+ voiceregs.cc -- implement Voice_registers
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
#include "musicalrequest.hh"
-#include "voicegroup.hh"
+#include "voiceregs.hh"
#include "register.hh"
#include "slurreg.hh"
#include "headreg.hh"
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
{
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);
}
-
--- /dev/null
+/*
+ walkregs.cc -- implement Walker_registers
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#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));
+}