Commits

Anonymous committed eb8d1fd

SVN reorganization - moved the current files to the trunk branch

Comments (0)

Files changed (768)

noteedit/Makefile.am

+# this has all of the subdirectories that make will recurse into.  if
+# there are none, comment this out
+SUBDIRS = resources icons
+
+lib_LTLIBRARIES = libnoteedit.la
+
+
+# this is the program that gets installed.  it's name is used for all
+# of the other Makefile.am variables
+bin_PROGRAMS = noteedit
+
+libnoteedit_la_SOURCES = abcexport.cpp mididevicelistbox.cpp \
+	chord.cpp clef.cpp configuredialog.cpp \
+	chorddiagram.cpp \
+	dbufferwidget.cpp \
+	exports.ui expWarn.ui \
+	filehandler.cpp filter.ui \
+	generProps.ui grammar.yy \
+	keyoffs.cpp keysig.cpp layout.cpp \
+	lexik.ll lilyexport.cpp lilytest.cpp lines.ui listSel.ui lyrics.ui \
+	mainframewidget2.cpp mainframewidget.cpp metronom.ui \
+	midiexport.cpp midimapper.cpp midi.ui mupWarning.ui muselement.cpp \
+	multistaffinfo.cpp \
+	musicxmlcommon.cpp musicxmlimport.cpp musicxmlexport.cpp \
+	musixtex.cpp miditimescale.cpp \
+	noteedit_part.cpp notesel.cpp numberdisplay.cpp \
+	outputbox.cpp \
+	pmxexport.cpp \
+	scaleedit.ui \
+	resource.cpp rest.cpp \
+	scaleEd.ui ScoreEditor.cpp scoreinfo.cpp sign.cpp \
+	smRest.ui staff.cpp staffElem.ui staffProps.ui staffSel.ui staffPropFrm.cpp \
+	text.cpp textDialog.ui textDialog_impl.cpp tempotrack.cpp timesig.cpp timesigDia.ui tip.ui transpainter.cpp tse3handler.cpp \
+	tse3Info.ui tupletdialog.ui tupletdialog_impl.cpp scaleedit_impl.cpp \
+	uiconnect.cpp \
+	voice.cpp voicedialog.cpp voiceDia.ui volume.ui \
+	zoomselection.cpp 
+
+libnoteedit_la_LDFLAGS = $(all_libraries) -version-info 1:0:0 -module
+
+# the libraries to link against.
+libnoteedit_la_LIBADD   = ../kguitar_excerpt/libkguitar_excerpt.la $(LIB_KFILE) $(TSE3LIBS) $(KMIDLIBS) -lkparts -lkdeprint
+
+# set the include path for X, qt and KDE
+INCLUDES = $(all_includes) $(TSE3INCLUDE) $(KMIDINCLUDE) $(ANTHEMINCLUDE)
+
+# we want exceptions
+# KDE_CXXFLAGS = $(USE_EXCEPTIONS)
+# no we won't use exceptions except "midimapper.cpp"
+
+noteedit_LDFLAGS = $(KDE_RPATH)
+noteedit_SOURCES = main.cpp
+noteedit_LDADD   = libnoteedit.la 
+noteedit_YFLAGS = -p$(LEX_PREFIX)
+
+LEX_PREFIX=@LEX_PREFIX@
+LEX_RESTART=@LEX_RESTART@
+LEX_LINENO=@LEX_LINENO@
+YACC_PARSE=@YACC_PARSE@
+YACC_LVAL=@YACC_LVAL@
+YFLAGS = -p$(LEX_PREFIX)
+
+PREFIX_DEF=-DYYLINENO=$(LEX_LINENO) -DYYRESTART=$(LEX_RESTART) -DYYPARSE=$(YACC_PARSE) -DYYLVAL=$(YACC_LVAL)
+KDE_CXXFLAGS = @SPECIAL_FLAGS_FOR_FINAL@
+
+noinst_HEADERS = mididevicelistbox.h \
+	aboutinfo.h \
+	chord.h clef.h configuredefaultvalues.h configuredialog.h \
+	dbufferwidget.h \
+	exports.h expWarn.h \
+	filehandler.h filter.h \
+	generProps.h grammar.h \
+	keyoffs.h keysig.h \
+	lilyexport.h lilytest.h lines.h listSel.h lyrics.h \
+	mainframewidget.h metronom.h midiexport.h midi.h midimapper.h \
+	mupWarning.h muselement.h musixtex.h miditimescale.h \
+	noteedit_part.h notesel.h numberdisplay.h \
+	outputbox.h \
+	parsertypes.h pmxexport.h \
+	text.h resource.h rest.h \
+	scaleEd.h ScoreEditor.h scoreinfo.h sign.h smRest.h \
+	staffElem.h staff.h staffProps.h staffSel.h \
+	textDialog_impl.h timesigDia.h timesig.h tip.h transpainter.h tse3handler.h tse3Info.h \
+	uiconnect.h \
+	voiceDia.h voicedialog.h voice.h volume.h \
+	zoomselection.h
+
+tipsdir = $(kde_datadir)/noteedit
+tips_DATA = tips
+# let automoc handle all of the meta source files (moc)
+METASOURCES = AUTO
+
+messages: rc.cpp
+	$(PREPARETIPS) > tips.cpp
+	$(XGETTEXT) *.cpp ../kguitar_excerpt/*.cpp -o $(podir)/noteedit.pot
+	rm -f tips.cpp
+
+# this is where the desktop file will go
+desktopdir   = $(kde_appsdir)/Utilities
+desktop_DATA = noteedit.desktop
+
+# this is where the XML-UI file will go
+xmluidir = $(kde_datadir)/noteedit
+xmlui_DATA = noteeditui.rc noteedit_part.rc
+
+
+.yy.cc:
+	$(YACC) $(AM_YFLAGS) $(YFLAGS) $<
+	sed '/extern *char *\*getenv *( *) *;/d' y.tab.c > y.tab1.c
+	sed '/__attribute__ *( *( *__unused__ *) *)/d' y.tab1.c > $@
+	rm y.tab.c y.tab1.c
+	if test -f y.tab.h; then \
+	if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
+	else :; fi
+
+.ll.cc:
+	$(LEX) -P$(LEX_PREFIX) -olex.yy.c $<
+	rm -f $@ lex.yy1.c
+	sed '/extern *int *isatty/d' lex.yy.c > lex.yy1.c
+	sed '/yy_state_buf.*= *yyalloc/s/yyalloc/(yy_state_type*) yyalloc/' lex.yy1.c > $@
+	rm lex.yy.c lex.yy1.c
+
+filehandler.lo: filehandler.cpp
+	$(LTCXXCOMPILE) $(PREFIX_DEF) -c $<
+
+grammar.h: grammar.yy
+
+grammar.lo: grammar.cc muselement.h resource.h staff.h rest.h sign.h chord.h chorddiagram.h grammar.h
+	$(LTCXXCOMPILE) $(PREFIX_DEF) -c $<
+
+lexik.lo: lexik.cc grammar.cc  # because with "grammar.cc" "grammar.h" is built
+	$(LTCXXCOMPILE) $(PREFIX_DEF) -c $<
+

noteedit/ScoreEditor.cpp

+/****************************************************************************************/
+/*											*/
+/* This program is free software; you can redistribute it and/or modify it under the	*/
+/* terms of the GNU General Public License as published by the Free Software		*/
+/* Foundation; either version 2 of the License, or (at your option) any later version.	*/
+/*											*/
+/* This program is distributed in the hope that it will be useful, but WITHOUT ANY	*/
+/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A	*/
+/* PARTICULAR PURPOSE. See the GNU General Public License for more details.		*/
+/*											*/
+/* You should have received a copy of the GNU General Public License along with this	*/
+/* program; (See "LICENSE.GPL"). If not, write to the Free Software Foundation, Inc.,	*/
+/* 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.				*/
+/*											*/
+/*--------------------------------------------------------------------------------------*/
+/*											*/
+/*		Joerg Anders, TU Chemnitz, Fakultaet fuer Informatik, GERMANY		*/
+/*		ja@informatik.tu-chemnitz.de						*/
+/*											*/
+/*											*/
+/****************************************************************************************/
+
+#include "ScoreEditor.h"
+#ifdef ANTHEM_PLUGIN
+#include "config.h"
+#if GCC_MAJ_VERS > 2
+#include <istream.h>
+#else
+#include <istream>
+#endif
+#include <qapplication.h>
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <kapp.h>
+#include <klocale.h>
+#include <tse3/PhraseEdit.h>
+#include "mainframewidget.h"
+#include "midimapper.h"
+#include "resource.h"
+
+NResource *ScoreEditor::resource_ = 0;
+
+ScoreEditor::ScoreEditor(TSE3::PhraseEdit *phraseEdit, KToolBar *toolbar,
+QWidget *parent) : PhraseEditorBase(phraseEdit, toolbar, parent)
+{
+    if (resource_ == 0) {
+    	resource_ = new NResource();
+	NResource::mapper_ = new NMidiMapper(0 /* TODO: the argument mus be the midi scheduler */ );
+    }
+    mainWidget_ = new NMainFrameWidget(toolbar, this, "mainWidget");
+    mainWidget_->plugButtons(toolbar);
+    mainWidget_->createStaffFromPhraseEdit(phraseEdit);
+}
+
+ScoreEditor::~ScoreEditor() {
+	mainWidget_->unPlugButtons(toolbar);
+	delete mainWidget_;
+}
+
+void ScoreEditor::resizeEvent( QResizeEvent * evt) {
+	mainWidget_->resize(evt->size().width(), evt->size().height());
+} 
+
+#endif /* ANTHEM_PLUGIN */
+	

noteedit/ScoreEditor.h

+#ifndef SCORE_EDITOR_H
+
+#define SCORE_EDITOR_H
+
+#include <config.h>
+#ifdef ANTHEM_PLUGIN
+
+#include <anthem/phraseeditors/PhraseEditor.h>
+class NMainFrameWidget;
+class NResource;
+
+class ScoreEditor : public PhraseEditorBase
+{
+    public:
+
+        ScoreEditor(TSE3::PhraseEdit *phraseEdit, KToolBar *toolbar,
+                   QWidget *parent);
+        virtual ~ScoreEditor();
+    protected:
+	virtual void resizeEvent ( QResizeEvent * evt);
+    private:
+	NMainFrameWidget *mainWidget_;
+	static NResource *resource_;
+};
+
+#endif /* ANTHEM_PLUGIN */
+#endif /* SCORE_EDITOR_H */

noteedit/abcexport.cpp

+/****************************************************************************************/
+/*											*/
+/* This program is free software; you can redistribute it and/or modify it under the	*/
+/* terms of the GNU General Public License as published by the Free Software		*/
+/* Foundation; either version 2 of the License, or (at your option) any later version.	*/
+/*											*/
+/* This program is distributed in the hope that it will be useful, but WITHOUT ANY	*/
+/* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A	*/
+/* PARTICULAR PURPOSE. See the GNU General Public License for more details.		*/
+/*											*/
+/* You should have received a copy of the GNU General Public License along with this	*/
+/* program; (See "LICENSE.GPL"). If not, write to the Free Software Foundation, Inc.,	*/
+/* 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.				*/
+/*											*/
+/*--------------------------------------------------------------------------------------*/
+/*											*/
+/*		Joerg Anders, TU Chemnitz, Fakultaet fuer Informatik, GERMANY		*/
+/*		ja@informatik.tu-chemnitz.de						*/
+/*											*/
+/*											*/
+/****************************************************************************************/
+
+// LVIFIX: this source file is not 7-bit clean, see NABCExport::lyrics2ABC(..
+
+#include <qstring.h>
+#include <qregexp.h>
+#include <qspinbox.h>
+#include <qcheckbox.h>
+#include <kmessagebox.h>
+#include <klocale.h>
+#include <ctype.h>
+#include "staff.h"
+#include "abcexport.h"
+#include "uiconnect.h"
+#include "keysig.h"
+#include "timesig.h"
+#include "mainframewidget.h"
+#include "rest.h"
+#include "chord.h"
+#include "text.h"
+#include "chorddiagram.h"
+#include "layout.h"
+
+#define ABC_ERR_IRREGULAER 1
+#define ABC_ERR_TUPLET	   2
+#define ABC_ERR_BRACE_NESTING 3
+#define ABC_ERR_ONE_STAFF_BRACKET 4
+#define ABC_ERR_VAS	   5
+
+
+NABCExport::NABCExport() {
+	int i;
+#if GCC_MAJ_VERS > 2
+	os_ = new ostringstream();
+	for (i = 0; i < NUM_LYRICS; i++) {
+		lyricsLine_[i] = new ostringstream();
+	}
+#else
+	os_ = new ostrstream(buffer_, 128);
+	for (i = 0; i < NUM_LYRICS; i++) {
+		lyricsLine_[i] = new ostrstream(NResource::lyricsbuffer_[i], LYRICS_LINE_LENGTH);
+	}
+#endif
+	chordDiagramList_.setAutoDelete(true);
+}
+
+void NABCExport::exportStaffs(QString fname, QList<NStaff> *stafflist, int count_of_voices, exportFrm *expWin, NMainFrameWidget *mainWidget) {
+	NStaff *staff_elem;
+	NVoice *voice_elem;
+	NClef *firstClef;
+	badinfo *bad;
+	int i, j, k;
+	int voice_count;
+	int current_time;
+	bool something_written;
+	bool ok;
+	bool with_pedal_marks, with_drums;
+	bool voice_with_pedal, voice_with_drum;
+	bool gridsused, firstcall, dummy;
+	chordDiagramName *diagNam;
+	double dval;
+	NMusElement *last_elem;
+	QRegExp reg = QRegExp("/100");
+	QString s;
+
+	out_.open(fname);
+	if (!out_) {
+		*os_ << "error opening file " << fname << '\0';
+#if GCC_MAJ_VERS > 2
+		KMessageBox::sorry
+			(0, QString(os_->str().c_str()), kapp->makeStdCaption(i18n("???")));
+#else
+		KMessageBox::sorry
+			(0, QString(os_->str()), kapp->makeStdCaption(i18n("???")));
+#endif
+		return;
+	}
+	out_.setf(ios::showpoint);
+	staffCount_ = stafflist->count();
+	badlist_.setAutoDelete(true);
+	badlist_.clear();
+	chordDiagramList_.clear();
+	lastMeasureNum_ = 1;
+	voiceStatList_ = new voice_stat_str[count_of_voices];
+	countOfLyricsLines_ = new int[staffCount_];
+
+
+	out_ << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
+	out_ << "%                                  %" << endl;
+	out_ << "%   ABC music output generated by  %" << endl;
+	out_ << "%           \"noteedit\"             %" << endl;
+	out_ << "%                                  %" << endl;
+	out_ << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl << endl;
+	out_ << "% PAGE LAYOUT" << endl;
+	out_ << '%' << endl;
+	dval =  expWin->ABCWidth->text().toDouble(&ok);
+	if (!ok) dval = 17.0; else dval /= 10.0;
+	out_ << "%%pagewidth\t" << dval << "cm" << endl;
+	dval =  expWin->ABCHeight->text().toDouble(&ok);
+	if (!ok) dval = 25.0; else dval /= 10.0;
+	out_ << "%%pageheight\t" << dval << "cm" << endl;
+	s = expWin->ABCscale->text();
+	s.replace (reg, "");
+	dval =  s.toDouble(&ok);
+	if (!ok) dval = 0.75; else dval /= 100.0;
+	out_ << "%%scale\t\t" << dval << endl;
+	dval =  expWin->ABCStaffSep->text().toDouble(&ok);
+	if (!ok) dval = 1.6; else dval /= 10.0;
+	out_ << "%%staffsep\t" << dval << "cm" << endl;
+	if (expWin->ABCExprAbove->isChecked()) {
+		out_ << "%%exprabove\ttrue" << endl;
+	}
+	else {
+		out_ << "%%exprabove\tfalse" << endl;
+	}
+	if (expWin->ABCMeasNumInBox->isChecked()) {
+		out_ << "%%measurebox\ttrue" << endl;
+	}
+	else {
+		out_ << "%%measurebox\tfalse" << endl;
+	}
+	out_ << '%' << endl;
+	with_pedal_marks =  with_drums = false;
+	for (staff_elem = stafflist->first(); staff_elem; staff_elem = stafflist->next()) {
+		voice_count = staff_elem->voiceCount();
+		for (j = 0; j < voice_count; j++) {
+			staff_elem->getVoiceNr(j)->detectABCSpecials(&voice_with_drum, &voice_with_pedal);
+			with_drums = with_drums || voice_with_drum;
+			with_pedal_marks = with_pedal_marks || voice_with_pedal;
+		}
+	}
+	if (with_pedal_marks) {
+		outputPedalGlyphs();
+	}
+	if (with_drums) {
+		outputDrumDefinitions();
+	}
+	firstcall = false;
+	for (staff_elem = stafflist->first(); staff_elem; staff_elem = stafflist->next()) {
+		voice_count = staff_elem->voiceCount();
+		for (j = 0; j < voice_count; j++) {
+			voice_elem = staff_elem->getVoiceNr(j);
+			voice_elem->prepareForWriting();
+			voice_elem->getChordDiagramms(&chordDiagramList_, &gridsused, firstcall, &dummy);
+			firstcall = false;
+		}
+	}
+	if (gridsused) {
+		outputGuitarPostscript();
+		for (diagNam = chordDiagramList_.first(); diagNam; diagNam = chordDiagramList_.next()) {
+			if (!diagNam->cdiagramm->showDiagram_) continue;
+			outputGrid(diagNam);
+		}
+	}
+
+
+	out_ << "%%postscript /crdc{	% usage: str x y crdc - cresc, decresc, .." << endl;
+	out_ << "%%postscript	/Times-Italic 14 selectfont" << endl;
+	out_ << "%%postscript	M -6 4 RM show}!" << endl;
+	out_ << "%%deco rit 6 crdc 20 2 24 ritard." << endl;
+	out_ << "%%deco acc 6 crdc 20 2 24 accel." << endl << endl;
+
+
+	out_ << "X: 1" << endl;
+	if (!mainWidget->scTitle_.isEmpty()) {
+		out_ << "T: " << mainWidget->scTitle_ << endl;
+	}
+	if (!mainWidget->scSubtitle_.isEmpty()) {
+		out_ << "T: " << mainWidget->scSubtitle_ << endl;
+	}
+	if (!mainWidget->scAuthor_.isEmpty()) {
+		out_ << "C: " << mainWidget->scAuthor_<< endl;
+	}
+	if (!mainWidget->scLastAuthor_.isEmpty()) {
+		out_ << "C: " << mainWidget->scLastAuthor_ << endl;
+	}
+	if (!mainWidget->scCopyright_.isEmpty()) {
+		out_ << "C: copyright: " << mainWidget->scCopyright_ << endl;
+	}
+	outputMeter(stafflist->first()->getVoiceNr(0)->getFirstTimeSig(), true);
+	out_ << "L: 1/4 % default length" << endl;
+	outputStaffAndVoiceDescription(stafflist, mainWidget);
+	outputKeySig(stafflist->first()->getVoiceNr(0)->getFirstKeysig(), true);
+	outputMidi(stafflist);
+	firstClef = stafflist->first()->getVoiceNr(0)->getFirstClef();
+	lastClef_ = new NClef(&(mainWidget->main_props_), &(stafflist->first()->staff_props_));
+	k = 0;
+	for (i = 0, staff_elem = stafflist->first(); staff_elem; staff_elem = stafflist->next(), i++) {
+		voice_count = staff_elem->voiceCount();
+		for (j = 0; j < voice_count; j++) {
+			voice_elem = staff_elem->getVoiceNr(j);
+			if (j == 0) {
+				countOfLyricsLines_[i] = voice_elem->countOfLyricsLines();
+			}
+			voice_elem->prepareForWriting();
+			if (k >= count_of_voices) {
+				NResource::abort("NABCExport::exportStaffs");
+			}
+			voice_elem->setIdx(k++);
+		}
+		staff_elem->actualClef_.change(staff_elem->getVoiceNr(0)->getFirstClef());
+	}
+	do {
+		something_written = false;
+		out_ << "% " << lastMeasureNum_ << endl;
+		for (i = 0, staff_elem = stafflist->first(); staff_elem; i++, staff_elem = stafflist->next()) {
+			voice_count = staff_elem->voiceCount();
+			voice_elem = staff_elem->getVoiceNr(0);
+			lastClef_->change(&(staff_elem->actualClef_));
+			if (writeFirstVoice(voice_elem, staff_elem->staffName_, i+1, staff_elem->voiceCount(), 4, i == staffCount_ - 1)) {
+				something_written = true;
+			}
+			for (j = 0; j < countOfLyricsLines_[i]; j++) {
+#if GCC_MAJ_VERS > 2
+				if (lyricsLine_[j]->tellp() > 0) {
+#else
+				if (lyricsLine_[j]->pcount() > 0) {
+					(*lyricsLine_[j]) << '\0';
+#endif
+					out_ << "w: " << lyricsLine_[j]->str() << endl;
+				}
+#ifdef BRACE_BALANCE /* for vi '%' usage */
+				}
+#endif
+			}
+			last_elem = voice_elem->getCurrentPosition();
+			if (last_elem) {
+				current_time = last_elem->midiTime_;
+			}
+			else {
+				current_time = (1 << 30);
+			}
+			if (voice_count > 1) {
+				staff_elem->mark();
+			}
+			for (j = 2; j <= voice_count; j++) {
+				voice_elem = staff_elem->getVoiceNr(j-1);
+				if (writeOtherVoicesTill(i+1, j, staff_elem->staffName_, voice_elem, staff_elem, current_time)) {
+					something_written = true;
+				}
+			}
+			if (voice_count > 1) {
+				staff_elem->gotoMarkedPosition();
+				staff_elem->actualClef_.change(lastClef_);
+			}
+		}
+	}
+	while (something_written);
+	out_.close();
+	delete []voiceStatList_;
+	delete []countOfLyricsLines_;
+	if (!badlist_.isEmpty()) {
+		QString output;
+		output = i18n
+			("Noteedit has exported the score to ABC music but there are some\n"
+			 "problems which will probably prevent successful PostScript output.\n");
+		output += i18n("-----------------------------------------------------\n");
+		for (bad = badlist_.first(); bad; bad = badlist_.next()) {
+			switch (bad->type_) {
+				case ABC_ERR_TUPLET:
+				output += i18n
+				( "Staff %1, measure %2: ABC music cannot deal with such kind of tuplets\n").arg(bad->staffnr_).arg(bad->barnr_);
+					break;
+				case ABC_ERR_IRREGULAER:
+				output += i18n
+				( "Staff %1 has irregular keysig. This cannot be expressed in ABC music\n").arg(bad->staffnr_);
+					break;
+				case ABC_ERR_BRACE_NESTING:
+					output += i18n
+						("ABC music cannot deal with nested brackets/braces\n");
+					break;
+				case ABC_ERR_ONE_STAFF_BRACKET:
+					output += i18n
+						("ABC music cannot deal with a one-staff bracket\n");
+					break;
+				case ABC_ERR_VAS:
+					output += i18n
+						("Staff %1, measure %2: ABC music cannot deal with octaviation (va lines)\n").arg(bad->staffnr_).arg(bad->barnr_);
+					break;
+			}
+		}
+		NResource::exportWarning_->setOutput(i18n ("ABC music produced. But there are some problems."), &output);
+		NResource::exportWarning_->show();
+	}
+}
+
+bool NABCExport::writeFirstVoice(NVoice *voice_elem, QString staffName, int staff_nr, int voice_count, int measure_count, bool lastStaff) {
+	NMusElement *elem, *elem2;
+	NStaff *actual_staff;
+	NChord *chord;
+	NRest *rest;
+	NNote *note;
+	NClef *clef;
+	NSign *sign;
+	QString *lyrics;
+	NChordDiagram *diag;
+	badinfo *bad;
+	bool inBeam = false;
+	bool inTuplet = false;
+	bool inGrace = false;
+	bool inChord;
+	int len;
+	int idx;
+	int i;
+
+#if GCC_MAJ_VERS > 2
+	for (i = 0; i < NUM_LYRICS; i++) {
+		delete lyricsLine_[i];
+		lyricsLine_[i] = new ostringstream();
+	}
+#else
+	for (i = 0; i < NUM_LYRICS; i++) {
+		lyricsLine_[i]->seekp(0);
+	}
+#endif
+	elem = voice_elem->getCurrentPosition();
+	if (!elem) return false;
+
+	out_ << "[V: ";
+	if (voice_count > 1) {
+		out_ << createVoiceName(staffName, staff_nr, 1);
+	}
+	else {
+		out_ << createVoiceName(staffName, staff_nr, 0);
+	}
+	out_ << "] ";
+
+	actual_staff = voice_elem->getStaff();
+	idx = voice_elem->getIdx();
+	do {
+		switch (elem->getType()) {
+			case T_CHORD: voiceStatList_[idx].lastBarSym = 0;
+				      chord = (NChord *) elem;
+				      if (chord->status_ & STAT_TUPLET) {
+				      	if (!inTuplet) {
+						inTuplet = true;
+						outputTupletStart(staff_nr, elem);
+					}
+				      }
+				      if (inGrace && !(chord->status_ & STAT_GRACE)) {
+				      	inGrace = false;
+					out_ << '}';
+				      }
+				      if (chord->status_ & STAT_GRACE) {
+				      	if (!inGrace) {
+						inGrace = true;
+						out_ << " {";
+						if (chord->getSubType() == INTERNAL_MARKER_OF_STROKEN_GRACE) {
+							out_ << '/';
+						}
+					}
+				      }
+				      if (!inTuplet && chord->getSubType() < QUARTER_LENGTH) {
+				      	if (chord->status_ & STAT_BEAMED) {
+						if (!inBeam) {
+							if (!inGrace) out_ << ' ';
+							inBeam = true;
+						}
+					}
+				      }
+				      else {
+				         inBeam =false;
+				      }
+				      if (!inTuplet && !inBeam && !inGrace) {
+				         out_ << ' ';
+				      }
+				      if (chord->lastBeamed()) {
+				      	inBeam = false;
+				      }
+				      if (!inGrace && chord->getSlurPartner()) {
+				      	out_ << '(';
+					voiceStatList_[idx].slurDepth++;
+				      }
+				      for (i = 0; i < NUM_LYRICS; i++) {
+				      	lyrics = chord->getLyrics(i);
+				      	if (!lyrics && i < countOfLyricsLines_[staff_nr-1]) {
+						(*lyricsLine_[i]) << " * ";
+					}
+					if (lyrics) {
+						(*lyricsLine_[i]) << lyrics2ABC(lyrics) << ' ';
+					}
+				      }
+				      if ((diag = chord->getChordChordDiagram()) != 0) {
+					writeChord(diag);
+				      }
+				      writePendingSigns(idx);
+				      if (chord->status_ & STAT_STACC)
+						out_ << '.';
+				      if (chord->status_ & STAT_SFORZ) 
+					        out_ << "!sfz!";
+				      if (chord->status_ & STAT_PORTA)
+					        out_ << "!tenuto!";
+				      if (chord->status_ & STAT_STPIZ)
+					        out_ << "!wedge!";
+				      if (chord->status_ & STAT_SFZND)
+					        out_ << "!accent!";
+				      if (chord->status2_ & STAT2_PEDAL_ON) {
+				      		out_ << "!ped!";
+				      }
+				      if (chord->status2_ & STAT2_PEDAL_OFF) {
+				      		out_ << "!ped-end!";
+				      }
+				      if (chord->status_ & STAT_FERMT) {
+				      		if (chord->status_ & STAT_STEM_UP) {
+							out_ << "!fermata!";
+						}
+						else {
+							out_ << "!invertedfermata!";
+						}
+				      }
+				      if (chord->va_) {
+				      	bad = new badinfo(ABC_ERR_VAS, staff_nr, lastMeasureNum_); badlist_.append(bad);
+				      }
+				      if (!inGrace && voiceStatList_[idx].trillendpos != 0 && chord->getBbox()->right() > voiceStatList_[idx].trillendpos) {
+					voiceStatList_[idx].trillendpos = 0;
+					out_ <<  "!trill)!";
+				      }
+				      if (chord->trill_ != 0) {
+					if (chord->trill_ > 0) {
+						out_ << "!trill!";
+					}
+					if (voice_elem->findNoteCountTillTrillEnd(chord)) {
+						voiceStatList_[idx].trillendpos = chord->getTrillEnd();
+						out_ << "!trill(!";
+					}
+				      }
+				      if (!inGrace && voiceStatList_[idx].lastDynSym && chord->getBbox()->right() > voiceStatList_[idx].dynEndPos) {
+				      	out_ << voiceStatList_[idx].lastDynSym;
+					voiceStatList_[idx].lastDynSym = 0;
+					voiceStatList_[idx].dynEndPos = 0;
+				      }
+				      if (chord->dynamic_) {
+				      	out_ << (chord->dynamicAlign_ ? "!crescendo(!" : "!diminuendo(!");
+					voiceStatList_[idx].dynEndPos = chord->getDynamicEnd();
+					voiceStatList_[idx].lastDynSym = (char *) (chord->dynamicAlign_ ? "!crescendo)!" : "!diminuendo)!");
+				      }
+				      if (elem->status_ & STAT_ARPEGG) {
+				      	out_ << "!arpeggio!";
+				      }
+				      inChord = chord->getNoteList()->count() > 1;
+				      if (inChord) {
+				      	out_ << '[';
+				      }
+				      for (note = chord->getNoteList()->first(); note; note = chord->getNoteList()->next()) {
+				     	outputNote(note, &(actual_staff->actualClef_), inChord);
+					if (!((chord->status_ & STAT_GRACE) && chord->getSubType() == INTERNAL_MARKER_OF_STROKEN_GRACE)) {
+						outputLength(chord->getSubType(), chord->status_, inChord, note->status & BODY_MASK);
+					}
+					if (note->status & STAT_TIED) out_ << '-';
+				      }
+				      if (inChord) {
+				      	out_ << ']';
+				      }
+				      if (voiceStatList_[idx].slurDepth > 0 && chord->getSlurStart()) {
+				      	out_ << ')';
+					voiceStatList_[idx].slurDepth--;
+				      }
+				      if (chord->status_ & STAT_LAST_TUPLET) {
+				        inTuplet = false;
+					out_ << ' ';
+				      }
+				      break;
+			case T_REST: voiceStatList_[idx].lastBarSym = 0;
+				     rest = (NRest *) elem;
+				     if (rest->status_ & STAT_TUPLET) {
+				     	if (!inTuplet) {
+						inTuplet = true;
+						outputTupletStart(staff_nr, elem);
+					}
+				     }
+				     inBeam =false;
+				     if (inGrace) {
+				     	inGrace = false;
+					out_ << '}';
+				     }
+				     if (!inTuplet) out_ << ' ';
+
+				     if ((diag = rest->getChordChordDiagram()) != 0) {
+					writeChord(diag);
+				     }
+				     writePendingSigns(idx);
+				     if (rest->status_ & STAT_FERMT) {
+					out_ << "!fermata!";
+				     }
+				     if (rest->getSubType() == MULTIREST) {
+				     	out_ << 'Z';
+					len = rest->getMultiRestLength() * QUARTER_LENGTH;
+				     }
+				     else if (rest->status_ & STAT_HIDDEN) {
+				        out_ << 'x';
+					len = rest->getSubType();
+				     }
+				     else {
+				        out_ << 'z';
+					len = rest->getSubType();
+				     }
+				     outputLength(len, rest->status_, true, false);
+				     if (rest->status_ & STAT_LAST_TUPLET) {
+				        inTuplet = false;
+					out_ << ' ';
+				     }
+				     break;
+			case T_SIGN: inBeam =false;
+				     if (inGrace) {
+				     	inGrace = false;
+					out_ << '}';
+				     }
+				     sign = (NSign *) elem;
+				     if (sign->getSubType() & BAR_SYMS) {
+				     	if (lastStaff) lastMeasureNum_ = sign->getBarNr();
+					measure_count--;
+					elem2 = voice_elem->getNextPosition();
+					if (!elem2) {
+						outputBarSym(sign, 0, voice_elem->isLast());
+						break;
+					}
+					if (elem2->getType() == T_SIGN) {
+						switch (elem2->getSubType()) {
+							case SPECIAL_ENDING1: 
+								outputBarSym(sign, 1, voice_elem->isLast()); break;
+							case SPECIAL_ENDING2: 
+								outputBarSym(sign, 2, voice_elem->isLast()); break;
+							default: voice_elem->getPrevPosition(); 
+								outputBarSym(sign, 0, voice_elem->isLast()); break;
+						}
+					}
+					else {
+						voice_elem->getPrevPosition();
+						outputBarSym(sign, 0, voice_elem->isLast());
+					}
+					break;
+				     }
+				     voiceStatList_[idx].lastBarSym = 0;
+				     switch (sign->getSubType()) {
+				     	case VOLUME_SIG: voiceStatList_[idx].pendingVolumes = sign; break;
+					case SEGNO:
+					case CODA: voiceStatList_[idx].pendingSegnos = sign; break;
+					case DAL_SEGNO:
+					case DAL_SEGNO_AL_FINE:
+					case DAL_SEGNO_AL_CODA:
+					case FINE: voiceStatList_[idx].pendingSegnos2 = sign; break;
+					case RITARDANDO:
+					case ACCELERANDO: voiceStatList_[idx].pendingRitAccel = sign; break;
+					case TEMPO_SIGNATURE: out_ << "[Q:1/4=" << sign->getTempo() << ']'; break;
+				     }
+				     break;
+			case T_CLEF: inBeam =false;
+				     voiceStatList_[idx].lastBarSym = 0;
+				     if (inGrace) {
+				     	inGrace = false;
+					out_ << '}';
+				     }
+				     clef = (NClef *) elem;
+				     actual_staff->actualClef_.change(clef);
+				     if (lastMeasureNum_ < 2) break;
+				     out_ << "[V: ";
+				     if (voice_count > 1) {
+					out_ << createVoiceName(staffName, staff_nr, 1) << ' ';
+				     }
+				     else {
+					out_ << createVoiceName(staffName, staff_nr, 0) << ' ';
+				     }
+				     outputClefInfo(clef);
+				     out_ << "] ";
+				     break;
+			case T_TIMESIG: 
+				     voiceStatList_[idx].lastBarSym = 0;
+				     inBeam =false;
+				     if (inGrace) {
+				     	inGrace = false;
+					out_ << '}';
+				     }
+				     if (lastMeasureNum_ < 2) break;
+				     out_ << '[';
+				     outputMeter((NTimeSig *) elem, false);
+				     out_ << ']';
+				     break;
+			case T_KEYSIG:
+				     voiceStatList_[idx].lastBarSym = 0;
+				     inBeam =false;
+				     if (inGrace) {
+				     	inGrace = false;
+					out_ << '}';
+				     }
+				     if (lastMeasureNum_ < 2) break;
+				     out_ << '[';
+				     outputKeySig((NKeySig *) elem, false);
+				     out_ << ']';
+				     break;
+			case T_TEXT:
+				     voiceStatList_[idx].pendingText = (NText *) elem;
+				     break;
+			default:     inBeam =false;
+				     voiceStatList_[idx].lastBarSym = 0;
+				     if (inGrace) {
+				     	inGrace = false;
+					out_ << '}';
+				     }
+		}
+		elem = voice_elem->getNextPosition();
+	}
+	while (elem && measure_count > 0);
+	out_ << endl;
+	return true;
+}
+
+bool NABCExport::writeOtherVoicesTill(int staff_nr, int voice_nr, QString staffName, NVoice *voice_elem, NStaff *staff_elem, int stopTime) {
+	NMusElement *elem;
+	NStaff *actual_staff;
+	NChord *chord;
+	NRest *rest;
+	NNote *note;
+	bool inBeam = false;
+	bool inTuplet = false;
+	bool inGrace = false;
+	bool inChord;
+	int len;
+	int idx;
+
+	actual_staff = voice_elem->getStaff();
+	elem = voice_elem->getCurrentPosition();
+
+
+	if (!elem || elem->midiTime_ >= stopTime) return false;
+	actual_staff->resetSpecialElement();
+	//actual_staff->syncSpecialElement(elem->getXpos());	// removed for FIX #3505
+	idx = voice_elem->getIdx();
+
+	out_ << "[V: " << createVoiceName(staffName, staff_nr, voice_nr) << "] ";
+
+	while (elem && elem->midiTime_ < stopTime) {
+		handleSpecialElements(actual_staff, elem);
+		switch (elem->getType()) {
+			case T_CHORD: chord = (NChord *) elem;
+				      if (chord->status_ & STAT_TUPLET) {
+				      	if (!inTuplet) {
+						inTuplet = true;
+						outputTupletStart(staff_nr, elem);
+					}
+				      }
+				      if (inGrace && !(chord->status_ & STAT_GRACE)) {
+				      	inGrace = false;
+					out_ << '}';
+				      }
+				      if (chord->status_ & STAT_GRACE) {
+				      	if (!inGrace) {
+						inGrace = true;
+						out_ << '{';
+						if (chord->getSubType() == INTERNAL_MARKER_OF_STROKEN_GRACE) {
+							out_ << '/';
+						}
+					}
+				      }
+				      if (!inTuplet && chord->getSubType() < QUARTER_LENGTH) {
+				      	if (chord->status_ & STAT_BEAMED) {
+						if (!inBeam) {
+							if (!inGrace) out_ << ' ';
+							inBeam = true;
+						}
+					}
+				      }
+				      else {
+				         inBeam =false;
+				      }
+				      if (!inTuplet && !inBeam && !inGrace) {
+				         out_ << ' ';
+				      }
+				      if (chord->lastBeamed()) {
+				      	inBeam = false;
+				      }
+				      if (!inGrace && chord->getSlurPartner()) {
+				      	out_ << '(';
+					voiceStatList_[idx].slurDepth++;
+				      }
+				      if (chord->status_ & STAT_STACC)
+						out_ << '.';
+				      if (chord->status_ & STAT_SFORZ) 
+					        out_ << "!sfz!";
+				      if (chord->status_ & STAT_PORTA)
+					        out_ << "!tenuto!";
+				      if (chord->status_ & STAT_STPIZ)
+					        out_ << "!wedge!";
+				      if (chord->status_ & STAT_SFZND)
+					        out_ << "!accent!";
+				      if (chord->status_ & STAT_FERMT) {
+				      		if (chord->status_ & STAT_STEM_UP) {
+							out_ << "!fermata!";
+						}
+						else {
+							out_ << "!invertedfermata!";
+						}
+				      }
+				      if (elem->status_ & STAT_ARPEGG) {
+				      	out_ << "!arpeggio!";
+				      }
+				      inChord = chord->getNoteList()->count() > 1;
+				      if (inChord) {
+				      	out_ << '[';
+				      }
+
+				      staff_elem->setCorrectClefAccordingTime(elem->midiTime_);
+				      for (note = chord->getNoteList()->first(); note; note = chord->getNoteList()->next()) {
+				     	outputNote(note, &(actual_staff->actualClef_), inChord);
+					if (!((chord->status_ & STAT_GRACE) && chord->getSubType() == INTERNAL_MARKER_OF_STROKEN_GRACE)) {
+						outputLength(chord->getSubType(), chord->status_, inChord, note->status & BODY_MASK);
+					}
+					if (note->status & STAT_TIED) out_ << '-';
+				      }
+				      if (inChord) {
+				      	out_ << ']';
+				      }
+				      if (voiceStatList_[idx].slurDepth > 0 && chord->getSlurStart()) {
+				      	out_ << ')';
+					voiceStatList_[idx].slurDepth--;
+				      }
+				      if (chord->status_ & STAT_LAST_TUPLET) {
+				        inTuplet = false;
+					out_ << ' ';
+				      }
+				      break;
+			case T_REST: rest = (NRest *) elem;
+				     if (rest->status_ & STAT_TUPLET) {
+				     	if (!inTuplet) {
+						inTuplet = true;
+						outputTupletStart(staff_nr, elem);
+					}
+				     }
+				     inBeam =false;
+				     if (inGrace) {
+				     	inGrace = false;
+					out_ << '}';
+				     }
+				     if (!inTuplet) out_ << ' ';
+				     if (rest->status_ & STAT_FERMT) {
+					out_ << "!fermata!";
+				     }
+				     if (rest->getSubType() == MULTIREST) {
+				     	out_ << 'Z';
+					len = rest->getMultiRestLength() * QUARTER_LENGTH;
+				     }
+				     else if (rest->status_ & STAT_HIDDEN) {
+				        out_ << 'x';
+					len = rest->getSubType();
+				     }
+				     else {
+				        out_ << 'z';
+					len = rest->getSubType();
+				     }
+				     outputLength(len, rest->status_, true, false);
+				     if (rest->status_ & STAT_LAST_TUPLET) {
+				        inTuplet = false;
+					out_ << ' ';
+				     }
+				     break;
+			default:     inBeam =false;
+				     if (inGrace) {
+				     	inGrace = false;
+					out_ << '}';
+				     }
+		}
+		elem = voice_elem->getNextPosition();
+	}
+	handleSpecialElements(actual_staff, elem);
+	out_ << endl;
+	return true;
+}
+
+void NABCExport::handleSpecialElements(NStaff *staff_elem, NMusElement *elem) {
+	NMusElement *specElem;
+	int xpos, volta;
+	bool ok;
+
+	if (elem) {
+		xpos = elem->getXpos();
+	}
+	else {
+		xpos = (1 << 30);
+	}
+	while (specElem = staff_elem->checkSpecialElement(xpos, &volta)) {
+		switch (specElem->getType()) {
+			case T_SIGN: ok = false;
+				     switch (specElem->getSubType()) {
+				        case END_BAR: ok = true;  out_ << " |"; break;
+					case SIMPLE_BAR: ok = true;  out_ << " |"; break;
+			             	case REPEAT_OPEN:ok = true;   out_ << " |:"; break;
+					case REPEAT_CLOSE: ok = true;  out_ << " :|"; break; 
+					case REPEAT_OPEN_CLOSE:ok = true;  out_ << " :||:"; break; 
+					case DOUBLE_BAR: ok = true;  out_ << " ||";  break;
+				     }
+				     if (ok && volta) {
+					out_ << volta << ' ';
+				     }
+				     break;
+			case T_CLEF: staff_elem->actualClef_.change((NClef *) specElem);
+				     break;
+		}
+	}
+}
+
+				    
+void NABCExport::outputBarSym(NSign *sign, int volta, bool isLast) {
+	switch (sign->getSubType()) {
+		case END_BAR: out_ << " |]"; break;
+		case SIMPLE_BAR: if (isLast) out_ << " |]"; else out_ << " |"; break;
+		case REPEAT_OPEN:  out_ << " |:"; break;
+		case REPEAT_CLOSE:  out_ << " :|"; break; 
+		case REPEAT_OPEN_CLOSE: out_ << " :||:"; break; 
+		case DOUBLE_BAR:  out_ << " ||";  break;
+		default: NResource::abort("NABCExport::outputBarSym");
+	}
+	if (volta) {
+		out_ << volta << ' ';
+	}
+}
+
+void NABCExport::writePendingSigns(int idx) {
+	NSign *sign;
+
+	if (sign = voiceStatList_[idx].pendingVolumes) {
+		voiceStatList_[idx].pendingVolumes = 0;
+		switch (sign->getVolType()) {
+			case V_PPPIANO : out_ << "!ppp!"; break;
+			case V_PPIANO  : out_ << "!pp!"; break;
+			case V_PIANO   : out_ << "!p!"; break;
+			case V_FORTE   : out_ << "!f!"; break;
+			case V_FFORTE  : out_ << "!ff!"; break;
+			case V_FFFORTE : out_ << "!fff!"; break;
+			default        : out_ << "!mf!"; break;
+		}
+	}
+	if (sign = voiceStatList_[idx].pendingSegnos) {
+		voiceStatList_[idx].pendingSegnos = 0;
+		switch(sign->getSubType()) {
+			case SEGNO     : out_ << "!segno! "; break;