summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL322
-rw-r--r--src/Makefile.am136
-rw-r--r--src/audioextractor.cc20
-rw-r--r--src/audioextractor.h4
-rw-r--r--src/canvastoolranges.cc (renamed from src/canvastoolselections.cc)130
-rw-r--r--src/canvastoolranges.h (renamed from src/canvastoolselections.h)34
-rw-r--r--src/canvaswidget.cc6
-rw-r--r--src/dgedit.pro12
-rw-r--r--src/filelist.cc4
-rw-r--r--src/filelist.h2
-rw-r--r--src/instrumentwidget.cc114
-rw-r--r--src/instrumentwidget.h12
-rw-r--r--src/player.cc40
-rw-r--r--src/player.h14
-rw-r--r--src/project.cc8
-rw-r--r--src/project.h8
-rw-r--r--src/projectrenderer.cc6
-rw-r--r--src/projectserialiser.cc30
-rw-r--r--src/range.cc (renamed from src/selection.cc)34
-rw-r--r--src/range.h (renamed from src/selection.h)52
-rw-r--r--src/rangeeditor.cc (renamed from src/selectioneditor.cc)30
-rw-r--r--src/rangeeditor.h (renamed from src/selectioneditor.h)12
-rw-r--r--src/samplesorter.cc58
-rw-r--r--src/samplesorter.h16
-rw-r--r--src/ts/dgedit_da.ts14
-rw-r--r--src/ts/dgedit_fr.ts15
-rwxr-xr-xtools/MocList12
27 files changed, 572 insertions, 573 deletions
diff --git a/INSTALL b/INSTALL
index 007e939..e82fd21 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,8 +1,8 @@
Installation Instructions
*************************
-Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
-Inc.
+ Copyright (C) 1994-1996, 1999-2002, 2004-2017, 2020-2021 Free
+Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
@@ -12,97 +12,96 @@ without warranty of any kind.
Basic Installation
==================
- Briefly, the shell commands `./configure; make; make install' should
-configure, build, and install this package. The following
-more-detailed instructions are generic; see the `README' file for
+ Briefly, the shell command './configure && make && make install'
+should configure, build, and install this package. The following
+more-detailed instructions are generic; see the 'README' file for
instructions specific to this package. Some packages provide this
-`INSTALL' file but do not implement all of the features documented
+'INSTALL' file but do not implement all of the features documented
below. The lack of an optional feature in a given package is not
necessarily a bug. More recommendations for GNU packages can be found
in *note Makefile Conventions: (standards)Makefile Conventions.
- The `configure' shell script attempts to guess correct values for
+ The 'configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions. Finally, it creates a shell script `config.status' that
+those values to create a 'Makefile' in each directory of the package.
+It may also create one or more '.h' files containing system-dependent
+definitions. Finally, it creates a shell script 'config.status' that
you can run in the future to recreate the current configuration, and a
-file `config.log' containing compiler output (useful mainly for
-debugging `configure').
+file 'config.log' containing compiler output (useful mainly for
+debugging 'configure').
- It can also use an optional file (typically called `config.cache'
-and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring. Caching is
-disabled by default to prevent problems with accidental use of stale
-cache files.
+ It can also use an optional file (typically called 'config.cache' and
+enabled with '--cache-file=config.cache' or simply '-C') that saves the
+results of its tests to speed up reconfiguring. Caching is disabled by
+default to prevent problems with accidental use of stale cache files.
If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
+to figure out how 'configure' could check whether to do them, and mail
+diffs or instructions to the address given in the 'README' so they can
be considered for the next release. If you are using the cache, and at
-some point `config.cache' contains results you don't want to keep, you
+some point 'config.cache' contains results you don't want to keep, you
may remove or edit it.
- The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'. You need `configure.ac' if
-you want to change it or regenerate `configure' using a newer version
-of `autoconf'.
+ The file 'configure.ac' (or 'configure.in') is used to create
+'configure' by a program called 'autoconf'. You need 'configure.ac' if
+you want to change it or regenerate 'configure' using a newer version of
+'autoconf'.
The simplest way to compile this package is:
- 1. `cd' to the directory containing the package's source code and type
- `./configure' to configure the package for your system.
+ 1. 'cd' to the directory containing the package's source code and type
+ './configure' to configure the package for your system.
- Running `configure' might take a while. While running, it prints
+ Running 'configure' might take a while. While running, it prints
some messages telling which features it is checking for.
- 2. Type `make' to compile the package.
+ 2. Type 'make' to compile the package.
- 3. Optionally, type `make check' to run any self-tests that come with
+ 3. Optionally, type 'make check' to run any self-tests that come with
the package, generally using the just-built uninstalled binaries.
- 4. Type `make install' to install the programs and any data files and
+ 4. Type 'make install' to install the programs and any data files and
documentation. When installing into a prefix owned by root, it is
recommended that the package be configured and built as a regular
- user, and only the `make install' phase executed with root
+ user, and only the 'make install' phase executed with root
privileges.
- 5. Optionally, type `make installcheck' to repeat any self-tests, but
+ 5. Optionally, type 'make installcheck' to repeat any self-tests, but
this time using the binaries in their final installed location.
This target does not install anything. Running this target as a
- regular user, particularly if the prior `make install' required
+ regular user, particularly if the prior 'make install' required
root privileges, verifies that the installation completed
correctly.
6. You can remove the program binaries and object files from the
- source code directory by typing `make clean'. To also remove the
- files that `configure' created (so you can compile the package for
- a different kind of computer), type `make distclean'. There is
- also a `make maintainer-clean' target, but that is intended mainly
+ source code directory by typing 'make clean'. To also remove the
+ files that 'configure' created (so you can compile the package for
+ a different kind of computer), type 'make distclean'. There is
+ also a 'make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
- 7. Often, you can also type `make uninstall' to remove the installed
+ 7. Often, you can also type 'make uninstall' to remove the installed
files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
- 8. Some packages, particularly those that use Automake, provide `make
+ 8. Some packages, particularly those that use Automake, provide 'make
distcheck', which can by used by developers to test that all other
- targets like `make install' and `make uninstall' work correctly.
+ targets like 'make install' and 'make uninstall' work correctly.
This target is generally not run by end users.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
-the `configure' script does not know about. Run `./configure --help'
+the 'configure' script does not know about. Run './configure --help'
for details on some of the pertinent environment variables.
- You can give `configure' initial values for configuration parameters
-by setting variables in the command line or in the environment. Here
-is an example:
+ You can give 'configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here is
+an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
@@ -113,21 +112,21 @@ Compiling For Multiple Architectures
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
-own directory. To do this, you can use GNU `make'. `cd' to the
+own directory. To do this, you can use GNU 'make'. 'cd' to the
directory where you want the object files and executables to go and run
-the `configure' script. `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'. This
-is known as a "VPATH" build.
+the 'configure' script. 'configure' automatically checks for the source
+code in the directory that 'configure' is in and in '..'. This is known
+as a "VPATH" build.
- With a non-GNU `make', it is safer to compile the package for one
+ With a non-GNU 'make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
-installed the package for one architecture, use `make distclean' before
+installed the package for one architecture, use 'make distclean' before
reconfiguring for another architecture.
On MacOS X 10.5 and later systems, you can create libraries and
executables that work on multiple system types--known as "fat" or
-"universal" binaries--by specifying multiple `-arch' options to the
-compiler but only a single `-arch' option to the preprocessor. Like
+"universal" binaries--by specifying multiple '-arch' options to the
+compiler but only a single '-arch' option to the preprocessor. Like
this:
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
@@ -136,105 +135,104 @@ this:
This is not guaranteed to produce working output in all cases, you
may have to build one architecture at a time and combine the results
-using the `lipo' tool if you have problems.
+using the 'lipo' tool if you have problems.
Installation Names
==================
- By default, `make install' installs the package's commands under
-`/usr/local/bin', include files under `/usr/local/include', etc. You
-can specify an installation prefix other than `/usr/local' by giving
-`configure' the option `--prefix=PREFIX', where PREFIX must be an
+ By default, 'make install' installs the package's commands under
+'/usr/local/bin', include files under '/usr/local/include', etc. You
+can specify an installation prefix other than '/usr/local' by giving
+'configure' the option '--prefix=PREFIX', where PREFIX must be an
absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
-pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
-options like `--bindir=DIR' to specify different values for particular
-kinds of files. Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them. In general, the
-default for these options is expressed in terms of `${prefix}', so that
-specifying just `--prefix' will affect all of the other directory
+options like '--bindir=DIR' to specify different values for particular
+kinds of files. Run 'configure --help' for a list of the directories
+you can set and what kinds of files go in them. In general, the default
+for these options is expressed in terms of '${prefix}', so that
+specifying just '--prefix' will affect all of the other directory
specifications that were not explicitly provided.
The most portable way to affect installation locations is to pass the
-correct locations to `configure'; however, many packages provide one or
+correct locations to 'configure'; however, many packages provide one or
both of the following shortcuts of passing variable assignments to the
-`make install' command line to change installation locations without
+'make install' command line to change installation locations without
having to reconfigure or recompile.
The first method involves providing an override variable for each
-affected directory. For example, `make install
+affected directory. For example, 'make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
-`${prefix}'. Any directories that were specified during `configure',
-but not in terms of `${prefix}', must each be overridden at install
-time for the entire installation to be relocated. The approach of
-makefile variable overrides for each directory variable is required by
-the GNU Coding Standards, and ideally causes no recompilation.
-However, some platforms have known limitations with the semantics of
-shared libraries that end up requiring recompilation when using this
-method, particularly noticeable in packages that use GNU Libtool.
-
- The second method involves providing the `DESTDIR' variable. For
-example, `make install DESTDIR=/alternate/directory' will prepend
-`/alternate/directory' before all installation names. The approach of
-`DESTDIR' overrides is not required by the GNU Coding Standards, and
+'${prefix}'. Any directories that were specified during 'configure',
+but not in terms of '${prefix}', must each be overridden at install time
+for the entire installation to be relocated. The approach of makefile
+variable overrides for each directory variable is required by the GNU
+Coding Standards, and ideally causes no recompilation. However, some
+platforms have known limitations with the semantics of shared libraries
+that end up requiring recompilation when using this method, particularly
+noticeable in packages that use GNU Libtool.
+
+ The second method involves providing the 'DESTDIR' variable. For
+example, 'make install DESTDIR=/alternate/directory' will prepend
+'/alternate/directory' before all installation names. The approach of
+'DESTDIR' overrides is not required by the GNU Coding Standards, and
does not work on platforms that have drive letters. On the other hand,
it does better at avoiding recompilation issues, and works well even
-when some directory options were not specified in terms of `${prefix}'
-at `configure' time.
+when some directory options were not specified in terms of '${prefix}'
+at 'configure' time.
Optional Features
=================
If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
- Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System). The
-`README' should mention any `--enable-' and `--with-' options that the
+with an extra prefix or suffix on their names by giving 'configure' the
+option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
+
+ Some packages pay attention to '--enable-FEATURE' options to
+'configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to '--with-PACKAGE' options, where PACKAGE
+is something like 'gnu-as' or 'x' (for the X Window System). The
+'README' should mention any '--enable-' and '--with-' options that the
package recognizes.
- For packages that use the X Window System, `configure' can usually
+ For packages that use the X Window System, 'configure' can usually
find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
+you can use the 'configure' options '--x-includes=DIR' and
+'--x-libraries=DIR' to specify their locations.
Some packages offer the ability to configure how verbose the
-execution of `make' will be. For these packages, running `./configure
+execution of 'make' will be. For these packages, running './configure
--enable-silent-rules' sets the default to minimal output, which can be
-overridden with `make V=1'; while running `./configure
+overridden with 'make V=1'; while running './configure
--disable-silent-rules' sets the default to verbose, which can be
-overridden with `make V=0'.
+overridden with 'make V=0'.
Particular systems
==================
- On HP-UX, the default C compiler is not ANSI C compatible. If GNU
-CC is not installed, it is recommended to use the following options in
+ On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC
+is not installed, it is recommended to use the following options in
order to use an ANSI C compiler:
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
- HP-UX `make' updates targets which have the same time stamps as
-their prerequisites, which makes it generally unusable when shipped
-generated files such as `configure' are involved. Use GNU `make'
-instead.
+ HP-UX 'make' updates targets which have the same timestamps as their
+prerequisites, which makes it generally unusable when shipped generated
+files such as 'configure' are involved. Use GNU 'make' instead.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
-parse its `<wchar.h>' header file. The option `-nodtk' can be used as
-a workaround. If GNU CC is not installed, it is therefore recommended
-to try
+parse its '<wchar.h>' header file. The option '-nodtk' can be used as a
+workaround. If GNU CC is not installed, it is therefore recommended to
+try
./configure CC="cc"
@@ -242,26 +240,26 @@ and if that doesn't work, try
./configure CC="cc -nodtk"
- On Solaris, don't put `/usr/ucb' early in your `PATH'. This
+ On Solaris, don't put '/usr/ucb' early in your 'PATH'. This
directory contains several dysfunctional programs; working variants of
-these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
-in your `PATH', put it _after_ `/usr/bin'.
+these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
+in your 'PATH', put it _after_ '/usr/bin'.
- On Haiku, software installed for all users goes in `/boot/common',
-not `/usr/local'. It is recommended to use the following options:
+ On Haiku, software installed for all users goes in '/boot/common',
+not '/usr/local'. It is recommended to use the following options:
./configure --prefix=/boot/common
Specifying the System Type
==========================
- There may be some features `configure' cannot figure out
+ There may be some features 'configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
-_same_ architectures, `configure' can figure that out, but if it prints
+_same_ architectures, 'configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
-`--build=TYPE' option. TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name which has the form:
+'--build=TYPE' option. TYPE can either be a short name for the system
+type, such as 'sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
@@ -270,101 +268,101 @@ where SYSTEM can have one of these forms:
OS
KERNEL-OS
- See the file `config.sub' for the possible values of each field. If
-`config.sub' isn't included in this package, then this package doesn't
+ See the file 'config.sub' for the possible values of each field. If
+'config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
-use the option `--target=TYPE' to select the type of system they will
+use the option '--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
-eventually be run) with `--host=TYPE'.
+eventually be run) with '--host=TYPE'.
Sharing Defaults
================
- If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists. Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
+ If you want to set default values for 'configure' scripts to share,
+you can create a site shell script called 'config.site' that gives
+default values for variables like 'CC', 'cache_file', and 'prefix'.
+'configure' looks for 'PREFIX/share/config.site' if it exists, then
+'PREFIX/etc/config.site' if it exists. Or, you can set the
+'CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all 'configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
-environment passed to `configure'. However, some packages may run
+environment passed to 'configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
-them in the `configure' command line, using `VAR=value'. For example:
+them in the 'configure' command line, using 'VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
-causes the specified `gcc' to be used as the C compiler (unless it is
+causes the specified 'gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
-Unfortunately, this technique does not work for `CONFIG_SHELL' due to
-an Autoconf limitation. Until the limitation is lifted, you can use
-this workaround:
+Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
+Autoconf limitation. Until the limitation is lifted, you can use this
+workaround:
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
-`configure' Invocation
+'configure' Invocation
======================
- `configure' recognizes the following options to control how it
+ 'configure' recognizes the following options to control how it
operates.
-`--help'
-`-h'
- Print a summary of all of the options to `configure', and exit.
+'--help'
+'-h'
+ Print a summary of all of the options to 'configure', and exit.
-`--help=short'
-`--help=recursive'
+'--help=short'
+'--help=recursive'
Print a summary of the options unique to this package's
- `configure', and exit. The `short' variant lists options used
- only in the top level, while the `recursive' variant lists options
- also present in any nested packages.
+ 'configure', and exit. The 'short' variant lists options used only
+ in the top level, while the 'recursive' variant lists options also
+ present in any nested packages.
-`--version'
-`-V'
- Print the version of Autoconf used to generate the `configure'
+'--version'
+'-V'
+ Print the version of Autoconf used to generate the 'configure'
script, and exit.
-`--cache-file=FILE'
+'--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
- traditionally `config.cache'. FILE defaults to `/dev/null' to
+ traditionally 'config.cache'. FILE defaults to '/dev/null' to
disable caching.
-`--config-cache'
-`-C'
- Alias for `--cache-file=config.cache'.
+'--config-cache'
+'-C'
+ Alias for '--cache-file=config.cache'.
-`--quiet'
-`--silent'
-`-q'
+'--quiet'
+'--silent'
+'-q'
Do not print messages saying which checks are being made. To
- suppress all normal output, redirect it to `/dev/null' (any error
+ suppress all normal output, redirect it to '/dev/null' (any error
messages will still be shown).
-`--srcdir=DIR'
+'--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
- `configure' can determine that directory automatically.
+ 'configure' can determine that directory automatically.
-`--prefix=DIR'
- Use DIR as the installation prefix. *note Installation Names::
- for more details, including other options available for fine-tuning
- the installation locations.
+'--prefix=DIR'
+ Use DIR as the installation prefix. *note Installation Names:: for
+ more details, including other options available for fine-tuning the
+ installation locations.
-`--no-create'
-`-n'
+'--no-create'
+'-n'
Run the configure checks, but stop before creating any output
files.
-`configure' also accepts some other, not widely useful, options. Run
-`configure --help' for more details.
+'configure' also accepts some other, not widely useful, options. Run
+'configure --help' for more details.
diff --git a/src/Makefile.am b/src/Makefile.am
index 8741aa2..6b23d17 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,88 +3,88 @@
bin_PROGRAMS = dgedit
dgedit_LDADD = $(SNDFILE_LIBS) $(QT_LIBS) $(AO_LIBS) \
- $(shell ../tools/MocList o ) qrc_dgedit.o
+ $(shell $(top_srcdir)/tools/MocList $(top_srcdir)/src o ) qrc_dgedit.o
dgedit_CXXFLAGS = -g $(SNDFILE_CXXFLAGS) $(QT_CFLAGS) $(AO_CFLAGS) \
- -DLOCALEDIR='"$(localedir)"'
+ -DLOCALEDIR='"$(localedir)"' -I$(top_srcdir)
AM_CXXFLAGS = $(QT_CFLAGS)
dgedit_TRANSLATIONS = \
- ts/dgedit_da.ts \
- ts/dgedit_fr.ts
+ $(top_srcdir)/src/ts/dgedit_da.ts \
+ $(top_srcdir)/src/ts/dgedit_fr.ts
dgedit_SOURCES = \
- dgedit.cc \
- aboutdialog.cc \
- audioextractor.cc \
- canvas.cc \
- canvastool.cc \
- canvastoollisten.cc \
- canvastoolselections.cc \
- canvastoolthreshold.cc \
- canvaswidget.cc \
- channeldialog.cc \
- channelswidget.cc \
- filelist.cc \
- imageeditor.cc \
- instrumentdialog.cc \
- instrumentwidget.cc \
- itemeditor.cc \
- localehandler.cc \
- mainwindow.cc \
- mipmap.cc \
- player.cc \
- project.cc \
- projectdialog.cc \
- projectrenderer.cc \
- projectserialiser.cc \
- renderdialog.cc \
- samplesorter.cc \
- selection.cc \
- selectioneditor.cc \
- settings.cc \
- volumefader.cc \
- zoomslider.cc
+ $(top_srcdir)/src/dgedit.cc \
+ $(top_srcdir)/src/aboutdialog.cc \
+ $(top_srcdir)/src/audioextractor.cc \
+ $(top_srcdir)/src/canvas.cc \
+ $(top_srcdir)/src/canvastool.cc \
+ $(top_srcdir)/src/canvastoollisten.cc \
+ $(top_srcdir)/src/canvastoolranges.cc \
+ $(top_srcdir)/src/canvastoolthreshold.cc \
+ $(top_srcdir)/src/canvaswidget.cc \
+ $(top_srcdir)/src/channeldialog.cc \
+ $(top_srcdir)/src/channelswidget.cc \
+ $(top_srcdir)/src/filelist.cc \
+ $(top_srcdir)/src/imageeditor.cc \
+ $(top_srcdir)/src/instrumentdialog.cc \
+ $(top_srcdir)/src/instrumentwidget.cc \
+ $(top_srcdir)/src/itemeditor.cc \
+ $(top_srcdir)/src/localehandler.cc \
+ $(top_srcdir)/src/mainwindow.cc \
+ $(top_srcdir)/src/mipmap.cc \
+ $(top_srcdir)/src/player.cc \
+ $(top_srcdir)/src/project.cc \
+ $(top_srcdir)/src/projectdialog.cc \
+ $(top_srcdir)/src/projectrenderer.cc \
+ $(top_srcdir)/src/projectserialiser.cc \
+ $(top_srcdir)/src/renderdialog.cc \
+ $(top_srcdir)/src/samplesorter.cc \
+ $(top_srcdir)/src/range.cc \
+ $(top_srcdir)/src/rangeeditor.cc \
+ $(top_srcdir)/src/settings.cc \
+ $(top_srcdir)/src/volumefader.cc \
+ $(top_srcdir)/src/zoomslider.cc
HDRS = \
- aboutdialog.h \
- audioextractor.h \
- canvas.h \
- canvastool.h \
- canvastoollisten.h \
- canvastoolselections.h \
- canvastoolthreshold.h \
- canvaswidget.h \
- channeldialog.h \
- channelswidget.h \
- filelist.h \
- imageeditor.h \
- instrumentdialog.h \
- instrumentwidget.h \
- itemeditor.h \
- localehandler.h \
- mainwindow.h \
- mipmap.h \
- player.h \
- project.h \
- projectdialog.h \
- projectrenderer.h \
- projectserialiser.h \
- renderdialog.h \
- samplesorter.h \
- selection.h \
- selectioneditor.h \
- sleep.h \
- settings.h \
- volumefader.h \
- zoomslider.h
+ $(top_srcdir)/src/aboutdialog.h \
+ $(top_srcdir)/src/audioextractor.h \
+ $(top_srcdir)/src/canvas.h \
+ $(top_srcdir)/src/canvastool.h \
+ $(top_srcdir)/src/canvastoollisten.h \
+ $(top_srcdir)/src/canvastoolranges.h \
+ $(top_srcdir)/src/canvastoolthreshold.h \
+ $(top_srcdir)/src/canvaswidget.h \
+ $(top_srcdir)/src/channeldialog.h \
+ $(top_srcdir)/src/channelswidget.h \
+ $(top_srcdir)/src/filelist.h \
+ $(top_srcdir)/src/imageeditor.h \
+ $(top_srcdir)/src/instrumentdialog.h \
+ $(top_srcdir)/src/instrumentwidget.h \
+ $(top_srcdir)/src/itemeditor.h \
+ $(top_srcdir)/src/localehandler.h \
+ $(top_srcdir)/src/mainwindow.h \
+ $(top_srcdir)/src/mipmap.h \
+ $(top_srcdir)/src/player.h \
+ $(top_srcdir)/src/project.h \
+ $(top_srcdir)/src/projectdialog.h \
+ $(top_srcdir)/src/projectrenderer.h \
+ $(top_srcdir)/src/projectserialiser.h \
+ $(top_srcdir)/src/renderdialog.h \
+ $(top_srcdir)/src/samplesorter.h \
+ $(top_srcdir)/src/range.h \
+ $(top_srcdir)/src/rangeeditor.h \
+ $(top_srcdir)/src/sleep.h \
+ $(top_srcdir)/src/settings.h \
+ $(top_srcdir)/src/volumefader.h \
+ $(top_srcdir)/src/zoomslider.h
EXTRA_DIST = \
$(dgedit_TRANSLATIONS) \
$(HDRS) \
dgedit.qrc
-dgedit_MOC = $(shell ../tools/MocList cc )
+dgedit_MOC = $(shell $(top_srcdir)/tools/MocList $(top_srcdir)/src cc )
BUILT_SOURCES = \
$(dgedit_MOC) \
@@ -94,7 +94,7 @@ BUILT_SOURCES = \
CLEANFILES = $(BUILT_SOURCES)
qrc_%.cc: %.qrc
- rcc $< > $@
+ QT_SELECT=qt5 $(QT_RCC) $< > $@
%.moc.cc: %.h
QT_SELECT=qt5 $(QT_MOC) -o $@ $<
diff --git a/src/audioextractor.cc b/src/audioextractor.cc
index 95fe6b2..d14370e 100644
--- a/src/audioextractor.cc
+++ b/src/audioextractor.cc
@@ -50,14 +50,14 @@ AudioExtractor::AudioExtractor(Instrument& instrument, QObject *parent)
{
}
-bool AudioExtractor::exportSelections()
+bool AudioExtractor::exportRanges()
{
- auto selections = instrument.getSelections();
+ auto ranges = instrument.getRanges();
auto exportpath = instrument.getProject().getExportPath();
auto prefix = instrument.getPrefix();
int samplerate = -1;
- emit setMaximumProgress(selections.ids().size() + 1/* for xml writing*/);
+ emit setMaximumProgress(ranges.ids().size() + 1/* for xml writing*/);
int progress = 0;
emit progressUpdate(progress++);
qApp->processEvents();
@@ -92,15 +92,15 @@ bool AudioExtractor::exportSelections()
}
idx = 1;
- QVector<sel_id_t> sels = selections.ids();
+ QVector<sel_id_t> sels = ranges.ids();
- // Sort selections by velocity
+ // Sort ranges by velocity
for(int v1 = 0; v1 < sels.size(); v1++)
{
for(int v2 = 0; v2 < sels.size(); v2++)
{
- Selection sel1 = selections.get(sels[v1]);
- Selection sel2 = selections.get(sels[v2]);
+ Range sel1 = ranges.get(sels[v1]);
+ Range sel2 = ranges.get(sels[v2]);
if(sel1.energy < sel2.energy)
{
@@ -121,7 +121,7 @@ bool AudioExtractor::exportSelections()
QVector<sel_id_t>::iterator si = sels.begin();
while(si != sels.end())
{
- Selection sel = selections.get(*si);
+ Range sel = ranges.get(*si);
size_t offset = sel.from;
size_t size = sel.to - sel.from;
size_t fadein = sel.fadein;
@@ -241,7 +241,7 @@ bool AudioExtractor::exportSelections()
{
index++;
- Selection i = selections.get(*si);
+ Range i = ranges.get(*si);
i.name = prefix + "-" + QString::number(index);
QDomElement sample = doc.createElement("sample");
@@ -249,7 +249,7 @@ bool AudioExtractor::exportSelections()
sample.setAttribute("power", QString::number(i.energy));
samples.appendChild(sample);
- selections.update(*si, i);
+ ranges.update(*si, i);
int channelnum = 1; // Filechannel numbers are 1-based.
diff --git a/src/audioextractor.h b/src/audioextractor.h
index 134c582..aa85d98 100644
--- a/src/audioextractor.h
+++ b/src/audioextractor.h
@@ -32,7 +32,7 @@
#include <QString>
#include <QVector>
-#include "selection.h"
+#include "range.h"
#include "samplesorter.h"
class Instrument;
@@ -45,7 +45,7 @@ public:
AudioExtractor(Instrument& instrument, QObject* parent);
public slots:
- bool exportSelections();
+ bool exportRanges();
signals:
void progressUpdate(int value);
diff --git a/src/canvastoolselections.cc b/src/canvastoolranges.cc
index d3e90f1..bd359a6 100644
--- a/src/canvastoolselections.cc
+++ b/src/canvastoolranges.cc
@@ -1,6 +1,6 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/***************************************************************************
- * canvastoolselections.cc
+ * canvastoolranges.cc
*
* Thu Jul 28 20:16:59 CEST 2011
* Copyright 2011 Bent Bisballe Nyeng
@@ -24,7 +24,7 @@
* along with DrumGizmo; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#include "canvastoolselections.h"
+#include "canvastoolranges.h"
#include <math.h>
#include <stdio.h>
@@ -34,18 +34,18 @@
#define unmapX(x) canvas->unmapX(x)
#define unmapY(x) canvas->unmapY(x)
-CanvasToolSelections::CanvasToolSelections(Canvas* c, Selections& s,
- Selections& p)
- : selections(s)
- , selections_preview(p)
+CanvasToolRanges::CanvasToolRanges(Canvas* c, Ranges& s,
+ Ranges& p)
+ : ranges(s)
+ , ranges_preview(p)
{
threshold = 0.5; // Default from CanvasToolThreshold
hold = 100;
canvas = c;
- selection_is_moving_left = false;
- selection_is_moving_right = false;
+ range_is_moving_left = false;
+ range_is_moving_right = false;
colSelBg = QColor(255, 0, 0, 60);
colSel = QColor(255, 0, 0, 160);
@@ -55,39 +55,39 @@ CanvasToolSelections::CanvasToolSelections(Canvas* c, Selections& s,
colPreviewSel = QColor(0, 0, 255, 160);
}
-bool CanvasToolSelections::mouseMoveEvent(QMouseEvent* event)
+bool CanvasToolRanges::mouseMoveEvent(QMouseEvent* event)
{
- sel_id_t active_selection = selections.active();
- Selection act_sel = selections.get(active_selection);
+ sel_id_t active_range = ranges.active();
+ Range act_sel = ranges.get(active_range);
- if(selection_is_moving_left)
+ if(range_is_moving_left)
{
float val = unmapX(event->x());
if(val > act_sel.to) val = act_sel.to - 1;
act_sel.from = std::max(0.0f, val);
- selections.update(active_selection, act_sel);
+ ranges.update(active_range, act_sel);
canvas->update();
return true;
}
- if(selection_is_moving_right)
+ if(range_is_moving_right)
{
float val = unmapX(event->x());
if(val < act_sel.from) val = act_sel.from + 1;
act_sel.to = std::min(val, (float)canvas->size);
- selections.update(active_selection, act_sel);
+ ranges.update(active_range, act_sel);
canvas->update();
return true;
}
if(event->button() != Qt::LeftButton)
{
- // Check if a selection is being dragged.
- QVector<sel_id_t> ids = selections.ids();
+ // Check if a range is being dragged.
+ QVector<sel_id_t> ids = ranges.ids();
QVector<sel_id_t>::iterator i = ids.begin();
while(i != ids.end())
{
- Selection sel = selections.get(*i);
+ Range sel = ranges.get(*i);
if(abs(event->x() - mapX(sel.from)) < 2
|| abs(event->x() - mapX(sel.to)) < 2)
{
@@ -101,42 +101,42 @@ bool CanvasToolSelections::mouseMoveEvent(QMouseEvent* event)
return false;
}
-bool CanvasToolSelections::mousePressEvent(QMouseEvent* event)
+bool CanvasToolRanges::mousePressEvent(QMouseEvent* event)
{
if(event->button() == Qt::LeftButton)
{
- // Check if a selection is being dragged.
- QVector<sel_id_t> ids = selections.ids();
+ // Check if a range is being dragged.
+ QVector<sel_id_t> ids = ranges.ids();
QVector<sel_id_t>::iterator i = ids.begin();
while(i != ids.end())
{
- Selection sel = selections.get(*i);
+ Range sel = ranges.get(*i);
if(abs(event->x() - mapX(sel.from)) < 2)
{
- selections.setActive(*i);
- selection_is_moving_left = true;
+ ranges.setActive(*i);
+ range_is_moving_left = true;
return true;
}
if(abs(event->x() - mapX(sel.to)) < 2)
{
- selections.setActive(*i);
- selection_is_moving_right = true;
+ ranges.setActive(*i);
+ range_is_moving_right = true;
return true;
}
i++;
}
- // Check if a selection is being selected.
+ // Check if a range is being selected.
i = ids.begin();
while(i != ids.end())
{
- Selection sel = selections.get(*i);
+ Range sel = ranges.get(*i);
if(event->x() > mapX(sel.from) &&
event->x() < mapX(sel.to))
{
- selections.setActive(*i);
+ ranges.setActive(*i);
canvas->update();
return true;
}
@@ -144,12 +144,12 @@ bool CanvasToolSelections::mousePressEvent(QMouseEvent* event)
i++;
}
- // Make new selection
+ // Make new range
int from = unmapX(event->x());
- Selection new_selection(from, from);
- sel_id_t id = selections.add(new_selection);
- selections.setActive(id);
- selection_is_moving_right = true;
+ Range new_range(from, from);
+ sel_id_t id = ranges.add(new_range);
+ ranges.setActive(id);
+ range_is_moving_right = true;
canvas->update();
return true;
}
@@ -157,14 +157,14 @@ bool CanvasToolSelections::mousePressEvent(QMouseEvent* event)
return false;
}
-bool CanvasToolSelections::mouseReleaseEvent(QMouseEvent* event)
+bool CanvasToolRanges::mouseReleaseEvent(QMouseEvent* event)
{
if(event->button() == Qt::LeftButton)
{
- if(selection_is_moving_left || selection_is_moving_right)
+ if(range_is_moving_left || range_is_moving_right)
{
- selection_is_moving_left = false;
- selection_is_moving_right = false;
+ range_is_moving_left = false;
+ range_is_moving_right = false;
canvas->setCursor(Qt::ArrowCursor);
canvas->update();
return true;
@@ -174,24 +174,24 @@ bool CanvasToolSelections::mouseReleaseEvent(QMouseEvent* event)
return false;
}
-void CanvasToolSelections::paintEvent(QPaintEvent* event, QPainter& painter)
+void CanvasToolRanges::paintEvent(QPaintEvent* event, QPainter& painter)
{
int pos = unmapX(event->rect().x());
int width = unmapX(event->rect().width());
{
- QVector<sel_id_t> ids = selections.ids();
+ QVector<sel_id_t> ids = ranges.ids();
QVector<sel_id_t>::iterator i = ids.begin();
while(i != ids.end())
{
- Selection sel = selections.get(*i);
+ Range sel = ranges.get(*i);
int from = sel.from;
int to = sel.to;
int fadein = sel.fadein;
int fadeout = sel.fadeout;
if(from > pos + width || to + width < pos)
{ i++; continue; }
- if(selections.active() ==* i)
+ if(ranges.active() ==* i)
{
painter.setBrush(colActiveSelBg);
painter.setPen(colActiveSel);
@@ -213,11 +213,11 @@ void CanvasToolSelections::paintEvent(QPaintEvent* event, QPainter& painter)
if(show_preview)
{
- QVector<sel_id_t> ids = selections_preview.ids();
+ QVector<sel_id_t> ids = ranges_preview.ids();
QVector<sel_id_t>::iterator i = ids.begin();
while(i != ids.end())
{
- Selection sel = selections_preview.get(*i);
+ Range sel = ranges_preview.get(*i);
int from = sel.from;
int to = sel.to;
int fadein = sel.fadein;
@@ -238,52 +238,52 @@ void CanvasToolSelections::paintEvent(QPaintEvent* event, QPainter& painter)
}
}
-void CanvasToolSelections::keyReleaseEvent(QKeyEvent* event)
+void CanvasToolRanges::keyReleaseEvent(QKeyEvent* event)
{
- if(selections.active() != SEL_NONE && event->key() == Qt::Key_Delete)
+ if(ranges.active() != SEL_NONE && event->key() == Qt::Key_Delete)
{
- selections.remove(selections.active());
+ ranges.remove(ranges.active());
canvas->update();
}
}
-void CanvasToolSelections::thresholdChanged(double t)
+void CanvasToolRanges::thresholdChanged(double t)
{
threshold = t;
}
-void CanvasToolSelections::holdChanged(int h)
+void CanvasToolRanges::holdChanged(int h)
{
hold = h;
}
-void CanvasToolSelections::noiseFloorChanged(int t)
+void CanvasToolRanges::noiseFloorChanged(int t)
{
double div = 666.0 / 0.00003;
noise_floor = (double)t/div;
}
-void CanvasToolSelections::fadeoutChanged(int t)
+void CanvasToolRanges::fadeoutChanged(int t)
{
fadeout = (double)t/1000.0;
}
-void CanvasToolSelections::autoCreateSelections()
+void CanvasToolRanges::autoCreateRanges()
{
- doAutoCreateSelections(false);
+ doAutoCreateRanges(false);
}
-void CanvasToolSelections::autoCreateSelectionsPreview()
+void CanvasToolRanges::autoCreateRangesPreview()
{
- doAutoCreateSelections(true);
+ doAutoCreateRanges(true);
}
-void CanvasToolSelections::doAutoCreateSelections(bool preview)
+void CanvasToolRanges::doAutoCreateRanges(bool preview)
{
float* data = canvas->data;
size_t size = canvas->size;
- if(preview) selections_preview.clear();
+ if(preview) ranges_preview.clear();
for(size_t i = 0; i < size; i++)
{
@@ -320,14 +320,14 @@ void CanvasToolSelections::doAutoCreateSelections(bool preview)
to++;
}
- Selection s(from, to, 2, ((to - from) / 3) * fadeout);
+ Range s(from, to, 2, ((to - from) / 3) * fadeout);
if(preview)
{
- selections_preview.add(s);
+ ranges_preview.add(s);
}
else
{
- selections.add(s);
+ ranges.add(s);
}
i = to+1;
@@ -336,16 +336,16 @@ void CanvasToolSelections::doAutoCreateSelections(bool preview)
canvas->update();
}
-void CanvasToolSelections::clearSelections()
+void CanvasToolRanges::clearRanges()
{
- selections.clear();
- selection_is_moving_left = false;
- selection_is_moving_right = false;
+ ranges.clear();
+ range_is_moving_left = false;
+ range_is_moving_right = false;
canvas->setCursor(Qt::ArrowCursor);
canvas->update();
}
-void CanvasToolSelections::setShowPreview(bool s)
+void CanvasToolRanges::setShowPreview(bool s)
{
show_preview = s;
canvas->update();
diff --git a/src/canvastoolselections.h b/src/canvastoolranges.h
index 21f00c6..122c21c 100644
--- a/src/canvastoolselections.h
+++ b/src/canvastoolranges.h
@@ -1,6 +1,6 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/***************************************************************************
- * canvastoolselections.h
+ * canvastoolranges.h
*
* Thu Jul 28 20:16:59 CEST 2011
* Copyright 2011 Bent Bisballe Nyeng
@@ -32,33 +32,33 @@
#include "canvas.h"
-#include "selection.h"
+#include "range.h"
-class CanvasToolSelections
+class CanvasToolRanges
: public CanvasTool
{
Q_OBJECT
public:
- CanvasToolSelections(Canvas* canvas, Selections& selections,
- Selections& selections_preview);
+ CanvasToolRanges(Canvas* canvas, Ranges& ranges,
+ Ranges& ranges_preview);
- QString name() { return tr("Selections"); }
+ QString name() { return tr("Ranges"); }
bool mouseMoveEvent(QMouseEvent* event);
bool mousePressEvent(QMouseEvent* event);
bool mouseReleaseEvent(QMouseEvent* event);
void paintEvent(QPaintEvent* event, QPainter& painter);
void keyReleaseEvent(QKeyEvent* event);
- //Selections selections();
+ //Ranges ranges();
signals:
- //void selectionsChanged(Selections selections);
- //void activeSelectionChanged(sel_id_t id);
+ //void rangesChanged(Ranges ranges);
+ //void activeRangeChanged(sel_id_t id);
public slots:
- void autoCreateSelections();
- void autoCreateSelectionsPreview();
- void clearSelections();
+ void autoCreateRanges();
+ void autoCreateRangesPreview();
+ void clearRanges();
void thresholdChanged(double threshold);
void noiseFloorChanged(int t);
void holdChanged(int h);
@@ -66,10 +66,10 @@ public slots:
void setShowPreview(bool show_preview);
private:
- void doAutoCreateSelections(bool preview);
+ void doAutoCreateRanges(bool preview);
- bool selection_is_moving_left;
- bool selection_is_moving_right;
+ bool range_is_moving_left;
+ bool range_is_moving_right;
Canvas* canvas;
@@ -85,8 +85,8 @@ private:
QColor colPreviewSelBg;
QColor colPreviewSel;
- Selections& selections;
- Selections& selections_preview;
+ Ranges& ranges;
+ Ranges& ranges_preview;
bool show_preview;
};
diff --git a/src/canvaswidget.cc b/src/canvaswidget.cc
index 5ce2731..7b3961a 100644
--- a/src/canvaswidget.cc
+++ b/src/canvaswidget.cc
@@ -29,8 +29,8 @@
#include <QGridLayout>
#define MAXVAL 10000000L
-#define SINGLESTEP MAXVAL/100000
-#define PAGESTEP MAXVAL/10000
+#define SINGLESTEP MAXVAL/10
+#define PAGESTEP MAXVAL/1000
CanvasWidget::CanvasWidget(QWidget* parent)
{
@@ -73,6 +73,8 @@ CanvasWidget::CanvasWidget(QWidget* parent)
void CanvasWidget::setXScale(float val)
{
canvas->setXScale(val);
+ xoffset->setSingleStep(std::max(val*val * SINGLESTEP, 1.0f));
+ xoffset->setPageStep(std::max(val*val * PAGESTEP, 1.0f));
}
void CanvasWidget::setYScale(float val)
diff --git a/src/dgedit.pro b/src/dgedit.pro
index 517be08..7c5034d 100644
--- a/src/dgedit.pro
+++ b/src/dgedit.pro
@@ -13,7 +13,7 @@ HEADERS += audioextractor.h \
canvas.h \
canvastool.h \
canvastoollisten.h \
- canvastoolselections.h \
+ canvastoolranges.h \
canvastoolthreshold.h \
canvaswidget.h \
filelist.h \
@@ -22,8 +22,8 @@ HEADERS += audioextractor.h \
mipmap.h \
player.h \
samplesorter.h \
- selection.h \
- selectioneditor.h \
+ range.h \
+ rangeeditor.h \
sleep.h \
volumefader.h \
zoomslider.h
@@ -31,7 +31,7 @@ SOURCES += audioextractor.cc \
canvas.cc \
canvastool.cc \
canvastoollisten.cc \
- canvastoolselections.cc \
+ canvastoolranges.cc \
canvastoolthreshold.cc \
canvaswidget.cc \
dgedit.cc \
@@ -41,8 +41,8 @@ SOURCES += audioextractor.cc \
mipmap.cc \
player.cc \
samplesorter.cc \
- selection.cc \
- selectioneditor.cc \
+ range.cc \
+ rangeeditor.cc \
volumefader.cc \
zoomslider.cc
RESOURCES += dgedit.qrc
diff --git a/src/filelist.cc b/src/filelist.cc
index e1467e3..dab2095 100644
--- a/src/filelist.cc
+++ b/src/filelist.cc
@@ -433,7 +433,7 @@ FileList::FileList(Instrument& instrument)
header()->resizeSection(2, 24);
connect(this, SIGNAL(doubleClicked(const QModelIndex&)),
- this, SLOT(selectionChanged(const QModelIndex&)));
+ this, SLOT(rangeChanged(const QModelIndex&)));
createMenus();
}
@@ -510,7 +510,7 @@ void FileList::addFiles()
model->refresh();
}
-void FileList::selectionChanged(const QModelIndex &index)
+void FileList::rangeChanged(const QModelIndex &index)
{
auto audiofile_ids = instrument.getAudioFileList();
auto audiofile_id = audiofile_ids.begin() + index.row();
diff --git a/src/filelist.h b/src/filelist.h
index 165af83..120fc77 100644
--- a/src/filelist.h
+++ b/src/filelist.h
@@ -53,7 +53,7 @@ public slots:
void addFiles();
private slots:
- void selectionChanged(const QModelIndex &index);
+ void rangeChanged(const QModelIndex &index);
void onCustomContextMenu(const QPoint &point);
void setMaster();
void removeFile();
diff --git a/src/instrumentwidget.cc b/src/instrumentwidget.cc
index 6a2e17e..9aeb7ee 100644
--- a/src/instrumentwidget.cc
+++ b/src/instrumentwidget.cc
@@ -51,7 +51,7 @@
#include "canvastool.h"
#include "canvastoolthreshold.h"
#include "volumefader.h"
-#include "selectioneditor.h"
+#include "rangeeditor.h"
#include "zoomslider.h"
#include "settings.h"
#include "project.h"
@@ -76,8 +76,8 @@ InstrumentWidget::InstrumentWidget(Settings& settings, Instrument& instrument)
{
int start = 44100 * 60;
- Selection p(start, start + 44100 * 60, 0, 0); // one minute selection
- selections_preview.add(p);
+ Range p(start, start + 44100 * 60, 0, 0); // one minute range
+ ranges_preview.add(p);
}
QWidget* central = new QWidget();
@@ -94,30 +94,30 @@ InstrumentWidget::InstrumentWidget(Settings& settings, Instrument& instrument)
addTool(toolbar, canvaswidget->canvas, listen);
threshold = new CanvasToolThreshold(canvaswidget->canvas, instrument);
canvaswidget->canvas->tools.push_back(threshold);
- tool_selections = new CanvasToolSelections(canvaswidget->canvas, selections,
- selections_preview);
+ tool_ranges = new CanvasToolRanges(canvaswidget->canvas, ranges,
+ ranges_preview);
connect(threshold, SIGNAL(thresholdChanged(double)),
- tool_selections, SLOT(thresholdChanged(double)));
+ tool_ranges, SLOT(thresholdChanged(double)));
connect(threshold, SIGNAL(thresholdChanging(double)),
- tool_selections, SLOT(thresholdChanged(double)));
- connect(&selections, SIGNAL(activeChanged(sel_id_t)),
+ tool_ranges, SLOT(thresholdChanged(double)));
+ connect(&ranges, SIGNAL(activeChanged(sel_id_t)),
canvaswidget->canvas, SLOT(update()));
- connect(&selections, SIGNAL(updated(sel_id_t)),
+ connect(&ranges, SIGNAL(updated(sel_id_t)),
canvaswidget->canvas, SLOT(update()));
- addTool(toolbar, canvaswidget->canvas, tool_selections);
-
- sorter = new SampleSorter(selections, selections_preview, instrument);
- connect(&selections, SIGNAL(added(sel_id_t)),
- sorter, SLOT(addSelection(sel_id_t)));
- connect(&selections_preview, SIGNAL(added(sel_id_t)),
- sorter, SLOT(addSelectionPreview(sel_id_t)));
- connect(&selections, SIGNAL(updated(sel_id_t)), sorter, SLOT(relayout()));
- connect(&selections_preview, SIGNAL(updated(sel_id_t)),
+ addTool(toolbar, canvaswidget->canvas, tool_ranges);
+
+ sorter = new SampleSorter(ranges, ranges_preview, instrument);
+ connect(&ranges, SIGNAL(added(sel_id_t)),
+ sorter, SLOT(addRange(sel_id_t)));
+ connect(&ranges_preview, SIGNAL(added(sel_id_t)),
+ sorter, SLOT(addRangePreview(sel_id_t)));
+ connect(&ranges, SIGNAL(updated(sel_id_t)), sorter, SLOT(relayout()));
+ connect(&ranges_preview, SIGNAL(updated(sel_id_t)),
sorter, SLOT(relayout()));
- connect(&selections, SIGNAL(removed(sel_id_t)), sorter, SLOT(relayout()));
- connect(&selections_preview, SIGNAL(removed(sel_id_t)),
+ connect(&ranges, SIGNAL(removed(sel_id_t)), sorter, SLOT(relayout()));
+ connect(&ranges_preview, SIGNAL(removed(sel_id_t)),
sorter, SLOT(relayout()));
- connect(&selections, SIGNAL(activeChanged(sel_id_t)),
+ connect(&ranges, SIGNAL(activeChanged(sel_id_t)),
sorter, SLOT(relayout()));
QPushButton* btn_playsamples = new QPushButton(tr("Play samples"));
@@ -168,8 +168,8 @@ InstrumentWidget::InstrumentWidget(Settings& settings, Instrument& instrument)
canvaswidget->xscale->setValue(0);
canvaswidget->xoffset->setValue(0);
- // Update selections according to threshold
- tool_selections->thresholdChanged(instrument.getThreshold());
+ // Update ranges according to threshold
+ tool_ranges->thresholdChanged(instrument.getThreshold());
}
InstrumentWidget::~InstrumentWidget()
@@ -178,9 +178,9 @@ InstrumentWidget::~InstrumentWidget()
void InstrumentWidget::tabChanged(int tabid)
{
- tool_selections->setShowPreview(tabid == generateTabId);
+ tool_ranges->setShowPreview(tabid == generateTabId);
sorter->setShowPreview(tabid == generateTabId);
- tool_selections->autoCreateSelectionsPreview();
+ tool_ranges->autoCreateRangesPreview();
threshold->setActive(tabid == generateTabId);
}
@@ -211,26 +211,26 @@ QWidget* InstrumentWidget::createFilesTab()
QWidget* InstrumentWidget::createEditTab()
{
- selections = instrument.getSelections();
- SelectionEditor* se = new SelectionEditor(selections, instrument);
+ ranges = instrument.getRanges();
+ RangeEditor* se = new RangeEditor(ranges, instrument);
- connect(&selections, SIGNAL(added(sel_id_t)), se, SLOT(added(sel_id_t)));
- connect(&selections, SIGNAL(updated(sel_id_t)), se, SLOT(updated(sel_id_t)));
- connect(&selections, SIGNAL(removed(sel_id_t)), se, SLOT(removed(sel_id_t)));
- connect(&selections, SIGNAL(activeChanged(sel_id_t)),
+ connect(&ranges, SIGNAL(added(sel_id_t)), se, SLOT(added(sel_id_t)));
+ connect(&ranges, SIGNAL(updated(sel_id_t)), se, SLOT(updated(sel_id_t)));
+ connect(&ranges, SIGNAL(removed(sel_id_t)), se, SLOT(removed(sel_id_t)));
+ connect(&ranges, SIGNAL(activeChanged(sel_id_t)),
se, SLOT(activeChanged(sel_id_t)));
- connect(&selections, SIGNAL(added(sel_id_t)), this, SLOT(selectionChanged()));
- connect(&selections, SIGNAL(updated(sel_id_t)), this, SLOT(selectionChanged()));
- connect(&selections, SIGNAL(removed(sel_id_t)), this, SLOT(selectionChanged()));
- connect(&selections, SIGNAL(activeChanged(sel_id_t)), this, SLOT(selectionChanged()));
+ connect(&ranges, SIGNAL(added(sel_id_t)), this, SLOT(rangeChanged()));
+ connect(&ranges, SIGNAL(updated(sel_id_t)), this, SLOT(rangeChanged()));
+ connect(&ranges, SIGNAL(removed(sel_id_t)), this, SLOT(rangeChanged()));
+ connect(&ranges, SIGNAL(activeChanged(sel_id_t)), this, SLOT(rangeChanged()));
return se;
}
-void InstrumentWidget::selectionChanged()
+void InstrumentWidget::rangeChanged()
{
- instrument.setSelections(selections);
+ instrument.setRanges(ranges);
}
static QSlider* createAttribute(QWidget* parent, QString name,
@@ -271,19 +271,19 @@ QWidget* InstrumentWidget::createGenerateTab()
QPushButton* autosel = new QPushButton();
autosel->setText(tr("Generate"));
connect(autosel, SIGNAL(clicked()),
- tool_selections, SLOT(clearSelections()));
+ tool_ranges, SLOT(clearRanges()));
connect(autosel, SIGNAL(clicked()),
- tool_selections, SLOT(autoCreateSelections()));
+ tool_ranges, SLOT(autoCreateRanges()));
connect(threshold, SIGNAL(thresholdChanged(double)),
- tool_selections, SLOT(autoCreateSelectionsPreview()));
+ tool_ranges, SLOT(autoCreateRangesPreview()));
connect(threshold, SIGNAL(thresholdChanging(double)),
- tool_selections, SLOT(autoCreateSelectionsPreview()));
+ tool_ranges, SLOT(autoCreateRangesPreview()));
QPushButton* clearsel = new QPushButton();
clearsel->setText(tr("Clear"));
connect(clearsel, SIGNAL(clicked()),
- tool_selections, SLOT(clearSelections()));
+ tool_ranges, SLOT(clearRanges()));
btns->addWidget(autosel);
btns->addWidget(clearsel);
@@ -294,7 +294,7 @@ QWidget* InstrumentWidget::createGenerateTab()
connect(slider_attacklength, SIGNAL(valueChanged(int)),
sorter, SLOT(setAttackLength(int)));
connect(slider_attacklength, SIGNAL(valueChanged(int)),
- tool_selections, SLOT(autoCreateSelectionsPreview()));
+ tool_ranges, SLOT(autoCreateRangesPreview()));
slider_attacklength->setValue(instrument.getAttackLength());
connect(slider_attacklength, SIGNAL(valueChanged(int)),
this, SLOT(generateSlidersChanged()));
@@ -303,34 +303,34 @@ QWidget* InstrumentWidget::createGenerateTab()
connect(slider_spread, SIGNAL(valueChanged(int)),
sorter, SLOT(setSpreadFactor(int)));
connect(slider_spread, SIGNAL(valueChanged(int)),
- tool_selections, SLOT(autoCreateSelectionsPreview()));
+ tool_ranges, SLOT(autoCreateRangesPreview()));
slider_spread->setValue(instrument.getPowerSpread());
connect(slider_spread, SIGNAL(valueChanged(int)),
this, SLOT(generateSlidersChanged()));
slider_hold = createAttribute(w, tr("Minimum size (samples):"), 0, 200000);
connect(slider_hold, SIGNAL(valueChanged(int)),
- tool_selections, SLOT(holdChanged(int)));
+ tool_ranges, SLOT(holdChanged(int)));
connect(slider_hold, SIGNAL(valueChanged(int)),
- tool_selections, SLOT(autoCreateSelectionsPreview()));
+ tool_ranges, SLOT(autoCreateRangesPreview()));
slider_hold->setValue(instrument.getMinimumSize());
connect(slider_hold, SIGNAL(valueChanged(int)),
this, SLOT(generateSlidersChanged()));
slider_falloff = createAttribute(w, tr("Falloff:"), 10, 5000);
connect(slider_falloff, SIGNAL(valueChanged(int)),
- tool_selections, SLOT(noiseFloorChanged(int)));
+ tool_ranges, SLOT(noiseFloorChanged(int)));
connect(slider_falloff, SIGNAL(valueChanged(int)),
- tool_selections, SLOT(autoCreateSelectionsPreview()));
+ tool_ranges, SLOT(autoCreateRangesPreview()));
slider_falloff->setValue(instrument.getFalloff());
connect(slider_falloff, SIGNAL(valueChanged(int)),
this, SLOT(generateSlidersChanged()));
slider_fadelength = createAttribute(w, tr("Fadelength:"), 0, 2000);
connect(slider_fadelength, SIGNAL(valueChanged(int)),
- tool_selections, SLOT(fadeoutChanged(int)));
+ tool_ranges, SLOT(fadeoutChanged(int)));
connect(slider_fadelength, SIGNAL(valueChanged(int)),
- tool_selections, SLOT(autoCreateSelectionsPreview()));
+ tool_ranges, SLOT(autoCreateRangesPreview()));
slider_fadelength->setValue(instrument.getFadeLength());
connect(slider_fadelength, SIGNAL(valueChanged(int)),
this, SLOT(generateSlidersChanged()));
@@ -404,10 +404,10 @@ void InstrumentWidget::exportPathChanged()
void InstrumentWidget::playSamples()
{
- Selections* sels = &selections;
+ Ranges* sels = &ranges;
if(tabs->currentIndex() == generateTabId)
{
- sels = &selections_preview;
+ sels = &ranges_preview;
}
QVector<sel_id_t> ids = sels->ids();
@@ -415,8 +415,8 @@ void InstrumentWidget::playSamples()
{
for(int v2 = 0; v2 < ids.size(); v2++)
{
- Selection sel1 = sels->get(ids[v1]);
- Selection sel2 = sels->get(ids[v2]);
+ Range sel1 = sels->get(ids[v1]);
+ Range sel2 = sels->get(ids[v2]);
if(sel1.energy < sel2.energy)
{
@@ -430,7 +430,7 @@ void InstrumentWidget::playSamples()
QVector<sel_id_t>::iterator i = ids.begin();
while(i != ids.end())
{
- Selection sel = sels->get(*i);
+ Range sel = sels->get(*i);
unsigned int length = sb_playsamples->value() * 44100 / 1000;
@@ -448,7 +448,7 @@ void InstrumentWidget::playSamples()
connect(&player, SIGNAL(positionUpdate(size_t)),
listen, SLOT(update(size_t)));
- player.playSelection(sel, to - sel.from);
+ player.playRange(sel, to - sel.from);
QTime t;
t.start();
while(t.elapsed() < sb_playsamples->value())
@@ -466,7 +466,7 @@ void InstrumentWidget::playSamples()
void InstrumentWidget::doExport()
{
- extractor->exportSelections();
+ extractor->exportRanges();
}
void InstrumentWidget::loadFile(QString filename)
diff --git a/src/instrumentwidget.h b/src/instrumentwidget.h
index 721b829..d2a4b9d 100644
--- a/src/instrumentwidget.h
+++ b/src/instrumentwidget.h
@@ -38,10 +38,10 @@
#include "audioextractor.h"
#include "samplesorter.h"
#include "filelist.h"
-#include "canvastoolselections.h"
+#include "canvastoolranges.h"
#include "canvastoolthreshold.h"
#include "canvastoollisten.h"
-#include "selection.h"
+#include "range.h"
#include "player.h"
#include "zoomslider.h"
#include "canvaswidget.h"
@@ -74,7 +74,7 @@ public slots:
void browse();
void tabChanged(int tabid);
void generateSlidersChanged();
- void selectionChanged();
+ void rangeChanged();
void prefixChanged();
void exportPathChanged();
@@ -87,7 +87,7 @@ private:
int generateTabId;
SampleSorter* sorter;
- CanvasToolSelections* tool_selections;
+ CanvasToolRanges* tool_ranges;
CanvasToolThreshold* threshold;
CanvasToolListen* listen;
AudioExtractor* extractor;
@@ -108,8 +108,8 @@ private:
QTabWidget* tabs;
// Session state information:
- Selections selections;
- Selections selections_preview;
+ Ranges ranges;
+ Ranges ranges_preview;
Player player;
Settings& settings;
diff --git a/src/player.cc b/src/player.cc
index d598d9f..a3eeaa2 100644
--- a/src/player.cc
+++ b/src/player.cc
@@ -38,7 +38,7 @@ Player::Player()
pcm_data = NULL;
pcm_size = 0;
end = 0;
- new_selection = false;
+ new_range = false;
connect(&report_timer, SIGNAL(timeout()), this, SLOT(reportTimeout()));
report_timer.start(50); // Update 25 times per second
@@ -55,7 +55,7 @@ Player::~Player()
#define _MIN(a, b) (a<b?a:b)
void Player::run()
{
- Selection sel;
+ Range sel;
static int init = 0;
if(init == 0)
@@ -79,14 +79,14 @@ void Player::run()
while(running)
{
{
- // Check for new Selection.
+ // Check for new Range.
QMutexLocker lock(&mutex);
- if(new_selection)
+ if(new_range)
{
- sel = selection;
+ sel = range;
pos = sel.from;
end = sel_end;
- new_selection = false;
+ new_range = false;
}
}
@@ -134,18 +134,18 @@ void Player::run()
}
}
-bool Player::playSelectionDone()
+bool Player::playRangeDone()
{
- return pos >= sel_end || pos >= selection.to;
+ return pos >= sel_end || pos >= range.to;
}
-void Player::playSelection(Selection s, int len)
+void Player::playRange(Range s, int len)
{
{
- // Enqueue new Selection for player consumation
+ // Enqueue new Range for player consumation
QMutexLocker lock(&mutex);
- selection = s;
+ range = s;
if(len > 0)
{
@@ -153,16 +153,16 @@ void Player::playSelection(Selection s, int len)
}
else
{
- sel_end = selection.to - selection.from;
+ sel_end = range.to - range.from;
}
- sel_end += selection.from;
+ sel_end += range.from;
- new_selection = true;
+ new_range = true;
}
- // Wait until player actually consumed the new Selection.
- while(new_selection)
+ // Wait until player actually consumed the new Range.
+ while(new_range)
{
msleep(1);
}
@@ -197,20 +197,20 @@ void Player::setPcmData(float* data, size_t size, double samplerate)
void Player::setPosition(size_t position)
{
- Selection s;
+ Range s;
s.from = position;
s.to = pcm_size;
s.fadein = 0;
s.fadeout = 0;
- playSelection(s);
+ playRange(s);
}
void Player::stop()
{
- Selection s;
+ Range s;
s.from = 0;
s.to = 0;
s.fadein = 0;
s.fadeout = 0;
- playSelection(s, pos);
+ playRange(s, pos);
}
diff --git a/src/player.h b/src/player.h
index 0f5b780..9bc03b7 100644
--- a/src/player.h
+++ b/src/player.h
@@ -32,7 +32,7 @@
#include <ao/ao.h>
-#include "selection.h"
+#include "range.h"
class Player
: public QThread
@@ -67,12 +67,12 @@ public slots:
//! Set player position as sample offset.
void setPosition(size_t position);
- //! Play range based on selection including fade-in/out.
+ //! Play range based on range including fade-in/out.
//! \param length Stop playing after length samples. -1 means play all.
- void playSelection(Selection selection, int length = -1);
+ void playRange(Range range, int length = -1);
- //! Return true if last selection is done playing.
- bool playSelectionDone();
+ //! Return true if last range is done playing.
+ bool playRangeDone();
//! Stop playing
void stop();
@@ -105,7 +105,7 @@ private:
bool running;
QMutex mutex;
- volatile bool new_selection;
+ volatile bool new_range;
size_t sel_end;
- Selection selection;
+ Range range;
};
diff --git a/src/project.cc b/src/project.cc
index 9cac537..b3b88a3 100644
--- a/src/project.cc
+++ b/src/project.cc
@@ -335,16 +335,16 @@ void Instrument::setThreshold(float threshold)
}
}
-Selections Instrument::getSelections() const
+Ranges Instrument::getRanges() const
{
- return selections;
+ return ranges;
}
-void Instrument::setSelections(const Selections& selections)
+void Instrument::setRanges(const Ranges& ranges)
{
{
Project::RAIIBulkUpdate bulkUpdate(project);
- this->selections = selections;
+ this->ranges = ranges;
}
}
diff --git a/src/project.h b/src/project.h
index 3e2b886..b21f089 100644
--- a/src/project.h
+++ b/src/project.h
@@ -32,7 +32,7 @@
#include <QString>
#include "audioextractor.h"
-#include "selection.h"
+#include "range.h"
class Project;
class Instrument;
@@ -105,8 +105,8 @@ public:
float getThreshold() const;
void setThreshold(float threshold);
- Selections getSelections() const;
- void setSelections(const Selections& selectios);
+ Ranges getRanges() const;
+ void setRanges(const Ranges& selectios);
QString getPrefix() const;
void setPrefix(const QString& prefix);
@@ -134,7 +134,7 @@ private:
float threshold{0.5f};
// Edit tab
- Selections selections;
+ Ranges ranges;
// Export tab
QString prefix;
diff --git a/src/projectrenderer.cc b/src/projectrenderer.cc
index 62d646e..a8e805b 100644
--- a/src/projectrenderer.cc
+++ b/src/projectrenderer.cc
@@ -85,8 +85,8 @@ void ProjectRenderer::render()
instrument.getInstrumentName());
{
- auto selections = instrument.getSelections().ids();
- emit progressRenderStart(selections.count());
+ auto ranges = instrument.getRanges().ids();
+ emit progressRenderStart(ranges.count());
qApp->processEvents();
}
@@ -94,7 +94,7 @@ void ProjectRenderer::render()
connect(&extractor, SIGNAL(progressUpdate(int)),
this, SIGNAL(progressRenderTask(int)));
- if(!extractor.exportSelections())
+ if(!extractor.exportRanges())
{
emit progressFinished(1);
qApp->processEvents();
diff --git a/src/projectserialiser.cc b/src/projectserialiser.cc
index 6a204eb..59cb97d 100644
--- a/src/projectserialiser.cc
+++ b/src/projectserialiser.cc
@@ -192,11 +192,11 @@ QString ProjectSerialiser::serialise(const Project& project)
}
auto regions = doc.createElement("regions");
- regions.setAttribute("nextid", i.selections.nextid);
- regions.setAttribute("act", i.selections.act);
+ regions.setAttribute("nextid", i.ranges.nextid);
+ regions.setAttribute("act", i.ranges.act);
instrument.appendChild(regions);
- for(auto r = i.selections.sels.begin(); r != i.selections.sels.end(); ++r)
+ for(auto r = i.ranges.sels.begin(); r != i.ranges.sels.end(); ++r)
{
auto region = doc.createElement("region");
region.setAttribute("id", (int)r.key());
@@ -292,20 +292,20 @@ bool ProjectSerialiser::deserialise(const QString& data, Project& project)
instr.prefix = instrument("prefix").text();
- auto selections = instrument("regions");
- instr.selections.nextid = selections["nextid"].toInt();
- instr.selections.act = selections["act"].toInt();
+ auto ranges = instrument("regions");
+ instr.ranges.nextid = ranges["nextid"].toInt();
+ instr.ranges.act = ranges["act"].toInt();
- for(auto& selection : selections.children())
+ for(auto& range : ranges.children())
{
- Selection s;
- s.from = selection["from"].toInt();
- s.to = selection["to"].toInt();
- s.fadein = selection["fadein"].toInt();
- s.fadeout = selection["fadeout"].toInt();
- s.energy = selection["energy"].toFloat();
- s.name = selection["name"];
- instr.selections.sels[selection["id"].toInt()] = s;
+ Range s;
+ s.from = range["from"].toInt();
+ s.to = range["to"].toInt();
+ s.fadein = range["fadein"].toInt();
+ s.fadeout = range["fadeout"].toInt();
+ s.energy = range["energy"].toFloat();
+ s.name = range["name"];
+ instr.ranges.sels[range["id"].toInt()] = s;
}
}
diff --git a/src/selection.cc b/src/range.cc
index e18e485..28bf48e 100644
--- a/src/selection.cc
+++ b/src/range.cc
@@ -1,6 +1,6 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/***************************************************************************
- * selection.cc
+ * range.cc
*
* Mon Apr 14 10:13:21 CEST 2014
* Copyright 2014 Bent Bisballe Nyeng
@@ -24,50 +24,50 @@
* along with DrumGizmo; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#include "selection.h"
+#include "range.h"
-Selections::Selections()
+Ranges::Ranges()
: QObject(NULL)
{
nextid = 0;
act = SEL_NONE;
}
-Selections::Selections(const Selections& other)
+Ranges::Ranges(const Ranges& other)
{
*this = other;
}
-void Selections::operator=(const Selections& other)
+void Ranges::operator=(const Ranges& other)
{
sels = other.sels;
nextid = other.nextid;
act = other.act;
}
-sel_id_t Selections::add(Selection selection)
+sel_id_t Ranges::add(Range range)
{
sel_id_t id = nextid++;
- sels[id] = selection;
+ sels[id] = range;
added(id);
return id;
}
-Selection Selections::get(sel_id_t id)
+Range Ranges::get(sel_id_t id)
{
if(sels.find(id) == sels.end())
{
- Selection s(0,0,0,0);
+ Range s(0,0,0,0);
return s;
}
return sels[id];
}
-QVector<sel_id_t> Selections::ids()
+QVector<sel_id_t> Ranges::ids()
{
QVector<sel_id_t> v;
- QMap<sel_id_t, Selection>::iterator i = sels.begin();
+ QMap<sel_id_t, Range>::iterator i = sels.begin();
while(i != sels.end())
{
v.push_back(i.key());
@@ -77,16 +77,16 @@ QVector<sel_id_t> Selections::ids()
return v;
}
-void Selections::update(sel_id_t id, Selection selection)
+void Ranges::update(sel_id_t id, Range range)
{
if(sels.find(id) != sels.end())
{
- sels[id] = selection;
+ sels[id] = range;
emit updated(id);
}
}
-void Selections::remove(sel_id_t id)
+void Ranges::remove(sel_id_t id)
{
if(sels.find(id) != sels.end())
{
@@ -99,7 +99,7 @@ void Selections::remove(sel_id_t id)
}
}
-void Selections::clear()
+void Ranges::clear()
{
QVector<sel_id_t> _ids = ids();
QVector<sel_id_t>::iterator i = _ids.begin();
@@ -110,7 +110,7 @@ void Selections::clear()
}
}
-void Selections::setActive(sel_id_t id)
+void Ranges::setActive(sel_id_t id)
{
if(sels.find(id) != sels.end())
{
@@ -123,7 +123,7 @@ void Selections::setActive(sel_id_t id)
emit activeChanged(act);
}
-sel_id_t Selections::active()
+sel_id_t Ranges::active()
{
return act;
}
diff --git a/src/selection.h b/src/range.h
index 338b381..c887a66 100644
--- a/src/selection.h
+++ b/src/range.h
@@ -1,6 +1,6 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/***************************************************************************
- * selection.h
+ * range.h
*
* Sat Nov 21 13:20:46 CET 2009
* Copyright 2009 Bent Bisballe Nyeng
@@ -31,10 +31,10 @@
#include <QMap>
#include <QVector>
-class Selection
+class Range
{
public:
- Selection(int from = 0, int to = 0, int fadein = 0, int fadeout = 0)
+ Range(int from = 0, int to = 0, int fadein = 0, int fadeout = 0)
{
this->from = from;
this->to = to;
@@ -54,62 +54,62 @@ public:
typedef int sel_id_t;
#define SEL_NONE -1
-class Selections
+class Ranges
: public QObject
{
Q_OBJECT
public:
- Selections();
- Selections(const Selections&);
+ Ranges();
+ Ranges(const Ranges&);
- void operator=(const Selections& other);
+ void operator=(const Ranges& other);
- //! Add a new selection object. The new id is returned.
- //! Adding a new selections will emit an added signal with the new id.
- sel_id_t add(Selection selection);
+ //! Add a new range object. The new id is returned.
+ //! Adding a new ranges will emit an added signal with the new id.
+ sel_id_t add(Range range);
- //! Get a stack copy of a specific selection object, by id.
- //! NOTE: If id does not exist an empty selection (from = to = 0) is
+ //! Get a stack copy of a specific range object, by id.
+ //! NOTE: If id does not exist an empty range (from = to = 0) is
//! returned.
- Selection get(sel_id_t id);
+ Range get(sel_id_t id);
//! Return vector (unsorted) of all ids in the object.
QVector<sel_id_t> ids();
- //! Set active selection (to be rendered yellow)
+ //! Set active range (to be rendered yellow)
void setActive(sel_id_t id);
- //! Get active selection id.
+ //! Get active range id.
sel_id_t active();
public slots:
- //! Update a selection by id.
- //! Updating a selection will emit a updated signal.
- void update(sel_id_t id, Selection selection);
+ //! Update a range by id.
+ //! Updating a range will emit a updated signal.
+ void update(sel_id_t id, Range range);
- //! Delete a selection by id.
- //! Deleting a selection will emit a deleted signal.
+ //! Delete a range by id.
+ //! Deleting a range will emit a deleted signal.
void remove(sel_id_t id);
- //! Delete all selections
+ //! Delete all ranges
void clear();
signals:
- //! This signal is emitted when a new selection has been added.
+ //! This signal is emitted when a new range has been added.
void added(sel_id_t id);
- //! This signal is emitted when an existing selection has been updated.
+ //! This signal is emitted when an existing range has been updated.
void updated(sel_id_t id);
- //! This signal is emitted when a selection has been removed.
+ //! This signal is emitted when a range has been removed.
void removed(sel_id_t id);
- //! The active selection changed.
+ //! The active range changed.
void activeChanged(sel_id_t id);
private:
friend class ProjectSerialiser;
- QMap<sel_id_t, Selection> sels;
+ QMap<sel_id_t, Range> sels;
sel_id_t nextid;
sel_id_t act;
};
diff --git a/src/selectioneditor.cc b/src/rangeeditor.cc
index 417059d..868f434 100644
--- a/src/selectioneditor.cc
+++ b/src/rangeeditor.cc
@@ -1,6 +1,6 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/***************************************************************************
- * selectioneditor.cc
+ * rangeeditor.cc
*
* Thu Apr 17 17:25:18 CEST 2014
* Copyright 2014 Bent Bisballe Nyeng
@@ -24,7 +24,7 @@
* along with DrumGizmo; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#include "selectioneditor.h"
+#include "rangeeditor.h"
#include "project.h"
@@ -40,7 +40,7 @@ static QLineEdit *createWidget(QString name, QWidget* parent)
QLineEdit* edt = new QLineEdit();
QObject::connect(edt, SIGNAL(editingFinished()),
- parent, SLOT(updateSelection()));
+ parent, SLOT(updateRange()));
l->addWidget(edt);
@@ -49,8 +49,8 @@ static QLineEdit *createWidget(QString name, QWidget* parent)
return edt;
}
-SelectionEditor::SelectionEditor(Selections &s, Instrument& instrument)
- : selections(s)
+RangeEditor::RangeEditor(Ranges &s, Instrument& instrument)
+ : ranges(s)
, instrument(instrument)
{
cur = SEL_NONE;
@@ -67,9 +67,9 @@ SelectionEditor::SelectionEditor(Selections &s, Instrument& instrument)
((QHBoxLayout*)layout())->addStretch();
}
-void SelectionEditor::updateSelection()
+void RangeEditor::updateRange()
{
- Selection sel;
+ Range sel;
sel.from = from->text().toInt();
sel.to = to->text().toInt();
@@ -78,14 +78,14 @@ void SelectionEditor::updateSelection()
sel.energy = energy->text().toDouble();
sel.name = name->text();
- selections.update(cur, sel);
+ ranges.update(cur, sel);
- instrument.setSelections(selections);
+ instrument.setRanges(ranges);
}
-void SelectionEditor::update()
+void RangeEditor::update()
{
- Selection sel = selections.get(cur);
+ Range sel = ranges.get(cur);
from->setText(QString::number(sel.from));
to->setText(QString::number(sel.to));
fadein->setText(QString::number(sel.fadein));
@@ -94,12 +94,12 @@ void SelectionEditor::update()
name->setText(sel.name);
}
-void SelectionEditor::added(sel_id_t id)
+void RangeEditor::added(sel_id_t id)
{
// Nothing to do here...
}
-void SelectionEditor::updated(sel_id_t id)
+void RangeEditor::updated(sel_id_t id)
{
if(cur == id)
{
@@ -107,7 +107,7 @@ void SelectionEditor::updated(sel_id_t id)
}
}
-void SelectionEditor::removed(sel_id_t id)
+void RangeEditor::removed(sel_id_t id)
{
if(cur == id)
{
@@ -116,7 +116,7 @@ void SelectionEditor::removed(sel_id_t id)
}
}
-void SelectionEditor::activeChanged(sel_id_t id)
+void RangeEditor::activeChanged(sel_id_t id)
{
cur = id;
update();
diff --git a/src/selectioneditor.h b/src/rangeeditor.h
index cdbf2de..b3ecd9b 100644
--- a/src/selectioneditor.h
+++ b/src/rangeeditor.h
@@ -1,6 +1,6 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/***************************************************************************
- * selectioneditor.h
+ * rangeeditor.h
*
* Thu Apr 17 17:25:17 CEST 2014
* Copyright 2014 Bent Bisballe Nyeng
@@ -29,16 +29,16 @@
#include <QWidget>
#include <QLineEdit>
-#include "selection.h"
+#include "range.h"
class Instrument;
-class SelectionEditor
+class RangeEditor
: public QWidget
{
Q_OBJECT
public:
- SelectionEditor(Selections& selections, Instrument& instrument);
+ RangeEditor(Ranges& ranges, Instrument& instrument);
public slots:
void added(sel_id_t id);
@@ -48,10 +48,10 @@ public slots:
private slots:
void update();
- void updateSelection();
+ void updateRange();
private:
- Selections& selections;
+ Ranges& ranges;
sel_id_t cur;
diff --git a/src/samplesorter.cc b/src/samplesorter.cc
index 29c24e6..15d6c3f 100644
--- a/src/samplesorter.cc
+++ b/src/samplesorter.cc
@@ -37,9 +37,9 @@
#define MAXFLOAT (3.40282347e+38F)
#endif
-SampleSorter::SampleSorter(Selections& s, Selections& p, Instrument& instrument)
- : selections(s)
- , selections_preview(p)
+SampleSorter::SampleSorter(Ranges& s, Ranges& p, Instrument& instrument)
+ : ranges(s)
+ , ranges_preview(p)
, instrument(instrument)
{
setMouseTracking(true);
@@ -84,9 +84,9 @@ void SampleSorter::setAttackLength(int len)
relayout();
}
-void SampleSorter::addSelection(sel_id_t id)
+void SampleSorter::addRange(sel_id_t id)
{
- Selection s = selections.get(id);
+ Range s = ranges.get(id);
double energy = 0.0;
for(size_t idx = s.from;
@@ -98,14 +98,14 @@ void SampleSorter::addSelection(sel_id_t id)
}
s.energy = pow(energy, spread);
- selections.update(id, s);
+ ranges.update(id, s);
relayout();
}
-void SampleSorter::addSelectionPreview(sel_id_t id)
+void SampleSorter::addRangePreview(sel_id_t id)
{
- Selection s = selections_preview.get(id);
+ Range s = ranges_preview.get(id);
double energy = 0.0;
for(size_t idx = s.from;
@@ -117,7 +117,7 @@ void SampleSorter::addSelectionPreview(sel_id_t id)
}
s.energy = pow(energy, spread);
- selections_preview.update(id, s);
+ ranges_preview.update(id, s);
relayout();
}
@@ -128,11 +128,11 @@ void SampleSorter::relayout()
max = 0.0;
{
- QVector<sel_id_t> ids = selections.ids();
+ QVector<sel_id_t> ids = ranges.ids();
QVector<sel_id_t>::iterator i = ids.begin();
while(i != ids.end())
{
- Selection sel = selections.get(*i);
+ Range sel = ranges.get(*i);
if(sel.energy < min)
{
@@ -149,11 +149,11 @@ void SampleSorter::relayout()
if(show_preview)
{
- QVector<sel_id_t> ids = selections_preview.ids();
+ QVector<sel_id_t> ids = ranges_preview.ids();
QVector<sel_id_t>::iterator i = ids.begin();
while(i != ids.end())
{
- Selection sel = selections_preview.get(*i);
+ Range sel = ranges_preview.get(*i);
if(sel.energy < min)
{
@@ -203,12 +203,12 @@ void SampleSorter::paintEvent(QPaintEvent* event)
{
- QVector<sel_id_t> ids = selections.ids();
+ QVector<sel_id_t> ids = ranges.ids();
QVector<sel_id_t>::iterator i = ids.begin();
while(i != ids.end())
{
- Selection sel = selections.get(*i);
- if(*i == selections.active())
+ Range sel = ranges.get(*i);
+ if(*i == ranges.active())
{
painter.setPen(colPtSel);
}
@@ -226,11 +226,11 @@ void SampleSorter::paintEvent(QPaintEvent* event)
if(show_preview)
{
- QVector<sel_id_t> ids = selections_preview.ids();
+ QVector<sel_id_t> ids = ranges_preview.ids();
QVector<sel_id_t>::iterator i = ids.begin();
while(i != ids.end())
{
- Selection sel = selections_preview.get(*i);
+ Range sel = ranges_preview.get(*i);
painter.setPen(colPtPreview);
float x = (sel.energy / max);
x = sqrt(x);
@@ -243,16 +243,16 @@ void SampleSorter::paintEvent(QPaintEvent* event)
}
-sel_id_t SampleSorter::getSelectionByCoordinate(int px, int py)
+sel_id_t SampleSorter::getRangeByCoordinate(int px, int py)
{
// Hit radius is slithly larger than the circles themselves.
int hit_r = C_RADIUS + 1;
- QVector<sel_id_t> ids = selections.ids();
+ QVector<sel_id_t> ids = ranges.ids();
QVector<sel_id_t>::iterator i = ids.begin();
while(i != ids.end())
{
- Selection sel = selections.get(*i);
+ Range sel = ranges.get(*i);
float x = (sel.energy/max);
x = sqrt(x);
x *= (float)width() * 0.9;
@@ -273,14 +273,14 @@ void SampleSorter::mouseMoveEvent(QMouseEvent* event)
{
if(sel_moving != SEL_NONE)
{
- Selection sel = selections.get(sel_moving);
+ Range sel = ranges.get(sel_moving);
if(sel_moving != SEL_NONE)
{
double power = unmapX(event->x());
power *= power;
power *= max;
sel.energy = power;
- selections.update(sel_moving, sel);
+ ranges.update(sel_moving, sel);
}
update();
@@ -288,7 +288,7 @@ void SampleSorter::mouseMoveEvent(QMouseEvent* event)
}
else
{
- sel_id_t psel = getSelectionByCoordinate(event->x(), event->y());
+ sel_id_t psel = getRangeByCoordinate(event->x(), event->y());
if(psel != SEL_NONE)
{
setCursor(Qt::OpenHandCursor);
@@ -304,9 +304,9 @@ void SampleSorter::mousePressEvent(QMouseEvent* event)
{
if(event->button() == Qt::LeftButton)
{
- sel_id_t psel = getSelectionByCoordinate(event->x(), event->y());
+ sel_id_t psel = getRangeByCoordinate(event->x(), event->y());
sel_moving = psel;
- selections.setActive(psel);
+ ranges.setActive(psel);
if(psel != SEL_NONE)
{
setCursor(Qt::ClosedHandCursor);
@@ -319,7 +319,7 @@ void SampleSorter::mouseReleaseEvent(QMouseEvent* event)
if(event->button() == Qt::LeftButton)
{
sel_moving = SEL_NONE;
- sel_id_t psel = getSelectionByCoordinate(event->x(), event->y());
+ sel_id_t psel = getRangeByCoordinate(event->x(), event->y());
if(psel != SEL_NONE)
{
setCursor(Qt::OpenHandCursor);
@@ -333,8 +333,8 @@ void SampleSorter::mouseReleaseEvent(QMouseEvent* event)
void SampleSorter::keyReleaseEvent(QKeyEvent* event)
{
- if(selections.active() != SEL_NONE && event->key() == Qt::Key_Delete)
+ if(ranges.active() != SEL_NONE && event->key() == Qt::Key_Delete)
{
- selections.remove(selections.active());
+ ranges.remove(ranges.active());
}
}
diff --git a/src/samplesorter.h b/src/samplesorter.h
index 056161d..f1774e3 100644
--- a/src/samplesorter.h
+++ b/src/samplesorter.h
@@ -28,7 +28,7 @@
#include <QWidget>
#include <QVector>
-#include "selection.h"
+#include "range.h"
class Instrument;
@@ -37,7 +37,7 @@ class SampleSorter
{
Q_OBJECT
public:
- SampleSorter(Selections& selections, Selections& selections_preview,
+ SampleSorter(Ranges& ranges, Ranges& ranges_preview,
Instrument& instrument);
public slots:
@@ -45,8 +45,8 @@ public slots:
void setAttackLength(int len);
int attackLength();
- void addSelection(sel_id_t id);
- void addSelectionPreview(sel_id_t id);
+ void addRange(sel_id_t id);
+ void addRangePreview(sel_id_t id);
void relayout();
@@ -62,10 +62,10 @@ protected:
void keyReleaseEvent(QKeyEvent* event) override;
private:
- sel_id_t getSelectionByCoordinate(int x, int y);
+ sel_id_t getRangeByCoordinate(int x, int y);
- Selections& selections;
- Selections& selections_preview;
+ Ranges& ranges;
+ Ranges& ranges_preview;
bool show_preview;
@@ -77,7 +77,7 @@ private:
const float* data;
size_t size;
- Selection sel;
+ Range sel;
sel_id_t sel_moving;
diff --git a/src/ts/dgedit_da.ts b/src/ts/dgedit_da.ts
index bda3ba5..7fc26cc 100644
--- a/src/ts/dgedit_da.ts
+++ b/src/ts/dgedit_da.ts
@@ -25,7 +25,7 @@
<context>
<name>CanvasToolSelections</name>
<message>
- <location filename="../canvastoolselections.h" line="45"/>
+ <location filename="../canvastoolranges.h" line="45"/>
<source>Selections</source>
<translation>Markeringer</translation>
</message>
@@ -537,32 +537,32 @@
<context>
<name>SelectionEditor</name>
<message>
- <location filename="../selectioneditor.cc" line="60"/>
+ <location filename="../rangeeditor.cc" line="60"/>
<source>From:</source>
<translation>Fra:</translation>
</message>
<message>
- <location filename="../selectioneditor.cc" line="61"/>
+ <location filename="../rangeeditor.cc" line="61"/>
<source>To:</source>
<translation>Til:</translation>
</message>
<message>
- <location filename="../selectioneditor.cc" line="62"/>
+ <location filename="../rangeeditor.cc" line="62"/>
<source>FadeIn:</source>
<translation>FadeIn:</translation>
</message>
<message>
- <location filename="../selectioneditor.cc" line="63"/>
+ <location filename="../rangeeditor.cc" line="63"/>
<source>FadeOut:</source>
<translation>FadeOut:</translation>
</message>
<message>
- <location filename="../selectioneditor.cc" line="64"/>
+ <location filename="../rangeeditor.cc" line="64"/>
<source>Energy:</source>
<translation>Energi:</translation>
</message>
<message>
- <location filename="../selectioneditor.cc" line="65"/>
+ <location filename="../rangeeditor.cc" line="65"/>
<source>Name:</source>
<translation>Navn:</translation>
</message>
diff --git a/src/ts/dgedit_fr.ts b/src/ts/dgedit_fr.ts
index deb07bd..b37cad8 100644
--- a/src/ts/dgedit_fr.ts
+++ b/src/ts/dgedit_fr.ts
@@ -25,7 +25,7 @@
<context>
<name>CanvasToolSelections</name>
<message>
- <location filename="../canvastoolselections.h" line="45"/>
+ <location filename="../canvastoolranges.h" line="45"/>
<source>Selections</source>
<translation>Sélections</translation>
</message>
@@ -537,32 +537,32 @@
<context>
<name>SelectionEditor</name>
<message>
- <location filename="../selectioneditor.cc" line="60"/>
+ <location filename="../rangeeditor.cc" line="60"/>
<source>From:</source>
<translation>Depuis :</translation>
</message>
<message>
- <location filename="../selectioneditor.cc" line="61"/>
+ <location filename="../rangeeditor.cc" line="61"/>
<source>To:</source>
<translation>Jusqu&apos;à :</translation>
</message>
<message>
- <location filename="../selectioneditor.cc" line="62"/>
+ <location filename="../rangeeditor.cc" line="62"/>
<source>FadeIn:</source>
<translation>Fondu ouverture :</translation>
</message>
<message>
- <location filename="../selectioneditor.cc" line="63"/>
+ <location filename="../rangeeditor.cc" line="63"/>
<source>FadeOut:</source>
<translation>Fondu fermeture :</translation>
</message>
<message>
- <location filename="../selectioneditor.cc" line="64"/>
+ <location filename="../rangeeditor.cc" line="64"/>
<source>Energy:</source>
<translation>Énergie :</translation>
</message>
<message>
- <location filename="../selectioneditor.cc" line="65"/>
+ <location filename="../rangeeditor.cc" line="65"/>
<source>Name:</source>
<translation>Nom :</translation>
</message>
@@ -581,4 +581,3 @@
</message>
</context>
</TS>
-
diff --git a/tools/MocList b/tools/MocList
index 8111e37..cbbec60 100755
--- a/tools/MocList
+++ b/tools/MocList
@@ -1,9 +1,9 @@
# -*- mode: shell-script; sh-shell: bash; sh-indentation: 2 -*-
-if [ "$1" = "cc" ]; then
- grep "Q_OBJECT" *.h | LC_ALL=C sort | cut -d: -f1 | sed -e 's/^//g;s/\.h/\.moc.cc/g'| xargs echo;
-elif [ "$1" = "o" ]; then
- grep "Q_OBJECT" *.h | LC_ALL=C sort | cut -d: -f1 | sed -e 's/^//g;s/\.h/\.moc.o/g'| xargs echo;
-elif [ "$1" = "h" ]; then
- grep "Q_OBJECT" *.h | LC_ALL=C sort | cut -d: -f1 | cut -d'/' -f3 | xargs echo;
+if [ "$2" = "cc" ]; then
+ grep -m1 "Q_OBJECT" $1/*.h | LC_ALL=C sort | cut -d: -f1 | sed -e 's/^//g;s/\.h/\.moc.cc/g'| xargs echo;
+elif [ "$2" = "o" ]; then
+ grep -m1 "Q_OBJECT" $1/*.h | LC_ALL=C sort | cut -d: -f1 | sed -e 's/^//g;s/\.h/\.moc.o/g'| xargs echo;
+elif [ "$2" = "h" ]; then
+ grep -m1 "Q_OBJECT" $1/*.h | LC_ALL=C sort | cut -d: -f1 | cut -d'/' -f3 | xargs echo;
fi