diff options
author | Robert Jonsson <spamatica@gmail.com> | 2010-10-13 19:34:22 +0000 |
---|---|---|
committer | Robert Jonsson <spamatica@gmail.com> | 2010-10-13 19:34:22 +0000 |
commit | 8a2c2824a59d7644e13bc52c9a0ecbd641f21f95 (patch) | |
tree | 064ad3f2bf8daab0ad27b128abd86a9bbdb1e496 /muse2/muse/master | |
parent | a27706d9629e8b592cca4659f865b70adef24e6d (diff) |
new branch muse2, first checkin
Diffstat (limited to 'muse2/muse/master')
-rw-r--r-- | muse2/muse/master/Makefile.am | 19 | ||||
-rw-r--r-- | muse2/muse/master/Makefile.in | 609 | ||||
-rw-r--r-- | muse2/muse/master/lmaster.cpp | 715 | ||||
-rw-r--r-- | muse2/muse/master/lmaster.h | 145 | ||||
-rw-r--r-- | muse2/muse/master/master.cpp | 341 | ||||
-rw-r--r-- | muse2/muse/master/master.h | 69 | ||||
-rw-r--r-- | muse2/muse/master/masteredit.cpp | 403 | ||||
-rw-r--r-- | muse2/muse/master/masteredit.h | 83 | ||||
-rw-r--r-- | muse2/muse/master/tscale.cpp | 61 | ||||
-rw-r--r-- | muse2/muse/master/tscale.h | 38 |
10 files changed, 2483 insertions, 0 deletions
diff --git a/muse2/muse/master/Makefile.am b/muse2/muse/master/Makefile.am new file mode 100644 index 00000000..55222bd4 --- /dev/null +++ b/muse2/muse/master/Makefile.am @@ -0,0 +1,19 @@ +include $(top_srcdir)/common.am + +if PCH +AM_CXXFLAGS += -include $(top_srcdir)/all.h +endif + +noinst_LIBRARIES = libmaster.a + +dist_libmaster_a_SOURCES = \ + lmaster.cpp lmaster.h \ + masteredit.cpp masteredit.h \ + master.cpp master.h \ + tscale.cpp tscale.h + +nodist_libmaster_a_SOURCES = \ + moc_lmaster.cpp \ + moc_masteredit.cpp \ + moc_master.cpp \ + moc_tscale.cpp diff --git a/muse2/muse/master/Makefile.in b/muse2/muse/master/Makefile.in new file mode 100644 index 00000000..19449168 --- /dev/null +++ b/muse2/muse/master/Makefile.in @@ -0,0 +1,609 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/common.am +@PCH_TRUE@am__append_1 = -include $(top_srcdir)/all.h +subdir = muse/master +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal-include.m4 \ + $(top_srcdir)/m4/alsa.m4 $(top_srcdir)/m4/docbook.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libmaster_a_AR = $(AR) $(ARFLAGS) +libmaster_a_LIBADD = +dist_libmaster_a_OBJECTS = lmaster.$(OBJEXT) masteredit.$(OBJEXT) \ + master.$(OBJEXT) tscale.$(OBJEXT) +nodist_libmaster_a_OBJECTS = moc_lmaster.$(OBJEXT) \ + moc_masteredit.$(OBJEXT) moc_master.$(OBJEXT) \ + moc_tscale.$(OBJEXT) +libmaster_a_OBJECTS = $(dist_libmaster_a_OBJECTS) \ + $(nodist_libmaster_a_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(dist_libmaster_a_SOURCES) $(nodist_libmaster_a_SOURCES) +DIST_SOURCES = $(dist_libmaster_a_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOKSTYLE = @DOCBOOKSTYLE@ +DOCBOOKTARGETS = @DOCBOOKTARGETS@ +DOT = @DOT@ +DOTPATH = @DOTPATH@ +DOXYGEN = @DOXYGEN@ +DOXYGEN_TREEVIEW = @DOXYGEN_TREEVIEW@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FLUIDSYNTHDIRS = @FLUIDSYNTHDIRS@ +FST_CFLAGS = @FST_CFLAGS@ +FST_LIBS = @FST_LIBS@ +Fluidsynth_CFLAGS = @Fluidsynth_CFLAGS@ +Fluidsynth_LIBS = @Fluidsynth_LIBS@ +GIVERTCAP = @GIVERTCAP@ +GREP = @GREP@ +HAVEDOT = @HAVEDOT@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JACK_CFLAGS = @JACK_CFLAGS@ +JACK_LIBS = @JACK_LIBS@ +JADE = @JADE@ +LASH_CFLAGS = @LASH_CFLAGS@ +LASH_LIBS = @LASH_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LO_CFLAGS = @LO_CFLAGS@ +LO_LIBS = @LO_LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MUSECXXFLAGS = @MUSECXXFLAGS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSGMLS = @NSGMLS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCH = @PCH@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_INCLUDES = @PYTHON_INCLUDES@ +PYTHON_LIB = @PYTHON_LIB@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +QTDIR_BIN = @QTDIR_BIN@ +QTDIR_INC = @QTDIR_INC@ +QT_LIBS = @QT_LIBS@ +RANLIB = @RANLIB@ +SAMPLERATE_CFLAGS = @SAMPLERATE_CFLAGS@ +SAMPLERATE_LIBS = @SAMPLERATE_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SNDFILE_CFLAGS = @SNDFILE_CFLAGS@ +SNDFILE_LIBS = @SNDFILE_LIBS@ +STRIP = @STRIP@ +SUIDBUILD = @SUIDBUILD@ +SUIDINSTALL = @SUIDINSTALL@ +USE_SSE = @USE_SSE@ +UUID_CFLAGS = @UUID_CFLAGS@ +UUID_LIBS = @UUID_LIBS@ +VERSION = @VERSION@ +XMKMF = @XMKMF@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +have_docbook = @have_docbook@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +synth_fluid = @synth_fluid@ +synth_fluidsynth = @synth_fluidsynth@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CXXFLAGS = $(MUSECXXFLAGS) -I.. -I$(top_srcdir)/synti \ + -I$(top_srcdir)/muse/widgets -DQT_SHARED -DQT_THREAD_SUPPORT \ + -DQT_PLUGIN $(QTDIR_INC) -DQT3_SUPPORT $(am__append_1) +AM_CPPFLAGS = +MOC = $(QTDIR_BIN)/moc +#UIC = $(QTDIR_BIN)/uic3 +UIC = /usr/bin/uic3 +UIFILES = $(wildcard *.ui) +MOCFILES = $(shell for h in $(filter %.h,$(SOURCES)); do \ + if grep -q Q_OBJECT $$h; then \ + echo $$h | sed "s/\(.*\)\.h/moc_\1.cpp/"; \ + fi; \ + done) + +BUILT_SOURCES = $(MOCFILES) $(UIFILES:%.ui=%.h) +MOSTLYCLEANFILES = $(MOCFILES) $(UIFILES:%.ui=%.h) +SUFFIXES = .ui .h.gch +noinst_LIBRARIES = libmaster.a +dist_libmaster_a_SOURCES = \ + lmaster.cpp lmaster.h \ + masteredit.cpp masteredit.h \ + master.cpp master.h \ + tscale.cpp tscale.h + +nodist_libmaster_a_SOURCES = \ + moc_lmaster.cpp \ + moc_masteredit.cpp \ + moc_master.cpp \ + moc_tscale.cpp + +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .ui .h.gch .cpp .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/common.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu muse/master/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu muse/master/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libmaster.a: $(libmaster_a_OBJECTS) $(libmaster_a_DEPENDENCIES) + -rm -f libmaster.a + $(libmaster_a_AR) libmaster.a $(libmaster_a_OBJECTS) $(libmaster_a_LIBADD) + $(RANLIB) libmaster.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmaster.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/master.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/masteredit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_lmaster.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_master.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_masteredit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moc_tscale.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tscale.Po@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(LIBRARIES) +installdirs: +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: all check install install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + + +de: + @for base in $(MOCFILES); do echo -e "\t$${base}.cpp $${base}.h \\"; done + +nde: + @for base in $(MOCFILES); do echo -e "\tmoc_$${base}.cpp \\"; done + +.ui.o: %.h + $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui + $(MOC) $*.h >> $*.cpp + $(CXXCOMPILE) -c $*.cpp -o $*.o + $(RM) $*.cpp moc_$*.cpp moc_$*.o + +.ui.lo: %.h + $(UIC) -L $(top_srcdir)/muse/widgets -o $*.cpp -impl $*.h $*.ui + $(MOC) $*.h >> $*.cpp + $(LTCXXCOMPILE) -c $*.cpp -o $*.lo + $(RM) $*.cpp moc_$*.cpp moc_$*.lo moc_$*.o + +moc_%.cpp: %.h + $(MOC) $< -o $@ + +%.h: %.ui + $(UIC) -o $@ $< +# $(UIC) -L $(top_srcdir)/muse/widgets -o $@ $< + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/muse2/muse/master/lmaster.cpp b/muse2/muse/master/lmaster.cpp new file mode 100644 index 00000000..0638049e --- /dev/null +++ b/muse2/muse/master/lmaster.cpp @@ -0,0 +1,715 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: lmaster.cpp,v 1.2.2.8 2009/03/09 02:05:18 terminator356 Exp $ +// (C) Copyright 2000 Werner Schweer (ws@seh.de) +//========================================================= + +#include "lmaster.h" +#include "xml.h" +#include "song.h" +#include "globals.h" +#include "audio.h" +#include "posedit.h" +#include "sigedit.h" +#include "shortcuts.h" +#include "debug.h" + +#include <q3toolbar.h> +#include <qtoolbutton.h> +#include <qtooltip.h> +#include <qlayout.h> +#include <qsizegrip.h> +#include <q3popupmenu.h> +#include <qmenubar.h> +#include <q3listview.h> +#include <qmessagebox.h> +#include <qstyle.h> +#include <q3accel.h> +#include <qaction.h> +//Added by qt3to4: +#include <QCloseEvent> + +#define LMASTER_BEAT_COL 0 +#define LMASTER_TIME_COL 1 +#define LMASTER_TYPE_COL 2 +#define LMASTER_VAL_COL 3 + +#define LMASTER_MSGBOX_STRING "MusE: List Editor" +//--------------------------------------------------------- +// closeEvent +//--------------------------------------------------------- + +void LMaster::closeEvent(QCloseEvent* e) + { + emit deleted((unsigned long)this); + e->accept(); + } + +//--------------------------------------------------------- +// songChanged +//--------------------------------------------------------- + +void LMaster::songChanged(int type) + { + if (type & (SC_SIG | SC_TEMPO)) + updateList(); + } + +//--------------------------------------------------------- +// LMaster +//--------------------------------------------------------- + +LMaster::LMaster() + : MidiEditor(0, 0, 0) + { + pos_editor = 0; + editor = 0; + sig_editor = 0; + editedItem = 0; + editingNewItem = false; + setCaption(tr("MusE: Mastertrack")); + setMinimumHeight(100); + setFixedWidth(400); + + //---------Pulldown Menu---------------------------- + menuEdit = new Q3PopupMenu(this); + menuBar()->insertItem(tr("&Edit"), menuEdit); + undoRedo->addTo(menuEdit); + menuEdit->insertSeparator(); + menuEdit->insertItem(tr("Insert Tempo"), CMD_INSERT_TEMPO); + menuEdit->insertItem(tr("Insert Signature"), CMD_INSERT_SIG); + menuEdit->insertItem(tr("Edit Positon"), CMD_EDIT_BEAT); + menuEdit->insertItem(tr("Edit Value"), CMD_EDIT_VALUE); + + menuEdit->insertItem(tr("Delete Event"), CMD_DELETE); + menuEdit->setAccel(Qt::Key_Delete, CMD_DELETE); + + connect(menuEdit, SIGNAL(activated(int)), SLOT(cmd(int))); + + //---------ToolBar---------------------------------- + tools = new Q3ToolBar(this, "list-tools"); + undoRedo->addTo(tools); + + Q3ToolBar* edit = new Q3ToolBar(this, "edit tools"); + QToolButton* tempoButton = new QToolButton(edit); + QToolButton* timeSigButton = new QToolButton(edit); + tempoButton->setText(tr("Tempo")); + timeSigButton->setText(tr("Timesig")); + QToolTip::add(tempoButton, tr("new tempo")); + QToolTip::add(timeSigButton, tr("new signature")); + Q3Accel* qa = new Q3Accel(this); + qa->connectItem(qa->insertItem(Qt::CTRL+Qt::Key_Z), song, SLOT(undo())); + qa->connectItem(qa->insertItem(Qt::CTRL+Qt::Key_Y), song, SLOT(redo())); + + //--------------------------------------------------- + // master + //--------------------------------------------------- + + view = new Q3ListView(mainw); + view->setAllColumnsShowFocus(true); + view->setSelectionMode(Q3ListView::Single); + view->addColumn(tr("Meter"), 100); + view->addColumn(tr("Time"), 100); + view->addColumn(tr("Type"), 100); + view->addColumn(tr("Value"), 100); + view->setSorting(-1); + + //--------------------------------------------------- + // Rest + //--------------------------------------------------- + +// QSizeGrip* corner = new QSizeGrip(mainw); + + mainGrid->setRowStretch(0, 100); + mainGrid->setColStretch(0, 100); + + mainGrid->addWidget(view, 0, 0); +// mainGrid->addWidget(corner, 1, 1, AlignBottom | AlignRight); + updateList(); + + connect(view, SIGNAL(selectionChanged(Q3ListViewItem*)), SLOT(select(Q3ListViewItem*))); + connect(view, SIGNAL(pressed(Q3ListViewItem*, const QPoint&, int)), SLOT(itemPressed(Q3ListViewItem*, const QPoint&, int))); + connect(view, SIGNAL(doubleClicked(Q3ListViewItem* )), SLOT(itemDoubleClicked(Q3ListViewItem*))); + connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(tempoButton, SIGNAL(clicked()), SLOT(tempoButtonClicked())); + connect(timeSigButton, SIGNAL(clicked()), SLOT(timeSigButtonClicked())); + + initShortcuts(); + } + +//--------------------------------------------------------- +// ~LMaster +//--------------------------------------------------------- + +LMaster::~LMaster() + { + undoRedo->removeFrom(tools); + } + +//--------------------------------------------------------- +// insertSig +//--------------------------------------------------------- + +void LMaster::insertSig(const SigEvent* ev) + { + new LMasterSigEventItem(view, ev); + } + +//--------------------------------------------------------- +// insertTempo +//--------------------------------------------------------- + +void LMaster::insertTempo(const TEvent* ev) + { + new LMasterTempoItem(view, ev); + } + +//--------------------------------------------------------- +// updateList +//--------------------------------------------------------- + +void LMaster::updateList() + { + LMasterLViewItem* selected = (LMasterLViewItem*) view->selectedItem(); + LMASTER_LVTYPE type = LMASTER_TEMPO; + unsigned tick = 0; + + if (selected) { + type = selected->getType(); + tick = selected->tick(); + } + + view->clear(); + const TempoList* t = &tempomap; + const SigList* s = &sigmap; + + criTEvent it = t->rbegin(); + criSigEvent is = s->rbegin(); + for (;;) { + if (it == t->rend()) { + while(is != s->rend()) { + insertSig(is->second); + ++is; + } + break; + } + if (is == s->rend()) { + while (it != t->rend()) { + insertTempo(it->second); + ++it; + } + break; + } + if (is->second->tick > it->second->tick) { + insertSig(is->second); + ++is; + } + else { + insertTempo(it->second); + ++it; + } + } + + // Try to reselect the previous selection: + if(selected) + { + LMasterLViewItem* tmp = getItemAtPos(tick, type); + if (tmp) { + view->clearSelection(); + view->setSelected(tmp, true); + } + } + } + +//--------------------------------------------------------- +// readStatus +//--------------------------------------------------------- + +void LMaster::readStatus(Xml& xml) + { + for (;;) { + Xml::Token token = xml.parse(); + const QString& tag = xml.s1(); + if (token == Xml::Error || token == Xml::End) + break; + switch (token) { + case Xml::TagStart: + if (tag == "midieditor") + MidiEditor::readStatus(xml); + else + xml.unknown("LMaster"); + break; + case Xml::TagEnd: + if (tag == "lmaster") + return; + default: + break; + } + } + } + +//--------------------------------------------------------- +// writeStatus +//--------------------------------------------------------- + +void LMaster::writeStatus(int level, Xml& xml) const + { + xml.tag(level++, "lmaster"); + MidiEditor::writeStatus(level, xml); + xml.tag(level, "/lmaster"); + } + +//--------------------------------------------------------- +// select +//--------------------------------------------------------- + +void LMaster::select(Q3ListViewItem* /*item*/) + { +// printf("select %x\n", unsigned(item)); + } + +//--------------------------------------------------------- +// cmd +//--------------------------------------------------------- + +void LMaster::cmd(int cmd) + { + switch(cmd) { + case CMD_DELETE: { + LMasterLViewItem* l = (LMasterLViewItem*) view->selectedItem(); + if (!l) + return; + // Delete item: + if (l->tick() != 0) { + if (l == view->lastItem()) + view->setSelected(l->itemAbove(), true); + else + view->setSelected(l->itemBelow(), true); + + switch (l->getType()) { + case LMASTER_TEMPO: + { + LMasterTempoItem* t = (LMasterTempoItem*) l; + audio->msgDeleteTempo(t->tick(), t->tempo(), true); + break; + } + case LMASTER_SIGEVENT: + { + LMasterSigEventItem* s = (LMasterSigEventItem*) l; + audio->msgRemoveSig(s->tick(), s->z(), s->n()); + break; + } + default: + M_ERROR("Default switch statement reached"); + break; + } + } + break; + } + case CMD_INSERT_TEMPO: + tempoButtonClicked(); + break; + case CMD_INSERT_SIG: + timeSigButtonClicked(); + break; + case CMD_EDIT_BEAT: + case CMD_EDIT_VALUE: + cmd == CMD_EDIT_VALUE ? editorColumn = LMASTER_VAL_COL : editorColumn = LMASTER_BEAT_COL; + if (view->selectedItem() && !editedItem) { + itemDoubleClicked(view->selectedItem()); + } + break; + } + } + +/*! + \fn LMaster::itemPressed(QListViewItem* i, const QPoint& p, int column) + */ +void LMaster::itemPressed(Q3ListViewItem* i, const QPoint& /*p*/, int column) + { + //printf("itemPressed, column: %d\n", column); + if (editedItem) { + if (editorColumn != column || editedItem != i) + returnPressed(); + } + else + editorColumn = column; + } + +//--------------------------------------------------------- +// itemDoubleClicked(QListViewItem* item) +//! Sets lmaster in edit mode, and opens editor for selected value +//--------------------------------------------------------- +void LMaster::itemDoubleClicked(Q3ListViewItem* i) + { + //printf("itemDoubleClicked\n"); + + if (!editedItem && editorColumn == LMASTER_VAL_COL) { + editedItem = (LMasterLViewItem*) i; + QRect itemRect = view->itemRect(editedItem); + int x1 = view->columnWidth(LMASTER_BEAT_COL) + view->columnWidth(LMASTER_TIME_COL) + + view->columnWidth(LMASTER_TYPE_COL); + itemRect.setX(x1); + //Qt makes crazy things with itemRect if this is called directly.. + if (editingNewItem) { + QFontMetrics fm(font()); + int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth,0 , this); // ddskrjo 0 + int h = fm.height() + fw * 2; + itemRect.setWidth(view->columnWidth(LMASTER_VAL_COL)); + itemRect.setY(1); + itemRect.setHeight(h); + } + + + // Edit tempo value: + if (editedItem->getType() == LMASTER_TEMPO) { + if (!editor) + editor = new QLineEdit(view->viewport(), "lineedit"); + editor->setText(editedItem->text(LMASTER_VAL_COL)); + editor->setGeometry(itemRect); + editor->show(); + editor->setFocus(); + editor->selectAll(); + connect(editor, SIGNAL(returnPressed()), SLOT(returnPressed())); + } + else { // Edit signatur value: + if (!sig_editor) + sig_editor = new SigEdit(view->viewport(), "sigedit"); + sig_editor->setValue(editedItem->text(LMASTER_VAL_COL)); + sig_editor->setGeometry(itemRect); + sig_editor->show(); + sig_editor->setFocus(); + connect(sig_editor, SIGNAL(returnPressed()), SLOT(returnPressed())); + } + } + // Edit tempo or signal position: + else if (!editedItem && editorColumn == LMASTER_BEAT_COL) { + editedItem = (LMasterLViewItem*) i; + // Don't allow movement of initial values: + if (editedItem->tick() == 0) { + QMessageBox::information(this, tr(LMASTER_MSGBOX_STRING), + tr("Reposition of the initial tempo and signature events is not allowed") ); + editedItem = 0; + } + // Everything OK + else { + if (!pos_editor) + pos_editor = new PosEdit(view->viewport(), "tmpposedit"); + pos_editor->setValue(editedItem->tick()); + QRect itemRect = view->itemRect(editedItem); + itemRect.setX(0); + itemRect.setWidth(view->columnWidth(LMASTER_BEAT_COL)); + pos_editor->setGeometry(itemRect); + pos_editor->show(); + pos_editor->setFocus(); + connect(pos_editor, SIGNAL(returnPressed()), SLOT(returnPressed())); + } + } + } + +//--------------------------------------------------------- +// returnPressed() +//! called when editor is closed +//--------------------------------------------------------- +void LMaster::returnPressed() + { + if (!editedItem) + return; + + setFocus(); + // Tempo event: + if (editedItem->getType() == LMASTER_TEMPO && editorColumn == LMASTER_VAL_COL) { + QString input = editor->text(); + editor->hide(); + repaint(); + LMasterTempoItem* e = (LMasterTempoItem*) editedItem; + const TEvent* t = e->getEvent(); + unsigned tick = t->tick; + bool conversionOK; + double dbl_input = input.toDouble(&conversionOK); + if (conversionOK && dbl_input < 250.0) { + int tempo = (int) ((1000000.0 * 60.0)/dbl_input); + + if (!editingNewItem) { + song->startUndo(); + audio->msgDeleteTempo(tick, e->tempo(), false); + audio->msgAddTempo(tick, tempo, false); + song->endUndo(SC_TEMPO); + } + // + // New item edited: + // + else { + audio->msgAddTempo(tick, tempo, true); + } + } + else { + QMessageBox::warning(this, tr("MusE: List Editor"), + tr("Input error, conversion not OK or value out of range"), + QMessageBox::Ok, Qt::NoButton + ); + } + } + // + // Beat column, change position of a particular tempo or signature event + // + else if (editorColumn == LMASTER_BEAT_COL) { + int oldtick = editedItem->tick(); + int newtick = pos_editor->pos().tick(); + if (newtick == 0) { // Do not allow change of position to beginning of song + QMessageBox::warning(this, tr(LMASTER_MSGBOX_STRING), + tr("Reposition of tempo and signature events to start position is not allowed!"), + QMessageBox::Ok, Qt::NoButton + ); + } + else if (oldtick != newtick) { // Ignore if tick hasn't changed + if (editedItem->getType() == LMASTER_TEMPO) { + LMasterTempoItem* t = (LMasterTempoItem*) editedItem; + int tempo = t->tempo(); + song->startUndo(); + audio->msgDeleteTempo(oldtick, tempo, false); + audio->msgAddTempo(newtick, tempo, false); + song->endUndo(SC_TEMPO); + // Select the item: + Q3ListViewItem* newSelected = (Q3ListViewItem*) getItemAtPos(newtick, LMASTER_TEMPO); + if (newSelected) { + view->clearSelection(); + view->setSelected(newSelected, true); + } + } + else if (editedItem->getType() == LMASTER_SIGEVENT) { + LMasterSigEventItem* t = (LMasterSigEventItem*) editedItem; + int z = t->z(); + int n = t->n(); + if (!editingNewItem) { + song->startUndo(); + audio->msgRemoveSig(oldtick, z, n, false); //Delete first, in order to get sane tick-value + newtick = pos_editor->pos().tick(); + audio->msgAddSig(newtick, z, n, false); + song->endUndo(SC_SIG); + } + else + audio->msgAddSig(newtick, z, n, false); + //audio->msgAddSig(newtick, z, n, true); + + // Select the item: + Q3ListViewItem* newSelected = (Q3ListViewItem*) getItemAtPos(newtick, LMASTER_SIGEVENT); + if (newSelected) { + view->clearSelection(); + view->setSelected(newSelected, true); + } + } + + } + pos_editor->hide(); + repaint(); + } + // + // SigEvent, value changed: + // + else if (editedItem->getType() == LMASTER_SIGEVENT && editorColumn == LMASTER_VAL_COL) + { + Sig newSig = sig_editor->sig(); + + sig_editor->hide(); + + // Added p3.3.43 Prevents aborting with 0 z or n. + if(newSig.isValid()) + { + + LMasterSigEventItem* e = (LMasterSigEventItem*) editedItem; + int tick = e->tick(); + if (!editingNewItem) { + song->startUndo(); + if (tick > 0) + audio->msgRemoveSig(tick, e->z(), e->n(), false); + audio->msgAddSig(tick, newSig.z, newSig.n, false); + song->endUndo(SC_SIG); + } + else + audio->msgAddSig(tick, newSig.z, newSig.n, true); + } + } + + view->setFocus(); + // No item edited now: + editedItem = 0; + editorColumn = -1; + editingNewItem = false; + } + + +/*! + \fn LMasterLViewItem::text(int column) + \brief Returns the initialized text to the View + */ +QString LMasterLViewItem::text(int column) const + { + QString ret = "?"; + switch (column) { + case LMASTER_BEAT_COL: + ret = c1; + break; + case LMASTER_TIME_COL: + ret = c2; + break; + case LMASTER_TYPE_COL: + ret = c3; + break; + case LMASTER_VAL_COL: + ret = c4; + break; + default: + fprintf(stderr,"LMasterLViewItem::text(int): Default switch statement reached... Unknown column.\n"); + break; + } + return ret; + } + +//--------------------------------------------------------- +// LMasterTempoItem +//! Initializes a LMasterTempoItem with a TEvent +//--------------------------------------------------------- +LMasterTempoItem::LMasterTempoItem(Q3ListView* parent, const TEvent* ev) + : LMasterLViewItem(parent) + { + tempoEvent = ev; + unsigned t = ev->tick; + //QString c1, c2, c3, c4; + int bar, beat; + unsigned tick; + sigmap.tickValues(t, &bar, &beat, &tick); + c1.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick); + + double time = double(ev->frame) / double(sampleRate); + int min = int(time) / 60; + int sec = int(time) % 60; + int msec = int((time - (min*60 + sec)) * 1000.0); + c2.sprintf("%03d:%02d:%03d", min, sec, msec); + c3 = "Tempo"; + double dt = (1000000.0 * 60.0)/ev->tempo; + c4.setNum(dt, 'f', 3); + } + +//--------------------------------------------------------- +// LMasterSigEventItem +//! Initializes a ListView item with a SigEvent +//--------------------------------------------------------- +LMasterSigEventItem::LMasterSigEventItem(Q3ListView* parent, const SigEvent* ev) + : LMasterLViewItem(parent) + { + sigEvent = ev; + unsigned t = ev->tick; + int bar, beat; + unsigned tick; + sigmap.tickValues(t, &bar, &beat, &tick); + c1.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick); + + double time = double(tempomap.tick2frame(t)) / double (sampleRate); + int min = int(time) / 60; + int sec = int(time) % 60; + int msec = int((time - (min*60 + sec)) * 1000.0); + c2.sprintf("%03d:%02d:%03d", min, sec, msec); + c3 = "Timesig"; + c4.sprintf("%d/%d", ev->z, ev->n); + } + +//--------------------------------------------------------- +// tempoButtonClicked() +//! inserts a new tempo-item in the list and starts the editor for it +//--------------------------------------------------------- +void LMaster::tempoButtonClicked() + { + LMasterTempoItem* lastTempo = (LMasterTempoItem*) getLastOfType(LMASTER_TEMPO); + QString beatString = ((LMasterLViewItem*)lastTempo)->text(LMASTER_BEAT_COL); + int m, b, t; + Pos p = Pos(beatString); + p.mbt(&m, &b, &t); + m++; //Next bar + int newTick = sigmap.bar2tick(m, b, t); + TEvent* ev = new TEvent(lastTempo->tempo(), newTick); + new LMasterTempoItem(view, ev); + Q3ListViewItem* newTempoItem = view->firstChild(); + + editingNewItem = true; // State + editorColumn = LMASTER_VAL_COL; // Set that we edit editorColumn + view->clearSelection(); + view->setSelected(newTempoItem, true); + itemDoubleClicked(newTempoItem); + } + + +//--------------------------------------------------------- +// tempoButtonClicked() +//! inserts a new sig-item in the list and starts the editor for it +//--------------------------------------------------------- +void LMaster::timeSigButtonClicked() + { + LMasterSigEventItem* lastSig = (LMasterSigEventItem*) getLastOfType(LMASTER_SIGEVENT); + QString beatString = ((LMasterLViewItem*)lastSig)->text(LMASTER_BEAT_COL); + int m, b, t; + Pos p = Pos(beatString); + p.mbt(&m, &b, &t); + m++; + int newTick = sigmap.bar2tick(m, b, t); + SigEvent* ev = new SigEvent(lastSig->z(), lastSig->n(), newTick); + new LMasterSigEventItem(view, ev); + Q3ListViewItem* newSigItem = view->firstChild(); + + editingNewItem = true; // State + editorColumn = LMASTER_VAL_COL; // Set that we edit editorColumn + view->clearSelection(); + view->setSelected(newSigItem, true); + itemDoubleClicked(newSigItem); + } + + +/*! + \fn LMaster::getLastOfType(LMASTER_LVTYPE t) + */ +LMasterLViewItem* LMaster::getLastOfType(LMASTER_LVTYPE t) + { + LMasterLViewItem* tmp = (LMasterLViewItem*) view->lastItem(); + while (tmp->getType() != t) { + tmp = (LMasterLViewItem*) tmp->itemAbove(); + } + return tmp; + } + + +/*! + \fn LMaster::getItemAtPos(unsigned tick, LMASTER_LVTYPE t) + */ +LMasterLViewItem* LMaster::getItemAtPos(unsigned tick, LMASTER_LVTYPE t) + { + LMasterLViewItem* tmp = (LMasterLViewItem*) view->firstChild(); + while (tmp) { + if (tmp->getType() == t && tmp->tick() == tick) + return tmp; + tmp = (LMasterLViewItem*) tmp->itemBelow(); + } + + return 0; + } + + +/*! + \fn LMaster::configChanged() + */ +void LMaster::configChanged() + { + initShortcuts(); + } + + +/*! + \fn LMaster::initShortcuts() + */ +void LMaster::initShortcuts() + { + menuEdit->setAccel(shortcuts[SHRT_LM_INS_TEMPO].key, CMD_INSERT_TEMPO); + menuEdit->setAccel(shortcuts[SHRT_LM_INS_SIG].key, CMD_INSERT_SIG); + menuEdit->setAccel(shortcuts[SHRT_LM_EDIT_BEAT].key, CMD_EDIT_BEAT); + menuEdit->setAccel(shortcuts[SHRT_LM_EDIT_VALUE].key, CMD_EDIT_VALUE); + } diff --git a/muse2/muse/master/lmaster.h b/muse2/muse/master/lmaster.h new file mode 100644 index 00000000..b67f64bf --- /dev/null +++ b/muse2/muse/master/lmaster.h @@ -0,0 +1,145 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: lmaster.h,v 1.1.1.1.2.5 2005/12/11 21:29:23 spamatica Exp $ +// (C) Copyright 2000 Werner Schweer (ws@seh.de) +//========================================================= + +#ifndef __LMASTER_EDIT_H__ +#define __LMASTER_EDIT_H__ + +#include <qwidget.h> +#include <qlineedit.h> +//Added by qt3to4: +#include <QMouseEvent> +#include <Q3PopupMenu> +#include <QCloseEvent> +#include "midieditor.h" +#include "noteinfo.h" +#include "cobject.h" +#include <q3mainwindow.h> +#include <q3listview.h> +#include "tempo.h" +#include "sig.h" + +class QToolButton; +class Q3ListView; +class SigEvent; +class QLineEdit; +class QMouseEvent; +class PosEdit; +class SigEdit; + +enum LMASTER_LVTYPE + { + LMASTER_TEMPO = 0, + LMASTER_SIGEVENT + }; + +//--------------------------------------------------------- +// LMasterLViewItem +//! QListViewItem base class for LMasterTempoItem and LMasterSigEventItem +//--------------------------------------------------------- +class LMasterLViewItem : public Q3ListViewItem { + protected: + QString c1, c2, c3, c4; + + public: + LMasterLViewItem(Q3ListView* parent) + : Q3ListViewItem(parent) { } + LMasterLViewItem(Q3ListView* parent, Q3ListViewItem* after) + : Q3ListViewItem(parent, after) { } + virtual QString text(int column) const; + virtual LMASTER_LVTYPE getType() = 0; + virtual unsigned tick() = 0; + }; + +//--------------------------------------------------------- +// LMasterTempoItem +//! QListViewItem which holds data for a TEvent +//--------------------------------------------------------- +class LMasterTempoItem : public LMasterLViewItem { + + private: + const TEvent* tempoEvent; + + public: + LMasterTempoItem(Q3ListView* parent, const TEvent* t); + virtual LMASTER_LVTYPE getType() { return LMASTER_TEMPO; } + const TEvent* getEvent() { return tempoEvent; } + virtual unsigned tick() { return tempoEvent->tick; } + int tempo() { return tempoEvent->tempo; } + }; + +//--------------------------------------------------------- +// LMasterTempoItem +//! QListViewItem which holds data for a SigEvent +//--------------------------------------------------------- +class LMasterSigEventItem : public LMasterLViewItem { + + private: + const SigEvent* sigEvent; + + public: + LMasterSigEventItem(Q3ListView* parent, const SigEvent* s); + virtual LMASTER_LVTYPE getType() { return LMASTER_SIGEVENT; } + const SigEvent* getEvent() { return sigEvent; } + virtual unsigned tick() { return sigEvent->tick; } + int z() { return sigEvent->z; } + int n() { return sigEvent->n; } + }; + + +//--------------------------------------------------------- +// LMaster +//--------------------------------------------------------- + +class LMaster : public MidiEditor { + Q3ListView* view; + Q3ToolBar* tools; + Q3PopupMenu* menuEdit; + + enum { CMD_DELETE, CMD_INSERT_SIG, CMD_INSERT_TEMPO, CMD_EDIT_BEAT, CMD_EDIT_VALUE }; + + Q_OBJECT + virtual void closeEvent(QCloseEvent*); + void updateList(); + void insertTempo(const TEvent*); + void insertSig(const SigEvent*); + LMasterLViewItem* getItemAtPos(unsigned tick, LMASTER_LVTYPE t); + void initShortcuts(); + QLineEdit* editor; + PosEdit* pos_editor; + // State-like members: + LMasterLViewItem* editedItem; + SigEdit* sig_editor; + int editorColumn; + bool editingNewItem; + + private slots: + void select(Q3ListViewItem*); + void itemDoubleClicked(Q3ListViewItem* item); + void returnPressed(); + void itemPressed(Q3ListViewItem* i, const QPoint& p, int column); + void tempoButtonClicked(); + void timeSigButtonClicked(); + void cmd(int cmd); + + public slots: + void songChanged(int); + void configChanged(); + + signals: + void deleted(unsigned long); + + public: + LMaster(); + ~LMaster(); + virtual void readStatus(Xml&); + virtual void writeStatus(int, Xml&) const; + LMasterLViewItem* getLastOfType(LMASTER_LVTYPE t); + }; + + +#endif + diff --git a/muse2/muse/master/master.cpp b/muse2/muse/master/master.cpp new file mode 100644 index 00000000..65204bef --- /dev/null +++ b/muse2/muse/master/master.cpp @@ -0,0 +1,341 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: master.cpp,v 1.3 2004/04/11 13:03:32 wschweer Exp $ +// (C) Copyright 2000 Werner Schweer (ws@seh.de) +//========================================================= + +#include <stdio.h> +#include <values.h> + +#include <qlineedit.h> +#include <q3popupmenu.h> +#include <qpainter.h> +#include <q3header.h> +#include <qcursor.h> +//Added by qt3to4: +#include <QMouseEvent> +#include <QEvent> + +#include "globals.h" +#include "master.h" +#include "song.h" +#include "scrollscale.h" +#include "midi.h" +#include "midieditor.h" +#include "icons.h" +#include "audio.h" + +extern void drawTickRaster(QPainter& p, int x, int y, + int w, int h, int quant); + +//--------------------------------------------------------- +// Master +//--------------------------------------------------------- + +Master::Master(MidiEditor* e, QWidget* parent, int xmag, int ymag) + : View(parent, xmag, ymag) + { + editor = e; + setBg(Qt::white); + vscroll = 0; + pos[0] = 0; + pos[1] = 0; + pos[2] = 0; + setMouseTracking(true); + connect(song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool))); + connect(song, SIGNAL(songChanged(int)), this, SLOT(redraw())); + } + +//--------------------------------------------------------- +// setPos +//--------------------------------------------------------- + +void Master::setPos(int idx, unsigned val, bool adjustScrollbar) + { + if (pos[idx] == val) + return; + + int opos = mapx(pos[idx]); + int npos = mapx(val); + + if (adjustScrollbar && idx == 0) { + switch (song->follow()) { + case Song::NO: + break; + case Song::JUMP: + if (npos >= width()) { + int ppos = val - rmapxDev(width()/8); + if (ppos < 0) + ppos = 0; + emit followEvent(ppos); + opos = mapx(pos[idx]); + npos = mapx(val); + } + else if (npos < 0) { + int ppos = val - rmapxDev(width()*3/4); + if (ppos < 0) + ppos = 0; + emit followEvent(ppos); + opos = mapx(pos[idx]); + npos = mapx(val); + } + break; + case Song::CONTINUOUS: + if (npos > (width()/2)) { + int ppos = pos[idx] - rmapxDev(width()/2); + if (ppos < 0) + ppos = 0; + emit followEvent(ppos); + opos = mapx(pos[idx]); + npos = mapx(val); + } + else if (npos < (width()/2)) { + int ppos = pos[idx] - rmapxDev(width()/2); + if (ppos < 0) + ppos = 0; + emit followEvent(ppos); + opos = mapx(pos[idx]); + npos = mapx(val); + } + break; + } + } + + int x; + int w = 1; + if (opos > npos) { + w += opos - npos; + x = npos; + } + else { + w += npos - opos; + x = opos; + } + pos[idx] = val; + redraw(QRect(x-1, 0, w+2, height())); + } + +//--------------------------------------------------------- +// leaveEvent +//--------------------------------------------------------- + +void Master::leaveEvent(QEvent*) + { + emit tempoChanged(-1); + emit timeChanged(MAXINT); + } + +//--------------------------------------------------------- +// pdraw +//--------------------------------------------------------- + +void Master::pdraw(QPainter& p, const QRect& rect) + { + View::pdraw(p, rect); // calls draw() + p.resetXForm(); + + int x = rect.x(); + int y = rect.y(); + int w = rect.width() + 2; + int h = rect.height(); + + int wh = height(); + //--------------------------------------------------- + // draw Canvas Items + //--------------------------------------------------- + + const TempoList* tl = &tempomap; + for (ciTEvent i = tl->begin(); i != tl->end(); ++i) { + TEvent* e = i->second; + int etick = mapx(i->first); + int stick = mapx(i->second->tick); + int tempo = mapy(280000 - int(60000000000.0/(e->tempo))); + + if (tempo < 0) + tempo = 0; + if (tempo < wh) { + p.fillRect(stick, tempo, etick-stick, wh, Qt::blue); + } + } + + //--------------------------------------------------- + // draw marker + //--------------------------------------------------- + + int xp = mapx(pos[0]); + if (xp >= x && xp < x+w) { + p.setPen(Qt::red); + p.drawLine(xp, y, xp, y+h); + } + xp = mapx(pos[1]); + if (xp >= x && xp < x+w) { + p.setPen(Qt::blue); + p.drawLine(xp, y, xp, y+h); + } + xp = mapx(pos[2]); + if (xp >= x && xp < x+w) { + p.setPen(Qt::blue); + p.drawLine(xp, y, xp, y+h); + } + } + +//--------------------------------------------------------- +// draw +//--------------------------------------------------------- + +void Master::draw(QPainter& p, const QRect& rect) + { + drawTickRaster(p, rect.x(), rect.y(), + rect.width(), rect.height(), 0); + } + +//--------------------------------------------------------- +// viewMousePressEvent +//--------------------------------------------------------- + +void Master::viewMousePressEvent(QMouseEvent* event) + { + start = event->pos(); + Tool activeTool = tool; +// bool shift = event->state() & ShiftButton; + + switch (activeTool) { + case PointerTool: + drag = DRAG_LASSO_START; + break; + + case PencilTool: + drag = DRAG_NEW; + song->startUndo(); + newVal(start.x(), start.x(), start.y()); + break; + + case RubberTool: + drag = DRAG_DELETE; + song->startUndo(); + deleteVal(start.x(), start.x()); + break; + + default: + break; + } + } + +//--------------------------------------------------------- +// viewMouseMoveEvent +//--------------------------------------------------------- + +void Master::viewMouseMoveEvent(QMouseEvent* event) + { + QPoint pos = event->pos(); +// QPoint dist = pos - start; +// bool moving = dist.y() >= 3 || dist.y() <= 3 || dist.x() >= 3 || dist.x() <= 3; + + switch (drag) { + case DRAG_NEW: + newVal(start.x(), pos.x(), pos.y()); + start = pos; + break; + + case DRAG_DELETE: + deleteVal(start.x(), pos.x()); + start = pos; + break; + + default: + break; + } + emit tempoChanged(280000 - event->y()); + int x = pos.x(); + if (x < 0) + x = 0; + emit timeChanged(editor->rasterVal(x)); + } + +//--------------------------------------------------------- +// viewMouseReleaseEvent +//--------------------------------------------------------- + +void Master::viewMouseReleaseEvent(QMouseEvent*) + { + switch (drag) { + case DRAG_RESIZE: + case DRAG_NEW: + case DRAG_DELETE: + song->endUndo(SC_TEMPO); + break; + default: + break; + } + drag = DRAG_OFF; + } + +//--------------------------------------------------------- +// deleteVal +//--------------------------------------------------------- + +bool Master::deleteVal1(unsigned int x1, unsigned int x2) + { + bool songChanged = false; + + TempoList* tl = &tempomap; + for (iTEvent i = tl->begin(); i != tl->end(); ++i) { + if (i->first < x1) + continue; + if (i->first >= x2) + break; + iTEvent ii = i; + ++ii; + if (ii != tl->end()) { + int tempo = ii->second->tempo; + audio->msgDeleteTempo(i->first, tempo, false); + songChanged = true; + } + } + return songChanged; + } + +void Master::deleteVal(int x1, int x2) + { + if (deleteVal1(editor->rasterVal1(x1), x2)) + redraw(); + } + +//--------------------------------------------------------- +// setTool +//--------------------------------------------------------- + +void Master::setTool(int t) + { + if (tool == Tool(t)) + return; + tool = Tool(t); + switch(tool) { + case PencilTool: + setCursor(QCursor(*pencilIcon, 4, 15)); + break; + default: + setCursor(QCursor(Qt::arrowCursor)); + break; + } + } + +//--------------------------------------------------------- +// newVal +//--------------------------------------------------------- + +void Master::newVal(int x1, int x2, int y) + { + int xx1 = editor->rasterVal1(x1); + int xx2 = editor->rasterVal2(x2); + + if (xx1 > xx2) { + int tmp = xx2; + xx2 = xx1; + xx1 = tmp; + } + deleteVal1(xx1, xx2); + audio->msgAddTempo(xx1, int(60000000000.0/(280000 - y)), false); + redraw(); + } diff --git a/muse2/muse/master/master.h b/muse2/muse/master/master.h new file mode 100644 index 00000000..ee5bfd21 --- /dev/null +++ b/muse2/muse/master/master.h @@ -0,0 +1,69 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: master.h,v 1.3 2004/04/11 13:03:32 wschweer Exp $ +// (C) Copyright 1999 Werner Schweer (ws@seh.de) +//========================================================= + +#ifndef __MASTER_H__ +#define __MASTER_H__ + +#include <qpoint.h> +//Added by qt3to4: +#include <QMouseEvent> +#include <QEvent> + +#include "view.h" +#include "song.h" +#include "tools.h" + +class ScrollScale; +class QPainter; +class QRect; +class MidiEditor; + +//--------------------------------------------------------- +// Master +//--------------------------------------------------------- + +class Master : public View { + enum DragMode { DRAG_OFF, DRAG_NEW, DRAG_MOVE_START, DRAG_MOVE, + DRAG_DELETE, DRAG_COPY_START, DRAG_COPY, + DRAG_RESIZE, DRAG_LASSO_START, DRAG_LASSO + }; + ScrollScale* vscroll; + unsigned pos[3]; + QPoint start; + Tool tool; + DragMode drag; + MidiEditor* editor; + + Q_OBJECT + virtual void pdraw(QPainter&, const QRect&); + virtual void viewMouseMoveEvent(QMouseEvent* event); + virtual void leaveEvent(QEvent*e); + virtual void viewMousePressEvent(QMouseEvent* event); + virtual void viewMouseReleaseEvent(QMouseEvent*); + + void draw(QPainter&, const QRect&); + void newVal(int x1, int x2, int y); + bool deleteVal1(unsigned int x1, unsigned int x2); + void deleteVal(int x1, int x2); + + signals: + void followEvent(int); + void xposChanged(int); + void yposChanged(int); + void timeChanged(unsigned); + void tempoChanged(int); + + public slots: + void setPos(int, unsigned, bool adjustScrollbar); + void setTool(int t); + + public: + Master(MidiEditor*, QWidget* parent, int xmag, int ymag); + }; + +#endif + diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp new file mode 100644 index 00000000..ef8abde8 --- /dev/null +++ b/muse2/muse/master/masteredit.cpp @@ -0,0 +1,403 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: masteredit.cpp,v 1.4.2.5 2009/07/01 22:14:56 spamatica Exp $ +// (C) Copyright 1999 Werner Schweer (ws@seh.de) +//========================================================= + +#include "masteredit.h" +#include "mtscale.h" +#include "hitscale.h" +#include "sigscale.h" +#include "scrollscale.h" +#include "poslabel.h" +#include "master.h" +#include "utils.h" +#include "tscale.h" +#include "tempolabel.h" +#include "xml.h" +#include "lcombo.h" +#include "doublelabel.h" +#include "sigedit.h" +#include "globals.h" + +#include <values.h> +#include <q3toolbar.h> +#include <qtoolbutton.h> +#include <qtooltip.h> +#include <q3accel.h> +#include <qlayout.h> +#include <q3hbox.h> +#include <qsizegrip.h> +#include <qscrollbar.h> +#include <qlabel.h> +#include <qpushbutton.h> +#include <qradiobutton.h> +#include <q3buttongroup.h> +#include <q3listbox.h> +#include <qcombobox.h> +#include <q3header.h> +#include <q3popupmenu.h> +#include <qmenubar.h> +#include <qaction.h> +//Added by qt3to4: +#include <QCloseEvent> + +int MasterEdit::_rasterInit = 0; + +//--------------------------------------------------------- +// closeEvent +//--------------------------------------------------------- + +void MasterEdit::closeEvent(QCloseEvent* e) + { + emit deleted((unsigned long)this); + e->accept(); + } + +//--------------------------------------------------------- +// songChanged +//--------------------------------------------------------- + +void MasterEdit::songChanged(int type) + { + if (type & SC_TEMPO) { + int tempo = tempomap.tempo(song->cpos()); + curTempo->blockSignals(true); + curTempo->setValue(double(60000000.0/tempo)); + + curTempo->blockSignals(false); + } + if (type & SC_SIG) { + int z, n; + sigmap.timesig(song->cpos(), z, n); + curSig->blockSignals(true); + curSig->setValue(Sig(z, n)); + curSig->blockSignals(false); + sign->redraw(); + } + if (type & SC_MASTER) { + enableButton->blockSignals(true); + enableButton->setOn(song->masterFlag()); + enableButton->blockSignals(false); + } + } + +//--------------------------------------------------------- +// MasterEdit +//--------------------------------------------------------- + +MasterEdit::MasterEdit() + : MidiEditor(0, _rasterInit, 0) + { + setCaption(tr("MusE: Mastertrack")); + _raster = 0; // measure + setMinimumSize(400, 300); + resize(500, 350); + + //---------Pulldown Menu---------------------------- +// QPopupMenu* file = new QPopupMenu(this); +// menuBar()->insertItem("&File", file); + + //---------ToolBar---------------------------------- + tools = new Q3ToolBar(tr("edit tools"), this); + undoRedo->addTo(tools); + + EditToolBar* tools2 = new EditToolBar(this, + PointerTool | PencilTool | RubberTool); + + Q3ToolBar* enableMaster = new Q3ToolBar(tr("EnableMaster"), this); + enableButton = new QToolButton(enableMaster); + enableButton->setToggleButton(true); + enableButton->setText(tr("Enable")); + QToolTip::add(enableButton, tr("Enable usage of master track")); + enableButton->setOn(song->masterFlag()); + connect(enableButton, SIGNAL(toggled(bool)), song, SLOT(setMasterFlag(bool))); + + Q3ToolBar* info = new Q3ToolBar(tr("Info"), this); + QLabel* label = new QLabel(tr("Cursor"), info); + label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); + label->setIndent(3); + + cursorPos = new PosLabel(info); + tempo = new TempoLabel(info); + + const char* rastval[] = { + QT_TR_NOOP("Off"), "Bar", "1/2", "1/4", "1/8", "1/16" + }; + rasterLabel = new LabelCombo(tr("Snap"), info); + rasterLabel->setFocusPolicy(Qt::NoFocus); + for (int i = 0; i < 6; i++) + rasterLabel->insertItem(tr(rastval[i]), i); + rasterLabel->setCurrentItem(1); + connect(rasterLabel, SIGNAL(activated(int)), SLOT(_setRaster(int))); + + QToolTip::add(cursorPos, tr("time at cursor position")); + QToolTip::add(tempo, tr("tempo at cursor position")); + + //---------values for current position--------------- + new QLabel(tr("CurPos "), info); + curTempo = new TempoEdit(info); + curSig = new SigEdit(info); + curSig->setValue(Sig(4, 4)); + QToolTip::add(curTempo, tr("tempo at current position")); + QToolTip::add(curSig, tr("time signature at current position")); + connect(curSig, SIGNAL(valueChanged(int,int)), song, SLOT(setSig(int,int))); + connect(curTempo, SIGNAL(valueChanged(double)), song, SLOT(setTempo(double))); + + //--------------------------------------------------- + // master + //--------------------------------------------------- + + int xscale = -20; + int yscale = -500; + hscroll = new ScrollScale(-100, -2, xscale, song->len(), Qt::Horizontal, mainw); + vscroll = new ScrollScale(-1000, -100, yscale, 120000, Qt::Vertical, mainw); + vscroll->setRange(30000, 250000); + time1 = new MTScale(&_raster, mainw, xscale); + sign = new SigScale(&_raster, mainw, xscale); +// thits = new HitScale(&_raster, mainw, xscale); + + canvas = new Master(this, mainw, xscale, yscale); + +// zhits = new HitScale(&_raster, mainw, xscale); + time2 = new MTScale(&_raster, mainw, xscale); + tscale = new TScale(mainw, yscale); + time2->setBarLocator(true); + + //--------------------------------------------------- + // Rest + //--------------------------------------------------- + +// QSizeGrip* corner = new QSizeGrip(mainw); + + mainGrid->setRowStretch(5, 100); + mainGrid->setColStretch(1, 100); + + mainGrid->addWidget(hLine(mainw), 0, 1); + mainGrid->addWidget(time1, 1, 1); + mainGrid->addWidget(hLine(mainw), 2, 1); + mainGrid->addWidget(sign, 3, 1); + mainGrid->addWidget(hLine(mainw), 4, 1); +// mainGrid->addWidget(thits, 5, 1); +// mainGrid->addWidget(hLine(mainw), 6, 1); + mainGrid->addWidget(canvas, 5, 1); + mainGrid->addWidget(tscale, 5, 0); + mainGrid->addWidget(hLine(mainw), 6, 1); +// mainGrid->addWidget(zhits, 9, 1); +// mainGrid->addWidget(hLine(mainw), 7, 1); + mainGrid->addWidget(time2, 7, 1); + mainGrid->addWidget(hscroll, 8, 1); + mainGrid->addMultiCellWidget(vscroll, 0, 9, 2, 2); +// mainGrid->addWidget(corner, 9, 2, AlignBottom | AlignRight); + + connect(tools2, SIGNAL(toolChanged(int)), canvas, SLOT(setTool(int))); + connect(vscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setYPos(int))); + connect(vscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setYMag(int))); + + connect(vscroll, SIGNAL(scrollChanged(int)), tscale, SLOT(setYPos(int))); + connect(vscroll, SIGNAL(scaleChanged(int)), tscale, SLOT(setYMag(int))); + + connect(hscroll, SIGNAL(scrollChanged(int)), time1, SLOT(setXPos(int))); + connect(hscroll, SIGNAL(scrollChanged(int)), sign, SLOT(setXPos(int))); +// connect(hscroll, SIGNAL(scrollChanged(int)), thits, SLOT(setXPos(int))); + connect(hscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setXPos(int))); +// connect(hscroll, SIGNAL(scrollChanged(int)), zhits, SLOT(setXPos(int))); + connect(hscroll, SIGNAL(scrollChanged(int)), time2, SLOT(setXPos(int))); + + connect(hscroll, SIGNAL(scaleChanged(int)), time1, SLOT(setXMag(int))); + connect(hscroll, SIGNAL(scaleChanged(int)), sign, SLOT(setXMag(int))); +// connect(hscroll, SIGNAL(scaleChanged(int)), thits, SLOT(setXMag(int))); + connect(hscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setXMag(int))); +// connect(hscroll, SIGNAL(scaleChanged(int)), zhits, SLOT(setXMag(int))); + connect(hscroll, SIGNAL(scaleChanged(int)), time2, SLOT(setXMag(int))); + + connect(time1, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned))); +// connect(sign, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned))); +// connect(thits, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned))); +// connect(canvas, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned))); +// connect(zhits, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned))); + connect(time2, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned))); + + connect(tscale, SIGNAL(tempoChanged(int)), SLOT(setTempo(int))); + connect(canvas, SIGNAL(tempoChanged(int)), SLOT(setTempo(int))); + connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(song, SIGNAL(posChanged(int,unsigned,bool)), SLOT(posChanged(int,unsigned,bool))); + + connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int))); + connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned))); + } + +//--------------------------------------------------------- +// ~MasterEdit +//--------------------------------------------------------- + +MasterEdit::~MasterEdit() + { + undoRedo->removeFrom(tools); + } + +//--------------------------------------------------------- +// readStatus +//--------------------------------------------------------- + +void MasterEdit::readStatus(Xml& xml) + { + for (;;) { + Xml::Token token = xml.parse(); + const QString& tag = xml.s1(); + switch (token) { + case Xml::Error: + case Xml::End: + return; + case Xml::TagStart: + if (tag == "midieditor") + MidiEditor::readStatus(xml); + else if (tag == "ypos") + vscroll->setPos(xml.parseInt()); + else if (tag == "ymag") { + // vscroll->setMag(xml.parseInt()); + int mag = xml.parseInt(); + vscroll->setMag(mag); + } + else + xml.unknown("MasterEdit"); + break; + case Xml::TagEnd: + if (tag == "master") { + // raster setzen + int item = 0; + switch(_raster) { + case 1: item = 0; break; + case 0: item = 1; break; + case 768: item = 2; break; + case 384: item = 3; break; + case 192: item = 4; break; + case 96: item = 5; break; + } + _rasterInit = _raster; + rasterLabel->setCurrentItem(item); + return; + } + default: + break; + } + } + } + +//--------------------------------------------------------- +// writeStatus +//--------------------------------------------------------- + +void MasterEdit::writeStatus(int level, Xml& xml) const + { + xml.tag(level++, "master"); + xml.intTag(level, "ypos", vscroll->pos()); + xml.intTag(level, "ymag", vscroll->mag()); + MidiEditor::writeStatus(level, xml); + xml.tag(level, "/master"); + } + +//--------------------------------------------------------- +// readConfiguration +//--------------------------------------------------------- + +void MasterEdit::readConfiguration(Xml& xml) + { + for (;;) { + Xml::Token token = xml.parse(); + const QString& tag = xml.s1(); + switch (token) { + case Xml::Error: + case Xml::End: + return; + case Xml::TagStart: + if (tag == "raster") + _rasterInit = xml.parseInt(); + else + xml.unknown("MasterEdit"); + break; + case Xml::TagEnd: + if (tag == "masteredit") + return; + default: + break; + } + } + } + +//--------------------------------------------------------- +// writeConfiguration +//--------------------------------------------------------- + +void MasterEdit::writeConfiguration(int level, Xml& xml) + { + xml.tag(level++, "masteredit"); + xml.intTag(level, "raster", _rasterInit); + xml.tag(level, "/masteredit"); + } + +//--------------------------------------------------------- +// _setRaster +//--------------------------------------------------------- + +void MasterEdit::_setRaster(int index) + { + static int rasterTable[] = { + 1, 0, 768, 384, 192, 96 + }; + _raster = rasterTable[index]; + _rasterInit = _raster; + } + +//--------------------------------------------------------- +// posChanged +//--------------------------------------------------------- + +void MasterEdit::posChanged(int idx, unsigned val, bool) + { + if (idx == 0) { + int z, n; + int tempo = tempomap.tempo(val); + sigmap.timesig(val, z, n); + curTempo->blockSignals(true); + curSig->blockSignals(true); + + curTempo->setValue(double(60000000.0/tempo)); + curSig->setValue(Sig(z, n)); + + curTempo->blockSignals(false); + curSig->blockSignals(false); + } + } + +//--------------------------------------------------------- +// setTime +//--------------------------------------------------------- + +void MasterEdit::setTime(unsigned tick) + { + if (tick == MAXINT) + cursorPos->setEnabled(false); + else { + cursorPos->setEnabled(true); + cursorPos->setValue(tick); + time1->setPos(3, tick, false); + time2->setPos(3, tick, false); + } + } + +//--------------------------------------------------------- +// setTempo +//--------------------------------------------------------- + +void MasterEdit::setTempo(int val) + { + if (val == -1) + tempo->setEnabled(false); + else { + tempo->setEnabled(true); + tempo->setValue(val); + } + } + diff --git a/muse2/muse/master/masteredit.h b/muse2/muse/master/masteredit.h new file mode 100644 index 00000000..88ada6eb --- /dev/null +++ b/muse2/muse/master/masteredit.h @@ -0,0 +1,83 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: masteredit.h,v 1.3.2.2 2009/04/01 01:37:11 terminator356 Exp $ +// (C) Copyright 1999 Werner Schweer (ws@seh.de) +//========================================================= + +#ifndef __MASTER_EDIT_H__ +#define __MASTER_EDIT_H__ + +#include <qwidget.h> +//Added by qt3to4: +#include <QCloseEvent> +#include "midieditor.h" +#include "noteinfo.h" +#include "cobject.h" +#include <q3mainwindow.h> + +class QToolButton; +class Master; +class ScrollScale; +class MTScale; +class SigScale; +class HitScale; +class TScale; +class TempoEdit; +class SigEdit; +class LabelCombo; +class PosLabel; +class TempoLabel; + +//--------------------------------------------------------- +// MasterEdit +//--------------------------------------------------------- + +class MasterEdit : public MidiEditor { + Master* canvas; + ScrollScale* hscroll; + ScrollScale* vscroll; + MTScale* time1; + MTScale* time2; + SigScale* sign; + HitScale* thits; + HitScale* zhits; + TScale* tscale; + + TempoEdit* curTempo; + SigEdit* curSig; + LabelCombo* rasterLabel; + Q3ToolBar* tools; + PosLabel* cursorPos; + TempoLabel* tempo; + QToolButton* enableButton; + + static int _rasterInit; + + Q_OBJECT + virtual void closeEvent(QCloseEvent*); + + private slots: + void _setRaster(int); + void posChanged(int,unsigned,bool); + void setTime(unsigned); + void setTempo(int); + + public slots: + void songChanged(int); +// void tempoChanged(double); + + signals: + void deleted(unsigned long); + + public: + MasterEdit(); + ~MasterEdit(); + virtual void readStatus(Xml&); + virtual void writeStatus(int, Xml&) const; + static void readConfiguration(Xml&); + static void writeConfiguration(int, Xml&); + }; + +#endif + diff --git a/muse2/muse/master/tscale.cpp b/muse2/muse/master/tscale.cpp new file mode 100644 index 00000000..e31af92c --- /dev/null +++ b/muse2/muse/master/tscale.cpp @@ -0,0 +1,61 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: tscale.cpp,v 1.2 2003/12/17 11:04:14 wschweer Exp $ +// (C) Copyright 1999 Werner Schweer (ws@seh.de) +//========================================================= + +#include <stdio.h> +#include "tscale.h" +#include "globals.h" +#include "gconfig.h" +//Added by qt3to4: +#include <QMouseEvent> +#include <QEvent> + +//--------------------------------------------------------- +// TScale +//--------------------------------------------------------- + +TScale::TScale(QWidget* parent, int ymag) + : View(parent, 1, ymag) + { + setFont(config.fonts[3]); + int w = 4 * QFontMetrics(config.fonts[4]).width('0'); + setFixedWidth(w); + setMouseTracking(true); + } + +//--------------------------------------------------------- +// draw +//--------------------------------------------------------- + +void TScale::pdraw(QPainter& p, const QRect& r) + { + int y = r.y(); + int h = r.height(); + p.setFont(config.fonts[4]); + QString s; + for (int i = 30000; i <= 250000; i += 10000) { + int yy = mapy(280000 - i); + if (yy < y) + break; + if (yy-15 > y+h) + continue; + p.drawLine(0, yy, width(), yy); + s.setNum(i/1000); + QFontMetrics fm(config.fonts[4]); + p.drawText(width() - fm.width(s) - 1, yy-2, s); + } + } + +void TScale::viewMouseMoveEvent(QMouseEvent* event) + { + emit tempoChanged(280000 - event->y()); + } + +void TScale::leaveEvent(QEvent*) + { + emit tempoChanged(-1); + } + diff --git a/muse2/muse/master/tscale.h b/muse2/muse/master/tscale.h new file mode 100644 index 00000000..08f91c7e --- /dev/null +++ b/muse2/muse/master/tscale.h @@ -0,0 +1,38 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: tscale.h,v 1.1.1.1 2003/10/27 18:52:36 wschweer Exp $ +// (C) Copyright 1999 Werner Schweer (ws@seh.de) +//========================================================= + +#ifndef __TSCALE_H__ +#define __TSCALE_H__ + +#include "view.h" +//Added by qt3to4: +#include <QEvent> +#include <QMouseEvent> + +//--------------------------------------------------------- +// Tscale +//--------------------------------------------------------- + +class TScale : public View { + double curTempo; + Q_OBJECT + + virtual void viewMouseMoveEvent(QMouseEvent* event); + virtual void leaveEvent(QEvent*e); + + protected: + virtual void pdraw(QPainter&, const QRect&); + + signals: + void tempoChanged(int); + + public: + TScale(QWidget*, int); + }; + +#endif + |