diff --git a/contrib/assdraw/Makefile.am b/contrib/assdraw/Makefile.am
deleted file mode 100644
index af437a64d..000000000
--- a/contrib/assdraw/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = src
diff --git a/contrib/assdraw/assdraw_2008.vcproj b/contrib/assdraw/assdraw_2008.vcproj
deleted file mode 100644
index 9f5c5083f..000000000
--- a/contrib/assdraw/assdraw_2008.vcproj
+++ /dev/null
@@ -1,473 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/contrib/assdraw/autogen.sh b/contrib/assdraw/autogen.sh
deleted file mode 100755
index 5bce9bab3..000000000
--- a/contrib/assdraw/autogen.sh
+++ /dev/null
@@ -1,1578 +0,0 @@
-#!/bin/sh
-# a u t o g e n . s h
-#
-# Copyright (c) 2005-2009 United States Government as represented by
-# the U.S. Army Research Laboratory.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided
-# with the distribution.
-#
-# 3. The name of the author may not be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
-# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
-# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-###
-#
-# Script for automatically preparing the sources for compilation by
-# performing the myriad of necessary steps. The script attempts to
-# detect proper version support, and outputs warnings about particular
-# systems that have autotool peculiarities.
-#
-# Basically, if everything is set up and installed correctly, the
-# script will validate that minimum versions of the GNU Build System
-# tools are installed, account for several common configuration
-# issues, and then simply run autoreconf for you.
-#
-# If autoreconf fails, which can happen for many valid configurations,
-# this script proceeds to run manual preparation steps effectively
-# providing a POSIX shell script (mostly complete) reimplementation of
-# autoreconf.
-#
-# The AUTORECONF, AUTOCONF, AUTOMAKE, LIBTOOLIZE, ACLOCAL, AUTOHEADER
-# environment variables and corresponding _OPTIONS variables (e.g.
-# AUTORECONF_OPTIONS) may be used to override the default automatic
-# detection behaviors. Similarly the _VERSION variables will override
-# the minimum required version numbers.
-#
-# Examples:
-#
-# To obtain help on usage:
-# ./autogen.sh --help
-#
-# To obtain verbose output:
-# ./autogen.sh --verbose
-#
-# To skip autoreconf and prepare manually:
-# AUTORECONF=false ./autogen.sh
-#
-# To verbosely try running with an older (unsupported) autoconf:
-# AUTOCONF_VERSION=2.50 ./autogen.sh --verbose
-#
-# Author:
-# Christopher Sean Morrison
-#
-# Patches:
-# Sebastian Pipping
-#
-######################################################################
-
-# set to minimum acceptable version of autoconf
-if [ "x$AUTOCONF_VERSION" = "x" ] ; then
- AUTOCONF_VERSION=2.52
-fi
-# set to minimum acceptable version of automake
-if [ "x$AUTOMAKE_VERSION" = "x" ] ; then
- AUTOMAKE_VERSION=1.6.0
-fi
-# set to minimum acceptable version of libtool
-if [ "x$LIBTOOL_VERSION" = "x" ] ; then
- LIBTOOL_VERSION=1.4.2
-fi
-
-
-##################
-# ident function #
-##################
-ident ( ) {
- # extract copyright from header
- __copyright="`grep Copyright $AUTOGEN_SH | head -${HEAD_N}1 | awk '{print $4}'`"
- if [ "x$__copyright" = "x" ] ; then
- __copyright="`date +%Y`"
- fi
-
- # extract version from CVS Id string
- __id="$Id: autogen.sh 33925 2009-03-01 23:27:06Z brlcad $"
- __version="`echo $__id | sed 's/.*\([0-9][0-9][0-9][0-9]\)[-\/]\([0-9][0-9]\)[-\/]\([0-9][0-9]\).*/\1\2\3/'`"
- if [ "x$__version" = "x" ] ; then
- __version=""
- fi
-
- echo "autogen.sh build preparation script by Christopher Sean Morrison"
- echo " + config.guess download patch by Sebastian Pipping (2008-12-03)"
- echo "revised 3-clause BSD-style license, copyright (c) $__copyright"
- echo "script version $__version, ISO/IEC 9945 POSIX shell script"
-}
-
-
-##################
-# USAGE FUNCTION #
-##################
-usage ( ) {
- echo "Usage: $AUTOGEN_SH [-h|--help] [-v|--verbose] [-q|--quiet] [-d|--download] [--version]"
- echo " --help Help on $NAME_OF_AUTOGEN usage"
- echo " --verbose Verbose progress output"
- echo " --quiet Quiet suppressed progress output"
- echo " --download Download the latest config.guess from gnulib"
- echo " --version Only perform GNU Build System version checks"
- echo
- echo "Description: This script will validate that minimum versions of the"
- echo "GNU Build System tools are installed and then run autoreconf for you."
- echo "Should autoreconf fail, manual preparation steps will be run"
- echo "potentially accounting for several common preparation issues. The"
-
- echo "AUTORECONF, AUTOCONF, AUTOMAKE, LIBTOOLIZE, ACLOCAL, AUTOHEADER,"
- echo "PROJECT, & CONFIGURE environment variables and corresponding _OPTIONS"
- echo "variables (e.g. AUTORECONF_OPTIONS) may be used to override the"
- echo "default automatic detection behavior."
- echo
-
- ident
-
- return 0
-}
-
-
-##########################
-# VERSION_ERROR FUNCTION #
-##########################
-version_error ( ) {
- if [ "x$1" = "x" ] ; then
- echo "INTERNAL ERROR: version_error was not provided a version"
- exit 1
- fi
- if [ "x$2" = "x" ] ; then
- echo "INTERNAL ERROR: version_error was not provided an application name"
- exit 1
- fi
- $ECHO
- $ECHO "ERROR: To prepare the ${PROJECT} build system from scratch,"
- $ECHO " at least version $1 of $2 must be installed."
- $ECHO
- $ECHO "$NAME_OF_AUTOGEN does not need to be run on the same machine that will"
- $ECHO "run configure or make. Either the GNU Autotools will need to be installed"
- $ECHO "or upgraded on this system, or $NAME_OF_AUTOGEN must be run on the source"
- $ECHO "code on another system and then transferred to here. -- Cheers!"
- $ECHO
-}
-
-##########################
-# VERSION_CHECK FUNCTION #
-##########################
-version_check ( ) {
- if [ "x$1" = "x" ] ; then
- echo "INTERNAL ERROR: version_check was not provided a minimum version"
- exit 1
- fi
- _min="$1"
- if [ "x$2" = "x" ] ; then
- echo "INTERNAL ERROR: version check was not provided a comparison version"
- exit 1
- fi
- _cur="$2"
-
- # needed to handle versions like 1.10 and 1.4-p6
- _min="`echo ${_min}. | sed 's/[^0-9]/./g' | sed 's/\.\././g'`"
- _cur="`echo ${_cur}. | sed 's/[^0-9]/./g' | sed 's/\.\././g'`"
-
- _min_major="`echo $_min | cut -d. -f1`"
- _min_minor="`echo $_min | cut -d. -f2`"
- _min_patch="`echo $_min | cut -d. -f3`"
-
- _cur_major="`echo $_cur | cut -d. -f1`"
- _cur_minor="`echo $_cur | cut -d. -f2`"
- _cur_patch="`echo $_cur | cut -d. -f3`"
-
- if [ "x$_min_major" = "x" ] ; then
- _min_major=0
- fi
- if [ "x$_min_minor" = "x" ] ; then
- _min_minor=0
- fi
- if [ "x$_min_patch" = "x" ] ; then
- _min_patch=0
- fi
- if [ "x$_cur_minor" = "x" ] ; then
- _cur_major=0
- fi
- if [ "x$_cur_minor" = "x" ] ; then
- _cur_minor=0
- fi
- if [ "x$_cur_patch" = "x" ] ; then
- _cur_patch=0
- fi
-
- $VERBOSE_ECHO "Checking if ${_cur_major}.${_cur_minor}.${_cur_patch} is greater than ${_min_major}.${_min_minor}.${_min_patch}"
-
- if [ $_min_major -lt $_cur_major ] ; then
- return 0
- elif [ $_min_major -eq $_cur_major ] ; then
- if [ $_min_minor -lt $_cur_minor ] ; then
- return 0
- elif [ $_min_minor -eq $_cur_minor ] ; then
- if [ $_min_patch -lt $_cur_patch ] ; then
- return 0
- elif [ $_min_patch -eq $_cur_patch ] ; then
- return 0
- fi
- fi
- fi
- return 1
-}
-
-
-######################################
-# LOCATE_CONFIGURE_TEMPLATE FUNCTION #
-######################################
-locate_configure_template ( ) {
- _pwd="`pwd`"
- if test -f "./configure.ac" ; then
- echo "./configure.ac"
- elif test -f "./configure.in" ; then
- echo "./configure.in"
- elif test -f "$_pwd/configure.ac" ; then
- echo "$_pwd/configure.ac"
- elif test -f "$_pwd/configure.in" ; then
- echo "$_pwd/configure.in"
- elif test -f "$PATH_TO_AUTOGEN/configure.ac" ; then
- echo "$PATH_TO_AUTOGEN/configure.ac"
- elif test -f "$PATH_TO_AUTOGEN/configure.in" ; then
- echo "$PATH_TO_AUTOGEN/configure.in"
- fi
-}
-
-
-##################
-# argument check #
-##################
-ARGS="$*"
-PATH_TO_AUTOGEN="`dirname $0`"
-NAME_OF_AUTOGEN="`basename $0`"
-AUTOGEN_SH="$PATH_TO_AUTOGEN/$NAME_OF_AUTOGEN"
-
-LIBTOOL_M4="${PATH_TO_AUTOGEN}/misc/libtool.m4"
-
-if [ "x$HELP" = "x" ] ; then
- HELP=no
-fi
-if [ "x$QUIET" = "x" ] ; then
- QUIET=no
-fi
-if [ "x$VERBOSE" = "x" ] ; then
- VERBOSE=no
-fi
-if [ "x$VERSION_ONLY" = "x" ] ; then
- VERSION_ONLY=no
-fi
-if [ "x$DOWNLOAD" = "x" ] ; then
- DOWNLOAD=no
-fi
-if [ "x$AUTORECONF_OPTIONS" = "x" ] ; then
- AUTORECONF_OPTIONS="-i -f"
-fi
-if [ "x$AUTOCONF_OPTIONS" = "x" ] ; then
- AUTOCONF_OPTIONS="-f"
-fi
-if [ "x$AUTOMAKE_OPTIONS" = "x" ] ; then
- AUTOMAKE_OPTIONS="-a -c -f"
-fi
-ALT_AUTOMAKE_OPTIONS="-a -c"
-if [ "x$LIBTOOLIZE_OPTIONS" = "x" ] ; then
- LIBTOOLIZE_OPTIONS="--automake -c -f"
-fi
-ALT_LIBTOOLIZE_OPTIONS="--automake --copy --force"
-if [ "x$ACLOCAL_OPTIONS" = "x" ] ; then
- ACLOCAL_OPTIONS=""
-fi
-if [ "x$AUTOHEADER_OPTIONS" = "x" ] ; then
- AUTOHEADER_OPTIONS=""
-fi
-if [ "x$CONFIG_GUESS_URL" = "x" ] ; then
- CONFIG_GUESS_URL="http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=build-aux/config.guess;hb=HEAD"
-fi
-for arg in $ARGS ; do
- case "x$arg" in
- x--help) HELP=yes ;;
- x-[hH]) HELP=yes ;;
- x--quiet) QUIET=yes ;;
- x-[qQ]) QUIET=yes ;;
- x--verbose) VERBOSE=yes ;;
- x-[dD]) DOWNLOAD=yes ;;
- x--download) DOWNLOAD=yes ;;
- x-[vV]) VERBOSE=yes ;;
- x--version) VERSION_ONLY=yes ;;
- *)
- echo "Unknown option: $arg"
- echo
- usage
- exit 1
- ;;
- esac
-done
-
-
-#####################
-# environment check #
-#####################
-
-# sanity check before recursions potentially begin
-if [ ! -f "$AUTOGEN_SH" ] ; then
- echo "INTERNAL ERROR: $AUTOGEN_SH does not exist"
- if [ ! "x$0" = "x$AUTOGEN_SH" ] ; then
- echo "INTERNAL ERROR: dirname/basename inconsistency: $0 != $AUTOGEN_SH"
- fi
- exit 1
-fi
-
-# force locale setting to C so things like date output as expected
-LC_ALL=C
-
-# commands that this script expects
-for __cmd in echo head tail pwd ; do
- echo "test" | $__cmd > /dev/null 2>&1
- if [ $? != 0 ] ; then
- echo "INTERNAL ERROR: '${__cmd}' command is required"
- exit 2
- fi
-done
-echo "test" | grep "test" > /dev/null 2>&1
-if test ! x$? = x0 ; then
- echo "INTERNAL ERROR: grep command is required"
- exit 1
-fi
-echo "test" | sed "s/test/test/" > /dev/null 2>&1
-if test ! x$? = x0 ; then
- echo "INTERNAL ERROR: sed command is required"
- exit 1
-fi
-
-
-# determine the behavior of echo
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
- *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T=' ' ;;
- *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
- *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
-esac
-
-# determine the behavior of head
-case "x`echo 'head' | head -n 1 2>&1`" in
- *xhead*) HEAD_N="n " ;;
- *) HEAD_N="" ;;
-esac
-
-# determine the behavior of tail
-case "x`echo 'tail' | tail -n 1 2>&1`" in
- *xtail*) TAIL_N="n " ;;
- *) TAIL_N="" ;;
-esac
-
-VERBOSE_ECHO=:
-ECHO=:
-if [ "x$QUIET" = "xyes" ] ; then
- if [ "x$VERBOSE" = "xyes" ] ; then
- echo "Verbose output quelled by quiet option. Further output disabled."
- fi
-else
- ECHO=echo
- if [ "x$VERBOSE" = "xyes" ] ; then
- echo "Verbose output enabled"
- VERBOSE_ECHO=echo
- fi
-fi
-
-
-# allow a recursive run to disable further recursions
-if [ "x$RUN_RECURSIVE" = "x" ] ; then
- RUN_RECURSIVE=yes
-fi
-
-
-################################################
-# check for help arg and bypass version checks #
-################################################
-if [ "x`echo $ARGS | sed 's/.*[hH][eE][lL][pP].*/help/'`" = "xhelp" ] ; then
- HELP=yes
-fi
-if [ "x$HELP" = "xyes" ] ; then
- usage
- $ECHO "---"
- $ECHO "Help was requested. No preparation or configuration will be performed."
- exit 0
-fi
-
-
-#######################
-# set up signal traps #
-#######################
-untrap_abnormal ( ) {
- for sig in 1 2 13 15; do
- trap - $sig
- done
-}
-
-# do this cleanup whenever we exit.
-trap '
- # start from the root
- if test -d "$START_PATH" ; then
- cd "$START_PATH"
- fi
-
- # restore/delete backup files
- if test "x$PFC_INIT" = "x1" ; then
- recursive_restore
- fi
-' 0
-
-# trap SIGHUP (1), SIGINT (2), SIGPIPE (13), SIGTERM (15)
-for sig in 1 2 13 15; do
- trap '
- $ECHO ""
- $ECHO "Aborting $NAME_OF_AUTOGEN: caught signal '$sig'"
-
- # start from the root
- if test -d "$START_PATH" ; then
- cd "$START_PATH"
- fi
-
- # clean up on abnormal exit
- $VERBOSE_ECHO "rm -rf autom4te.cache"
- rm -rf autom4te.cache
-
- if test -f "acinclude.m4.$$.backup" ; then
- $VERBOSE_ECHO "cat acinclude.m4.$$.backup > acinclude.m4"
- chmod u+w acinclude.m4
- cat acinclude.m4.$$.backup > acinclude.m4
-
- $VERBOSE_ECHO "rm -f acinclude.m4.$$.backup"
- rm -f acinclude.m4.$$.backup
- fi
-
- { (exit 1); exit 1; }
-' $sig
-done
-
-
-#############################
-# look for a configure file #
-#############################
-if [ "x$CONFIGURE" = "x" ] ; then
- CONFIGURE="`locate_configure_template`"
- if [ ! "x$CONFIGURE" = "x" ] ; then
- $VERBOSE_ECHO "Found a configure template: $CONFIGURE"
- fi
-else
- $ECHO "Using CONFIGURE environment variable override: $CONFIGURE"
-fi
-if [ "x$CONFIGURE" = "x" ] ; then
- if [ "x$VERSION_ONLY" = "xyes" ] ; then
- CONFIGURE=/dev/null
- else
- $ECHO
- $ECHO "A configure.ac or configure.in file could not be located implying"
- $ECHO "that the GNU Build System is at least not used in this directory. In"
- $ECHO "any case, there is nothing to do here without one of those files."
- $ECHO
- $ECHO "ERROR: No configure.in or configure.ac file found in `pwd`"
- exit 1
- fi
-fi
-
-####################
-# get project name #
-####################
-if [ "x$PROJECT" = "x" ] ; then
- PROJECT="`grep AC_INIT $CONFIGURE | grep -v '.*#.*AC_INIT' | tail -${TAIL_N}1 | sed 's/^[ ]*AC_INIT(\([^,)]*\).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`"
- if [ "x$PROJECT" = "xAC_INIT" ] ; then
- # projects might be using the older/deprecated arg-less AC_INIT .. look for AM_INIT_AUTOMAKE instead
- PROJECT="`grep AM_INIT_AUTOMAKE $CONFIGURE | grep -v '.*#.*AM_INIT_AUTOMAKE' | tail -${TAIL_N}1 | sed 's/^[ ]*AM_INIT_AUTOMAKE(\([^,)]*\).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`"
- fi
- if [ "x$PROJECT" = "xAM_INIT_AUTOMAKE" ] ; then
- PROJECT="project"
- fi
- if [ "x$PROJECT" = "x" ] ; then
- PROJECT="project"
- fi
-else
- $ECHO "Using PROJECT environment variable override: $PROJECT"
-fi
-$ECHO "Preparing the $PROJECT build system...please wait"
-$ECHO
-
-
-########################
-# check for autoreconf #
-########################
-HAVE_AUTORECONF=no
-if [ "x$AUTORECONF" = "x" ] ; then
- for AUTORECONF in autoreconf ; do
- $VERBOSE_ECHO "Checking autoreconf version: $AUTORECONF --version"
- $AUTORECONF --version > /dev/null 2>&1
- if [ $? = 0 ] ; then
- HAVE_AUTORECONF=yes
- break
- fi
- done
-else
- HAVE_AUTORECONF=yes
- $ECHO "Using AUTORECONF environment variable override: $AUTORECONF"
-fi
-
-
-##########################
-# autoconf version check #
-##########################
-_acfound=no
-if [ "x$AUTOCONF" = "x" ] ; then
- for AUTOCONF in autoconf ; do
- $VERBOSE_ECHO "Checking autoconf version: $AUTOCONF --version"
- $AUTOCONF --version > /dev/null 2>&1
- if [ $? = 0 ] ; then
- _acfound=yes
- break
- fi
- done
-else
- _acfound=yes
- $ECHO "Using AUTOCONF environment variable override: $AUTOCONF"
-fi
-
-_report_error=no
-if [ ! "x$_acfound" = "xyes" ] ; then
- $ECHO "ERROR: Unable to locate GNU Autoconf."
- _report_error=yes
-else
- _version="`$AUTOCONF --version | head -${HEAD_N}1 | sed 's/[^0-9]*\([0-9\.][0-9\.]*\)/\1/'`"
- if [ "x$_version" = "x" ] ; then
- _version="0.0.0"
- fi
- $ECHO "Found GNU Autoconf version $_version"
- version_check "$AUTOCONF_VERSION" "$_version"
- if [ $? -ne 0 ] ; then
- _report_error=yes
- fi
-fi
-if [ "x$_report_error" = "xyes" ] ; then
- version_error "$AUTOCONF_VERSION" "GNU Autoconf"
- exit 1
-fi
-
-
-##########################
-# automake version check #
-##########################
-_amfound=no
-if [ "x$AUTOMAKE" = "x" ] ; then
- for AUTOMAKE in automake ; do
- $VERBOSE_ECHO "Checking automake version: $AUTOMAKE --version"
- $AUTOMAKE --version > /dev/null 2>&1
- if [ $? = 0 ] ; then
- _amfound=yes
- break
- fi
- done
-else
- _amfound=yes
- $ECHO "Using AUTOMAKE environment variable override: $AUTOMAKE"
-fi
-
-
-_report_error=no
-if [ ! "x$_amfound" = "xyes" ] ; then
- $ECHO
- $ECHO "ERROR: Unable to locate GNU Automake."
- _report_error=yes
-else
- _version="`$AUTOMAKE --version | head -${HEAD_N}1 | sed 's/[^0-9]*\([0-9\.][0-9\.]*\)/\1/'`"
- if [ "x$_version" = "x" ] ; then
- _version="0.0.0"
- fi
- $ECHO "Found GNU Automake version $_version"
- version_check "$AUTOMAKE_VERSION" "$_version"
- if [ $? -ne 0 ] ; then
- _report_error=yes
- fi
-fi
-if [ "x$_report_error" = "xyes" ] ; then
- version_error "$AUTOMAKE_VERSION" "GNU Automake"
- exit 1
-fi
-
-
-########################
-# check for libtoolize #
-########################
-HAVE_LIBTOOLIZE=yes
-HAVE_ALT_LIBTOOLIZE=no
-_ltfound=no
-if [ "x$LIBTOOLIZE" = "x" ] ; then
- LIBTOOLIZE=libtoolize
- $VERBOSE_ECHO "Checking libtoolize version: $LIBTOOLIZE --version"
- $LIBTOOLIZE --version > /dev/null 2>&1
- if [ ! $? = 0 ] ; then
- HAVE_LIBTOOLIZE=no
- $ECHO
- if [ "x$HAVE_AUTORECONF" = "xno" ] ; then
- $ECHO "Warning: libtoolize does not appear to be available."
- else
- $ECHO "Warning: libtoolize does not appear to be available. This means that"
- $ECHO "the automatic build preparation via autoreconf will probably not work."
- $ECHO "Preparing the build by running each step individually, however, should"
- $ECHO "work and will be done automatically for you if autoreconf fails."
- fi
-
- # look for some alternates
- for tool in glibtoolize libtoolize15 libtoolize14 libtoolize13 ; do
- $VERBOSE_ECHO "Checking libtoolize alternate: $tool --version"
- _glibtoolize="`$tool --version > /dev/null 2>&1`"
- if [ $? = 0 ] ; then
- $VERBOSE_ECHO "Found $tool --version"
- _glti="`which $tool`"
- if [ "x$_glti" = "x" ] ; then
- $VERBOSE_ECHO "Cannot find $tool with which"
- continue;
- fi
- if test ! -f "$_glti" ; then
- $VERBOSE_ECHO "Cannot use $tool, $_glti is not a file"
- continue;
- fi
- _gltidir="`dirname $_glti`"
- if [ "x$_gltidir" = "x" ] ; then
- $VERBOSE_ECHO "Cannot find $tool path with dirname of $_glti"
- continue;
- fi
- if test ! -d "$_gltidir" ; then
- $VERBOSE_ECHO "Cannot use $tool, $_gltidir is not a directory"
- continue;
- fi
- HAVE_ALT_LIBTOOLIZE=yes
- LIBTOOLIZE="$tool"
- $ECHO
- $ECHO "Fortunately, $tool was found which means that your system may simply"
- $ECHO "have a non-standard or incomplete GNU Autotools install. If you have"
- $ECHO "sufficient system access, it may be possible to quell this warning by"
- $ECHO "running:"
- $ECHO
- sudo -V > /dev/null 2>&1
- if [ $? = 0 ] ; then
- $ECHO " sudo ln -s $_glti $_gltidir/libtoolize"
- $ECHO
- else
- $ECHO " ln -s $_glti $_gltidir/libtoolize"
- $ECHO
- $ECHO "Run that as root or with proper permissions to the $_gltidir directory"
- $ECHO
- fi
- _ltfound=yes
- break
- fi
- done
- else
- _ltfound=yes
- fi
-else
- _ltfound=yes
- $ECHO "Using LIBTOOLIZE environment variable override: $LIBTOOLIZE"
-fi
-
-
-############################
-# libtoolize version check #
-############################
-_report_error=no
-if [ ! "x$_ltfound" = "xyes" ] ; then
- $ECHO
- $ECHO "ERROR: Unable to locate GNU Libtool."
- _report_error=yes
-else
- _version="`$LIBTOOLIZE --version | head -${HEAD_N}1 | sed 's/[^0-9]*\([0-9\.][0-9\.]*\)/\1/'`"
- if [ "x$_version" = "x" ] ; then
- _version="0.0.0"
- fi
- $ECHO "Found GNU Libtool version $_version"
- version_check "$LIBTOOL_VERSION" "$_version"
- if [ $? -ne 0 ] ; then
- _report_error=yes
- fi
-fi
-if [ "x$_report_error" = "xyes" ] ; then
- version_error "$LIBTOOL_VERSION" "GNU Libtool"
- exit 1
-fi
-
-
-#####################
-# check for aclocal #
-#####################
-if [ "x$ACLOCAL" = "x" ] ; then
- for ACLOCAL in aclocal ; do
- $VERBOSE_ECHO "Checking aclocal version: $ACLOCAL --version"
- $ACLOCAL --version > /dev/null 2>&1
- if [ $? = 0 ] ; then
- break
- fi
- done
-else
- $ECHO "Using ACLOCAL environment variable override: $ACLOCAL"
-fi
-
-
-########################
-# check for autoheader #
-########################
-if [ "x$AUTOHEADER" = "x" ] ; then
- for AUTOHEADER in autoheader ; do
- $VERBOSE_ECHO "Checking autoheader version: $AUTOHEADER --version"
- $AUTOHEADER --version > /dev/null 2>&1
- if [ $? = 0 ] ; then
- break
- fi
- done
-else
- $ECHO "Using AUTOHEADER environment variable override: $AUTOHEADER"
-fi
-
-
-#########################
-# check if version only #
-#########################
-$VERBOSE_ECHO "Checking whether to only output version information"
-if [ "x$VERSION_ONLY" = "xyes" ] ; then
- $ECHO
- ident
- $ECHO "---"
- $ECHO "Version requested. No preparation or configuration will be performed."
- exit 0
-fi
-
-
-#################################
-# PROTECT_FROM_CLOBBER FUNCTION #
-#################################
-protect_from_clobber ( ) {
- PFC_INIT=1
-
- # protect COPYING & INSTALL from overwrite by automake. the
- # automake force option will (inappropriately) ignore the existing
- # contents of a COPYING and/or INSTALL files (depending on the
- # version) instead of just forcing *missing* files like it does
- # for AUTHORS, NEWS, and README. this is broken but extremely
- # prevalent behavior, so we protect against it by keeping a backup
- # of the file that can later be restored.
-
- for file in COPYING INSTALL ; do
- if test -f ${file} ; then
- if test -f ${file}.$$.protect_from_automake.backup ; then
- $VERBOSE_ECHO "Already backed up ${file} in `pwd`"
- else
- $VERBOSE_ECHO "Backing up ${file} in `pwd`"
- $VERBOSE_ECHO "cp -p ${file} ${file}.$$.protect_from_automake.backup"
- cp -p ${file} ${file}.$$.protect_from_automake.backup
- fi
- fi
- done
-}
-
-
-##############################
-# RECURSIVE_PROTECT FUNCTION #
-##############################
-recursive_protect ( ) {
-
- # for projects using recursive configure, run the build
- # preparation steps for the subdirectories. this function assumes
- # START_PATH was set to pwd before recursion begins so that
- # relative paths work.
-
- # git 'r done, protect COPYING and INSTALL from being clobbered
- protect_from_clobber
-
- if test -d autom4te.cache ; then
- $VERBOSE_ECHO "Found an autom4te.cache directory, deleting it"
- $VERBOSE_ECHO "rm -rf autom4te.cache"
- rm -rf autom4te.cache
- fi
-
- # find configure template
- _configure="`locate_configure_template`"
- if [ "x$_configure" = "x" ] ; then
- return
- fi
- # $VERBOSE_ECHO "Looking for configure template found `pwd`/$_configure"
-
- # look for subdirs
- # $VERBOSE_ECHO "Looking for subdirs in `pwd`"
- _det_config_subdirs="`grep AC_CONFIG_SUBDIRS $_configure | grep -v '.*#.*AC_CONFIG_SUBDIRS' | sed 's/^[ ]*AC_CONFIG_SUBDIRS(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`"
- CHECK_DIRS=""
- for dir in $_det_config_subdirs ; do
- if test -d "`pwd`/$dir" ; then
- CHECK_DIRS="$CHECK_DIRS \"`pwd`/$dir\""
- fi
- done
-
- # process subdirs
- if [ ! "x$CHECK_DIRS" = "x" ] ; then
- $VERBOSE_ECHO "Recursively scanning the following directories:"
- $VERBOSE_ECHO " $CHECK_DIRS"
- for dir in $CHECK_DIRS ; do
- $VERBOSE_ECHO "Protecting files from automake in $dir"
- cd "$START_PATH"
- eval "cd $dir"
-
- # recursively git 'r done
- recursive_protect
- done
- fi
-} # end of recursive_protect
-
-
-#############################
-# RESTORE_CLOBBERED FUNCION #
-#############################
-restore_clobbered ( ) {
-
- # The automake (and autoreconf by extension) -f/--force-missing
- # option may overwrite COPYING and INSTALL even if they do exist.
- # Here we restore the files if necessary.
-
- spacer=no
-
- for file in COPYING INSTALL ; do
- if test -f ${file}.$$.protect_from_automake.backup ; then
- if test -f ${file} ; then
- # compare entire content, restore if needed
- if test "x`cat ${file}`" != "x`cat ${file}.$$.protect_from_automake.backup`" ; then
- if test "x$spacer" = "xno" ; then
- $VERBOSE_ECHO
- spacer=yes
- fi
- # restore the backup
- $VERBOSE_ECHO "Restoring ${file} from backup (automake -f likely clobbered it)"
- $VERBOSE_ECHO "rm -f ${file}"
- rm -f ${file}
- $VERBOSE_ECHO "mv ${file}.$$.protect_from_automake.backup ${file}"
- mv ${file}.$$.protect_from_automake.backup ${file}
- fi # check contents
- elif test -f ${file}.$$.protect_from_automake.backup ; then
- $VERBOSE_ECHO "mv ${file}.$$.protect_from_automake.backup ${file}"
- mv ${file}.$$.protect_from_automake.backup ${file}
- fi # -f ${file}
-
- # just in case
- $VERBOSE_ECHO "rm -f ${file}.$$.protect_from_automake.backup"
- rm -f ${file}.$$.protect_from_automake.backup
- fi # -f ${file}.$$.protect_from_automake.backup
- done
-
- CONFIGURE="`locate_configure_template`"
- if [ "x$CONFIGURE" = "x" ] ; then
- return
- fi
-
- _aux_dir="`grep AC_CONFIG_AUX_DIR $CONFIGURE | grep -v '.*#.*AC_CONFIG_AUX_DIR' | tail -${TAIL_N}1 | sed 's/^[ ]*AC_CONFIG_AUX_DIR(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`"
- if test ! -d "$_aux_dir" ; then
- _aux_dir=.
- fi
-
- for file in config.guess config.sub ltmain.sh ; do
- if test -f "${_aux_dir}/${file}" ; then
- $VERBOSE_ECHO "rm -f \"${_aux_dir}/${file}.backup\""
- rm -f "${_aux_dir}/${file}.backup"
- fi
- done
-} # end of restore_clobbered
-
-
-##############################
-# RECURSIVE_RESTORE FUNCTION #
-##############################
-recursive_restore ( ) {
-
- # restore COPYING and INSTALL from backup if they were clobbered
- # for each directory recursively.
-
- # git 'r undone
- restore_clobbered
-
- # find configure template
- _configure="`locate_configure_template`"
- if [ "x$_configure" = "x" ] ; then
- return
- fi
-
- # look for subdirs
- _det_config_subdirs="`grep AC_CONFIG_SUBDIRS $_configure | grep -v '.*#.*AC_CONFIG_SUBDIRS' | sed 's/^[ ]*AC_CONFIG_SUBDIRS(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`"
- CHECK_DIRS=""
- for dir in $_det_config_subdirs ; do
- if test -d "`pwd`/$dir" ; then
- CHECK_DIRS="$CHECK_DIRS \"`pwd`/$dir\""
- fi
- done
-
- # process subdirs
- if [ ! "x$CHECK_DIRS" = "x" ] ; then
- $VERBOSE_ECHO "Recursively scanning the following directories:"
- $VERBOSE_ECHO " $CHECK_DIRS"
- for dir in $CHECK_DIRS ; do
- $VERBOSE_ECHO "Checking files for automake damage in $dir"
- cd "$START_PATH"
- eval "cd $dir"
-
- # recursively git 'r undone
- recursive_restore
- done
- fi
-} # end of recursive_restore
-
-
-#######################
-# INITIALIZE FUNCTION #
-#######################
-initialize ( ) {
-
- # this routine performs a variety of directory-specific
- # initializations. some are sanity checks, some are preventive,
- # and some are necessary setup detection.
- #
- # this function sets:
- # CONFIGURE
- # SEARCH_DIRS
- # CONFIG_SUBDIRS
-
- ##################################
- # check for a configure template #
- ##################################
- CONFIGURE="`locate_configure_template`"
- if [ "x$CONFIGURE" = "x" ] ; then
- $ECHO
- $ECHO "A configure.ac or configure.in file could not be located implying"
- $ECHO "that the GNU Build System is at least not used in this directory. In"
- $ECHO "any case, there is nothing to do here without one of those files."
- $ECHO
- $ECHO "ERROR: No configure.in or configure.ac file found in `pwd`"
- exit 1
- fi
-
- #####################
- # detect an aux dir #
- #####################
- _aux_dir="`grep AC_CONFIG_AUX_DIR $CONFIGURE | grep -v '.*#.*AC_CONFIG_AUX_DIR' | tail -${TAIL_N}1 | sed 's/^[ ]*AC_CONFIG_AUX_DIR(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`"
- if test ! -d "$_aux_dir" ; then
- _aux_dir=.
- else
- $VERBOSE_ECHO "Detected auxillary directory: $_aux_dir"
- fi
-
- ################################
- # detect a recursive configure #
- ################################
- CONFIG_SUBDIRS=""
- _det_config_subdirs="`grep AC_CONFIG_SUBDIRS $CONFIGURE | grep -v '.*#.*AC_CONFIG_SUBDIRS' | sed 's/^[ ]*AC_CONFIG_SUBDIRS(\(.*\)).*/\1/' | sed 's/.*\[\(.*\)\].*/\1/'`"
- for dir in $_det_config_subdirs ; do
- if test -d "`pwd`/$dir" ; then
- $VERBOSE_ECHO "Detected recursive configure directory: `pwd`/$dir"
- CONFIG_SUBDIRS="$CONFIG_SUBDIRS `pwd`/$dir"
- fi
- done
-
- ###########################################################
- # make sure certain required files exist for GNU projects #
- ###########################################################
- _marker_found=""
- _marker_found_message_intro='Detected non-GNU marker "'
- _marker_found_message_mid='" in '
- for marker in foreign cygnus ; do
- _marker_found_message=${_marker_found_message_intro}${marker}${_marker_found_message_mid}
- _marker_found="`grep 'AM_INIT_AUTOMAKE.*'${marker} $CONFIGURE`"
- if [ ! "x$_marker_found" = "x" ] ; then
- $VERBOSE_ECHO "${_marker_found_message}`basename \"$CONFIGURE\"`"
- break
- fi
- if test -f "`dirname \"$CONFIGURE\"/Makefile.am`" ; then
- _marker_found="`grep 'AUTOMAKE_OPTIONS.*'${marker} Makefile.am`"
- if [ ! "x$_marker_found" = "x" ] ; then
- $VERBOSE_ECHO "${_marker_found_message}Makefile.am"
- break
- fi
- fi
- done
- if [ "x${_marker_found}" = "x" ] ; then
- _suggest_foreign=no
- for file in AUTHORS COPYING ChangeLog INSTALL NEWS README ; do
- if [ ! -f $file ] ; then
- $VERBOSE_ECHO "Touching ${file} since it does not exist"
- _suggest_foreign=yes
- touch $file
- fi
- done
-
- if [ "x${_suggest_foreign}" = "xyes" ] ; then
- $ECHO
- $ECHO "Warning: Several files expected of projects that conform to the GNU"
- $ECHO "coding standards were not found. The files were automatically added"
- $ECHO "for you since you do not have a 'foreign' declaration specified."
- $ECHO
- $ECHO "Considered adding 'foreign' to AM_INIT_AUTOMAKE in `basename \"$CONFIGURE\"`"
- if test -f "`dirname \"$CONFIGURE\"/Makefile.am`" ; then
- $ECHO "or to AUTOMAKE_OPTIONS in your top-level Makefile.am file."
- fi
- $ECHO
- fi
- fi
-
- ##################################################
- # make sure certain generated files do not exist #
- ##################################################
- for file in config.guess config.sub ltmain.sh ; do
- if test -f "${_aux_dir}/${file}" ; then
- $VERBOSE_ECHO "mv -f \"${_aux_dir}/${file}\" \"${_aux_dir}/${file}.backup\""
- mv -f "${_aux_dir}/${file}" "${_aux_dir}/${file}.backup"
- fi
- done
-
- ############################
- # search alternate m4 dirs #
- ############################
- SEARCH_DIRS=""
- for dir in m4 ; do
- if [ -d $dir ] ; then
- $VERBOSE_ECHO "Found extra aclocal search directory: $dir"
- SEARCH_DIRS="$SEARCH_DIRS -I $dir"
- fi
- done
-
- ######################################
- # remove any previous build products #
- ######################################
- if test -d autom4te.cache ; then
- $VERBOSE_ECHO "Found an autom4te.cache directory, deleting it"
- $VERBOSE_ECHO "rm -rf autom4te.cache"
- rm -rf autom4te.cache
- fi
-# tcl/tk (and probably others) have a customized aclocal.m4, so can't delete it
-# if test -f aclocal.m4 ; then
-# $VERBOSE_ECHO "Found an aclocal.m4 file, deleting it"
-# $VERBOSE_ECHO "rm -f aclocal.m4"
-# rm -f aclocal.m4
-# fi
-
-} # end of initialize()
-
-
-##############
-# initialize #
-##############
-
-# stash path
-START_PATH="`pwd`"
-
-# Before running autoreconf or manual steps, some prep detection work
-# is necessary or useful. Only needs to occur once per directory, but
-# does need to traverse the entire subconfigure hierarchy to protect
-# files from being clobbered even by autoreconf.
-recursive_protect
-
-# start from where we started
-cd "$START_PATH"
-
-# get ready to process
-initialize
-
-
-#########################################
-# DOWNLOAD_GNULIB_CONFIG_GUESS FUNCTION #
-#########################################
-
-# TODO - should make sure wget/curl exist and/or work before trying to
-# use them.
-
-download_gnulib_config_guess () {
- # abuse gitweb to download gnulib's latest config.guess via HTTP
- config_guess_temp="config.guess.$$.download"
- ret=1
- for __cmd in wget curl fetch ; do
- $VERBOSE_ECHO "Checking for command ${__cmd}"
- ${__cmd} --version > /dev/null 2>&1
- ret=$?
- if [ ! $ret = 0 ] ; then
- continue
- fi
-
- __cmd_version=`${__cmd} --version | head -n 1 | sed -e 's/^[^0-9]\+//' -e 's/ .*//'`
- $VERBOSE_ECHO "Found ${__cmd} ${__cmd_version}"
-
- opts=""
- case ${__cmd} in
- wget)
- opts="-O"
- ;;
- curl)
- opts="-o"
- ;;
- fetch)
- opts="-t 5 -f"
- ;;
- esac
-
- $VERBOSE_ECHO "Running $__cmd \"${CONFIG_GUESS_URL}\" $opts \"${config_guess_temp}\""
- eval "$__cmd \"${CONFIG_GUESS_URL}\" $opts \"${config_guess_temp}\"" > /dev/null 2>&1
- if [ $? = 0 ] ; then
- mv -f "${config_guess_temp}" ${_aux_dir}/config.guess
- ret=0
- break
- fi
- done
-
- if [ ! $ret = 0 ] ; then
- $ECHO "Warning: config.guess download failed from: $CONFIG_GUESS_URL"
- rm -f "${config_guess_temp}"
- fi
-}
-
-
-##############################
-# LIBTOOLIZE_NEEDED FUNCTION #
-##############################
-libtoolize_needed () {
- ret=1 # means no, don't need libtoolize
- for feature in AC_PROG_LIBTOOL AM_PROG_LIBTOOL LT_INIT ; do
- $VERBOSE_ECHO "Searching for $feature in $CONFIGURE"
- found="`grep \"^$feature.*\" $CONFIGURE`"
- if [ ! "x$found" = "x" ] ; then
- ret=0 # means yes, need to run libtoolize
- break
- fi
- done
- return ${ret}
-}
-
-
-
-############################################
-# prepare build via autoreconf or manually #
-############################################
-reconfigure_manually=no
-if [ "x$HAVE_AUTORECONF" = "xyes" ] ; then
- $ECHO
- $ECHO $ECHO_N "Automatically preparing build ... $ECHO_C"
-
- $VERBOSE_ECHO "$AUTORECONF $SEARCH_DIRS $AUTORECONF_OPTIONS"
- autoreconf_output="`$AUTORECONF $SEARCH_DIRS $AUTORECONF_OPTIONS 2>&1`"
- ret=$?
- $VERBOSE_ECHO "$autoreconf_output"
-
- if [ ! $ret = 0 ] ; then
- if [ "x$HAVE_ALT_LIBTOOLIZE" = "xyes" ] ; then
- if [ ! "x`echo \"$autoreconf_output\" | grep libtoolize | grep \"No such file or directory\"`" = "x" ] ; then
- $ECHO
- $ECHO "Warning: autoreconf failed but due to what is usually a common libtool"
- $ECHO "misconfiguration issue. This problem is encountered on systems that"
- $ECHO "have installed libtoolize under a different name without providing a"
- $ECHO "symbolic link or without setting the LIBTOOLIZE environment variable."
- $ECHO
- $ECHO "Restarting the preparation steps with LIBTOOLIZE set to $LIBTOOLIZE"
-
- export LIBTOOLIZE
- RUN_RECURSIVE=no
- export RUN_RECURSIVE
- untrap_abnormal
-
- $VERBOSE_ECHO sh $AUTOGEN_SH "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
- sh "$AUTOGEN_SH" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
- exit $?
- fi
- fi
-
- $ECHO "Warning: $AUTORECONF failed"
-
- if test -f ltmain.sh ; then
- $ECHO "libtoolize being run by autoreconf is not creating ltmain.sh in the auxillary directory like it should"
- fi
-
- $ECHO "Attempting to run the preparation steps individually"
- reconfigure_manually=yes
- else
- if [ "x$DOWNLOAD" = "xyes" ] ; then
- if libtoolize_needed ; then
- download_gnulib_config_guess
- fi
- fi
- fi
-else
- reconfigure_manually=yes
-fi
-
-
-############################
-# LIBTOOL_FAILURE FUNCTION #
-############################
-libtool_failure ( ) {
-
- # libtool is rather error-prone in comparison to the other
- # autotools and this routine attempts to compensate for some
- # common failures. the output after a libtoolize failure is
- # parsed for an error related to AC_PROG_LIBTOOL and if found, we
- # attempt to inject a project-provided libtool.m4 file.
-
- _autoconf_output="$1"
-
- if [ "x$RUN_RECURSIVE" = "xno" ] ; then
- # we already tried the libtool.m4, don't try again
- return 1
- fi
-
- if test -f "$LIBTOOL_M4" ; then
- found_libtool="`$ECHO $_autoconf_output | grep AC_PROG_LIBTOOL`"
- if test ! "x$found_libtool" = "x" ; then
- if test -f acinclude.m4 ; then
- rm -f acinclude.m4.$$.backup
- $VERBOSE_ECHO "cat acinclude.m4 > acinclude.m4.$$.backup"
- cat acinclude.m4 > acinclude.m4.$$.backup
- fi
- $VERBOSE_ECHO "cat \"$LIBTOOL_M4\" >> acinclude.m4"
- chmod u+w acinclude.m4
- cat "$LIBTOOL_M4" >> acinclude.m4
-
- # don't keep doing this
- RUN_RECURSIVE=no
- export RUN_RECURSIVE
- untrap_abnormal
-
- $ECHO
- $ECHO "Restarting the preparation steps with libtool macros in acinclude.m4"
- $VERBOSE_ECHO sh $AUTOGEN_SH "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
- sh "$AUTOGEN_SH" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
- exit $?
- fi
- fi
-}
-
-
-###########################
-# MANUAL_AUTOGEN FUNCTION #
-###########################
-manual_autogen ( ) {
-
- ##################################################
- # Manual preparation steps taken are as follows: #
- # aclocal [-I m4] #
- # libtoolize --automake -c -f #
- # aclocal [-I m4] #
- # autoconf -f #
- # autoheader #
- # automake -a -c -f #
- ##################################################
-
- ###########
- # aclocal #
- ###########
- $VERBOSE_ECHO "$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS"
- aclocal_output="`$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS 2>&1`"
- ret=$?
- $VERBOSE_ECHO "$aclocal_output"
- if [ ! $ret = 0 ] ; then $ECHO "ERROR: $ACLOCAL failed" && exit 2 ; fi
-
- ##############
- # libtoolize #
- ##############
- if libtoolize_needed ; then
- if [ "x$HAVE_LIBTOOLIZE" = "xyes" ] ; then
- $VERBOSE_ECHO "$LIBTOOLIZE $LIBTOOLIZE_OPTIONS"
- libtoolize_output="`$LIBTOOLIZE $LIBTOOLIZE_OPTIONS 2>&1`"
- ret=$?
- $VERBOSE_ECHO "$libtoolize_output"
-
- if [ ! $ret = 0 ] ; then $ECHO "ERROR: $LIBTOOLIZE failed" && exit 2 ; fi
- else
- if [ "x$HAVE_ALT_LIBTOOLIZE" = "xyes" ] ; then
- $VERBOSE_ECHO "$LIBTOOLIZE $ALT_LIBTOOLIZE_OPTIONS"
- libtoolize_output="`$LIBTOOLIZE $ALT_LIBTOOLIZE_OPTIONS 2>&1`"
- ret=$?
- $VERBOSE_ECHO "$libtoolize_output"
-
- if [ ! $ret = 0 ] ; then $ECHO "ERROR: $LIBTOOLIZE failed" && exit 2 ; fi
- fi
- fi
-
- ###########
- # aclocal #
- ###########
- # re-run again as instructed by libtoolize
- $VERBOSE_ECHO "$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS"
- aclocal_output="`$ACLOCAL $SEARCH_DIRS $ACLOCAL_OPTIONS 2>&1`"
- ret=$?
- $VERBOSE_ECHO "$aclocal_output"
-
- # libtoolize might put ltmain.sh in the wrong place
- if test -f ltmain.sh ; then
- if test ! -f "${_aux_dir}/ltmain.sh" ; then
- $ECHO
- $ECHO "Warning: $LIBTOOLIZE is creating ltmain.sh in the wrong directory"
- $ECHO
- $ECHO "Fortunately, the problem can be worked around by simply copying the"
- $ECHO "file to the appropriate location (${_aux_dir}/). This has been done for you."
- $ECHO
- $VERBOSE_ECHO "cp -p ltmain.sh \"${_aux_dir}/ltmain.sh\""
- cp -p ltmain.sh "${_aux_dir}/ltmain.sh"
- $ECHO $ECHO_N "Continuing build preparation ... $ECHO_C"
- fi
- fi # ltmain.sh
-
- if [ "x$DOWNLOAD" = "xyes" ] ; then
- download_gnulib_config_guess
- fi
- fi # libtoolize_needed
-
- ############
- # autoconf #
- ############
- $VERBOSE_ECHO
- $VERBOSE_ECHO "$AUTOCONF $AUTOCONF_OPTIONS"
- autoconf_output="`$AUTOCONF $AUTOCONF_OPTIONS 2>&1`"
- ret=$?
- $VERBOSE_ECHO "$autoconf_output"
-
- if [ ! $ret = 0 ] ; then
- # retry without the -f and check for usage of macros that are too new
- ac2_59_macros="AC_C_RESTRICT AC_INCLUDES_DEFAULT AC_LANG_ASSERT AC_LANG_WERROR AS_SET_CATFILE"
- ac2_55_macros="AC_COMPILER_IFELSE AC_FUNC_MBRTOWC AC_HEADER_STDBOOL AC_LANG_CONFTEST AC_LANG_SOURCE AC_LANG_PROGRAM AC_LANG_CALL AC_LANG_FUNC_TRY_LINK AC_MSG_FAILURE AC_PREPROC_IFELSE"
- ac2_54_macros="AC_C_BACKSLASH_A AC_CONFIG_LIBOBJ_DIR AC_GNU_SOURCE AC_PROG_EGREP AC_PROG_FGREP AC_REPLACE_FNMATCH AC_FUNC_FNMATCH_GNU AC_FUNC_REALLOC AC_TYPE_MBSTATE_T"
-
- macros_to_search=""
- ac_major="`echo ${AUTOCONF_VERSION}. | cut -d. -f1 | sed 's/[^0-9]//g'`"
- ac_minor="`echo ${AUTOCONF_VERSION}. | cut -d. -f2 | sed 's/[^0-9]//g'`"
-
- if [ $ac_major -lt 2 ] ; then
- macros_to_search="$ac2_59_macros $ac2_55_macros $ac2_54_macros"
- else
- if [ $ac_minor -lt 54 ] ; then
- macros_to_search="$ac2_59_macros $ac2_55_macros $ac2_54_macros"
- elif [ $ac_minor -lt 55 ] ; then
- macros_to_search="$ac2_59_macros $ac2_55_macros"
- elif [ $ac_minor -lt 59 ] ; then
- macros_to_search="$ac2_59_macros"
- fi
- fi
-
- configure_ac_macros=__none__
- for feature in $macros_to_search ; do
- $VERBOSE_ECHO "Searching for $feature in $CONFIGURE"
- found="`grep \"^$feature.*\" $CONFIGURE`"
- if [ ! "x$found" = "x" ] ; then
- if [ "x$configure_ac_macros" = "x__none__" ] ; then
- configure_ac_macros="$feature"
- else
- configure_ac_macros="$feature $configure_ac_macros"
- fi
- fi
- done
- if [ ! "x$configure_ac_macros" = "x__none__" ] ; then
- $ECHO
- $ECHO "Warning: Unsupported macros were found in $CONFIGURE"
- $ECHO
- $ECHO "The `basename \"$CONFIGURE\"` file was scanned in order to determine if any"
- $ECHO "unsupported macros are used that exceed the minimum version"
- $ECHO "settings specified within this file. As such, the following macros"
- $ECHO "should be removed from configure.ac or the version numbers in this"
- $ECHO "file should be increased:"
- $ECHO
- $ECHO "$configure_ac_macros"
- $ECHO
- $ECHO $ECHO_N "Ignorantly continuing build preparation ... $ECHO_C"
- fi
-
- ###################
- # autoconf, retry #
- ###################
- $VERBOSE_ECHO
- $VERBOSE_ECHO "$AUTOCONF"
- autoconf_output="`$AUTOCONF 2>&1`"
- ret=$?
- $VERBOSE_ECHO "$autoconf_output"
-
- if [ ! $ret = 0 ] ; then
- # test if libtool is busted
- libtool_failure "$autoconf_output"
-
- # let the user know what went wrong
- cat <= 2.5.0, [with_libagg=yes], [with_libagg=no])
-
-if test "$with_libagg" != "yes"; then
- AC_MSG_FAILURE([You must have AGG installed: http://vector-agg.sourceforge.net/])
-fi
-
-AC_OUTPUT([
-Makefile
-src/wxAGG/Makefile
-src/xpm/Makefile
-src/Makefile
-])
diff --git a/contrib/assdraw/m4/wxwin.m4 b/contrib/assdraw/m4/wxwin.m4
deleted file mode 100644
index 1c50dcc27..000000000
--- a/contrib/assdraw/m4/wxwin.m4
+++ /dev/null
@@ -1,1060 +0,0 @@
-dnl ---------------------------------------------------------------------------
-dnl Author: wxWidgets development team,
-dnl Francesco Montorsi,
-dnl Bob McCown (Mac-testing)
-dnl Creation date: 24/11/2001
-dnl RCS-ID: $Id$
-dnl ---------------------------------------------------------------------------
-
-dnl ===========================================================================
-dnl Table of Contents of this macro file:
-dnl -------------------------------------
-dnl
-dnl SECTION A: wxWidgets main macros
-dnl - WX_CONFIG_OPTIONS
-dnl - WX_CONFIG_CHECK
-dnl - WXRC_CHECK
-dnl - WX_STANDARD_OPTIONS
-dnl - WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS
-dnl - WX_DETECT_STANDARD_OPTION_VALUES
-dnl
-dnl SECTION B: wxWidgets-related utilities
-dnl - WX_LIKE_LIBNAME
-dnl - WX_ARG_ENABLE_YESNOAUTO
-dnl - WX_ARG_WITH_YESNOAUTO
-dnl
-dnl SECTION C: messages to the user
-dnl - WX_STANDARD_OPTIONS_SUMMARY_MSG
-dnl - WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN
-dnl - WX_STANDARD_OPTIONS_SUMMARY_MSG_END
-dnl - WX_BOOLOPT_SUMMARY
-dnl
-dnl The special "WX_DEBUG_CONFIGURE" variable can be set to 1 to enable extra
-dnl debug output on stdout from these macros.
-dnl ===========================================================================
-
-
-dnl ---------------------------------------------------------------------------
-dnl Macros for wxWidgets detection. Typically used in configure.in as:
-dnl
-dnl AC_ARG_ENABLE(...)
-dnl AC_ARG_WITH(...)
-dnl ...
-dnl WX_CONFIG_OPTIONS
-dnl ...
-dnl ...
-dnl WX_CONFIG_CHECK([2.6.0], [wxWin=1])
-dnl if test "$wxWin" != 1; then
-dnl AC_MSG_ERROR([
-dnl wxWidgets must be installed on your system
-dnl but wx-config script couldn't be found.
-dnl
-dnl Please check that wx-config is in path, the directory
-dnl where wxWidgets libraries are installed (returned by
-dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or
-dnl equivalent variable and wxWidgets version is 2.3.4 or above.
-dnl ])
-dnl fi
-dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
-dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
-dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
-dnl
-dnl LIBS="$LIBS $WX_LIBS"
-dnl
-dnl If you want to support standard --enable-debug/unicode/shared options, you
-dnl may do the following:
-dnl
-dnl ...
-dnl AC_CANONICAL_SYSTEM
-dnl
-dnl # define configure options
-dnl WX_CONFIG_OPTIONS
-dnl WX_STANDARD_OPTIONS([debug,unicode,shared,toolkit,wxshared])
-dnl
-dnl # basic configure checks
-dnl ...
-dnl
-dnl # we want to always have DEBUG==WX_DEBUG and UNICODE==WX_UNICODE
-dnl WX_DEBUG=$DEBUG
-dnl WX_UNICODE=$UNICODE
-dnl
-dnl WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS
-dnl WX_CONFIG_CHECK([2.8.0], [wxWin=1],,[html,core,net,base],[$WXCONFIG_FLAGS])
-dnl WX_DETECT_STANDARD_OPTION_VALUES
-dnl
-dnl # write the output files
-dnl AC_CONFIG_FILES([Makefile ...])
-dnl AC_OUTPUT
-dnl
-dnl # optional: just to show a message to the user
-dnl WX_STANDARD_OPTIONS_SUMMARY_MSG
-dnl
-dnl ---------------------------------------------------------------------------
-
-
-dnl ---------------------------------------------------------------------------
-dnl WX_CONFIG_OPTIONS
-dnl
-dnl adds support for --wx-prefix, --wx-exec-prefix, --with-wxdir and
-dnl --wx-config command line options
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([WX_CONFIG_OPTIONS],
-[
- AC_ARG_WITH(wxdir,
- [ --with-wxdir=PATH Use uninstalled version of wxWidgets in PATH],
- [ wx_config_name="$withval/wx-config"
- wx_config_args="--inplace"])
- AC_ARG_WITH(wx-config,
- [ --with-wx-config=CONFIG wx-config script to use (optional)],
- wx_config_name="$withval" )
- AC_ARG_WITH(wx-prefix,
- [ --with-wx-prefix=PREFIX Prefix where wxWidgets is installed (optional)],
- wx_config_prefix="$withval", wx_config_prefix="")
- AC_ARG_WITH(wx-exec-prefix,
- [ --with-wx-exec-prefix=PREFIX
- Exec prefix where wxWidgets is installed (optional)],
- wx_config_exec_prefix="$withval", wx_config_exec_prefix="")
-])
-
-dnl Helper macro for checking if wx version is at least $1.$2.$3, set's
-dnl wx_ver_ok=yes if it is:
-AC_DEFUN([_WX_PRIVATE_CHECK_VERSION],
-[
- wx_ver_ok=""
- if test "x$WX_VERSION" != x ; then
- if test $wx_config_major_version -gt $1; then
- wx_ver_ok=yes
- else
- if test $wx_config_major_version -eq $1; then
- if test $wx_config_minor_version -gt $2; then
- wx_ver_ok=yes
- else
- if test $wx_config_minor_version -eq $2; then
- if test $wx_config_micro_version -ge $3; then
- wx_ver_ok=yes
- fi
- fi
- fi
- fi
- fi
- fi
-])
-
-dnl ---------------------------------------------------------------------------
-dnl WX_CONFIG_CHECK(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
-dnl [, WX-LIBS [, ADDITIONAL-WX-CONFIG-FLAGS]]]])
-dnl
-dnl Test for wxWidgets, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC
-dnl (the latter is for static linking against wxWidgets). Set WX_CONFIG_NAME
-dnl environment variable to override the default name of the wx-config script
-dnl to use. Set WX_CONFIG_PATH to specify the full path to wx-config - in this
-dnl case the macro won't even waste time on tests for its existence.
-dnl
-dnl Optional WX-LIBS argument contains comma- or space-separated list of
-dnl wxWidgets libraries to link against. If it is not specified then WX_LIBS
-dnl and WX_LIBS_STATIC will contain flags to link with all of the core
-dnl wxWidgets libraries.
-dnl
-dnl Optional ADDITIONAL-WX-CONFIG-FLAGS argument is appended to wx-config
-dnl invocation command in present. It can be used to fine-tune lookup of
-dnl best wxWidgets build available.
-dnl
-dnl Example use:
-dnl WX_CONFIG_CHECK([2.6.0], [wxWin=1], [wxWin=0], [html,core,net]
-dnl [--unicode --debug])
-dnl ---------------------------------------------------------------------------
-
-dnl
-dnl Get the cflags and libraries from the wx-config script
-dnl
-AC_DEFUN([WX_CONFIG_CHECK],
-[
- dnl do we have wx-config name: it can be wx-config or wxd-config or ...
- if test x${WX_CONFIG_NAME+set} != xset ; then
- WX_CONFIG_NAME=wx-config
- fi
-
- if test "x$wx_config_name" != x ; then
- WX_CONFIG_NAME="$wx_config_name"
- fi
-
- dnl deal with optional prefixes
- if test x$wx_config_exec_prefix != x ; then
- wx_config_args="$wx_config_args --exec-prefix=$wx_config_exec_prefix"
- WX_LOOKUP_PATH="$wx_config_exec_prefix/bin"
- fi
- if test x$wx_config_prefix != x ; then
- wx_config_args="$wx_config_args --prefix=$wx_config_prefix"
- WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin"
- fi
- if test "$cross_compiling" = "yes"; then
- wx_config_args="$wx_config_args --host=$host_alias"
- fi
-
- dnl don't search the PATH if WX_CONFIG_NAME is absolute filename
- if test -x "$WX_CONFIG_NAME" ; then
- AC_MSG_CHECKING(for wx-config)
- WX_CONFIG_PATH="$WX_CONFIG_NAME"
- AC_MSG_RESULT($WX_CONFIG_PATH)
- else
- AC_PATH_PROG(WX_CONFIG_PATH, $WX_CONFIG_NAME, no, "$WX_LOOKUP_PATH:$PATH")
- fi
-
- if test "$WX_CONFIG_PATH" != "no" ; then
- WX_VERSION=""
-
- min_wx_version=ifelse([$1], ,2.2.1,$1)
- if test -z "$5" ; then
- AC_MSG_CHECKING([for wxWidgets version >= $min_wx_version])
- else
- AC_MSG_CHECKING([for wxWidgets version >= $min_wx_version ($5)])
- fi
-
- dnl don't add the libraries ($4) to this variable as this would result in
- dnl an error when it's used with --version below
- WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args $5"
-
- WX_VERSION=`$WX_CONFIG_WITH_ARGS --version 2>/dev/null`
- wx_config_major_version=`echo $WX_VERSION | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
- wx_config_minor_version=`echo $WX_VERSION | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
- wx_config_micro_version=`echo $WX_VERSION | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
-
- wx_requested_major_version=`echo $min_wx_version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
- wx_requested_minor_version=`echo $min_wx_version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
- wx_requested_micro_version=`echo $min_wx_version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
-
- _WX_PRIVATE_CHECK_VERSION([$wx_requested_major_version],
- [$wx_requested_minor_version],
- [$wx_requested_micro_version])
-
- if test -n "$wx_ver_ok"; then
- AC_MSG_RESULT(yes (version $WX_VERSION))
- WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs $4`
-
- dnl is this even still appropriate? --static is a real option now
- dnl and WX_CONFIG_WITH_ARGS is likely to contain it if that is
- dnl what the user actually wants, making this redundant at best.
- dnl For now keep it in case anyone actually used it in the past.
- AC_MSG_CHECKING([for wxWidgets static library])
- WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs $4 2>/dev/null`
- if test "x$WX_LIBS_STATIC" = "x"; then
- AC_MSG_RESULT(no)
- else
- AC_MSG_RESULT(yes)
- fi
-
- dnl starting with version 2.2.6 wx-config has --cppflags argument
- wx_has_cppflags=""
- if test $wx_config_major_version -gt 2; then
- wx_has_cppflags=yes
- else
- if test $wx_config_major_version -eq 2; then
- if test $wx_config_minor_version -gt 2; then
- wx_has_cppflags=yes
- else
- if test $wx_config_minor_version -eq 2; then
- if test $wx_config_micro_version -ge 6; then
- wx_has_cppflags=yes
- fi
- fi
- fi
- fi
- fi
-
- dnl starting with version 2.7.0 wx-config has --rescomp option
- wx_has_rescomp=""
- if test $wx_config_major_version -gt 2; then
- wx_has_rescomp=yes
- else
- if test $wx_config_major_version -eq 2; then
- if test $wx_config_minor_version -ge 7; then
- wx_has_rescomp=yes
- fi
- fi
- fi
- if test "x$wx_has_rescomp" = x ; then
- dnl cannot give any useful info for resource compiler
- WX_RESCOMP=
- else
- WX_RESCOMP=`$WX_CONFIG_WITH_ARGS --rescomp`
- fi
-
- if test "x$wx_has_cppflags" = x ; then
- dnl no choice but to define all flags like CFLAGS
- WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags $4`
- WX_CPPFLAGS=$WX_CFLAGS
- WX_CXXFLAGS=$WX_CFLAGS
-
- WX_CFLAGS_ONLY=$WX_CFLAGS
- WX_CXXFLAGS_ONLY=$WX_CFLAGS
- else
- dnl we have CPPFLAGS included in CFLAGS included in CXXFLAGS
- WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags $4`
- WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags $4`
- WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags $4`
-
- WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"`
- WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"`
- fi
-
- ifelse([$2], , :, [$2])
-
- else
-
- if test "x$WX_VERSION" = x; then
- dnl no wx-config at all
- AC_MSG_RESULT(no)
- else
- AC_MSG_RESULT(no (version $WX_VERSION is not new enough))
- fi
-
- WX_CFLAGS=""
- WX_CPPFLAGS=""
- WX_CXXFLAGS=""
- WX_LIBS=""
- WX_LIBS_STATIC=""
- WX_RESCOMP=""
-
- if test ! -z "$5"; then
-
- wx_error_message="
- The configuration you asked for $PACKAGE_NAME requires a wxWidgets
- build with the following settings:
- $5
- but such build is not available.
-
- To see the wxWidgets builds available on this system, please use
- 'wx-config --list' command. To use the default build, returned by
- 'wx-config --selected-config', use the options with their 'auto'
- default values."
-
- fi
-
- wx_error_message="
- The requested wxWidgets build couldn't be found.
- $wx_error_message
-
- If you still get this error, then check that 'wx-config' is
- in path, the directory where wxWidgets libraries are installed
- (returned by 'wx-config --libs' command) is in LD_LIBRARY_PATH
- or equivalent variable and wxWidgets version is $1 or above."
-
- ifelse([$3], , AC_MSG_ERROR([$wx_error_message]), [$3])
-
- fi
- else
-
- WX_CFLAGS=""
- WX_CPPFLAGS=""
- WX_CXXFLAGS=""
- WX_LIBS=""
- WX_LIBS_STATIC=""
- WX_RESCOMP=""
-
- ifelse([$3], , :, [$3])
-
- fi
-
- AC_SUBST(WX_CPPFLAGS)
- AC_SUBST(WX_CFLAGS)
- AC_SUBST(WX_CXXFLAGS)
- AC_SUBST(WX_CFLAGS_ONLY)
- AC_SUBST(WX_CXXFLAGS_ONLY)
- AC_SUBST(WX_LIBS)
- AC_SUBST(WX_LIBS_STATIC)
- AC_SUBST(WX_VERSION)
- AC_SUBST(WX_RESCOMP)
-
- dnl need to export also WX_VERSION_MINOR and WX_VERSION_MAJOR symbols
- dnl to support wxpresets bakefiles (we export also WX_VERSION_MICRO for completeness):
- WX_VERSION_MAJOR="$wx_config_major_version"
- WX_VERSION_MINOR="$wx_config_minor_version"
- WX_VERSION_MICRO="$wx_config_micro_version"
- AC_SUBST(WX_VERSION_MAJOR)
- AC_SUBST(WX_VERSION_MINOR)
- AC_SUBST(WX_VERSION_MICRO)
-])
-
-dnl ---------------------------------------------------------------------------
-dnl Get information on the wxrc program for making C++, Python and xrs
-dnl resource files.
-dnl
-dnl AC_ARG_ENABLE(...)
-dnl AC_ARG_WITH(...)
-dnl ...
-dnl WX_CONFIG_OPTIONS
-dnl ...
-dnl WX_CONFIG_CHECK(2.6.0, wxWin=1)
-dnl if test "$wxWin" != 1; then
-dnl AC_MSG_ERROR([
-dnl wxWidgets must be installed on your system
-dnl but wx-config script couldn't be found.
-dnl
-dnl Please check that wx-config is in path, the directory
-dnl where wxWidgets libraries are installed (returned by
-dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or
-dnl equivalent variable and wxWidgets version is 2.6.0 or above.
-dnl ])
-dnl fi
-dnl
-dnl WXRC_CHECK([HAVE_WXRC=1], [HAVE_WXRC=0])
-dnl if test "x$HAVE_WXRC" != x1; then
-dnl AC_MSG_ERROR([
-dnl The wxrc program was not installed or not found.
-dnl
-dnl Please check the wxWidgets installation.
-dnl ])
-dnl fi
-dnl
-dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
-dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
-dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
-dnl
-dnl LDFLAGS="$LDFLAGS $WX_LIBS"
-dnl ---------------------------------------------------------------------------
-
-dnl ---------------------------------------------------------------------------
-dnl WXRC_CHECK([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
-dnl
-dnl Test for wxWidgets' wxrc program for creating either C++, Python or XRS
-dnl resources. The variable WXRC will be set and substituted in the configure
-dnl script and Makefiles.
-dnl
-dnl Example use:
-dnl WXRC_CHECK([wxrc=1], [wxrc=0])
-dnl ---------------------------------------------------------------------------
-
-dnl
-dnl wxrc program from the wx-config script
-dnl
-AC_DEFUN([WXRC_CHECK],
-[
- AC_ARG_VAR([WXRC], [Path to wxWidget's wxrc resource compiler])
-
- if test "x$WX_CONFIG_NAME" = x; then
- AC_MSG_ERROR([The wxrc tests must run after wxWidgets test.])
- else
-
- AC_MSG_CHECKING([for wxrc])
-
- if test "x$WXRC" = x ; then
- dnl wx-config --utility is a new addition to wxWidgets:
- _WX_PRIVATE_CHECK_VERSION(2,5,3)
- if test -n "$wx_ver_ok"; then
- WXRC=`$WX_CONFIG_WITH_ARGS --utility=wxrc`
- fi
- fi
-
- if test "x$WXRC" = x ; then
- AC_MSG_RESULT([not found])
- ifelse([$2], , :, [$2])
- else
- AC_MSG_RESULT([$WXRC])
- ifelse([$1], , :, [$1])
- fi
-
- AC_SUBST(WXRC)
- fi
-])
-
-dnl ---------------------------------------------------------------------------
-dnl WX_LIKE_LIBNAME([output-var] [prefix], [name])
-dnl
-dnl Sets the "output-var" variable to the name of a library named with same
-dnl wxWidgets rule.
-dnl E.g. for output-var=='lib', name=='test', prefix='mine', sets
-dnl the $lib variable to:
-dnl 'mine_gtk2ud_test-2.8'
-dnl if WX_PORT=gtk2, WX_UNICODE=1, WX_DEBUG=1 and WX_RELEASE=28
-dnl ---------------------------------------------------------------------------
-AC_DEFUN([WX_LIKE_LIBNAME],
- [
- wx_temp="$2""_""$WX_PORT"
-
- dnl add the [u][d] string
- if test "$WX_UNICODE" = "1"; then
- wx_temp="$wx_temp""u"
- fi
- if test "$WX_DEBUG" = "1"; then
- wx_temp="$wx_temp""d"
- fi
-
- dnl complete the name of the lib
- wx_temp="$wx_temp""_""$3""-$WX_VERSION_MAJOR.$WX_VERSION_MINOR"
-
- dnl save it in the user's variable
- $1=$wx_temp
- ])
-
-dnl ---------------------------------------------------------------------------
-dnl WX_ARG_ENABLE_YESNOAUTO/WX_ARG_WITH_YESNOAUTO
-dnl
-dnl Two little custom macros which define the ENABLE/WITH configure arguments.
-dnl Macro arguments:
-dnl $1 = the name of the --enable / --with feature
-dnl $2 = the name of the variable associated
-dnl $3 = the description of that feature
-dnl $4 = the default value for that feature
-dnl $5 = additional action to do in case option is given with "yes" value
-dnl ---------------------------------------------------------------------------
-AC_DEFUN([WX_ARG_ENABLE_YESNOAUTO],
- [AC_ARG_ENABLE($1,
- AC_HELP_STRING([--enable-$1], [$3 (default is $4)]),
- [], [enableval="$4"])
-
- dnl Show a message to the user about this option
- AC_MSG_CHECKING([for the --enable-$1 option])
- if test "$enableval" = "yes" ; then
- AC_MSG_RESULT([yes])
- $2=1
- $5
- elif test "$enableval" = "no" ; then
- AC_MSG_RESULT([no])
- $2=0
- elif test "$enableval" = "auto" ; then
- AC_MSG_RESULT([will be automatically detected])
- $2="auto"
- else
- AC_MSG_ERROR([
- Unrecognized option value (allowed values: yes, no, auto)
- ])
- fi
- ])
-
-AC_DEFUN([WX_ARG_WITH_YESNOAUTO],
- [AC_ARG_WITH($1,
- AC_HELP_STRING([--with-$1], [$3 (default is $4)]),
- [], [withval="$4"])
-
- dnl Show a message to the user about this option
- AC_MSG_CHECKING([for the --with-$1 option])
- if test "$withval" = "yes" ; then
- AC_MSG_RESULT([yes])
- $2=1
- $5
- dnl NB: by default we don't allow --with-$1=no option
- dnl since it does not make much sense !
- elif test "$6" = "1" -a "$withval" = "no" ; then
- AC_MSG_RESULT([no])
- $2=0
- elif test "$withval" = "auto" ; then
- AC_MSG_RESULT([will be automatically detected])
- $2="auto"
- else
- AC_MSG_ERROR([
- Unrecognized option value (allowed values: yes, auto)
- ])
- fi
- ])
-
-
-dnl ---------------------------------------------------------------------------
-dnl WX_STANDARD_OPTIONS([options-to-add])
-dnl
-dnl Adds to the configure script one or more of the following options:
-dnl --enable-[debug|unicode|shared|wxshared|wxdebug]
-dnl --with-[gtk|msw|motif|x11|mac|dfb]
-dnl --with-wxversion
-dnl Then checks for their presence and eventually set the DEBUG, UNICODE, SHARED,
-dnl PORT, WX_SHARED, WX_DEBUG, variables to one of the "yes", "no", "auto" values.
-dnl
-dnl Note that e.g. UNICODE != WX_UNICODE; the first is the value of the
-dnl --enable-unicode option (in boolean format) while the second indicates
-dnl if wxWidgets was built in Unicode mode (and still is in boolean format).
-dnl ---------------------------------------------------------------------------
-AC_DEFUN([WX_STANDARD_OPTIONS],
- [
-
- dnl the following lines will expand to WX_ARG_ENABLE_YESNOAUTO calls if and only if
- dnl the $1 argument contains respectively the debug,unicode or shared options.
-
- dnl be careful here not to set debug flag if only "wxdebug" was specified
- ifelse(regexp([$1], [\bdebug]), [-1],,
- [WX_ARG_ENABLE_YESNOAUTO([debug], [DEBUG], [Build in debug mode], [auto])])
-
- ifelse(index([$1], [unicode]), [-1],,
- [WX_ARG_ENABLE_YESNOAUTO([unicode], [UNICODE], [Build in Unicode mode], [auto])])
-
- ifelse(regexp([$1], [\bshared]), [-1],,
- [WX_ARG_ENABLE_YESNOAUTO([shared], [SHARED], [Build as shared library], [auto])])
-
- dnl WX_ARG_WITH_YESNOAUTO cannot be used for --with-toolkit since it's an option
- dnl which must be able to accept the auto|gtk1|gtk2|msw|... values
- ifelse(index([$1], [toolkit]), [-1],,
- [
- AC_ARG_WITH([toolkit],
- AC_HELP_STRING([--with-toolkit],
- [Build against a specific wxWidgets toolkit (default is auto)]),
- [], [withval="auto"])
-
- dnl Show a message to the user about this option
- AC_MSG_CHECKING([for the --with-toolkit option])
- if test "$withval" = "auto" ; then
- AC_MSG_RESULT([will be automatically detected])
- TOOLKIT="auto"
- else
- TOOLKIT="$withval"
-
- dnl PORT must be one of the allowed values
- if test "$TOOLKIT" != "gtk1" -a "$TOOLKIT" != "gtk2" -a \
- "$TOOLKIT" != "msw" -a "$TOOLKIT" != "motif" -a \
- "$TOOLKIT" != "osx_carbon" -a "$TOOLKIT" != "osx_cocoa" -a \
- "$TOOLKIT" != "dfb" -a "$TOOLKIT" != "x11"; then
- AC_MSG_ERROR([
- Unrecognized option value (allowed values: auto, gtk1, gtk2, msw, motif, osx_carbon, osx_cocoa, dfb, x11)
- ])
- fi
-
- AC_MSG_RESULT([$TOOLKIT])
- fi
- ])
-
- dnl ****** IMPORTANT *******
- dnl Unlike for the UNICODE setting, you can build your program in
- dnl shared mode against a static build of wxWidgets. Thus we have the
- dnl following option which allows these mixtures. E.g.
- dnl
- dnl ./configure --disable-shared --with-wxshared
- dnl
- dnl will build your library in static mode against the first available
- dnl shared build of wxWidgets.
- dnl
- dnl Note that's not possible to do the viceversa:
- dnl
- dnl ./configure --enable-shared --without-wxshared
- dnl
- dnl Doing so you would try to build your library in shared mode against a static
- dnl build of wxWidgets. This is not possible (you would mix PIC and non PIC code) !
- dnl A check for this combination of options is in WX_DETECT_STANDARD_OPTION_VALUES
- dnl (where we know what 'auto' should be expanded to).
- dnl
- dnl If you try to build something in ANSI mode against a UNICODE build
- dnl of wxWidgets or in RELEASE mode against a DEBUG build of wxWidgets,
- dnl then at best you'll get ton of linking errors !
- dnl ************************
-
- ifelse(index([$1], [wxshared]), [-1],,
- [
- WX_ARG_WITH_YESNOAUTO(
- [wxshared], [WX_SHARED],
- [Force building against a shared build of wxWidgets, even if --disable-shared is given],
- [auto], [], [1])
- ])
-
- dnl Just like for SHARED and WX_SHARED it may happen that some adventurous
- dnl peoples will want to mix a wxWidgets release build with a debug build of
- dnl his app/lib. So, we have both DEBUG and WX_DEBUG variables.
- ifelse(index([$1], [wxdebug]), [-1],,
- [
- WX_ARG_WITH_YESNOAUTO(
- [wxdebug], [WX_DEBUG],
- [Force building against a debug build of wxWidgets, even if --disable-debug is given],
- [auto], [], [1])
- ])
-
- dnl WX_ARG_WITH_YESNOAUTO cannot be used for --with-wxversion since it's an option
- dnl which accepts the "auto|2.6|2.7|2.8|2.9|3.0" etc etc values
- ifelse(index([$1], [wxversion]), [-1],,
- [
- AC_ARG_WITH([wxversion],
- AC_HELP_STRING([--with-wxversion],
- [Build against a specific version of wxWidgets (default is auto)]),
- [], [withval="auto"])
-
- dnl Show a message to the user about this option
- AC_MSG_CHECKING([for the --with-wxversion option])
- if test "$withval" = "auto" ; then
- AC_MSG_RESULT([will be automatically detected])
- WX_RELEASE="auto"
- else
-
- wx_requested_major_version=`echo $withval | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).*/\1/'`
- wx_requested_minor_version=`echo $withval | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).*/\2/'`
-
- dnl both vars above must be exactly 1 digit
- if test "${#wx_requested_major_version}" != "1" -o \
- "${#wx_requested_minor_version}" != "1" ; then
- AC_MSG_ERROR([
- Unrecognized option value (allowed values: auto, 2.6, 2.7, 2.8, 2.9, 3.0)
- ])
- fi
-
- WX_RELEASE="$wx_requested_major_version"".""$wx_requested_minor_version"
- AC_MSG_RESULT([$WX_RELEASE])
- fi
- ])
-
- if test "$WX_DEBUG_CONFIGURE" = "1"; then
- echo "[[dbg]] DEBUG: $DEBUG, WX_DEBUG: $WX_DEBUG"
- echo "[[dbg]] UNICODE: $UNICODE, WX_UNICODE: $WX_UNICODE"
- echo "[[dbg]] SHARED: $SHARED, WX_SHARED: $WX_SHARED"
- echo "[[dbg]] TOOLKIT: $TOOLKIT, WX_TOOLKIT: $WX_TOOLKIT"
- echo "[[dbg]] VERSION: $VERSION, WX_RELEASE: $WX_RELEASE"
- fi
- ])
-
-
-dnl ---------------------------------------------------------------------------
-dnl WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS
-dnl
-dnl Sets the WXCONFIG_FLAGS string using the SHARED,DEBUG,UNICODE variable values
-dnl which are different from "auto".
-dnl Thus this macro needs to be called only once all options have been set.
-dnl ---------------------------------------------------------------------------
-AC_DEFUN([WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS],
- [
- if test "$WX_SHARED" = "1" ; then
- WXCONFIG_FLAGS="--static=no "
- elif test "$WX_SHARED" = "0" ; then
- WXCONFIG_FLAGS="--static=yes "
- fi
-
- if test "$WX_DEBUG" = "1" ; then
- WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--debug=yes "
- elif test "$WX_DEBUG" = "0" ; then
- WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--debug=no "
- fi
-
- dnl The user should have set WX_UNICODE=UNICODE
- if test "$WX_UNICODE" = "1" ; then
- WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--unicode=yes "
- elif test "$WX_UNICODE" = "0" ; then
- WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--unicode=no "
- fi
-
- if test "$TOOLKIT" != "auto" ; then
- WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--toolkit=$TOOLKIT "
- fi
-
- if test "$WX_RELEASE" != "auto" ; then
- WXCONFIG_FLAGS="$WXCONFIG_FLAGS""--version=$WX_RELEASE "
- fi
-
- dnl strip out the last space of the string
- WXCONFIG_FLAGS=${WXCONFIG_FLAGS% }
-
- if test "$WX_DEBUG_CONFIGURE" = "1"; then
- echo "[[dbg]] WXCONFIG_FLAGS: $WXCONFIG_FLAGS"
- fi
- ])
-
-
-dnl ---------------------------------------------------------------------------
-dnl _WX_SELECTEDCONFIG_CHECKFOR([RESULTVAR], [STRING], [MSG]
-dnl [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
-dnl
-dnl Outputs the given MSG. Then searches the given STRING in the wxWidgets
-dnl additional CPP flags and put the result of the search in WX_$RESULTVAR
-dnl also adding the "yes" or "no" message result to MSG.
-dnl ---------------------------------------------------------------------------
-AC_DEFUN([_WX_SELECTEDCONFIG_CHECKFOR],
- [
- if test "$$1" = "auto" ; then
-
- dnl The user does not have particular preferences for this option;
- dnl so we will detect the wxWidgets relative build setting and use it
- AC_MSG_CHECKING([$3])
-
- dnl set WX_$1 variable to 1 if the $WX_SELECTEDCONFIG contains the $2
- dnl string or to 0 otherwise.
- dnl NOTE: 'expr match STRING REGEXP' cannot be used since on Mac it
- dnl doesn't work; we use 'expr STRING : REGEXP' instead
- WX_$1=$(expr "$WX_SELECTEDCONFIG" : ".*$2.*")
-
- if test "$WX_$1" != "0"; then
- WX_$1=1
- AC_MSG_RESULT([yes])
- ifelse([$4], , :, [$4])
- else
- WX_$1=0
- AC_MSG_RESULT([no])
- ifelse([$5], , :, [$5])
- fi
- else
-
- dnl Use the setting given by the user
- WX_$1=$$1
- fi
- ])
-
-dnl ---------------------------------------------------------------------------
-dnl WX_DETECT_STANDARD_OPTION_VALUES
-dnl
-dnl Detects the values of the following variables:
-dnl 1) WX_RELEASE
-dnl 2) WX_UNICODE
-dnl 3) WX_DEBUG
-dnl 4) WX_SHARED (and also WX_STATIC)
-dnl 5) WX_PORT
-dnl from the previously selected wxWidgets build; this macro in fact must be
-dnl called *after* calling the WX_CONFIG_CHECK macro.
-dnl
-dnl Note that the WX_VERSION_MAJOR, WX_VERSION_MINOR symbols are already set
-dnl by WX_CONFIG_CHECK macro
-dnl ---------------------------------------------------------------------------
-AC_DEFUN([WX_DETECT_STANDARD_OPTION_VALUES],
- [
- dnl IMPORTANT: WX_VERSION contains all three major.minor.micro digits,
- dnl while WX_RELEASE only the major.minor ones.
- WX_RELEASE="$WX_VERSION_MAJOR""$WX_VERSION_MINOR"
- if test $WX_RELEASE -lt 26 ; then
-
- AC_MSG_ERROR([
- Cannot detect the wxWidgets configuration for the selected wxWidgets build
- since its version is $WX_VERSION < 2.6.0; please install a newer
- version of wxWidgets.
- ])
- fi
-
- dnl The wx-config we are using understands the "--selected_config"
- dnl option which returns an easy-parseable string !
- WX_SELECTEDCONFIG=$($WX_CONFIG_WITH_ARGS --selected_config)
-
- if test "$WX_DEBUG_CONFIGURE" = "1"; then
- echo "[[dbg]] Using wx-config --selected-config"
- echo "[[dbg]] WX_SELECTEDCONFIG: $WX_SELECTEDCONFIG"
- fi
-
-
- dnl we could test directly for WX_SHARED with a line like:
- dnl _WX_SELECTEDCONFIG_CHECKFOR([SHARED], [shared],
- dnl [if wxWidgets was built in SHARED mode])
- dnl but wx-config --selected-config DOES NOT outputs the 'shared'
- dnl word when wx was built in shared mode; it rather outputs the
- dnl 'static' word when built in static mode.
- if test $WX_SHARED = "1"; then
- STATIC=0
- elif test $WX_SHARED = "0"; then
- STATIC=1
- elif test $WX_SHARED = "auto"; then
- STATIC="auto"
- fi
-
- dnl Now set the WX_UNICODE, WX_DEBUG, WX_STATIC variables
- _WX_SELECTEDCONFIG_CHECKFOR([UNICODE], [unicode],
- [if wxWidgets was built with UNICODE enabled])
- _WX_SELECTEDCONFIG_CHECKFOR([DEBUG], [debug],
- [if wxWidgets was built in DEBUG mode])
- _WX_SELECTEDCONFIG_CHECKFOR([STATIC], [static],
- [if wxWidgets was built in STATIC mode])
-
- dnl init WX_SHARED from WX_STATIC
- if test "$WX_STATIC" != "0"; then
- WX_SHARED=0
- else
- WX_SHARED=1
- fi
-
- AC_SUBST(WX_UNICODE)
- AC_SUBST(WX_DEBUG)
- AC_SUBST(WX_SHARED)
-
- dnl detect the WX_PORT to use
- if test "$TOOLKIT" = "auto" ; then
-
- dnl The user does not have particular preferences for this option;
- dnl so we will detect the wxWidgets relative build setting and use it
- AC_MSG_CHECKING([which wxWidgets toolkit was selected])
-
- WX_GTKPORT1=$(expr "$WX_SELECTEDCONFIG" : ".*gtk1.*")
- WX_GTKPORT2=$(expr "$WX_SELECTEDCONFIG" : ".*gtk2.*")
- WX_MSWPORT=$(expr "$WX_SELECTEDCONFIG" : ".*msw.*")
- WX_MOTIFPORT=$(expr "$WX_SELECTEDCONFIG" : ".*motif.*")
- WX_OSXCOCOAPORT=$(expr "$WX_SELECTEDCONFIG" : ".*osx_cocoa.*")
- WX_OSXCARBONPORT=$(expr "$WX_SELECTEDCONFIG" : ".*osx_carbon.*")
- WX_X11PORT=$(expr "$WX_SELECTEDCONFIG" : ".*x11.*")
- WX_DFBPORT=$(expr "$WX_SELECTEDCONFIG" : ".*dfb.*")
-
- WX_PORT="unknown"
- if test "$WX_GTKPORT1" != "0"; then WX_PORT="gtk1"; fi
- if test "$WX_GTKPORT2" != "0"; then WX_PORT="gtk2"; fi
- if test "$WX_MSWPORT" != "0"; then WX_PORT="msw"; fi
- if test "$WX_MOTIFPORT" != "0"; then WX_PORT="motif"; fi
- if test "$WX_OSXCOCOAPORT" != "0"; then WX_PORT="osx_cocoa"; fi
- if test "$WX_OSXCARBONPORT" != "0"; then WX_PORT="osx_carbon"; fi
- if test "$WX_X11PORT" != "0"; then WX_PORT="x11"; fi
- if test "$WX_DFBPORT" != "0"; then WX_PORT="dfb"; fi
-
- dnl NOTE: backward-compatible check for wx2.8; in wx2.9 the mac
- dnl ports are called 'osx_cocoa' and 'osx_carbon' (see above)
- WX_MACPORT=$(expr "$WX_SELECTEDCONFIG" : ".*mac.*")
- if test "$WX_MACPORT" != "0"; then WX_PORT="mac"; fi
-
- dnl check at least one of the WX_*PORT has been set !
-
- if test "$WX_PORT" = "unknown" ; then
- AC_MSG_ERROR([
- Cannot detect the currently installed wxWidgets port !
- Please check your 'wx-config --cxxflags'...
- ])
- fi
-
- AC_MSG_RESULT([$WX_PORT])
- else
-
- dnl Use the setting given by the user
- if test -z "$TOOLKIT" ; then
- WX_PORT=$TOOLKIT
- else
- dnl try with PORT
- WX_PORT=$PORT
- fi
- fi
-
- AC_SUBST(WX_PORT)
-
- if test "$WX_DEBUG_CONFIGURE" = "1"; then
- echo "[[dbg]] Values of all WX_* options after final detection:"
- echo "[[dbg]] WX_DEBUG: $WX_DEBUG"
- echo "[[dbg]] WX_UNICODE: $WX_UNICODE"
- echo "[[dbg]] WX_SHARED: $WX_SHARED"
- echo "[[dbg]] WX_RELEASE: $WX_RELEASE"
- echo "[[dbg]] WX_PORT: $WX_PORT"
- fi
-
- dnl Avoid problem described in the WX_STANDARD_OPTIONS which happens when
- dnl the user gives the options:
- dnl ./configure --enable-shared --without-wxshared
- dnl or just do
- dnl ./configure --enable-shared
- dnl but there is only a static build of wxWidgets available.
- if test "$WX_SHARED" = "0" -a "$SHARED" = "1"; then
- AC_MSG_ERROR([
- Cannot build shared library against a static build of wxWidgets !
- This error happens because the wxWidgets build which was selected
- has been detected as static while you asked to build $PACKAGE_NAME
- as shared library and this is not possible.
- Use the '--disable-shared' option to build $PACKAGE_NAME
- as static library or '--with-wxshared' to use wxWidgets as shared library.
- ])
- fi
-
- dnl now we can finally update the DEBUG,UNICODE,SHARED options
- dnl to their final values if they were set to 'auto'
- if test "$DEBUG" = "auto"; then
- DEBUG=$WX_DEBUG
- fi
- if test "$UNICODE" = "auto"; then
- UNICODE=$WX_UNICODE
- fi
- if test "$SHARED" = "auto"; then
- SHARED=$WX_SHARED
- fi
- if test "$TOOLKIT" = "auto"; then
- TOOLKIT=$WX_PORT
- fi
-
- dnl in case the user needs a BUILD=debug/release var...
- if test "$DEBUG" = "1"; then
- BUILD="debug"
- elif test "$DEBUG" = "0" -o "$DEBUG" = ""; then
- BUILD="release"
- fi
-
- dnl respect the DEBUG variable adding the optimize/debug flags
- dnl NOTE: the CXXFLAGS are merged together with the CPPFLAGS so we
- dnl don't need to set them, too
- if test "$DEBUG" = "1"; then
- CXXFLAGS="$CXXFLAGS -g -O0"
- CFLAGS="$CFLAGS -g -O0"
- else
- CXXFLAGS="$CXXFLAGS -O2"
- CFLAGS="$CFLAGS -O2"
- fi
- ])
-
-dnl ---------------------------------------------------------------------------
-dnl WX_BOOLOPT_SUMMARY([name of the boolean variable to show summary for],
-dnl [what to print when var is 1],
-dnl [what to print when var is 0])
-dnl
-dnl Prints $2 when variable $1 == 1 and prints $3 when variable $1 == 0.
-dnl This macro mainly exists just to make configure.ac scripts more readable.
-dnl
-dnl NOTE: you need to use the [" my message"] syntax for 2nd and 3rd arguments
-dnl if you want that m4 avoid to throw away the spaces prefixed to the
-dnl argument value.
-dnl ---------------------------------------------------------------------------
-AC_DEFUN([WX_BOOLOPT_SUMMARY],
- [
- if test "x$$1" = "x1" ; then
- echo $2
- elif test "x$$1" = "x0" ; then
- echo $3
- else
- echo "$1 is $$1"
- fi
- ])
-
-dnl ---------------------------------------------------------------------------
-dnl WX_STANDARD_OPTIONS_SUMMARY_MSG
-dnl
-dnl Shows a summary message to the user about the WX_* variable contents.
-dnl This macro is used typically at the end of the configure script.
-dnl ---------------------------------------------------------------------------
-AC_DEFUN([WX_STANDARD_OPTIONS_SUMMARY_MSG],
- [
- echo
- echo " The wxWidgets build which will be used by $PACKAGE_NAME $PACKAGE_VERSION"
- echo " has the following settings:"
- WX_BOOLOPT_SUMMARY([WX_DEBUG], [" - DEBUG build"], [" - RELEASE build"])
- WX_BOOLOPT_SUMMARY([WX_UNICODE], [" - UNICODE mode"], [" - ANSI mode"])
- WX_BOOLOPT_SUMMARY([WX_SHARED], [" - SHARED mode"], [" - STATIC mode"])
- echo " - VERSION: $WX_VERSION"
- echo " - PORT: $WX_PORT"
- ])
-
-
-dnl ---------------------------------------------------------------------------
-dnl WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN, WX_STANDARD_OPTIONS_SUMMARY_MSG_END
-dnl
-dnl Like WX_STANDARD_OPTIONS_SUMMARY_MSG macro but these two macros also gives info
-dnl about the configuration of the package which used the wxpresets.
-dnl
-dnl Typical usage:
-dnl WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN
-dnl echo " - Package setting 1: $SETTING1"
-dnl echo " - Package setting 2: $SETTING1"
-dnl ...
-dnl WX_STANDARD_OPTIONS_SUMMARY_MSG_END
-dnl
-dnl ---------------------------------------------------------------------------
-AC_DEFUN([WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN],
- [
- echo
- echo " ----------------------------------------------------------------"
- echo " Configuration for $PACKAGE_NAME $PACKAGE_VERSION successfully completed."
- echo " Summary of main configuration settings for $PACKAGE_NAME:"
- WX_BOOLOPT_SUMMARY([DEBUG], [" - DEBUG build"], [" - RELEASE build"])
- WX_BOOLOPT_SUMMARY([UNICODE], [" - UNICODE mode"], [" - ANSI mode"])
- WX_BOOLOPT_SUMMARY([SHARED], [" - SHARED mode"], [" - STATIC mode"])
- ])
-
-AC_DEFUN([WX_STANDARD_OPTIONS_SUMMARY_MSG_END],
- [
- WX_STANDARD_OPTIONS_SUMMARY_MSG
- echo
- echo " Now, just run make."
- echo " ----------------------------------------------------------------"
- echo
- ])
-
-
-dnl ---------------------------------------------------------------------------
-dnl Deprecated macro wrappers
-dnl ---------------------------------------------------------------------------
-
-AC_DEFUN([AM_OPTIONS_WXCONFIG], [WX_CONFIG_OPTIONS])
-AC_DEFUN([AM_PATH_WXCONFIG], [
- WX_CONFIG_CHECK([$1],[$2],[$3],[$4],[$5])
-])
-AC_DEFUN([AM_PATH_WXRC], [WXRC_CHECK([$1],[$2])])
diff --git a/contrib/assdraw/osx-bundle.sh b/contrib/assdraw/osx-bundle.sh
deleted file mode 100755
index 0c0570a45..000000000
--- a/contrib/assdraw/osx-bundle.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh
-
-set -e
-
-BUNDLE_ROOT="$(dirname $0)/Assdraw.app/"
-SRC_DIR="$(dirname $0)"
-
-if test -d "${BUNDLE_ROOT}"; then
- rm -rf "${BUNDLE_ROOT}"
-fi
-
-mkdir -p "${BUNDLE_ROOT}/Contents/MacOS"
-
-cp "${SRC_DIR}/src/assdraw" "${BUNDLE_ROOT}/Contents/MacOS/assdraw"
-
-python ../../aegisub/tools/osx-fix-libs.py "${BUNDLE_ROOT}/Contents/MacOS/assdraw"
-
-cat << 'EOF' > "${BUNDLE_ROOT}/Info.plist"
-
-
-
-
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleDevelopmentRegion
- English
- CFBundleExecutable
- assdraw
- CFBundleIdentifier
- com.aegisub.assdraw
- CFBundleName
- ASSDraw3
- CFBundleDisplayName
- ASSDraw3
- CFBundlePackageType
- APPL
- LSHasLocalizedDisplayName
-
-
-
-EOF
diff --git a/contrib/assdraw/src/ASSDraw3.dev b/contrib/assdraw/src/ASSDraw3.dev
deleted file mode 100644
index 5afb0aa92..000000000
--- a/contrib/assdraw/src/ASSDraw3.dev
+++ /dev/null
@@ -1,323 +0,0 @@
-[Project]
-FileName=ASSDraw3.dev
-Name=ASSDraw
-UnitCount=26
-Type=0
-Ver=3
-IsCpp=1
-Folders=AGG
-CommandLine=
-CompilerSettings=0000000001001000000100
-PchHead=-1
-PchSource=-1
-ProfilesCount=1
-ProfileIndex=0
-
-[Unit1]
-FileName=assdraw.cpp
-CompileCpp=1
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[VersionInfo]
-Major=3
-Minor=0
-Release=0
-Build=0
-LanguageID=1033
-CharsetID=1252
-CompanyName=ai-chan
-FileVersion=3.0.0.0
-FileDescription=A tool for designing shapes to be used in ASS subtitle
-InternalName=ASSDraw3
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=ASSDraw3.exe
-ProductName=ASSDraw
-ProductVersion=3
-AutoIncBuildNrOnRebuild=0
-AutoIncBuildNrOnCompile=0
-UnitCount=20
-
-[Unit3]
-FileName=cmd.hpp
-CompileCpp=1
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit4]
-FileName=engine.hpp
-CompileCpp=1
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit5]
-FileName=assdraw.rc
-CompileCpp=1
-Folder=Resources
-Compile=1
-Link=0
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit7]
-FileName=engine.cpp
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-CompileCpp=1
-
-[Unit9]
-FileName=include_once.hpp
-CompileCpp=1
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit6]
-FileName=assdraw.hpp
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-CompileCpp=1
-
-[Unit2]
-FileName=cmd.cpp
-CompileCpp=1
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Profile1]
-ProfileName=Default Profile
-Type=0
-ObjFiles=
-Includes=E:\DEV;E:\DEV\agg-2.5\include;E:\DEV\wxTreeMultiCtrl\include
-Libs=E:\DEV\agg-2.5;E:\DEV\wxTreeMultiCtrl
-PrivateResource=E:\DEV\_projects\ASSDraw 3\Default Profile\ASSDraw_private.rc
-ResourceIncludes=
-MakeIncludes=
-Compiler=
-CppCompiler=-D__WXMSW__ -DNO_GCC_PRAGMA -fno-rtti -fno-exceptions_@@_ -Wno-deprecated_@@_
-Linker=-lwxmsw28_propgrid_@@_-mwindows_@@_-lwxmsw28_@@_-lwxmsw28_gl_@@_-lwxtiff_@@_-lwxjpeg_@@_-lwxpng_@@_-lwxzlib_@@_-lwxregex_@@_-lwxexpat_@@_-lkernel32_@@_-luser32_@@_-lgdi32_@@_-lcomdlg32_@@_-lwinspool_@@_-lwinmm_@@_-lshell32_@@_-lcomctl32_@@_-lole32_@@_-loleaut32_@@_-luuid_@@_-lrpcrt4_@@_-ladvapi32_@@_-lwsock32_@@_-lodbc32_@@_-lopengl32_@@_-lagg_@@_
-PreprocDefines=
-CompilerSettings=0000000001001000000100
-Icon=
-ExeOutput=E:\DEV\_projects\ASSDraw 3\Default Profile\
-ObjectOutput=E:\DEV\_projects\ASSDraw 3\Default Profile\
-OverrideOutput=1
-OverrideOutputName=ASSDraw3.exe
-HostApplication=
-CommandLine=
-UseCustomMakefile=0
-CustomMakefile=
-IncludeVersionInfo=1
-SupportXPThemes=1
-CompilerSet=0
-compilerType=0
-
-[Unit8]
-FileName=dlgctrl.cpp
-CompileCpp=1
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit10]
-FileName=resource.h
-CompileCpp=1
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit15]
-FileName=agg_bcspline.cpp
-CompileCpp=1
-Folder=AGG
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit16]
-FileName=enums.hpp
-CompileCpp=1
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit18]
-FileName=library.cpp
-CompileCpp=1
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit17]
-FileName=library.hpp
-CompileCpp=1
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit13]
-FileName=wxAGG\AGGWindow.cpp
-CompileCpp=1
-Folder=AGG
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit14]
-FileName=agg_vcgen_bcspline.cpp
-CompileCpp=1
-Folder=AGG
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit11]
-FileName=canvas.cpp
-CompileCpp=1
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit12]
-FileName=canvas.hpp
-CompileCpp=1
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit20]
-FileName=dlgctrl.hpp
-CompileCpp=1
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit19]
-FileName=_common.hpp
-CompileCpp=1
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit21]
-FileName=settings.cpp
-CompileCpp=1
-Folder=ASSDraw
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit22]
-FileName=settings.hpp
-CompileCpp=1
-Folder=ASSDraw
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit23]
-FileName=assdraw_settings.cpp
-CompileCpp=1
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit24]
-FileName=agghelper.hpp
-CompileCpp=1
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit25]
-FileName=canvas_mouse.hpp
-CompileCpp=1
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
-[Unit26]
-FileName=canvas_mouse.cpp
-CompileCpp=1
-Folder=
-Compile=1
-Link=1
-Priority=1000
-OverrideBuildCmd=0
-BuildCmd=
-
diff --git a/contrib/assdraw/src/ASSDraw3.layout b/contrib/assdraw/src/ASSDraw3.layout
deleted file mode 100644
index 8ed9b9f28..000000000
--- a/contrib/assdraw/src/ASSDraw3.layout
+++ /dev/null
@@ -1,185 +0,0 @@
-[Editor_10]
-CursorCol=32
-CursorRow=553
-TopLine=535
-LeftChar=1
-Open=1
-Top=0
-[Editor_7]
-CursorCol=6
-CursorRow=227
-TopLine=197
-LeftChar=1
-Open=1
-Top=1
-[Editor_5]
-CursorCol=11
-CursorRow=19
-TopLine=1
-LeftChar=1
-Open=1
-Top=0
-[Editor_18]
-CursorCol=11
-CursorRow=14
-TopLine=1
-LeftChar=1
-Open=0
-Top=0
-[Editor_19]
-CursorCol=12
-CursorRow=3
-TopLine=3
-LeftChar=1
-Open=0
-Top=0
-[Editor_11]
-CursorCol=8
-CursorRow=44
-TopLine=31
-LeftChar=1
-Open=0
-Top=0
-[Editor_3]
-CursorCol=1
-CursorRow=268
-TopLine=243
-LeftChar=1
-Open=1
-Top=0
-[Editor_15]
-CursorCol=15
-CursorRow=7
-TopLine=1
-LeftChar=1
-Open=1
-Top=0
-[Editor_8]
-CursorCol=1
-CursorRow=69
-TopLine=33
-LeftChar=1
-Open=0
-Top=0
-[Editor_16]
-CursorCol=2
-CursorRow=25
-TopLine=1
-LeftChar=1
-Open=0
-Top=0
-[Editor_0]
-CursorCol=39
-CursorRow=212
-TopLine=184
-LeftChar=1
-Open=1
-Top=0
-[Editors]
-Focused=7
-Order=5,0,10,17,3,6,7,22,21,20,15
-[Editor_1]
-Open=0
-Top=0
-CursorCol=21
-CursorRow=63
-TopLine=30
-LeftChar=1
-[Editor_2]
-Open=0
-Top=0
-CursorCol=7
-CursorRow=83
-TopLine=50
-LeftChar=1
-[Editor_4]
-Open=0
-Top=0
-CursorCol=19
-CursorRow=21
-TopLine=21
-LeftChar=1
-[Editor_6]
-Open=1
-Top=0
-CursorCol=1
-CursorRow=577
-TopLine=556
-LeftChar=1
-[Editor_9]
-Open=0
-Top=0
-CursorCol=1
-CursorRow=1
-TopLine=1
-LeftChar=1
-[Editor_12]
-Open=0
-Top=0
-CursorCol=6
-CursorRow=99
-TopLine=91
-LeftChar=1
-[Editor_13]
-Open=0
-Top=0
-CursorCol=1
-CursorRow=204
-TopLine=170
-LeftChar=1
-[Editor_14]
-Open=0
-Top=0
-CursorCol=1
-CursorRow=290
-TopLine=256
-LeftChar=1
-[Editor_17]
-Open=1
-Top=0
-CursorCol=68
-CursorRow=133
-TopLine=112
-LeftChar=1
-[Editor_20]
-Open=1
-Top=0
-CursorCol=46
-CursorRow=195
-TopLine=163
-LeftChar=1
-[Editor_21]
-Open=1
-Top=0
-CursorCol=2
-CursorRow=58
-TopLine=57
-LeftChar=1
-[Editor_22]
-Open=1
-Top=0
-CursorCol=32
-CursorRow=160
-TopLine=129
-LeftChar=1
-[Editor_23]
-Open=0
-Top=0
-CursorCol=2
-CursorRow=6
-TopLine=1
-LeftChar=1
-[Editor_24]
-CursorCol=1
-CursorRow=56
-TopLine=25
-LeftChar=1
-Open=0
-Top=0
-[Editor_25]
-Open=0
-Top=0
-CursorCol=18
-CursorRow=8
-TopLine=1
-LeftChar=1
diff --git a/contrib/assdraw/src/Makefile.am b/contrib/assdraw/src/Makefile.am
deleted file mode 100644
index 71667b1b9..000000000
--- a/contrib/assdraw/src/Makefile.am
+++ /dev/null
@@ -1,43 +0,0 @@
-SUFFIXES = .cpp
-
-SUBDIRS = wxAGG xpm
-
-AM_CXXFLAGS = @WX_CPPFLAGS@ @LIBAGG_CFLAGS@
-
-bin_PROGRAMS = assdraw
-#assdraw_CPPFLAGS =
-assdraw_LDFLAGS = @WX_LIBS@ @LIBAGG_LIBS@
-assdraw_LDADD = wxAGG/libaggwindow.a xpm/libres.a
-
-assdraw_SOURCES = \
- agg_bcspline.cpp \
- agg_vcgen_bcspline.cpp \
- assdraw.cpp \
- assdraw_settings.cpp \
- canvas.cpp \
- canvas_mouse.cpp \
- cmd.cpp \
- dlgctrl.cpp \
- engine.cpp \
- library.cpp \
- settings.cpp
-
-assdraw_SOURCES += \
- agg_bcspline.h \
- agg_conv_bcspline.h \
- agg_vcgen_bcspline.h \
- resource.h
-
-EXTRA_DIST = \
- _common.hpp \
- agghelper.hpp
- assdraw.hpp \
- canvas.hpp \
- canvas_mouse.hpp \
- cmd.hpp \
- dlgctrl.hpp \
- engine.hpp \
- enums.hpp \
- include_once.hpp \
- library.hpp \
- settings.hpp
diff --git a/contrib/assdraw/src/Makefile.win b/contrib/assdraw/src/Makefile.win
deleted file mode 100644
index aa45a440e..000000000
--- a/contrib/assdraw/src/Makefile.win
+++ /dev/null
@@ -1,69 +0,0 @@
-# Project: ASSDraw
-# Compiler: Default GCC compiler
-# Compiler Type: MingW 3
-# Makefile created by wxDev-C++ 6.10.2 on 20/01/08 23:46
-
-CPP = g++.exe
-CC = gcc.exe
-WINDRES = windres.exe
-OBJ = ../Default\ Profile/assdraw.o ../Default\ Profile/cmd.o ../Default\ Profile/engine.o ../Default\ Profile/dlgctrl.o ../Default\ Profile/canvas.o ../Default\ Profile/AGGWindow.o ../Default\ Profile/agg_vcgen_bcspline.o ../Default\ Profile/agg_bcspline.o ../Default\ Profile/library.o ../Default\ Profile/settings.o ../Default\ Profile/assdraw_settings.o ../Default\ Profile/canvas_mouse.o ../Default\ Profile/ASSDraw3_private.res
-LINKOBJ = "../Default Profile/assdraw.o" "../Default Profile/cmd.o" "../Default Profile/engine.o" "../Default Profile/dlgctrl.o" "../Default Profile/canvas.o" "../Default Profile/AGGWindow.o" "../Default Profile/agg_vcgen_bcspline.o" "../Default Profile/agg_bcspline.o" "../Default Profile/library.o" "../Default Profile/settings.o" "../Default Profile/assdraw_settings.o" "../Default Profile/canvas_mouse.o" "../Default Profile/ASSDraw3_private.res"
-LIBS = -L"D:/Program Files/Dev-Cpp/Lib" -L"E:/DEV/agg-2.5" -L"E:/DEV/wxTreeMultiCtrl" -lwxmsw28_propgrid -mwindows -lwxmsw28 -lwxmsw28_gl -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregex -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lodbc32 -lopengl32 -lagg -s
-INCS = -I"include" -I"E:/DEV" -I"E:/DEV/agg-2.5/include" -I"E:/DEV/wxTreeMultiCtrl/include"
-CXXINCS = -I"D:/Program Files/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"D:/Program Files/Dev-Cpp/include/c++/3.4.2/backward" -I"D:/Program Files/Dev-Cpp/include/c++/3.4.2/mingw32" -I"D:/Program Files/Dev-Cpp/include/c++/3.4.2" -I"D:/Program Files/Dev-Cpp/include" -I"D:/Program Files/Dev-Cpp/" -I"D:/Program Files/Dev-Cpp/include/common/wx/msw" -I"D:/Program Files/Dev-Cpp/include/common/wx/generic" -I"D:/Program Files/Dev-Cpp/include/common/wx/fl" -I"D:/Program Files/Dev-Cpp/include/common/wx/gizmos" -I"D:/Program Files/Dev-Cpp/include/common/wx/html" -I"D:/Program Files/Dev-Cpp/include/common/wx/mmedia" -I"D:/Program Files/Dev-Cpp/include/common/wx/net" -I"D:/Program Files/Dev-Cpp/include/common/wx/ogl" -I"D:/Program Files/Dev-Cpp/include/common/wx/plot" -I"D:/Program Files/Dev-Cpp/include/common/wx/protocol" -I"D:/Program Files/Dev-Cpp/include/common/wx/stc" -I"D:/Program Files/Dev-Cpp/include/common/wx/svg" -I"D:/Program Files/Dev-Cpp/include/common/wx/xml" -I"D:/Program Files/Dev-Cpp/include/common/wx/xrc" -I"D:/Program Files/Dev-Cpp/include/common/wx" -I"D:/Program Files/Dev-Cpp/include/common" -I"E:/dev/ACE-5.5" -I"E:/DEV" -I"E:/DEV/agg-2.5/include" -I"E:/DEV/wxTreeMultiCtrl/include"
-RCINCS = --include-dir "D:/PROGRA~1/Dev-Cpp/include/common"
-BIN = ../Default\ Profile/ASSDraw3.exe
-DEFINES =
-CXXFLAGS = $(CXXINCS) $(DEFINES) -D__WXMSW__ -DNO_GCC_PRAGMA -fno-rtti -fno-exceptions -Wno-deprecated -fexpensive-optimizations -O3
-CFLAGS = $(INCS) $(DEFINES) -fexpensive-optimizations -O3
-GPROF = gprof.exe
-RM = rm -f
-LINK = g++.exe
-
-.PHONY: all all-before all-after clean clean-custom
-all: all-before $(BIN) all-after
-
-clean: clean-custom
- $(RM) $(OBJ) $(BIN)
-
-$(BIN): $(OBJ)
- $(LINK) $(LINKOBJ) -o "..\Default Profile\ASSDraw3.exe" $(LIBS)
-
-../Default\ Profile/assdraw.o: $(GLOBALDEPS) assdraw.cpp assdraw.hpp _common.hpp enums.hpp include_once.hpp
- $(CPP) -c assdraw.cpp -o "../Default Profile/assdraw.o" $(CXXFLAGS)
-
-../Default\ Profile/cmd.o: $(GLOBALDEPS) cmd.cpp
- $(CPP) -c cmd.cpp -o "../Default Profile/cmd.o" $(CXXFLAGS)
-
-../Default\ Profile/engine.o: $(GLOBALDEPS) engine.cpp
- $(CPP) -c engine.cpp -o "../Default Profile/engine.o" $(CXXFLAGS)
-
-../Default\ Profile/dlgctrl.o: $(GLOBALDEPS) dlgctrl.cpp assdraw.hpp _common.hpp
- $(CPP) -c dlgctrl.cpp -o "../Default Profile/dlgctrl.o" $(CXXFLAGS)
-
-../Default\ Profile/canvas.o: $(GLOBALDEPS) canvas.cpp assdraw.hpp _common.hpp cmd.hpp agghelper.hpp
- $(CPP) -c canvas.cpp -o "../Default Profile/canvas.o" $(CXXFLAGS)
-
-../Default\ Profile/AGGWindow.o: $(GLOBALDEPS) wxAGG/AGGWindow.cpp wxAGG/AGGWindow.h wxAGG/PixelFormatConvertor.h
- $(CPP) -c wxAGG/AGGWindow.cpp -o "../Default Profile/AGGWindow.o" $(CXXFLAGS)
-
-../Default\ Profile/agg_vcgen_bcspline.o: $(GLOBALDEPS) agg_vcgen_bcspline.cpp agg_vcgen_bcspline.h agg_bcspline.h
- $(CPP) -c agg_vcgen_bcspline.cpp -o "../Default Profile/agg_vcgen_bcspline.o" $(CXXFLAGS)
-
-../Default\ Profile/agg_bcspline.o: $(GLOBALDEPS) agg_bcspline.cpp agg_bcspline.h
- $(CPP) -c agg_bcspline.cpp -o "../Default Profile/agg_bcspline.o" $(CXXFLAGS)
-
-../Default\ Profile/library.o: $(GLOBALDEPS) library.cpp assdraw.hpp _common.hpp library.hpp engine.hpp _common.hpp wxAGG/AGGWindow.h wxAGG/PixelFormatConvertor.h agg_conv_bcspline.h agg_vcgen_bcspline.h agg_bcspline.h
- $(CPP) -c library.cpp -o "../Default Profile/library.o" $(CXXFLAGS)
-
-../Default\ Profile/settings.o: $(GLOBALDEPS) settings.cpp assdraw.hpp _common.hpp settings.hpp _common.hpp
- $(CPP) -c settings.cpp -o "../Default Profile/settings.o" $(CXXFLAGS)
-
-../Default\ Profile/assdraw_settings.o: $(GLOBALDEPS) assdraw_settings.cpp assdraw.hpp _common.hpp
- $(CPP) -c assdraw_settings.cpp -o "../Default Profile/assdraw_settings.o" $(CXXFLAGS)
-
-../Default\ Profile/canvas_mouse.o: $(GLOBALDEPS) canvas_mouse.cpp canvas_mouse.hpp _common.hpp enums.hpp engine.hpp _common.hpp wxAGG/AGGWindow.h wxAGG/PixelFormatConvertor.h agg_conv_bcspline.h agg_vcgen_bcspline.h agg_bcspline.h canvas.hpp engine.hpp enums.hpp
- $(CPP) -c canvas_mouse.cpp -o "../Default Profile/canvas_mouse.o" $(CXXFLAGS)
-
-../Default\ Profile/ASSDraw3_private.res: ../Default\ Profile/ASSDraw3_private.rc assdraw.rc
- $(WINDRES) --input-format=rc -o "../Default Profile/ASSDraw3_private.res" $(RCINCS) ../DEFAUL~1/ASSDRA~1.RC -O coff
diff --git a/contrib/assdraw/src/_common.hpp b/contrib/assdraw/src/_common.hpp
deleted file mode 100644
index 93c17f235..000000000
--- a/contrib/assdraw/src/_common.hpp
+++ /dev/null
@@ -1,14 +0,0 @@
-
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
- #pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
- #include "wx/wx.h"
-#endif
-
-#define TITLE wxT("ASSDraw3")
-
-#define __DPDS__ wxDefaultPosition, wxDefaultSize
diff --git a/contrib/assdraw/src/agg_bcspline.cpp b/contrib/assdraw/src/agg_bcspline.cpp
deleted file mode 100644
index d6973c04a..000000000
--- a/contrib/assdraw/src/agg_bcspline.cpp
+++ /dev/null
@@ -1,289 +0,0 @@
-//----------------------------------------------------------------------------
-// Anti-Grain Geometry (AGG) - Version 2.5
-// A high quality rendering engine for C++
-// Copyright (C) 2002-2006 Maxim Shemanarev
-// Contact: mcseem@antigrain.com
-// mcseemagg@yahoo.com
-// http://antigrain.com
-//
-// AGG is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// AGG is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with AGG; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-// MA 02110-1301, USA.
-//----------------------------------------------------------------------------
-
-#include "agg_bcspline.h"
-
-namespace agg
-{
- //------------------------------------------------------------------------
- bcspline::bcspline() :
- m_max(0),
- m_num(0),
- m_x(0),
- m_y(0),
- m_last_idx(-1)
- {
- }
-
- //------------------------------------------------------------------------
- bcspline::bcspline(int num) :
- m_max(0),
- m_num(0),
- m_x(0),
- m_y(0),
- m_last_idx(-1)
- {
- init(num);
- }
-
- //------------------------------------------------------------------------
- bcspline::bcspline(int num, const double* x, const double* y) :
- m_max(0),
- m_num(0),
- m_x(0),
- m_y(0),
- m_last_idx(-1)
- {
- init(num, x, y);
- }
-
-
- //------------------------------------------------------------------------
- void bcspline::init(int max)
- {
- if(max > 2 && max > m_max)
- {
- m_am.resize(max * 3);
- m_max = max;
- m_x = &m_am[m_max];
- m_y = &m_am[m_max * 2];
- }
- m_num = 0;
- m_last_idx = -1;
- }
-
-
- //------------------------------------------------------------------------
- void bcspline::add_point(double x, double y)
- {
- if(m_num < m_max)
- {
- m_x[m_num] = x;
- m_y[m_num] = y;
- ++m_num;
- }
- }
-
-
- //------------------------------------------------------------------------
- void bcspline::prepare()
- {
- if(m_num > 2)
- {
- int i, k, n1;
- double* temp;
- double* r;
- double* s;
- double h, p, d, f, e;
-
- for(k = 0; k < m_num; k++)
- {
- m_am[k] = 0.0;
- }
-
- n1 = 3 * m_num;
-
- pod_array al(n1);
- temp = &al[0];
-
- for(k = 0; k < n1; k++)
- {
- temp[k] = 0.0;
- }
-
- r = temp + m_num;
- s = temp + m_num * 2;
-
- n1 = m_num - 1;
- d = m_x[1] - m_x[0];
- e = (m_y[1] - m_y[0]) / d;
-
- for(k = 1; k < n1; k++)
- {
- h = d;
- d = m_x[k + 1] - m_x[k];
- f = e;
- e = (m_y[k + 1] - m_y[k]) / d;
- al[k] = d / (d + h);
- r[k] = 1.0 - al[k];
- s[k] = 6.0 * (e - f) / (h + d);
- }
-
- for(k = 1; k < n1; k++)
- {
- p = 1.0 / (r[k] * al[k - 1] + 2.0);
- al[k] *= -p;
- s[k] = (s[k] - r[k] * s[k - 1]) * p;
- }
-
- m_am[n1] = 0.0;
- al[n1 - 1] = s[n1 - 1];
- m_am[n1 - 1] = al[n1 - 1];
-
- for(k = n1 - 2, i = 0; i < m_num - 2; i++, k--)
- {
- al[k] = al[k] * al[k + 1] + s[k];
- m_am[k] = al[k];
- }
- }
- m_last_idx = -1;
- }
-
-
-
- //------------------------------------------------------------------------
- void bcspline::init(int num, const double* x, const double* y)
- {
- if(num > 2)
- {
- init(num);
- int i;
- for(i = 0; i < num; i++)
- {
- add_point(*x++, *y++);
- }
- prepare();
- }
- m_last_idx = -1;
- }
-
-
- //------------------------------------------------------------------------
- void bcspline::bsearch(int n, const double *x, double x0, int *i)
- {
- int j = n - 1;
- int k;
-
- for(*i = 0; (j - *i) > 1; )
- {
- if(x0 < x[k = (*i + j) >> 1]) j = k;
- else *i = k;
- }
- }
-
-
-
- //------------------------------------------------------------------------
- double bcspline::interpolation(double x, int i) const
- {
- int j = i + 1;
- double d = m_x[i] - m_x[j];
- double h = x - m_x[j];
- double r = m_x[i] - x;
- double p = d * d / 6.0;
- return (m_am[j] * r * r * r + m_am[i] * h * h * h) / 6.0 / d +
- ((m_y[j] - m_am[j] * p) * r + (m_y[i] - m_am[i] * p) * h) / d;
- }
-
-
- //------------------------------------------------------------------------
- double bcspline::extrapolation_left(double x) const
- {
- double d = m_x[1] - m_x[0];
- return (-d * m_am[1] / 6 + (m_y[1] - m_y[0]) / d) *
- (x - m_x[0]) +
- m_y[0];
- }
-
- //------------------------------------------------------------------------
- double bcspline::extrapolation_right(double x) const
- {
- double d = m_x[m_num - 1] - m_x[m_num - 2];
- return (d * m_am[m_num - 2] / 6 + (m_y[m_num - 1] - m_y[m_num - 2]) / d) *
- (x - m_x[m_num - 1]) +
- m_y[m_num - 1];
- }
-
- //------------------------------------------------------------------------
- double bcspline::get(double x) const
- {
- if(m_num > 2)
- {
- int i;
-
- // Extrapolation on the left
- if(x < m_x[0]) return extrapolation_left(x);
-
- // Extrapolation on the right
- if(x >= m_x[m_num - 1]) return extrapolation_right(x);
-
- // Interpolation
- bsearch(m_num, m_x, x, &i);
- return interpolation(x, i);
- }
- return 0.0;
- }
-
-
- //------------------------------------------------------------------------
- double bcspline::get_stateful(double x) const
- {
- if(m_num > 2)
- {
- // Extrapolation on the left
- if(x < m_x[0]) return extrapolation_left(x);
-
- // Extrapolation on the right
- if(x >= m_x[m_num - 1]) return extrapolation_right(x);
-
- if(m_last_idx >= 0)
- {
- // Check if x is not in current range
- if(x < m_x[m_last_idx] || x > m_x[m_last_idx + 1])
- {
- // Check if x between next points (most probably)
- if(m_last_idx < m_num - 2 &&
- x >= m_x[m_last_idx + 1] &&
- x <= m_x[m_last_idx + 2])
- {
- ++m_last_idx;
- }
- else
- if(m_last_idx > 0 &&
- x >= m_x[m_last_idx - 1] &&
- x <= m_x[m_last_idx])
- {
- // x is between pevious points
- --m_last_idx;
- }
- else
- {
- // Else perform full search
- bsearch(m_num, m_x, x, &m_last_idx);
- }
- }
- return interpolation(x, m_last_idx);
- }
- else
- {
- // Interpolation
- bsearch(m_num, m_x, x, &m_last_idx);
- return interpolation(x, m_last_idx);
- }
- }
- return 0.0;
- }
-
-}
-
diff --git a/contrib/assdraw/src/agg_bcspline.h b/contrib/assdraw/src/agg_bcspline.h
deleted file mode 100644
index 05d236497..000000000
--- a/contrib/assdraw/src/agg_bcspline.h
+++ /dev/null
@@ -1,81 +0,0 @@
-//----------------------------------------------------------------------------
-// Anti-Grain Geometry (AGG) - Version 2.5
-// A high quality rendering engine for C++
-// Copyright (C) 2002-2006 Maxim Shemanarev
-// Contact: mcseem@antigrain.com
-// mcseemagg@yahoo.com
-// http://antigrain.com
-//
-// AGG is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// AGG is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with AGG; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-// MA 02110-1301, USA.
-//----------------------------------------------------------------------------
-
-#ifndef AGG_bcspline_INCLUDED
-#define AGG_bcspline_INCLUDED
-
-#include "agg_array.h"
-
-namespace agg
-{
- //----------------------------------------------------------------bcspline
- // A very simple class of Bi-cubic Spline interpolation.
- // First call init(num, x[], y[]) where num - number of source points,
- // x, y - arrays of X and Y values respectively. Here Y must be a function
- // of X. It means that all the X-coordinates must be arranged in the ascending
- // order.
- // Then call get(x) that calculates a value Y for the respective X.
- // The class supports extrapolation, i.e. you can call get(x) where x is
- // outside the given with init() X-range. Extrapolation is a simple linear
- // function.
- //
- // See Implementation agg_bcspline.cpp
- //------------------------------------------------------------------------
- class bcspline
- {
- public:
- bcspline();
- bcspline(int num);
- bcspline(int num, const double* x, const double* y);
-
- void init(int num);
- void add_point(double x, double y);
- void prepare();
-
- void init(int num, const double* x, const double* y);
-
- double get(double x) const;
- double get_stateful(double x) const;
-
- private:
- bcspline(const bcspline&);
- const bcspline& operator = (const bcspline&);
-
- static void bsearch(int n, const double *x, double x0, int *i);
- double extrapolation_left(double x) const;
- double extrapolation_right(double x) const;
- double interpolation(double x, int i) const;
-
- int m_max;
- int m_num;
- double* m_x;
- double* m_y;
- pod_array m_am;
- mutable int m_last_idx;
- };
-
-
-}
-
-#endif
diff --git a/contrib/assdraw/src/agg_conv_bcspline.h b/contrib/assdraw/src/agg_conv_bcspline.h
deleted file mode 100644
index 3d40b9619..000000000
--- a/contrib/assdraw/src/agg_conv_bcspline.h
+++ /dev/null
@@ -1,58 +0,0 @@
-//----------------------------------------------------------------------------
-// Anti-Grain Geometry (AGG) - Version 2.5
-// A high quality rendering engine for C++
-// Copyright (C) 2002-2006 Maxim Shemanarev
-// Contact: mcseem@antigrain.com
-// mcseemagg@yahoo.com
-// http://antigrain.com
-//
-// AGG is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// AGG is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with AGG; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-// MA 02110-1301, USA.
-//----------------------------------------------------------------------------
-
-#ifndef AGG_conv_bcspline_INCLUDED
-#define AGG_conv_bcspline_INCLUDED
-
-#include "agg_basics.h"
-#include "agg_vcgen_bcspline.h"
-#include "agg_conv_adaptor_vcgen.h"
-
-
-namespace agg
-{
-
- //---------------------------------------------------------conv_bcspline
- template
- struct conv_bcspline : public conv_adaptor_vcgen
- {
- typedef conv_adaptor_vcgen base_type;
-
- conv_bcspline(VertexSource& vs) :
- conv_adaptor_vcgen(vs) {}
-
- void interpolation_step(double v) { base_type::generator().interpolation_step(v); }
- double interpolation_step() const { return base_type::generator().interpolation_step(); }
-
- private:
- conv_bcspline(const conv_bcspline&);
- const conv_bcspline&
- operator = (const conv_bcspline&);
- };
-
-}
-
-
-#endif
-
diff --git a/contrib/assdraw/src/agg_vcgen_bcspline.cpp b/contrib/assdraw/src/agg_vcgen_bcspline.cpp
deleted file mode 100644
index 5796b1277..000000000
--- a/contrib/assdraw/src/agg_vcgen_bcspline.cpp
+++ /dev/null
@@ -1,203 +0,0 @@
-//----------------------------------------------------------------------------
-// Anti-Grain Geometry (AGG) - Version 2.5
-// A high quality rendering engine for C++
-// Copyright (C) 2002-2006 Maxim Shemanarev
-// Contact: mcseem@antigrain.com
-// mcseemagg@yahoo.com
-// http://antigrain.com
-//
-// AGG is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// AGG is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with AGG; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-// MA 02110-1301, USA.
-//----------------------------------------------------------------------------
-
-#include "agg_vcgen_bcspline.h"
-
-namespace agg
-{
-
- //------------------------------------------------------------------------
- vcgen_bcspline::vcgen_bcspline() :
- m_src_vertices(),
- m_spline_x(),
- m_spline_y(),
- m_interpolation_step(1.0/50.0),
- m_closed(0),
- m_status(initial),
- m_src_vertex(0)
- {
- }
-
-
- //------------------------------------------------------------------------
- void vcgen_bcspline::remove_all()
- {
- m_src_vertices.remove_all();
- m_closed = 0;
- m_status = initial;
- m_src_vertex = 0;
- }
-
-
- //------------------------------------------------------------------------
- void vcgen_bcspline::add_vertex(double x, double y, unsigned cmd)
- {
- m_status = initial;
- if(is_move_to(cmd))
- {
- m_src_vertices.modify_last(point_d(x, y));
- }
- else
- {
- if(is_vertex(cmd))
- {
- m_src_vertices.add(point_d(x, y));
- }
- else
- {
- m_closed = get_close_flag(cmd);
- }
- }
- }
-
-
- //------------------------------------------------------------------------
- void vcgen_bcspline::rewind(unsigned)
- {
- m_cur_abscissa = 0.0;
- m_max_abscissa = 0.0;
- m_src_vertex = 0;
- if(m_status == initial && m_src_vertices.size() > 2)
- {
- if(m_closed)
- {
- m_spline_x.init(m_src_vertices.size() + 8);
- m_spline_y.init(m_src_vertices.size() + 8);
- m_spline_x.add_point(0.0, m_src_vertices.prev(m_src_vertices.size() - 3).x);
- m_spline_y.add_point(0.0, m_src_vertices.prev(m_src_vertices.size() - 3).y);
- m_spline_x.add_point(1.0, m_src_vertices[m_src_vertices.size() - 3].x);
- m_spline_y.add_point(1.0, m_src_vertices[m_src_vertices.size() - 3].y);
- m_spline_x.add_point(2.0, m_src_vertices[m_src_vertices.size() - 2].x);
- m_spline_y.add_point(2.0, m_src_vertices[m_src_vertices.size() - 2].y);
- m_spline_x.add_point(3.0, m_src_vertices[m_src_vertices.size() - 1].x);
- m_spline_y.add_point(3.0, m_src_vertices[m_src_vertices.size() - 1].y);
- }
- else
- {
- m_spline_x.init(m_src_vertices.size());
- m_spline_y.init(m_src_vertices.size());
- }
- unsigned i;
- for(i = 0; i < m_src_vertices.size(); i++)
- {
- double x = m_closed ? i + 4 : i;
- m_spline_x.add_point(x, m_src_vertices[i].x);
- m_spline_y.add_point(x, m_src_vertices[i].y);
- }
- m_cur_abscissa = 0.0;
- m_max_abscissa = m_src_vertices.size() - 1;
- if(m_closed)
- {
- m_cur_abscissa = 4.0;
- m_max_abscissa += 5.0;
- m_spline_x.add_point(m_src_vertices.size() + 4, m_src_vertices[0].x);
- m_spline_y.add_point(m_src_vertices.size() + 4, m_src_vertices[0].y);
- m_spline_x.add_point(m_src_vertices.size() + 5, m_src_vertices[1].x);
- m_spline_y.add_point(m_src_vertices.size() + 5, m_src_vertices[1].y);
- m_spline_x.add_point(m_src_vertices.size() + 6, m_src_vertices[2].x);
- m_spline_y.add_point(m_src_vertices.size() + 6, m_src_vertices[2].y);
- m_spline_x.add_point(m_src_vertices.size() + 7, m_src_vertices.next(2).x);
- m_spline_y.add_point(m_src_vertices.size() + 7, m_src_vertices.next(2).y);
- }
- m_spline_x.prepare();
- m_spline_y.prepare();
- }
- m_status = ready;
- }
-
-
-
-
-
-
- //------------------------------------------------------------------------
- unsigned vcgen_bcspline::vertex(double* x, double* y)
- {
- unsigned cmd = path_cmd_line_to;
- while(!is_stop(cmd))
- {
- switch(m_status)
- {
- case initial:
- rewind(0);
-
- case ready:
- if(m_src_vertices.size() < 2)
- {
- cmd = path_cmd_stop;
- break;
- }
-
- if(m_src_vertices.size() == 2)
- {
- *x = m_src_vertices[m_src_vertex].x;
- *y = m_src_vertices[m_src_vertex].y;
- m_src_vertex++;
- if(m_src_vertex == 1) return path_cmd_move_to;
- if(m_src_vertex == 2) return path_cmd_line_to;
- cmd = path_cmd_stop;
- break;
- }
-
- cmd = path_cmd_move_to;
- m_status = polygon;
- m_src_vertex = 0;
-
- case polygon:
- if(m_cur_abscissa >= m_max_abscissa)
- {
- if(m_closed)
- {
- m_status = end_poly;
- break;
- }
- else
- {
- *x = m_src_vertices[m_src_vertices.size() - 1].x;
- *y = m_src_vertices[m_src_vertices.size() - 1].y;
- m_status = end_poly;
- return path_cmd_line_to;
- }
- }
-
- *x = m_spline_x.get(m_cur_abscissa);
- *y = m_spline_y.get(m_cur_abscissa);
- m_src_vertex++;
- m_cur_abscissa += m_interpolation_step;
- return (m_src_vertex == 1) ? path_cmd_move_to : path_cmd_line_to;
-
- case end_poly:
- m_status = stop;
- return path_cmd_end_poly | m_closed;
-
- case stop:
- return path_cmd_stop;
- }
- }
- return cmd;
- }
-
-
-}
-
diff --git a/contrib/assdraw/src/agg_vcgen_bcspline.h b/contrib/assdraw/src/agg_vcgen_bcspline.h
deleted file mode 100644
index 6f92d9942..000000000
--- a/contrib/assdraw/src/agg_vcgen_bcspline.h
+++ /dev/null
@@ -1,83 +0,0 @@
-//----------------------------------------------------------------------------
-// Anti-Grain Geometry (AGG) - Version 2.5
-// A high quality rendering engine for C++
-// Copyright (C) 2002-2006 Maxim Shemanarev
-// Contact: mcseem@antigrain.com
-// mcseemagg@yahoo.com
-// http://antigrain.com
-//
-// AGG is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// AGG is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with AGG; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-// MA 02110-1301, USA.
-//----------------------------------------------------------------------------
-
-#ifndef AGG_vcgen_bcspline_INCLUDED
-#define AGG_vcgen_bcspline_INCLUDED
-
-#include "agg_basics.h"
-#include "agg_array.h"
-#include "agg_bcspline.h"
-
-
-namespace agg
-{
-
- //==========================================================vcgen_bcspline
- class vcgen_bcspline
- {
- enum status_e
- {
- initial,
- ready,
- polygon,
- end_poly,
- stop
- };
-
- public:
- typedef pod_bvector vertex_storage;
-
- vcgen_bcspline();
-
- void interpolation_step(double v) { m_interpolation_step = v; }
- double interpolation_step() const { return m_interpolation_step; }
-
- // Vertex Generator Interface
- void remove_all();
- void add_vertex(double x, double y, unsigned cmd);
-
- // Vertex Source Interface
- void rewind(unsigned path_id);
- unsigned vertex(double* x, double* y);
-
- private:
- vcgen_bcspline(const vcgen_bcspline&);
- const vcgen_bcspline& operator = (const vcgen_bcspline&);
-
- vertex_storage m_src_vertices;
- bcspline m_spline_x;
- bcspline m_spline_y;
- double m_interpolation_step;
- unsigned m_closed;
- status_e m_status;
- unsigned m_src_vertex;
- double m_cur_abscissa;
- double m_max_abscissa;
- };
-
-}
-
-
-#endif
-
diff --git a/contrib/assdraw/src/agghelper.hpp b/contrib/assdraw/src/agghelper.hpp
deleted file mode 100644
index de0ce66fc..000000000
--- a/contrib/assdraw/src/agghelper.hpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#pragma once
-
-#include "agg_path_storage.h"
-
-class agghelper
-{
-public:
-
- static agg::path_storage RectanglePath(double left, double right, double top, double bottom)
- {
- agg::path_storage path;
- path.move_to(left,top);
- path.line_to(right,top);
- path.line_to(right,bottom);
- path.line_to(left,bottom);
- path.line_to(left,top);
- return path;
- }
-
-};
diff --git a/contrib/assdraw/src/assdraw.cpp b/contrib/assdraw/src/assdraw.cpp
deleted file mode 100644
index 1c9696083..000000000
--- a/contrib/assdraw/src/assdraw.cpp
+++ /dev/null
@@ -1,741 +0,0 @@
-/*
-* Copyright (c) 2007, ai-chan
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the ASSDraw3 Team nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-///////////////////////////////////////////////////////////////////////////////
-// Name: assdraw.cpp
-// Purpose: ASSDraw main source file
-// Author: ai-chan
-// Created: 08/26/06
-// Copyright: (c) ai-chan
-// Licence: 3-clause BSD
-///////////////////////////////////////////////////////////////////////////////
-
-
-#include "assdraw.hpp"
-#include "enums.hpp"
-#include "include_once.hpp"
-#include
-#include
-#include
-#include
-#include
-
-#if !defined(__WINDOWS__)
-#include "xpm/res.h"
-#endif
-
-/////////////
-// Libraries
-#ifdef __VISUALC__
-#pragma comment(lib, "Vfw32.lib")
-#pragma comment(lib, "comctl32.lib")
-#pragma comment(lib, "rpcrt4.lib")
-#pragma comment(lib, "winmm.lib")
-#pragma comment(lib, "advapi32.lib")
-#pragma comment(lib, "wsock32.lib")
-#ifdef __WXDEBUG__
-#pragma comment(lib, "wxmsw28ud_propgrid.lib")
-#else
-#pragma comment(lib, "wxmsw28u_propgrid.lib")
-#endif
-#endif
-
-
-//DEFINE_EVENT_TYPE(wxEVT_SETTINGS_CHANGED)
-
-// initialize wxWidget to accept our App class
-IMPLEMENT_APP(ASSDrawApp)
-
-BEGIN_EVENT_TABLE(ASSDrawFrame, wxFrame)
- EVT_TOOL(TB_CLEAR, ASSDrawFrame::OnSelect_Clear)
- EVT_TOOL(TB_PREVIEW, ASSDrawFrame::OnSelect_Preview)
- EVT_TOOL(TB_TRANSFORM, ASSDrawFrame::OnSelect_Transform)
- EVT_TOOL_RANGE(MODE_ARR, MODE_DEL, ASSDrawFrame::OnChoose_Mode)
- EVT_TOOL_RCLICKED(wxID_ANY, ASSDrawFrame::OnToolRClick)
- EVT_COMMAND(wxID_ANY, wxEVT_SETTINGS_CHANGED, ASSDrawFrame::OnSettingsChanged)
- EVT_MENU_RANGE(MENU_TB_ALL, MENU_TB_BGIMG, ASSDrawFrame::OnChoose_TBarRClickMenu)
- EVT_MENU(MENU_CLEAR, ASSDrawFrame::OnSelect_Clear)
- EVT_MENU(MENU_PREVIEW, ASSDrawFrame::OnSelect_Preview)
- EVT_MENU(MENU_TRANSFORM, ASSDrawFrame::OnSelect_Transform)
- EVT_MENU(MENU_LIBRARY, ASSDrawFrame::OnSelect_Library)
- EVT_MENU(MENU_SETTINGS, ASSDrawFrame::OnSelect_Settings)
- EVT_MENU(MENU_RESETPERSPECTIVE, ASSDrawFrame::OnSelect_ResetPerspective)
- EVT_MENU(MENU_HELP, ASSDrawFrame::OnSelect_Help)
- EVT_MENU(wxID_ABOUT, ASSDrawFrame::OnSelect_About)
- EVT_MENU(MENU_UNDO, ASSDrawFrame::OnSelect_Undo)
- EVT_MENU(MENU_REDO, ASSDrawFrame::OnSelect_Redo)
- EVT_MENU(MENU_PASTE, ASSDrawFrame::OnSelect_Paste)
- EVT_MENU(MENU_BGIMG_REMOVE, ASSDrawFrame::OnSelect_RemoveBG)
- EVT_MENU(MENU_BGIMG_ALPHA, ASSDrawFrame::OnSelect_AlphaBG)
- EVT_MENU_RANGE(MODE_ARR, MODE_NUT_BILINEAR, ASSDrawFrame::OnChoose_Mode)
- EVT_MENU_RANGE(MENU_REPOS_TOPLEFT, MENU_REPOS_BOTRIGHT, ASSDrawFrame::OnChoose_Recenter)
- EVT_MENU_RANGE(MENU_REPOS_BGTOPLEFT, MENU_REPOS_BGBOTRIGHT, ASSDrawFrame::OnChoose_RecenterToBG)
- EVT_CLOSE(ASSDrawFrame::OnClose)
-END_EVENT_TABLE()
-
-// ----------------------------------------------------------------------------
-// the application class: ASSDrawApp
-// ----------------------------------------------------------------------------
-
-// 'Main program' equivalent: the program execution _T("starts") here
-bool ASSDrawApp::OnInit()
-{
- SetAppName(TITLE);
- // create the main application window
- ASSDrawFrame * assdrawframe = new ASSDrawFrame( this, TITLE, wxDefaultPosition, wxSize(640, 480) );
- SetTopWindow(assdrawframe);
- return TRUE;
-}
-
-
-
-// ----------------------------------------------------------------------------
-// main frame: ASSDrawFrame
-// ----------------------------------------------------------------------------
-
-// constructor
-
-ASSDrawFrame::ASSDrawFrame( wxApp *app, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
- : wxFrame(NULL, wxID_ANY, title, pos, size, style)
-{
- m_app = app;
- m_mgr.SetManagedWindow(this);
-#ifndef __UNIX__
- m_mgr.SetFlags(m_mgr.GetFlags() | wxAUI_MGR_ALLOW_ACTIVE_PANE);
-#else
- m_mgr.SetFlags(wxAUI_MGR_ALLOW_FLOATING | wxAUI_MGR_ALLOW_ACTIVE_PANE | wxAUI_MGR_RECTANGLE_HINT);
-#endif
-
- // set the frame icon
- SetIcon(wxICON(appico));
-
- // Create status bar for the frame
- CreateStatusBar(3);
- int statwidths[] = { 64, -1, 64 };
- GetStatusBar()->SetStatusWidths(3, statwidths);
- SetStatusBarPane(1);
-
- InitializeDefaultSettings();
-
- // load config
- configfile = wxFileName(wxStandardPaths::Get().GetUserDataDir(), _T("ASSDraw3.cfg")).GetFullPath();
-
- bool firsttime = !::wxFileExists(configfile);
- if (firsttime) {
- wxFileName::Mkdir(wxStandardPaths::Get().GetUserDataDir(), wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
- wxFileOutputStream(configfile).Close();
- }
- wxFileInputStream cfgf(configfile);
- config = new wxFileConfig(cfgf);
-
- // nullify transformdlg
- transformdlg = NULL;
-
- Maximize(true);
- Show(true); // to get the right client size, must call Show() first
-
- // config
- LoadSettings();
-
- // THE CANVAS
- m_canvas = new ASSDrawCanvas( this , this );
-
- // shapes library
- shapelib = new ASSDrawShapeLibrary(this, this);
-
- // source text ctrl
- srctxtctrl = new ASSDrawSrcTxtCtrl(this, this);
-
- // settings
- settingsdlg = new ASSDrawSettingsDialog(this, this);
- settingsdlg->Init();
-
- SetMenus();
- SetToolBars();
- SetPanes();
-
- // config
-
- config->SetPath(_T("info"));
- wxString version;
- config->Read(_T("version"), &version);
- config->SetPath(_T(".."));
-
- default_perspective = m_mgr.SavePerspective(); // back up default perspective
- config->SetPath(_T("perspective"));
- wxString perspective;
- if (config->Read(_T("perspective"), &perspective) && version == VERSION) m_mgr.LoadPerspective(perspective, false);
- config->SetPath(_T(".."));
-
- config->SetPath(_T("library"));
- int n = 0;
- config->Read(_T("n"), &n);
- for (int i = 0; i < n; i++)
- {
- wxString libcmds;
- config->Read(wxString::Format(_T("%d"),i), &libcmds);
- shapelib->AddShapePreview(libcmds);
- }
- config->SetPath(_T(".."));
-
- m_mgr.Update();
- m_canvas->SetFocus();
- m_canvas->Show();
-
- wxSize clientsize = m_canvas->GetClientSize();
- m_canvas->ChangeZoomLevelTo(DEFAULT_SCALE, wxPoint(clientsize.x / 2, clientsize.y / 2));
- m_canvas->MoveCanvasOriginTo(clientsize.x / 2, clientsize.y / 2);
- UpdateASSCommandStringToSrcTxtCtrl(m_canvas->GenerateASS());
-
- UpdateFrameUI();
- ApplySettings();
-
- if (firsttime)
- _About();
- else if (!behaviors.nosplashscreen)
- _About(3);
-
- helpcontroller.SetParentWindow(this);
- helpcontroller.Initialize(wxFileName(::wxGetCwd(), _T("ASSDraw3.chm")).GetFullPath());
-}
-
-void ASSDrawFrame::SetToolBars()
-{
- drawtbar = new wxToolBar(this, wxID_ANY, __DPDS__ , wxTB_FLAT | wxTB_TEXT | wxTB_NODIVIDER | wxTB_HORIZONTAL);
- drawtbar->AddTool(TB_CLEAR, _T("Clear"), wxBITMAP(new_), wxNullBitmap, wxITEM_NORMAL, _T(""), TIPS_CLEAR);
- //tbar->AddTool(TB_EDITSRC, _T("Source"), wxBITMAP(src_), wxNullBitmap, wxITEM_NORMAL, _T(""), TIPS_EDITSRC);
- drawtbar->AddCheckTool(TB_PREVIEW, _T("Preview"), wxBITMAP(preview_), wxNullBitmap, _T(""), TIPS_PREVIEW);
- //drawtbar->AddTool(TB_TRANSFORM, _T("Transform"), wxBITMAP(rot_), wxNullBitmap, wxITEM_NORMAL, _T(""), TIPS_TRANSFORM);
- zoomslider = new wxSlider(drawtbar, TB_ZOOMSLIDER, 1000, 100, 5000, __DPDS__ );
- //zoomslider->SetSize(280, zoomslider->GetSize().y);
- zoomslider->Connect(wxEVT_SCROLL_LINEUP, wxScrollEventHandler(ASSDrawFrame::OnZoomSliderChanged), NULL, this);
- zoomslider->Connect(wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler(ASSDrawFrame::OnZoomSliderChanged), NULL, this);
- zoomslider->Connect(wxEVT_SCROLL_PAGEUP, wxScrollEventHandler(ASSDrawFrame::OnZoomSliderChanged), NULL, this);
- zoomslider->Connect(wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler(ASSDrawFrame::OnZoomSliderChanged), NULL, this);
- zoomslider->Connect(wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(ASSDrawFrame::OnZoomSliderChanged), NULL, this);
- zoomslider->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(ASSDrawFrame::OnZoomSliderChanged), NULL, this);
- drawtbar->AddControl(zoomslider);
- drawtbar->Realize();
-
- m_mgr.AddPane(drawtbar, wxAuiPaneInfo().Name(_T("drawtbar")).Caption(TBNAME_DRAW).
- ToolbarPane().Top().Position(0).Dockable(true).LeftDockable(false).RightDockable(false));
-
- modetbar = new wxToolBar(this, wxID_ANY, __DPDS__ , wxTB_FLAT | wxTB_TEXT | wxTB_NODIVIDER | wxTB_HORIZONTAL);
- modetbar->AddRadioTool(MODE_ARR, _T("Drag"), wxBITMAP(arr_), wxNullBitmap, _T(""), TIPS_ARR);
- modetbar->AddRadioTool(MODE_M, _T("Move"), wxBITMAP(m_), wxNullBitmap, _T(""), TIPS_M);
- //modetbar->AddRadioTool(MODE_N, _T("Move*"), wxBITMAP(n_), wxNullBitmap, _T(""), TIPS_N);
- modetbar->AddRadioTool(MODE_L, _T("Line"), wxBITMAP(l_), wxNullBitmap, _T(""), TIPS_L);
- modetbar->AddRadioTool(MODE_B, _T("Bezier"), wxBITMAP(b_), wxNullBitmap, _T(""), TIPS_B);
- //modetbar->AddRadioTool(MODE_S, _T("Spline"), wxBITMAP(s_), wxNullBitmap, _T(""), TIPS_S);
- //modetbar->AddRadioTool(MODE_P, _T("Extend"), wxBITMAP(p_), wxNullBitmap, _T(""), TIPS_P);
- //modetbar->AddRadioTool(MODE_C, _T("Close"), wxBITMAP(c_), wxNullBitmap, _T(""), TIPS_C);
- modetbar->AddRadioTool(MODE_DEL, _T("Delete"), wxBITMAP(del_), wxNullBitmap, _T(""), TIPS_DEL);
- modetbar->AddRadioTool(MODE_SCALEROTATE, _T("Scale/Rotate"), wxBITMAP(sc_rot_), wxNullBitmap, _T(""), TIPS_SCALEROTATE);
- modetbar->AddRadioTool(MODE_NUT_BILINEAR, _T("Bilinear"), wxBITMAP(nut_), wxNullBitmap, _T(""), TIPS_NUTB);
- //modetbar->AddRadioTool(MODE_NUT_PERSPECTIVE, _T("NUT:P"), wxBITMAP(arr_), wxNullBitmap, _T(""), _T(""));
- modetbar->Realize();
-
- m_mgr.AddPane(modetbar, wxAuiPaneInfo().Name(_T("modetbar")).Caption(TBNAME_MODE).
- ToolbarPane().Top().Position(1).Dockable(true).LeftDockable(false).RightDockable(false));
-
- bgimgtbar = new wxToolBar(this, wxID_ANY, __DPDS__ , wxTB_FLAT | wxTB_TEXT | wxTB_NODIVIDER | wxTB_HORIZONTAL);
- bgimgtbar->SetToolBitmapSize(wxSize(24,15));
- bgimgtbar->AddCheckTool(DRAG_DWG, _T("Pan drawing"), wxBITMAP(pan_shp), wxNullBitmap, _T(""), TIPS_DWG);
- bgimgtbar->AddCheckTool(DRAG_BGIMG, _T("Pan background"), wxBITMAP(pan_bg), wxNullBitmap, _T(""), TIPS_BGIMG);
- //bgimgtbar->AddRadioTool(DRAG_BOTH, _T("Pan both"), wxBITMAP(pan_both), wxNullBitmap, _T(""), TIPS_BOTH);
- bgimgtbar->Realize();
-
- m_mgr.AddPane(bgimgtbar, wxAuiPaneInfo().Name(_T("bgimgtbar")).Caption(TBNAME_BGIMG).
- ToolbarPane().Top().Position(2).Dockable(true).LeftDockable(false).RightDockable(false));
-
-}
-
-void ASSDrawFrame::SetMenus()
-{
- drawMenu = new wxMenu;
- drawMenu->Append(MENU_CLEAR, _T("&Clear\tCtrl+N"), TIPS_CLEAR);
- //drawMenu->Append(MENU_EDITSRC, _T("&Source"), TIPS_EDITSRC);
- drawMenu->Append(MENU_PREVIEW, _T("&Preview\tCtrl+P"), TIPS_PREVIEW, wxITEM_CHECK);
- drawMenu->Append(MENU_TRANSFORM, _T("&Transform"), TIPS_TRANSFORM);
- drawMenu->Append(MENU_PASTE, _T("&Paste\tCtrl+V"), TIPS_PASTE);
- drawMenu->AppendSeparator();
- drawMenu->Append(MENU_UNDO, _T("&Undo\tCtrl+Z"), TIPS_UNDO);
- drawMenu->Append(MENU_REDO, _T("&Redo\tCtrl+Y"), TIPS_REDO);
- drawMenu->Enable(MENU_UNDO, false);
- drawMenu->Enable(MENU_REDO, false);
-
- modeMenu = new wxMenu;
- modeMenu->Append(MODE_ARR, _T("D&rag\tF1"), TIPS_ARR, wxITEM_RADIO);
- modeMenu->Append(MODE_M, _T("Draw &M\tF2"), TIPS_M, wxITEM_RADIO);
- modeMenu->Append(MODE_L, _T("Draw &L\tF3"), TIPS_L, wxITEM_RADIO);
- modeMenu->Append(MODE_B, _T("Draw &B\tF4"), TIPS_B, wxITEM_RADIO);
- modeMenu->Append(MODE_DEL, _T("&Delete\tF5"), TIPS_DEL, wxITEM_RADIO);
- modeMenu->Append(MODE_SCALEROTATE, _T("&Scale/Rotate\tF6"), TIPS_NUTB, wxITEM_RADIO);
- modeMenu->Append(MODE_NUT_BILINEAR, _T("&Bilinear transformation\tF7"), TIPS_SCALEROTATE, wxITEM_RADIO);
-
- bgimgMenu = new wxMenu;
- bgimgMenu->Append(DRAG_DWG, _T("Pan/Zoom &Drawing\tShift+F1"), TIPS_DWG, wxITEM_CHECK);
- bgimgMenu->Append(DRAG_BGIMG, _T("Pan/Zoom Back&ground\tShift+F2"), TIPS_BGIMG, wxITEM_CHECK);
- bgimgMenu->AppendSeparator();
- bgimgMenu->Append(MENU_BGIMG_ALPHA, _T("Set background image opacity"), _T(""));
- wxMenu* reposbgMenu = new wxMenu;
- reposbgMenu->Append( MENU_REPOS_BGTOPLEFT, _T("Top left\tCtrl+Shift+7") );
- reposbgMenu->Append( MENU_REPOS_BGTOPRIGHT, _T("Top right\tCtrl+Shift+9") );
- reposbgMenu->Append( MENU_REPOS_BGCENTER, _T("&Center\tCtrl+Shift+5") );
- reposbgMenu->Append( MENU_REPOS_BGBOTLEFT, _T("Bottom left\tCtrl+Shift+1") );
- reposbgMenu->Append( MENU_REPOS_BGBOTRIGHT, _T("Bottom right\tCtrl+Shift+3") );
- bgimgMenu->Append(MENU_BGIMG_RECENTER, _T("Reposition [&0, 0]"), reposbgMenu);
- bgimgMenu->Append(MENU_BGIMG_REMOVE, _T("Remove background\tShift+Del"), _T(""));
-
- wxMenu* reposMenu = new wxMenu;
- reposMenu->Append( MENU_REPOS_TOPLEFT, _T("Top left\tCtrl+7") );
- reposMenu->Append( MENU_REPOS_TOPRIGHT, _T("Top right\tCtrl+9") );
- reposMenu->Append( MENU_REPOS_CENTER, _T("&Center\tCtrl+5") );
- reposMenu->Append( MENU_REPOS_BOTLEFT, _T("Bottom left\tCtrl+1") );
- reposMenu->Append( MENU_REPOS_BOTRIGHT, _T("Bottom right\tCtrl+3") );
-
- tbarMenu = new wxMenu;
- tbarMenu->AppendCheckItem(MENU_TB_DRAW, TBNAME_DRAW);
- tbarMenu->AppendCheckItem(MENU_TB_MODE, TBNAME_MODE);
- tbarMenu->AppendCheckItem(MENU_TB_BGIMG, TBNAME_BGIMG);
- tbarMenu->AppendSeparator();
- tbarMenu->Append(MENU_TB_ALL, _T("Show all"));
- tbarMenu->Append(MENU_TB_NONE, _T("Hide all"));
- tbarMenu->Append(MENU_TB_DOCK, _T("Dock all"));
- tbarMenu->Append(MENU_TB_UNDOCK, _T("Undock all"));
-
- viewMenu = new wxMenu;
- viewMenu->Append(MENU_LIBRARY, _T("&Library"), TIPS_LIBRARY, wxITEM_CHECK);
- if (settingsdlg)
- viewMenu->Append(MENU_SETTINGS, _T("&Settings"), _T(""), wxITEM_CHECK);
- viewMenu->Append(MENU_TBAR, _T("&Toolbars"), tbarMenu);
- viewMenu->Append(MENU_RECENTER, _T("Reposition [&0, 0]"), reposMenu);
- viewMenu->AppendSeparator();
- viewMenu->Append(MENU_RESETPERSPECTIVE, _T("&Reset workspace"));
-
- wxMenu* helpMenu = new wxMenu;
- helpMenu->Append(MENU_HELP, _T("&Manual"));
- helpMenu->Append(wxID_ABOUT, _T("&About"));
-
- wxMenuBar *menuBar = new wxMenuBar();
- menuBar->Append(drawMenu, _T("&Canvas"));
- menuBar->Append(modeMenu, _T("&Mode"));
- menuBar->Append(bgimgMenu, _T("&Background"));
- menuBar->Append(viewMenu, _T("&Workspace"));
- menuBar->Append(helpMenu, _T("&Help"));
-
-
- SetMenuBar(menuBar);
-}
-
-void ASSDrawFrame::SetPanes()
-{
- m_mgr.AddPane(shapelib, wxAuiPaneInfo().Name(_T("library")).Caption(_T("Shapes Library")).
- Right().Layer(2).Position(0).CloseButton(true).BestSize(wxSize(120, 480)).MinSize(wxSize(100, 200)));
-
- m_mgr.AddPane(m_canvas, wxAuiPaneInfo().Name(_T("canvas")).CenterPane());
-
- m_mgr.AddPane(srctxtctrl, wxAuiPaneInfo().Name(_T("commands")).Caption(_T("Drawing commands")).
- Bottom().Layer(1).CloseButton(false).BestSize(wxSize(320, 48)));
-
- if (settingsdlg)
- m_mgr.AddPane(settingsdlg, wxAuiPaneInfo().Name(_T("settings")).Caption(_T("Settings")).
- Right().Layer(3).Position(0).CloseButton(true).BestSize(wxSize(240, 480)).MinSize(wxSize(200, 200)).Show(false));
-}
-
-ASSDrawFrame::~ASSDrawFrame()
-{
- config->SetPath(_T("info"));
- config->Write(_T("assdraw3.exe"), wxStandardPaths::Get().GetExecutablePath());
- config->Write(_T("version"), VERSION);
- config->SetPath(_T(".."));
-
- SaveSettings();
-
- config->SetPath(_T("perspective"));
- config->Write(_T("perspective"), m_mgr.SavePerspective());
- config->SetPath(_T(".."));
-
- config->DeleteGroup(_T("library"));
- config->SetPath(_T("library"));
- typedef std::vector< ASSDrawShapePreview *> PrevVec;
- PrevVec shapes = shapelib->GetShapePreviews();
- int n = shapes.size();
- config->Write(_T("n"), n);
- for (int i = 0; i < n; i++)
- config->Write(wxString::Format(_T("%d"),i), shapes[i]->GenerateASS());
- config->SetPath(_T(".."));
-
- wxFileOutputStream cfgf(configfile);
- config->Save(cfgf);
- delete config;
-
- if (settingsdlg) settingsdlg->Destroy(); // we need this since wxPropertyGrid must be Clear()ed before deleting
-
- m_mgr.UnInit();
-}
-
-void ASSDrawFrame::_Clear()
-{
- wxMessageDialog msgb(this, _T("Clear the canvas and create a new drawing?"),
- _T("Confirmation"), wxOK | wxCANCEL | wxICON_QUESTION );
- if (msgb.ShowModal() == wxID_OK)
- {
- m_canvas->RefreshUndocmds();
- m_canvas->AddUndo(_T("Clear canvas"));
- m_canvas->ResetEngine(true);
- wxSize siz = m_canvas->GetClientSize();
- m_canvas->ChangeZoomLevelTo(DEFAULT_SCALE, wxPoint(siz.x / 2, siz.y / 2));
- m_canvas->MoveCanvasOriginTo(siz.x / 2, siz.y / 2);
- UpdateUndoRedoMenu();
- m_canvas->RefreshDisplay();
- }
-}
-
-void ASSDrawFrame::_Preview()
-{
- m_canvas->SetPreviewMode( !m_canvas->IsPreviewMode() );
- UpdateFrameUI();
- m_canvas->RefreshDisplay();
-}
-
-void ASSDrawFrame::_ToggleLibrary()
-{
- m_mgr.GetPane(shapelib).Show(!m_mgr.GetPane(shapelib).IsShown());
- m_mgr.Update();
- UpdateFrameUI();
-}
-
-void ASSDrawFrame::_ToggleSettings()
-{
- if (settingsdlg == NULL) return;
- m_mgr.GetPane(settingsdlg).Show(!m_mgr.GetPane(settingsdlg).IsShown());
- m_mgr.Update();
- UpdateFrameUI();
-}
-
-void ASSDrawFrame::_ResetPerspective()
-{
- m_mgr.LoadPerspective(default_perspective, false);
- UpdateFrameUI();
- m_mgr.Update();
- DRAGMODE bck = m_canvas->GetDragMode();
- if (m_canvas->HasBackgroundImage()) m_canvas->SetDragMode(DRAGMODE(true, true));
- wxSize clientsize = m_canvas->GetClientSize();
- m_canvas->ChangeZoomLevelTo(DEFAULT_SCALE, wxPoint(clientsize.x / 2, clientsize.y / 2));
- m_canvas->MoveCanvasOriginTo(clientsize.x / 2, clientsize.y / 2);
- m_canvas->SetDragMode(bck);
- UpdateFrameUI();
-}
-
-void ASSDrawFrame::_Transform()
-{
- if (transformdlg == NULL)
- transformdlg = new ASSDrawTransformDlg( this );
-
- if (transformdlg->ShowModal() == wxID_OK)
- {
- m_canvas->Transform(
- transformdlg->xformvals.f1,
- transformdlg->xformvals.f2,
- transformdlg->xformvals.f3,
- transformdlg->xformvals.f4,
- transformdlg->xformvals.f5,
- transformdlg->xformvals.f6,
- transformdlg->xformvals.f7,
- transformdlg->xformvals.f8 );
- m_canvas->AddUndo(_T("Transform"));
- m_canvas->RefreshDisplay();
- UpdateUndoRedoMenu();
- }
-}
-
-void ASSDrawFrame::_Paste()
-{
- if (wxTheClipboard->Open())
- {
- if (wxTheClipboard->IsSupported( wxDF_BITMAP ))
- {
- wxBitmapDataObject data;
- wxTheClipboard->GetData( data );
- m_canvas->SetBackgroundImage( data.GetBitmap().ConvertToImage() );
- //m_canvas->AskUserForBackgroundAlpha();
- }
- else if (wxTheClipboard->IsSupported( wxDF_TEXT ))
- {
- wxTextDataObject data;
- wxTheClipboard->GetData( data );
- UpdateASSCommandStringToSrcTxtCtrl( data.GetText() );
- }
- wxTheClipboard->Close();
- }
-}
-
-void ASSDrawFrame::OnChoose_Recenter(wxCommandEvent& event)
-{
- int x = 0, y = 0;
- wxSize f = m_canvas->GetClientSize();
-
- switch (event.GetId())
- {
- case MENU_REPOS_TOPLEFT: x = 0, y = 0; break;
- case MENU_REPOS_TOPRIGHT: x = f.x, y = 0; break;
- case MENU_REPOS_CENTER: x = f.x / 2, y = f.y / 2; break;
- case MENU_REPOS_BOTLEFT: x = 0, y = f.y; break;
- case MENU_REPOS_BOTRIGHT: x = f.x, y = f.y; break;
- }
-
- m_canvas->MoveCanvasOriginTo(x, y);
- m_canvas->RefreshDisplay();
-}
-
-void ASSDrawFrame::OnChoose_RecenterToBG(wxCommandEvent& event)
-{
- unsigned w, h;
- wxRealPoint disp;
- double scale;
- if (m_canvas->GetBackgroundInfo(w, h, disp, scale))
- {
- int x = 0, y = 0;
- int lx = (int)disp.x, ty = (int)disp.y;
- int rx = lx + (int)(w * scale);
- int by = ty + (int)(h * scale);
-
- switch (event.GetId())
- {
- case MENU_REPOS_BGTOPLEFT: x = lx, y = ty; break;
- case MENU_REPOS_BGTOPRIGHT: x = rx, y = ty; break;
- case MENU_REPOS_BGCENTER: x = (rx + lx) / 2, y = (by + ty) / 2; break;
- case MENU_REPOS_BGBOTLEFT: x = lx, y = by; break;
- case MENU_REPOS_BGBOTRIGHT: x = rx, y = by; break;
- }
-
- m_canvas->MoveCanvasDrawing(x - m_canvas->GetOriginX(), y - m_canvas->GetOriginY());
- m_canvas->RefreshDisplay();
- }
-}
-
-void ASSDrawFrame::_Help()
-{
- helpcontroller.DisplayContents();
-}
-
-void ASSDrawFrame::_About(unsigned timeout)
-{
- ASSDrawAboutDlg *aboutdlg = new ASSDrawAboutDlg( this, timeout );
- aboutdlg->ShowModal();
- aboutdlg->Destroy();
-}
-
-void ASSDrawFrame::OnChoose_Mode(wxCommandEvent& event)
-{
- m_canvas->SetDrawMode( (MODE) event.GetId() );
- UpdateFrameUI();
-}
-
-void ASSDrawFrame::OnChoose_DragMode(wxCommandEvent& event)
-{
- DRAGMODE dm = m_canvas->GetDragMode();
- switch (event.GetId())
- {
- case DRAG_DWG: dm.drawing = !dm.drawing; break;
- case DRAG_BGIMG: dm.bgimg = !dm.bgimg; break;
- }
- m_canvas->SetDragMode( dm );
- UpdateFrameUI();
-}
-
-void ASSDrawFrame::OnZoomSliderChanged(wxScrollEvent &event)
-{
- double zoom = (double) event.GetPosition() / 100.0;
- m_canvas->ChangeZoomLevelTo(zoom, wxPoint((int) m_canvas->GetOriginX(), (int) m_canvas->GetOriginY()));
-}
-
-void ASSDrawFrame::OnToolRClick(wxCommandEvent& event)
-{
- int id = event.GetId();
- if (drawtbar->FindById(id) != NULL
- || modetbar->FindById(id) != NULL
- || bgimgtbar->FindById(id) != NULL)
- {
- PopupMenu(tbarMenu);
- }
-}
-
-void ASSDrawFrame::OnChoose_TBarRClickMenu(wxCommandEvent& event)
-{
- int id = event.GetId();
- wxToolBar* tbar[3] = { drawtbar, modetbar, bgimgtbar };
- bool tb[3] = { false, false, false };
- bool show[2] = { false, true };
- bool dock[2] = { false, true };
- switch (id)
- {
- case MENU_TB_ALL:
- tb[0] = true, tb[1] = true, tb[2] = true;
- show[0] = true, show[1] = true;
- break;
- case MENU_TB_NONE:
- tb[0] = true, tb[1] = true, tb[2] = true;
- show[0] = true, show[1] = false;
- break;
- case MENU_TB_DOCK:
- tb[0] = true, tb[1] = true, tb[2] = true;
- dock[0] = true, dock[1] = true;
- break;
- case MENU_TB_UNDOCK:
- tb[0] = true, tb[1] = true, tb[2] = true;
- dock[0] = true, dock[1] = false;
- break;
- case MENU_TB_DRAW:
- tb[0] = true;
- show[0] = true, show[1] = !m_mgr.GetPane(tbar[0]).IsShown();
- break;
- case MENU_TB_MODE:
- tb[1] = true;
- show[0] = true, show[1] = !m_mgr.GetPane(tbar[1]).IsShown();
- break;
- case MENU_TB_BGIMG:
- tb[2] = true;
- show[0] = true, show[1] = !m_mgr.GetPane(tbar[2]).IsShown();
- break;
- }
- for (int i = 0; i < 3; i++)
- {
- if (tb[i])
- {
- if (show[0])
- m_mgr.GetPane(tbar[i]).Show(show[1]);
- if (dock[0])
- if (dock[1])
- m_mgr.GetPane(tbar[i]).Dock();
- else
- m_mgr.GetPane(tbar[i]).Float();
- }
- }
- m_mgr.Update();
- UpdateFrameUI();
-}
-
-void ASSDrawFrame::UpdateASSCommandStringFromSrcTxtCtrl(wxString cmds)
-{
- m_canvas->ParseASS(cmds, true);
- m_canvas->RefreshDisplay();
-}
-
-void ASSDrawFrame::UpdateASSCommandStringToSrcTxtCtrl(wxString cmd)
-{
- if (behaviors.capitalizecmds)
- cmd.UpperCase();
- else
- cmd.LowerCase();
- srctxtctrl->ChangeValue(cmd);
- //srctxtctrl->AppendText(cmd);
-}
-
-void ASSDrawFrame::UndoOrRedo(bool isundo)
-{
- if (isundo)
- m_canvas->Undo();
- else
- m_canvas->Redo();
- UpdateUndoRedoMenu();
- UpdateFrameUI();
-}
-
-void ASSDrawFrame::UpdateUndoRedoMenu()
-{
- wxString nextUndo = m_canvas->GetTopUndo();
- if (nextUndo.IsSameAs(_T("")))
- {
- drawMenu->SetLabel(MENU_UNDO, _T("Undo\tCtrl+Z"));
- drawMenu->Enable(MENU_UNDO, false);
- }
- else
- {
- drawMenu->SetLabel(MENU_UNDO, wxString::Format(_T("Undo: %s\tCtrl+Z"), nextUndo.c_str()));
- drawMenu->Enable(MENU_UNDO, true);
- }
- wxString nextRedo = m_canvas->GetTopRedo();
- if (nextRedo.IsSameAs(_T("")))
- {
- drawMenu->SetLabel(MENU_REDO, _T("Redo\tCtrl+Y"));
- drawMenu->Enable(MENU_REDO, false);
- }
- else
- {
- drawMenu->SetLabel(MENU_REDO, wxString::Format(_T("Redo: %s\tCtrl+Y"), nextRedo.c_str()));
- drawMenu->Enable(MENU_REDO, true);
- }
-}
-
-void ASSDrawFrame::UpdateFrameUI(unsigned level)
-{
- bool hasbg = m_canvas->HasBackgroundImage();
- int zoom = (int) ((m_canvas->GetScale() * 100.0)+0.5);
- switch (level)
- {
- case 0: // all
- drawtbar->ToggleTool(TB_PREVIEW, m_canvas->IsPreviewMode());
- modetbar->ToggleTool(m_canvas->GetDrawMode(), true);
- drawMenu->Check(MENU_PREVIEW, m_canvas->IsPreviewMode());
- modeMenu->Check(m_canvas->GetDrawMode(), true);
- case 2: // bgimg & toolbars
- bgimgtbar->ToggleTool(DRAG_DWG, m_canvas->GetDragMode().drawing);
- bgimgtbar->ToggleTool(DRAG_BGIMG, m_canvas->GetDragMode().bgimg);
- bgimgtbar->EnableTool(DRAG_BGIMG, hasbg);
- m_mgr.Update();
- viewMenu->Check(MENU_LIBRARY, m_mgr.GetPane(shapelib).IsShown());
- if (settingsdlg)
- viewMenu->Check(MENU_SETTINGS, m_mgr.GetPane(settingsdlg).IsShown());
- bgimgMenu->Check(DRAG_DWG, m_canvas->GetDragMode().drawing);
- bgimgMenu->Check(DRAG_BGIMG, m_canvas->GetDragMode().bgimg);
- bgimgMenu->Enable(DRAG_BGIMG, hasbg);
- bgimgMenu->Enable(MENU_BGIMG_ALPHA, hasbg);
- bgimgMenu->Enable(MENU_BGIMG_RECENTER, hasbg);
- bgimgMenu->Enable(MENU_BGIMG_REMOVE, hasbg);
- tbarMenu->Check(MENU_TB_DRAW, m_mgr.GetPane(drawtbar).IsShown());
- tbarMenu->Check(MENU_TB_MODE, m_mgr.GetPane(modetbar).IsShown());
- tbarMenu->Check(MENU_TB_BGIMG, m_mgr.GetPane(bgimgtbar).IsShown());
- case 3: // zoom slider
- zoomslider->SetValue(zoom);
- SetStatusText( wxString::Format(_T("%d%%"), zoom), 2 );
- zoomslider->Enable(m_canvas->GetDragMode().drawing && m_canvas->CanZoom());
- }
-}
-
-void ASSDrawFrame::OnClose(wxCloseEvent &event)
-{
- if (event.CanVeto() && behaviors.confirmquit)
- {
- if (wxMessageDialog(this, _T("Do you want to close ASSDraw3 now?"), _T("Confirmation"), wxOK | wxCANCEL).ShowModal() == wxID_OK)
- Destroy();
- else
- event.Veto();
- }
- else
- Destroy();
-}
diff --git a/contrib/assdraw/src/assdraw.hpp b/contrib/assdraw/src/assdraw.hpp
deleted file mode 100644
index 1ebd4dc4f..000000000
--- a/contrib/assdraw/src/assdraw.hpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
-* Copyright (c) 2007, ai-chan
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the ASSDraw3 Team nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-///////////////////////////////////////////////////////////////////////////////
-// Name: assdraw.hpp
-// Purpose: header file for ASSDraw main source file; also includes
-// declarations for all GUI elements (except wxRuler, which has
-// its own header file)
-// Author: ai-chan
-// Created: 08/26/06
-// Copyright: (c) ai-chan
-// Licence: 3-clause BSD
-///////////////////////////////////////////////////////////////////////////////
-
-#pragma once
-
-#include "_common.hpp"
-
-#include
-#include
-#include
-#include
-#include
-
-#include "canvas.hpp" // the canvas
-#include "dlgctrl.hpp" // custom dialogs & controls
-#include "settings.hpp" // settings property grid
-#include "library.hpp" // shape library
-
-//#define BETAVERSION 2
-#define VERSION _T("3.0 final")
-
-// this header file declares the following classes
-class ASSDrawApp;
-class ASSDrawFrame;
-class ASSDrawCanvas;
-
-class ASSDrawApp : public wxApp
-{
-public:
- bool OnInit();
-};
-
-class ASSDrawFrame : public wxFrame
-{
-public:
- // constructor
- ASSDrawFrame(wxApp *app, const wxString& title, const wxPoint& pos, const wxSize& size = wxDefaultSize,
- long style = wxDEFAULT_FRAME_STYLE);
- virtual ~ASSDrawFrame();
-
- // event handlers (these functions should _not_ be virtual)
- // OnSelect_* for single items, OnChoose_* for many-choose-one items
- void OnSelect_Clear(wxCommandEvent& WXUNUSED(event)) { _Clear(); }
- void OnSelect_Preview(wxCommandEvent& WXUNUSED(event)) { _Preview(); }
- void OnSelect_Transform(wxCommandEvent& WXUNUSED(event)) { _Transform(); }
- void OnSelect_Library(wxCommandEvent& WXUNUSED(event)) { _ToggleLibrary(); }
- void OnSelect_Settings(wxCommandEvent& WXUNUSED(event)) { _ToggleSettings(); }
- void OnSelect_ResetPerspective(wxCommandEvent& WXUNUSED(event)) { _ResetPerspective(); }
- void OnSelect_Help(wxCommandEvent& WXUNUSED(event)) { _Help(); }
- void OnSelect_About(wxCommandEvent& WXUNUSED(event)) { _About(); }
- void OnSelect_Undo(wxCommandEvent& WXUNUSED(event)) { UndoOrRedo( true ); }
- void OnSelect_Redo(wxCommandEvent& WXUNUSED(event)) { UndoOrRedo( false ); }
- void OnSelect_Paste(wxCommandEvent& WXUNUSED(event)) { _Paste(); }
- void OnSelect_RemoveBG(wxCommandEvent& WXUNUSED(event)) { m_canvas->RemoveBackgroundImage(); }
- void OnSelect_AlphaBG(wxCommandEvent& WXUNUSED(event)) { m_canvas->AskUserForBackgroundAlpha(); }
- void OnChoose_Recenter(wxCommandEvent& event);
- void OnChoose_RecenterToBG(wxCommandEvent& event);
- void OnChoose_Mode(wxCommandEvent& event);
- void OnChoose_DragMode(wxCommandEvent& event);
- void OnZoomSliderChanged(wxScrollEvent &event);
- void OnToolRClick(wxCommandEvent& event);
- void OnChoose_TBarRClickMenu(wxCommandEvent& event);
- void OnSettingsChanged(wxCommandEvent& event);
- void OnClose(wxCloseEvent &event);
-
- void UpdateASSCommandStringToSrcTxtCtrl(wxString cmds);
- void UpdateASSCommandStringFromSrcTxtCtrl(wxString cmds);
-
- void UndoOrRedo(bool isundo);
- void UpdateUndoRedoMenu();
-
- void _Clear();
- void _Preview();
- void _Transform();
- void _ToggleLibrary();
- void _ToggleSettings();
- void _Help();
- void _About(unsigned timeout = 0);
- void _Paste();
- void _ResetPerspective();
-
- void UpdateFrameUI(unsigned level = 0);
-
- // the canvas
- wxApp *m_app;
- ASSDrawCanvas* m_canvas;
- wxAuiManager m_mgr;
- wxString default_perspective;
- ASSDrawSrcTxtCtrl* srctxtctrl;
-
- // config
- wxString configfile;
- wxFileConfig *config;
-
- // toolbars
- wxToolBar *drawtbar, *modetbar, *bgimgtbar;
-
- // zoom slider
- wxSlider* zoomslider;
-
- //library
- ASSDrawShapeLibrary *shapelib;
- typedef std::vector< ASSDrawEngine* > DrawEngineVec;
- DrawEngineVec libshapes;
-
- // menus
-#if wxUSE_MENUS
- wxMenu *drawMenu;
- wxMenu *modeMenu;
- wxMenu *bgimgMenu;
- wxMenu *viewMenu;
- wxMenu *tbarMenu;
-#endif
-
- // dialogs
- ASSDrawTransformDlg* transformdlg;
- ASSDrawSettingsDialog* settingsdlg;
-
- // colors
- struct
- {
- wxColour canvas_bg;
- wxColour canvas_shape_normal;
- wxColour canvas_shape_preview;
- wxColour canvas_shape_outline;
- wxColour canvas_shape_guideline;
- wxColour canvas_shape_mainpoint;
- wxColour canvas_shape_controlpoint;
- wxColour canvas_shape_selectpoint;
- wxColour library_shape;
- wxColour library_libarea;
- wxColour origin, ruler_h, ruler_v;
- } colors;
-
- struct
- {
- long canvas_shape_normal;
- long canvas_shape_preview;
- long canvas_shape_outline;
- long canvas_shape_guideline;
- long canvas_shape_mainpoint;
- long canvas_shape_controlpoint;
- long canvas_shape_selectpoint;
- } alphas;
-
- struct
- {
- long origincross;
- } sizes;
-
- struct
- {
- bool capitalizecmds;
- bool autoaskimgopac;
- bool parse_spc;
- bool nosplashscreen;
- bool confirmquit;
- } behaviors;
-
- void LoadSettings();
- void SaveSettings();
- void InitializeDefaultSettings();
- void ApplySettings();
- static void wxColourToAggRGBA(wxColour &colour, agg::rgba &rgba);
- static void wxColourSetAlpha(wxColour &colour, long alpha);
-
-protected:
- virtual void SetToolBars();
- virtual void SetMenus();
- virtual void SetPanes();
- DECLARE_EVENT_TABLE()
-
- wxHelpController helpcontroller;
-
-};
diff --git a/contrib/assdraw/src/assdraw.rc b/contrib/assdraw/src/assdraw.rc
deleted file mode 100644
index 162d9bd91..000000000
--- a/contrib/assdraw/src/assdraw.rc
+++ /dev/null
@@ -1,101 +0,0 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "afxres.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-APPICO ICON "tsukasa.ico"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Bitmap
-//
-
-ASSDRAW3_ BITMAP "bitmaps/assdraw3.bmp"
-NEW_ BITMAP "bitmaps/new_.bmp"
-SRC_ BITMAP "bitmaps/src_.bmp"
-PREVIEW_ BITMAP "bitmaps/preview_.bmp"
-ARR_ BITMAP "bitmaps/arr_.bmp"
-M_ BITMAP "bitmaps/m_.bmp"
-N_ BITMAP "bitmaps/n_.bmp"
-L_ BITMAP "bitmaps/l_.bmp"
-B_ BITMAP "bitmaps/b_.bmp"
-S_ BITMAP "bitmaps/s_.bmp"
-P_ BITMAP "bitmaps/p_.bmp"
-C_ BITMAP "bitmaps/c_.bmp"
-DEL_ BITMAP "bitmaps/del_.bmp"
-NUT_ BITMAP "bitmaps/nut_.bmp"
-SC_ROT_ BITMAP "bitmaps/sc_rot_.bmp"
-ROT_ BITMAP "bitmaps/rot_.bmp"
-HELP_ BITMAP "bitmaps/help_.bmp"
-TRANSFORM BITMAP "bitmaps/transform.bmp"
-PAN_SHP BITMAP "bitmaps/pan_shp.bmp"
-PAN_BG BITMAP "bitmaps/pan_bg.bmp"
-//PAN_BOTH BITMAP "bitmaps/pan_both.bmp"
-ADD BITMAP "bitmaps/add_.bmp"
-CHECK BITMAP "bitmaps/check_.bmp"
-UNCHECK BITMAP "bitmaps/uncheck_.bmp"
-DELCROSS BITMAP "bitmaps/del_cross.bmp"
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "resource.h\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""afxres.h""\r\n"
-END
-
-#endif // APSTUDIO_INVOKED
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/contrib/assdraw/src/assdraw_settings.cpp b/contrib/assdraw/src/assdraw_settings.cpp
deleted file mode 100644
index d774f55c1..000000000
--- a/contrib/assdraw/src/assdraw_settings.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
-* Copyright (c) 2007, ai-chan
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the ASSDraw3 Team nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#include "assdraw.hpp"
-
-void ASSDrawFrame::InitializeDefaultSettings()
-{
- colors.canvas_bg = wxColour(0xFF, 0xFF, 0xFF);
- colors.canvas_shape_normal = wxColour(0x0, 0x0, 0xFF, 0x99);
- colors.canvas_shape_preview = wxColour(0x0, 0x0, 0xFF);
- colors.canvas_shape_outline = wxColour(0x0, 0x0, 0x0);
- colors.canvas_shape_guideline = wxColour(0x66, 0x66, 0x66);
- colors.canvas_shape_mainpoint = wxColour(0xFF, 0x0, 0x0, 0xCC);
- colors.canvas_shape_controlpoint = wxColour(0x0, 0xFF, 0x0, 0xCC);
- colors.canvas_shape_selectpoint = wxColour(0x0, 0x0, 0xCC);
- colors.library_shape = wxColour(0x0, 0x66, 0x99);
- colors.library_libarea = wxColour(0xFF, 0xFF, 0x99);
- colors.origin = wxColour(0xFF, 0x0, 0x0);
- colors.ruler_h = wxColour(0x0, 0x0, 0x66);
- colors.ruler_v = wxColour(0x66, 0x0, 0x0);
-
- alphas.canvas_shape_normal = 128;
- alphas.canvas_shape_preview = 255;
- alphas.canvas_shape_outline = 255;
- alphas.canvas_shape_guideline = 255;
- alphas.canvas_shape_mainpoint = 128;
- alphas.canvas_shape_controlpoint = 128;
- alphas.canvas_shape_selectpoint = 255;
-
- sizes.origincross = 2;
-
- behaviors.capitalizecmds = false;
- behaviors.autoaskimgopac = true;
- behaviors.parse_spc = false;
- behaviors.nosplashscreen = false;
- behaviors.confirmquit = true;
-}
-
-void ASSDrawFrame::ApplySettings()
-{
- wxColourSetAlpha(colors.canvas_shape_normal, alphas.canvas_shape_normal);
- wxColourSetAlpha(colors.canvas_shape_preview, alphas.canvas_shape_preview);
- wxColourSetAlpha(colors.canvas_shape_outline, alphas.canvas_shape_outline);
- wxColourSetAlpha(colors.canvas_shape_guideline, alphas.canvas_shape_guideline);
- wxColourSetAlpha(colors.canvas_shape_mainpoint, alphas.canvas_shape_mainpoint);
- wxColourSetAlpha(colors.canvas_shape_controlpoint, alphas.canvas_shape_controlpoint);
- wxColourSetAlpha(colors.canvas_shape_selectpoint, alphas.canvas_shape_selectpoint);
-
- wxColourToAggRGBA(colors.canvas_shape_normal, m_canvas->rgba_shape_normal);
- wxColourToAggRGBA(colors.canvas_shape_preview, m_canvas->rgba_shape);
- wxColourToAggRGBA(colors.canvas_shape_outline, m_canvas->rgba_outline);
- wxColourToAggRGBA(colors.canvas_shape_guideline, m_canvas->rgba_guideline);
- wxColourToAggRGBA(colors.canvas_shape_mainpoint, m_canvas->rgba_mainpoint);
- wxColourToAggRGBA(colors.canvas_shape_controlpoint, m_canvas->rgba_controlpoint);
- wxColourToAggRGBA(colors.canvas_shape_selectpoint, m_canvas->rgba_selectpoint);
- wxColourToAggRGBA(colors.origin, m_canvas->rgba_origin);
- wxColourToAggRGBA(colors.ruler_h, m_canvas->rgba_ruler_h);
- wxColourToAggRGBA(colors.ruler_v, m_canvas->rgba_ruler_v);
-
- m_canvas->color_bg.r = colors.canvas_bg.Red();
- m_canvas->color_bg.g = colors.canvas_bg.Green();
- m_canvas->color_bg.b = colors.canvas_bg.Blue();
- m_canvas->color_bg.a = colors.canvas_bg.Alpha();
- m_canvas->PrepareBackgroundBitmap(-1.0);
- m_canvas->Refresh();
-
- shapelib->libarea->SetBackgroundColour(colors.library_libarea);
- typedef std::vector< ASSDrawShapePreview *> PrevVec;
- PrevVec shapes = shapelib->GetShapePreviews();
- int n = shapes.size();
- for (int i = 0; i < n; i++)
- wxColourToAggRGBA(colors.library_shape, shapes[i]->rgba_shape);
- shapelib->libarea->Refresh();
-
- m_canvas->SetDrawCmdSet(behaviors.parse_spc? _T("m n l b s p c _"):_T("m n l b _"));
-
- UpdateASSCommandStringToSrcTxtCtrl(m_canvas->GenerateASS());
-}
-
-void ASSDrawFrame::wxColourToAggRGBA(wxColour &colour, agg::rgba &rgba)
-{
- rgba.r = (double) colour.Red() / 255.0;
- rgba.g = (double) colour.Green() / 255.0;
- rgba.b = (double) colour.Blue() / 255.0;
- rgba.a = (double) colour.Alpha() / 255.0;
-}
-
-void ASSDrawFrame::wxColourSetAlpha(wxColour &colour, long alpha)
-{
- colour.Set(colour.Red(), colour.Green(), colour.Blue(), alpha);
-}
-
-void ASSDrawFrame::OnSettingsChanged(wxCommandEvent& event)
-{
- ApplySettings();
-}
-
-void ASSDrawFrame::LoadSettings()
-{
- #define CFGREADCOLOR(color) if (config->Read(wxString(#color,wxConvUTF8), &tmpstr)) color.Set(tmpstr);
- #define CFGREAD(var) config->Read(wxString(#var,wxConvUTF8), &var);
- config->SetPath(_T("settings"));
- wxString tmpstr;
- CFGREADCOLOR(colors.canvas_bg)
- CFGREADCOLOR(colors.canvas_shape_normal)
- CFGREADCOLOR(colors.canvas_shape_preview)
- CFGREADCOLOR(colors.canvas_shape_controlpoint)
- CFGREADCOLOR(colors.canvas_shape_guideline)
- CFGREADCOLOR(colors.canvas_shape_mainpoint)
- CFGREADCOLOR(colors.canvas_shape_outline)
- CFGREADCOLOR(colors.canvas_shape_selectpoint)
- CFGREADCOLOR(colors.library_libarea)
- CFGREADCOLOR(colors.library_shape)
- CFGREADCOLOR(colors.origin)
- CFGREADCOLOR(colors.ruler_h)
- CFGREADCOLOR(colors.ruler_v)
- CFGREAD(alphas.canvas_shape_normal)
- CFGREAD(alphas.canvas_shape_preview)
- CFGREAD(alphas.canvas_shape_controlpoint)
- CFGREAD(alphas.canvas_shape_guideline)
- CFGREAD(alphas.canvas_shape_mainpoint)
- CFGREAD(alphas.canvas_shape_outline)
- CFGREAD(alphas.canvas_shape_selectpoint)
- CFGREAD(sizes.origincross)
- CFGREAD(behaviors.autoaskimgopac)
- CFGREAD(behaviors.capitalizecmds)
- CFGREAD(behaviors.parse_spc)
- CFGREAD(behaviors.nosplashscreen)
- CFGREAD(behaviors.confirmquit)
- config->SetPath(_T(".."));
-}
-
-void ASSDrawFrame::SaveSettings()
-{
- #define CFGWRITE(var) config->Write(wxString(#var,wxConvUTF8), var);
- #define CFGWRITECOLOR(color) config->Write(wxString(#color,wxConvUTF8), color.GetAsString(wxC2S_CSS_SYNTAX));
- config->SetPath(_T("settings"));
- CFGWRITECOLOR(colors.canvas_bg)
- CFGWRITECOLOR(colors.canvas_shape_normal)
- CFGWRITECOLOR(colors.canvas_shape_preview)
- CFGWRITECOLOR(colors.canvas_shape_controlpoint)
- CFGWRITECOLOR(colors.canvas_shape_guideline)
- CFGWRITECOLOR(colors.canvas_shape_mainpoint)
- CFGWRITECOLOR(colors.canvas_shape_outline)
- CFGWRITECOLOR(colors.canvas_shape_selectpoint)
- CFGWRITECOLOR(colors.library_libarea)
- CFGWRITECOLOR(colors.library_shape)
- CFGWRITECOLOR(colors.origin)
- CFGWRITECOLOR(colors.ruler_h)
- CFGWRITECOLOR(colors.ruler_v)
- CFGWRITE(alphas.canvas_shape_normal)
- CFGWRITE(alphas.canvas_shape_preview)
- CFGWRITE(alphas.canvas_shape_controlpoint)
- CFGWRITE(alphas.canvas_shape_guideline)
- CFGWRITE(alphas.canvas_shape_mainpoint)
- CFGWRITE(alphas.canvas_shape_outline)
- CFGWRITE(alphas.canvas_shape_selectpoint)
- CFGWRITE(sizes.origincross)
- CFGWRITE(behaviors.autoaskimgopac)
- CFGWRITE(behaviors.capitalizecmds)
- CFGWRITE(behaviors.parse_spc)
- CFGWRITE(behaviors.nosplashscreen)
- CFGWRITE(behaviors.confirmquit)
- config->SetPath(_T(".."));
-}
diff --git a/contrib/assdraw/src/bitmaps/Copy of assdraw3.bmp b/contrib/assdraw/src/bitmaps/Copy of assdraw3.bmp
deleted file mode 100644
index 4fe735e5b..000000000
Binary files a/contrib/assdraw/src/bitmaps/Copy of assdraw3.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/add_.bmp b/contrib/assdraw/src/bitmaps/add_.bmp
deleted file mode 100644
index 5a87ed3fb..000000000
Binary files a/contrib/assdraw/src/bitmaps/add_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/arr_.bmp b/contrib/assdraw/src/bitmaps/arr_.bmp
deleted file mode 100644
index 34ec029d1..000000000
Binary files a/contrib/assdraw/src/bitmaps/arr_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/arr_1.bmp b/contrib/assdraw/src/bitmaps/arr_1.bmp
deleted file mode 100644
index 14f71ee26..000000000
Binary files a/contrib/assdraw/src/bitmaps/arr_1.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/assdraw3.bmp b/contrib/assdraw/src/bitmaps/assdraw3.bmp
deleted file mode 100644
index debaf3c8b..000000000
Binary files a/contrib/assdraw/src/bitmaps/assdraw3.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/b_.bmp b/contrib/assdraw/src/bitmaps/b_.bmp
deleted file mode 100644
index 3046a9048..000000000
Binary files a/contrib/assdraw/src/bitmaps/b_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/b_.cur b/contrib/assdraw/src/bitmaps/b_.cur
deleted file mode 100644
index 117906dd9..000000000
Binary files a/contrib/assdraw/src/bitmaps/b_.cur and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/c_.bmp b/contrib/assdraw/src/bitmaps/c_.bmp
deleted file mode 100644
index 8a37dae86..000000000
Binary files a/contrib/assdraw/src/bitmaps/c_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/check_.bmp b/contrib/assdraw/src/bitmaps/check_.bmp
deleted file mode 100644
index 41ca19aa3..000000000
Binary files a/contrib/assdraw/src/bitmaps/check_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/del_.bmp b/contrib/assdraw/src/bitmaps/del_.bmp
deleted file mode 100644
index 034986fd0..000000000
Binary files a/contrib/assdraw/src/bitmaps/del_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/del_cross.bmp b/contrib/assdraw/src/bitmaps/del_cross.bmp
deleted file mode 100644
index e6dc0957f..000000000
Binary files a/contrib/assdraw/src/bitmaps/del_cross.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/help.bmp b/contrib/assdraw/src/bitmaps/help.bmp
deleted file mode 100644
index d5636e9aa..000000000
Binary files a/contrib/assdraw/src/bitmaps/help.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/help_.bmp b/contrib/assdraw/src/bitmaps/help_.bmp
deleted file mode 100644
index eac6f2e5e..000000000
Binary files a/contrib/assdraw/src/bitmaps/help_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/l_.bmp b/contrib/assdraw/src/bitmaps/l_.bmp
deleted file mode 100644
index 92af791d0..000000000
Binary files a/contrib/assdraw/src/bitmaps/l_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/m_.bmp b/contrib/assdraw/src/bitmaps/m_.bmp
deleted file mode 100644
index 5e5b4c861..000000000
Binary files a/contrib/assdraw/src/bitmaps/m_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/n_.bmp b/contrib/assdraw/src/bitmaps/n_.bmp
deleted file mode 100644
index 47c4ad7f2..000000000
Binary files a/contrib/assdraw/src/bitmaps/n_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/new_.bmp b/contrib/assdraw/src/bitmaps/new_.bmp
deleted file mode 100644
index 3c8f88d41..000000000
Binary files a/contrib/assdraw/src/bitmaps/new_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/nut_.bmp b/contrib/assdraw/src/bitmaps/nut_.bmp
deleted file mode 100644
index f76644e38..000000000
Binary files a/contrib/assdraw/src/bitmaps/nut_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/p_.bmp b/contrib/assdraw/src/bitmaps/p_.bmp
deleted file mode 100644
index 67aeafa72..000000000
Binary files a/contrib/assdraw/src/bitmaps/p_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/pan_bg.bmp b/contrib/assdraw/src/bitmaps/pan_bg.bmp
deleted file mode 100644
index 0587ca30e..000000000
Binary files a/contrib/assdraw/src/bitmaps/pan_bg.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/pan_both.bmp b/contrib/assdraw/src/bitmaps/pan_both.bmp
deleted file mode 100644
index 84eb52fd0..000000000
Binary files a/contrib/assdraw/src/bitmaps/pan_both.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/pan_shape.bmp b/contrib/assdraw/src/bitmaps/pan_shape.bmp
deleted file mode 100644
index 32ada0ae3..000000000
Binary files a/contrib/assdraw/src/bitmaps/pan_shape.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/pan_shp.bmp b/contrib/assdraw/src/bitmaps/pan_shp.bmp
deleted file mode 100644
index 1b5da621b..000000000
Binary files a/contrib/assdraw/src/bitmaps/pan_shp.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/preview_.bmp b/contrib/assdraw/src/bitmaps/preview_.bmp
deleted file mode 100644
index b8b6fbe98..000000000
Binary files a/contrib/assdraw/src/bitmaps/preview_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/rot_.bmp b/contrib/assdraw/src/bitmaps/rot_.bmp
deleted file mode 100644
index b2c14a906..000000000
Binary files a/contrib/assdraw/src/bitmaps/rot_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/s_.bmp b/contrib/assdraw/src/bitmaps/s_.bmp
deleted file mode 100644
index 1e8afab55..000000000
Binary files a/contrib/assdraw/src/bitmaps/s_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/sc_rot_.bmp b/contrib/assdraw/src/bitmaps/sc_rot_.bmp
deleted file mode 100644
index 546d7fdf1..000000000
Binary files a/contrib/assdraw/src/bitmaps/sc_rot_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/src_.bmp b/contrib/assdraw/src/bitmaps/src_.bmp
deleted file mode 100644
index ae2e55e07..000000000
Binary files a/contrib/assdraw/src/bitmaps/src_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/transform.bmp b/contrib/assdraw/src/bitmaps/transform.bmp
deleted file mode 100644
index 8ae24e5ad..000000000
Binary files a/contrib/assdraw/src/bitmaps/transform.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/bitmaps/uncheck_.bmp b/contrib/assdraw/src/bitmaps/uncheck_.bmp
deleted file mode 100644
index b600bebec..000000000
Binary files a/contrib/assdraw/src/bitmaps/uncheck_.bmp and /dev/null differ
diff --git a/contrib/assdraw/src/canvas.cpp b/contrib/assdraw/src/canvas.cpp
deleted file mode 100644
index a077c1ef5..000000000
--- a/contrib/assdraw/src/canvas.cpp
+++ /dev/null
@@ -1,1997 +0,0 @@
-/*
-* Copyright (c) 2007, ai-chan
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the ASSDraw3 Team nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-///////////////////////////////////////////////////////////////////////////////
-// Name: canvas.cpp
-// Purpose: implementations of ASSDraw main canvas class
-// Author: ai-chan
-// Created: 08/26/06
-// Copyright: (c) ai-chan
-// Licence: 3-clause BSD
-///////////////////////////////////////////////////////////////////////////////
-
-#include "assdraw.hpp"
-#include "cmd.hpp"
-#include "agg_gsv_text.h"
-#include "agg_ellipse.h"
-#include "agg_conv_dash.h"
-#include "agg_trans_bilinear.h"
-#include "agg_trans_perspective.h"
-
-#include "agghelper.hpp"
-#include
-#include
-#include
-
-// ----------------------------------------------------------------------------
-// the main drawing canvas: ASSDrawCanvas
-// ----------------------------------------------------------------------------
-
-BEGIN_EVENT_TABLE(ASSDrawCanvas, ASSDrawEngine)
- EVT_MOTION (ASSDrawCanvas::OnMouseMove)
- EVT_LEFT_UP(ASSDrawCanvas::OnMouseLeftUp)
- EVT_LEFT_DOWN(ASSDrawCanvas::OnMouseLeftDown)
- EVT_RIGHT_UP(ASSDrawCanvas::OnMouseRightUp)
- EVT_RIGHT_DOWN(ASSDrawCanvas::OnMouseRightDown)
- EVT_RIGHT_DCLICK(ASSDrawCanvas::OnMouseRightDClick)
- EVT_MOUSEWHEEL(ASSDrawCanvas::OnMouseWheel)
- EVT_KEY_DOWN(ASSDrawCanvas::CustomOnKeyDown)
- EVT_KEY_UP(ASSDrawCanvas::CustomOnKeyUp)
- EVT_MENU(MENU_DRC_LNTOBEZ, ASSDrawCanvas::OnSelect_ConvertLineToBezier)
- EVT_MENU(MENU_DRC_BEZTOLN, ASSDrawCanvas::OnSelect_ConvertBezierToLine)
- EVT_MENU(MENU_DRC_C1CONTBEZ, ASSDrawCanvas::OnSelect_C1ContinuityBezier)
- EVT_MENU(MENU_DRC_MOVE00, ASSDrawCanvas::OnSelect_Move00Here)
- EVT_MOUSE_CAPTURE_LOST(ASSDrawCanvas::CustomOnMouseCaptureLost)
-END_EVENT_TABLE()
-
-ASSDrawCanvas::ASSDrawCanvas(wxWindow *parent, ASSDrawFrame *frame, int extraflags)
- : ASSDrawEngine( parent, extraflags )
-{
- m_frame = frame;
- preview_mode = false;
- lastDrag_left = NULL;
- lastDrag_right = NULL;
- dragAnchor_left = NULL;
- dragAnchor_right = NULL;
- newcommand = NULL;
- mousedownAt_point = NULL;
- pointedAt_point = NULL;
- draw_mode = MODE_ARR;
-
- dragOrigin = false;
- hilite_cmd = NULL;
- hilite_point = NULL;
- capturemouse_left = false;
- capturemouse_right = false;
- bgimg.bgbmp = NULL;
- bgimg.bgimg = NULL;
- bgimg.alpha = 0.5;
- rectbound2upd = -1, rectbound2upd2 = -1;
-
- rgba_shape_normal = agg::rgba(0,0,1,0.5);
- rgba_outline = agg::rgba(0,0,0);
- rgba_guideline = agg::rgba(0.5,0.5,0.5);
- rgba_mainpoint = agg::rgba(1,0,0,0.75);
- rgba_controlpoint = agg::rgba(0,1,0,0.75);
- rgba_selectpoint = agg::rgba(0,0,1,0.75);
- rgba_origin = agg::rgba(0,0,0);
- rgba_ruler_h = agg::rgba(0,0,1);
- rgba_ruler_v = agg::rgba(1,0,0);
-
- wxFlexGridSizer* sizer = new wxFlexGridSizer(1, 1, 0);
- sizer->AddGrowableRow(0);
- sizer->AddGrowableCol(0);
- sizer->Add( this, 0, wxGROW|wxGROW, 5);
- parent->SetSizer(sizer);
-
- // for background image loading
- ::wxInitAllImageHandlers();
- bgimg.bgbmp = NULL;
- bgimg.bgimg = NULL;
- // drag image background file
- SetDropTarget(new ASSDrawFileDropTarget(this));
-
- hasStatusBar = m_frame->GetStatusBar() != NULL;
-
- // cursor = crosshair
- SetCursor( *wxCROSS_CURSOR );
-
- bgimg.alpha_dlg = new wxDialog(this, wxID_ANY, wxString(_T("Background image opacity")));
- bgimg.alpha_slider = new wxSlider(bgimg.alpha_dlg, TB_BGALPHA_SLIDER, 50, 0, 100, __DPDS__ , wxSL_LABELS);
- bgimg.alpha_slider->SetSize(280, bgimg.alpha_slider->GetSize().y);
- bgimg.alpha_dlg->Fit();
- bgimg.alpha_dlg->Show(false);
- bgimg.alpha_slider->Connect(wxEVT_SCROLL_LINEUP, wxScrollEventHandler(ASSDrawCanvas::OnAlphaSliderChanged), NULL, this);
- bgimg.alpha_slider->Connect(wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler(ASSDrawCanvas::OnAlphaSliderChanged), NULL, this);
- bgimg.alpha_slider->Connect(wxEVT_SCROLL_PAGEUP, wxScrollEventHandler(ASSDrawCanvas::OnAlphaSliderChanged), NULL, this);
- bgimg.alpha_slider->Connect(wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler(ASSDrawCanvas::OnAlphaSliderChanged), NULL, this);
- bgimg.alpha_slider->Connect(wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(ASSDrawCanvas::OnAlphaSliderChanged), NULL, this);
- bgimg.alpha_slider->Connect(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(ASSDrawCanvas::OnAlphaSliderChanged), NULL, this);
-
- RefreshUndocmds();
-
-}
-
-// Destructor
-ASSDrawCanvas::~ASSDrawCanvas()
-{
- ASSDrawEngine::ResetEngine(false);
- if (pointsys) delete pointsys;
- if (bgimg.bgbmp) delete bgimg.bgbmp;
- if (bgimg.bgimg) delete bgimg.bgimg;
-}
-
-void ASSDrawCanvas::ParseASS(wxString str, bool addundo)
-{
- if (addundo)
- AddUndo(_T("Modify drawing commands"));
-
- ASSDrawEngine::ParseASS(str);
-
- RefreshUndocmds();
-}
-
-void ASSDrawCanvas::ResetEngine(bool addM)
-{
- ClearPointsSelection();
- SetHighlighted(NULL, NULL);
- SetPreviewMode(false);
- SetDrawMode(MODE_ARR);
- ASSDrawEngine::ResetEngine(addM);
- RefreshUndocmds();
-}
-
-void ASSDrawCanvas::SetPreviewMode(bool mode)
-{
- preview_mode = mode;
- if (preview_mode)
- {
- if (mousedownAt_point != NULL)
- {
- mousedownAt_point->cmd_main->Init();
- mousedownAt_point = NULL;
- }
-
- if (pointedAt_point != NULL)
- pointedAt_point = NULL;
-
- SetHighlighted( NULL, NULL );
-
- RefreshDisplay();
- }
-}
-
-// (Re)draw canvas
-void ASSDrawCanvas::RefreshDisplay()
-{
- ASSDrawEngine::RefreshDisplay();
- wxString asscmds = GenerateASS();
- if (oldasscmds != asscmds)
- {
- m_frame->UpdateASSCommandStringToSrcTxtCtrl(asscmds);
- oldasscmds = asscmds;
- }
-}
-
-void ASSDrawCanvas::SetDrawMode( MODE mode )
-{
- draw_mode = mode;
-
- if (!selected_points.empty())
- ClearPointsSelection();
-
- RefreshDisplay();
-
- if (IsTransformMode())
- {
- isshapetransformable = cmds.size() > 1;
-
- if (isshapetransformable)
- {
-
- // backup cmds
- backupcmds.free_all();
- for (DrawCmdList::iterator iterate = cmds.begin(); iterate != cmds.end(); iterate++)
- {
- DrawCmd* cmd = (*iterate);
- for (PointList::iterator iterate2 = cmd->controlpoints.begin(); iterate2 != cmd->controlpoints.end(); iterate2++)
- {
- wxPoint pp = (*iterate2)->ToWxPoint();
- backupcmds.move_to(pp.x, pp.y);
- }
- wxPoint pp = (*iterate)->m_point->ToWxPoint();
- backupcmds.move_to(pp.x, pp.y);
- }
-
- // calculate bounding rectangle
- agg::trans_affine mtx;
- trans_path *rm, *rb;
- agg::conv_curve *rc;
- ConstructPathsAndCurves(mtx, rm, rb, rc);
- rasterizer.reset();
- rasterizer.add_path(*rc);
- delete rm;
- delete rb;
- delete rc;
- int minx = rasterizer.min_x(), miny = rasterizer.min_y();
- int maxx = rasterizer.max_x(), maxy = rasterizer.max_y();
-
- rectbound[0] = wxRealPoint(minx, miny);
- rectbound[1] = wxRealPoint(maxx, miny);
- rectbound[2] = wxRealPoint(maxx, maxy);
- rectbound[3] = wxRealPoint(minx, maxy);
- for (int i = 0; i < 4; i++)
- rectbound2[i] = rectbound[i];
-
- rectbound2upd = -1;
- rectbound2upd2 = -1;
-
- backupowner = NONE;
- InitiateDraggingIfTransformMode();
-
- if (maxx - minx < 5 || maxy - miny < 5)
- isshapetransformable = false;
- }
- }
-
- RefreshUndocmds();
- m_frame->UpdateFrameUI();
-
-}
-
-void ASSDrawCanvas::SetDragMode( DRAGMODE mode )
-{
- drag_mode = mode;
-}
-
-bool ASSDrawCanvas::IsTransformMode()
-{
- return draw_mode == MODE_NUT_BILINEAR || draw_mode == MODE_SCALEROTATE;
-}
-
-bool ASSDrawCanvas::CanZoom()
-{
- return !IsTransformMode() || !drag_mode.drawing;
-}
-
-bool ASSDrawCanvas::CanMove()
-{
- return !IsTransformMode() || dragAnchor_left == NULL;
-}
-
-// Do the dragging
-void ASSDrawCanvas::OnMouseMove(wxMouseEvent &event)
-{
- mouse_point = event.GetPosition();
- int xx, yy, wx, wy;
- xx = mouse_point.x; yy = mouse_point.y;
- pointsys->FromWxPoint ( mouse_point, wx, wy );
- if (event.Dragging())
- {
- if (IsTransformMode() && isshapetransformable && backupowner == LEFT)
- {
- // update bounding polygon
- if (rectbound2upd > -1)
- {
- if (!dragAnchor_left) dragAnchor_left = new wxPoint(mouse_point);
- wxPoint diff = mouse_point - *dragAnchor_left;
- wxRealPoint rdiff(diff.x, diff.y);
- switch(draw_mode)
- {
- case MODE_NUT_BILINEAR:
- if (rectbound2upd2 == -1) //only one vertex dragged
- rectbound2[rectbound2upd].x = xx, rectbound2[rectbound2upd].y = yy;
- else
- {
- rectbound2[rectbound2upd].x += diff.x, rectbound2[rectbound2upd].y += diff.y;
- rectbound2[rectbound2upd2].x += diff.x, rectbound2[rectbound2upd2].y += diff.y;
- }
- undodesc = _T("Bilinear transform");
- *dragAnchor_left = mouse_point;
- break;
- case MODE_SCALEROTATE:
- if (rectbound2upd2 == -1) //only one vertex dragged
- {
- int adjacent[2] = { (rectbound2upd + 3) % 4, (rectbound2upd + 1) % 4 };
- int opposite = (rectbound2upd + 2) % 4;
- wxRealPoint newpoint = backup[rectbound2upd] + rdiff;
- double nx, ny;
- for (int i = 0; i < 2; i++)
- {
- bool isect = agg::calc_intersection(
- backup[opposite].x, backup[opposite].y,
- backup[adjacent[i]].x, backup[adjacent[i]].y,
- newpoint.x, newpoint.y,
- backup[adjacent[i]].x + diff.x, backup[adjacent[i]].y + diff.y,
- &nx, &ny);
- if (isect && !(fabs(nx - backup[opposite].x) < 10 && fabs(ny - backup[opposite].y) < 10))
- rectbound2[adjacent[i]] = wxRealPoint(nx, ny);
- }
- GetThe4thPoint(backup[opposite].x, backup[opposite].y,
- rectbound2[adjacent[0]].x, rectbound2[adjacent[0]].y,
- rectbound2[adjacent[1]].x, rectbound2[adjacent[1]].y,
- &rectbound2[rectbound2upd].x, &rectbound2[rectbound2upd].y);
- if (event.ShiftDown()) // shift down = maintain aspect ratio (damn so complicated)
- {
- // first create the guide points, which are basically backup points reoriented based on mouse position
- wxRealPoint guide[4];
- guide[opposite] = backup[opposite];
- guide[adjacent[0]] = backup[adjacent[0]];
- guide[adjacent[1]] = backup[adjacent[1]];
- for (int i = 0; i < 2; i++)
- {
- if ((rectbound2[adjacent[i]].x < guide[opposite].x && guide[opposite].x < guide[adjacent[i]].x)
- || (rectbound2[adjacent[i]].x > guide[opposite].x && guide[opposite].x > guide[adjacent[i]].x)
- || (rectbound2[adjacent[i]].y < guide[opposite].y && guide[opposite].y < guide[adjacent[i]].y)
- || (rectbound2[adjacent[i]].y > guide[opposite].y && guide[opposite].y > guide[adjacent[i]].y))
- {
- guide[adjacent[i]] = guide[opposite] - (guide[adjacent[i]] - guide[opposite]);
- }
- }
- guide[rectbound2upd] = guide[adjacent[0]] + (guide[adjacent[1]] - guide[opposite]);
- // now we determine which rescaled sides have larger enlargement/shrinkage ratio ..
- double ix[2], iy[2], dx[2], dy[2];
- for (int i = 0; i < 2; i++)
- {
- agg::calc_intersection(guide[opposite].x, guide[opposite].y, guide[rectbound2upd].x, guide[rectbound2upd].y,
- rectbound2[rectbound2upd].x, rectbound2[rectbound2upd].y,
- rectbound2[adjacent[i]].x, rectbound2[adjacent[i]].y, &ix[i], &iy[i]);
- dx[i] = ix[i] - guide[opposite].x;
- dy[i] = iy[i] - guide[opposite].y;
- }
- // .. and modify the other sides to follow the ratio
- for (int i = 0; i < 2; i++)
- {
- int j = (i + 1) % 2;
- if (fabs(dx[i]) > fabs(dx[j]) || fabs(dy[i]) > fabs(dy[j]))
- {
- rectbound2[rectbound2upd].x = ix[i];
- rectbound2[rectbound2upd].y = iy[i];
- GetThe4thPoint(rectbound2[adjacent[i]].x, rectbound2[adjacent[i]].y,
- guide[opposite].x, guide[opposite].y, ix[i], iy[i],
- &rectbound2[adjacent[j]].x, &rectbound2[adjacent[j]].y);
- }
- }
- }
- }
- else // an edge dragged (i.e. move 2 vertices in sync)
- {
- // it is guaranteed that rectbound2upd and rectbound2upd2 are in clockwise direction
- // from the way they are detected in OnMouseLeftDown()
- int toupd[2] = { rectbound2upd, rectbound2upd2 };
- int adjacent[2] = { (rectbound2upd2 + 2) % 4, (rectbound2upd2 + 1) % 4 };
- wxRealPoint vertexone = backup[toupd[0]] + rdiff, vertextwo = backup[toupd[1]] + rdiff;
- double nx, ny;
- for (int i = 0; i < 2; i++)
- {
- agg::calc_intersection(
- rectbound2[adjacent[i]].x, rectbound2[adjacent[i]].y,
- backup[toupd[i]].x, backup[toupd[i]].y,
- vertexone.x, vertexone.y,
- vertextwo.x, vertextwo.y,
- &nx, &ny);
- if (!(fabs(nx - backup[adjacent[i]].x) < 10 && fabs(ny - backup[adjacent[i]].y) < 10))
- rectbound2[toupd[i]].x = (int) nx, rectbound2[toupd[i]].y = (int) ny;
- }
- }
- UpdateTranformModeRectCenter();
- undodesc = _T("Scale");
- break;
- }
-
- // update points
- UpdateNonUniformTransformation();
- RefreshDisplay();
- }
- }
- else if (draw_mode != MODE_DEL)
- {
-
- // point left-dragged
- if (mousedownAt_point != NULL && mousedownAt_point->isselected)
- {
- if (!mousedownAt_point->IsAt( wx, wy ))
- {
- if (draw_mode == MODE_ARR) {
- int movex = wx - mousedownAt_point->x(), movey = wy - mousedownAt_point->y();
- PointSet::iterator iter = selected_points.begin();
- for (; iter != selected_points.end(); iter++)
- (*iter)->setXY( (*iter)->x() + movex, (*iter)->y() + movey );
- }
- else
- mousedownAt_point->setXY( wx, wy );
-
- EnforceC1Continuity (mousedownAt_point->cmd_main, mousedownAt_point);
-
- RefreshDisplay();
- if (undodesc == _T(""))
- {
- if (mousedownAt_point->type == MP)
- undodesc = _T("Drag point");
- else
- undodesc = _T("Drag control point");
- }
- }
- }
- // origin left-dragged
- else if (dragOrigin)
- {
- if (wx != 0 || wy != 0)
- {
- wxPoint wxp = pointsys->ToWxPoint ( wx, wy );
- MovePoints(-wx, -wy);
- pointsys->originx = wxp.x;
- pointsys->originy = wxp.y;
- RefreshDisplay();
- undodesc = _T("Move origin");
- }
- }
- else if (dragAnchor_left != NULL)
- {
- // handle left-dragging here
- if (lastDrag_left && dragAnchor_left != lastDrag_left)
- delete lastDrag_left;
- lastDrag_left = new wxPoint(xx, yy);
- int ax = dragAnchor_left->x, ay = dragAnchor_left->y;
- int sx = lastDrag_left->x, sy = lastDrag_left->y;
- int lx, rx, ty, by;
- if (ax > sx) lx = sx, rx = ax;
- else lx = ax, rx = sx;
- if (ay > sy) ty = sy, by = ay;
- else ty = ay, by = sy;
- SelectPointsWithin( lx, rx, ty, by, GetSelectMode(event) );
- RefreshDisplay();
- }
- }
-
- // right-dragged
- if (dragAnchor_right != NULL)
- {
- if (draw_mode == MODE_SCALEROTATE)
- {
- if (backupowner == RIGHT)
- {
- double cx = rectcenter.x, cy = rectcenter.y; // center x,y
- double diameter = sqrt(pow(rectbound2[0].x - rectbound2[2].x, 2) + pow(rectbound2[0].y - rectbound2[2].y, 2));
- double radius = diameter / 2;
- double old_dx = dragAnchor_right->x - cx, old_dy = dragAnchor_right->y - cy;
- double new_dx = mouse_point.x - cx, new_dy = mouse_point.y - cy;
- double old_angle = atan2(old_dy, old_dx);
- double new_angle = atan2(new_dy, new_dx);
- double delta = new_angle - old_angle;
- for (int i = 0; i < 4; i++)
- {
- old_dx = backup[i].x - cx, old_dy = backup[i].y - cy;
- old_angle = atan2(old_dy, old_dx);
- new_angle = old_angle + delta;
- new_dx = radius * cos(new_angle), new_dy = radius * sin(new_angle);
- rectbound2[i].x = (int)(new_dx + cx), rectbound2[i].y = (int)(new_dy + cy);
- }
- UpdateNonUniformTransformation();
- RefreshDisplay();
- undodesc = _T("Rotate");
- }
- }
- else if (CanMove())
- {
- MoveCanvas(xx - dragAnchor_right->x, yy - dragAnchor_right->y);
- dragAnchor_right->x = xx;
- dragAnchor_right->y = yy;
- RefreshDisplay();
- }
- }
- }
- else if (!preview_mode)// not dragging and not preview mode
- {
- if (IsTransformMode())
- {
- int oldrectbound = rectbound2upd;
- rectbound2upd = -1;
- rectbound2upd2 = -1;
- for (int i = 0; i < 4; i++)
- {
- if (abs((int)rectbound2[i].x - mouse_point.x) <= pointsys->scale
- && abs((int)rectbound2[i].y - mouse_point.y) <= pointsys->scale)
- rectbound2upd = i;
- }
- for (int i = 0; rectbound2upd == -1 && i < 4; i++)
- {
- int j = (i+1) % 4;
- wxRealPoint &pi = rectbound2[i], &pj = rectbound2[j];
- double dy = fabs(pj.y - pi.y);
- double dy3 = dy / 3;
- double dx = fabs(pj.x - pi.x);
- double dx3 = dx / 3;
- double ix, iy;
- bool intersect = false;
- if (dy > dx)
- {
- intersect = agg::calc_intersection(
- pi.x, pi.y, pj.x, pj.y,
- mouse_point.x - pointsys->scale, mouse_point.y,
- mouse_point.x + pointsys->scale, mouse_point.y, &ix, &iy);
- intersect &= fabs(mouse_point.x - ix) <= pointsys->scale;
- intersect &= (pj.y > pi.y?
- pj.y - dy3 > iy && iy > pi.y + dy3:
- pj.y + dy3 < iy && iy < pi.y - dy3);
- }
- else
- {
- intersect = agg::calc_intersection(
- pi.x, pi.y, pj.x, pj.y,
- mouse_point.x, mouse_point.y - pointsys->scale,
- mouse_point.x, mouse_point.y + pointsys->scale, &ix, &iy);
- intersect &= fabs(mouse_point.y - iy) <= pointsys->scale;
- intersect &= (pj.x > pi.x?
- pj.x - dx3 > ix && ix > pi.x + dx3:
- pj.x + dx3 < ix && ix < pi.x - dx3);
- }
- if (intersect)
- {
- rectbound2upd = i;
- rectbound2upd2 = j;
- }
- }
- if (rectbound2upd != -1 || oldrectbound != -1)
- RefreshDisplay();
- }
- else
- {
- /* figure out if the mouse is pointing at a point of a command
- we need not do this for dragging since this same block has set
- the related variables before the user starts to hold the button
- (well, before you can drag something you have to move the pointer
- over that thing first, right?) and we don't want to mess with those
- when it's dragging
- */
-
- // check if mouse points on any control point first
- Point* last_pointedAt_point = pointedAt_point;
- ControlAt( wx, wy, pointedAt_point );
-
- // then check if mouse points on any m_points
- // override any control point set to pointedAt_point above
- DrawCmd* p = PointAt( wx, wy );
- if (p != NULL)
- {
- pointedAt_point = p->m_point;
- }
-
- if (pointedAt_point != last_pointedAt_point)
- {
- if (pointedAt_point != NULL)
- SetHighlighted( pointedAt_point->cmd_main, pointedAt_point );
- else
- SetHighlighted( NULL, NULL );
- RefreshDisplay();
- }
- }
- } // not dragging and preview mode = ignore all mouse movements
-
- // we are not done yet?
- // oh yeah, we need to set the status bar just for fun
- if (hasStatusBar)
- {
- m_frame->SetStatusText(
- wxString::Format( _T("%5d %5d"), (int)wx, (int)wy ), 0 );
- if (pointedAt_point == NULL ||
- (newcommand != NULL && !newcommand->initialized) )
- m_frame->SetStatusText( _T(""), 1 );
- else
- m_frame->SetStatusText( _T(" ") + pointedAt_point->cmd_main->ToString().Upper(), 1 );
- }
-
-}
-
-// End drag points
-void ASSDrawCanvas::OnMouseLeftUp(wxMouseEvent& event)
-{
- ProcessOnMouseLeftUp();
- event.Skip( true );
-}
-
-void ASSDrawCanvas::ProcessOnMouseLeftUp()
-{
- if (!capturemouse_left) return;
-
- // draw mode
- if (newcommand != NULL)
- {
- newcommand->Init();
- switch (newcommand->type)
- {
- case M:
- undodesc = _T("Add a new M"); break;
- case L:
- undodesc = _T("Add a new L"); break;
- case B:
- undodesc = _T("Add a new B"); break;
- }
- newcommand = NULL;
- // we need to manually refresh the GUI to draw the new control points
- RefreshDisplay();
- }
- else if ( draw_mode == MODE_DEL // if it's delete mode
- && mousedownAt_point != NULL // and mouse down at a point
- && mousedownAt_point == pointedAt_point ) // and released at the same point
- {
- // first take care of mouse readings
- pointedAt_point = NULL;
- Point *lastmousedownAt_point = mousedownAt_point;
- mousedownAt_point = NULL;
-
- // try deleting
- CMDTYPE t = lastmousedownAt_point->cmd_main->type;
- if ( DeleteCommand( lastmousedownAt_point->cmd_main ) )
- {
- ClearPointsSelection();
- SetHighlighted( NULL, NULL );
- RefreshDisplay();
- switch (t)
- {
- case M:
- undodesc = _T("Delete a M"); break;
- case L:
- undodesc = _T("Delete a L"); break;
- case B:
- undodesc = _T("Delete a B"); break;
- }
- }
- else
- {
- RefreshDisplay(); // redraw before showing the error box
- wxMessageDialog msgb(m_frame,
- _T("You must delete that command/point last"),
- _T("Error"), wxOK | wxICON_EXCLAMATION );
- msgb.ShowModal();
- }
- }
- else if ( lastDrag_left && dragAnchor_left ) // point selection
- {
- if (lastDrag_left && dragAnchor_left != lastDrag_left)
- delete lastDrag_left;
- delete dragAnchor_left;
- lastDrag_left = NULL;
- dragAnchor_left = NULL;
- }
-
- if (dragOrigin)
- {
- dragOrigin = false;
- RefreshDisplay(); // clear the crosshair
- }
-
- rectbound2upd = -1;
- rectbound2upd2 = -1;
- backupowner = NONE;
-
- if (!undodesc.IsSameAs(_T("")))
- {
- AddUndo( undodesc );
- undodesc = _T("");
- RefreshUndocmds();
- }
-
- mousedownAt_point = NULL;
-
- if (HasCapture())
- ReleaseMouse();
- capturemouse_left = false;
-
- RefreshDisplay();
-}
-
-// Set up to drag points, if any
-void ASSDrawCanvas::OnMouseLeftDown(wxMouseEvent& event)
-{
-
- // no drawing in preview mode
- if (preview_mode)
- return;
-
- wxPoint q = event.GetPosition();
-
- // wxPoint to Point
- int px, py;
- pointsys->FromWxPoint(q, px, py);
-
- // create new cmd if in draw mode / or delete point if del tool selected
- switch (draw_mode)
- {
- case MODE_M:
- newcommand = NewCmd(M, px, py);
- break;
- case MODE_L:
- newcommand = NewCmd(L, px, py);
- break;
- case MODE_B:
- newcommand = NewCmd(B, px, py);
- break;
- }
-
- // continue working on the new command (if any)
- // only if it is not mouse down on any control point
- if (newcommand != NULL)
- {
- if (pointedAt_point != NULL && pointedAt_point->type == CP)
- {
- // oops, user clicked on a control point so cancel new command
- // and let him drag the control point
- delete newcommand;
- newcommand = NULL;
- }
- else
- {
- // first set to drag the new command no matter what
- mousedownAt_point = newcommand->m_point;
-
- // if user drags from existing point, insert the new command
- // else append the new command
- if (pointedAt_point != NULL)
- InsertCmd( newcommand, pointedAt_point->cmd_main );
- else
- {
- if (cmds.empty() && newcommand->type != M)
- AppendCmd( M, px, py );
- newcommand = AppendCmd( newcommand );
- }
-
- pointedAt_point = mousedownAt_point;
-
- //highlight it
- SetHighlighted( newcommand, newcommand->m_point );
- }
- }
-
- // we already calculated pointedAt_point in OnMouseMove() so just use it
- mousedownAt_point = pointedAt_point;
- SELECTMODE smode = GetSelectMode(event);
- if (mousedownAt_point && !mousedownAt_point->isselected)
- {
- if (smode == NEW)
- {
- ClearPointsSelection();
- mousedownAt_point->isselected = true;
- selected_points.insert(mousedownAt_point);
- }
- else
- {
- wxPoint wxp = mousedownAt_point->ToWxPoint();
- SelectPointsWithin(wxp.x, wxp.x, wxp.y, wxp.y, smode);
- }
- }
- else if (!mousedownAt_point && smode == NEW)
- ClearPointsSelection();
-
- if ( mousedownAt_point == NULL && px == 0 && py == 0 )
- dragOrigin = true;
-
- if ( mousedownAt_point == NULL && !dragOrigin )
- {
- dragAnchor_left = new wxPoint(q.x, q.y);
- lastDrag_left = dragAnchor_left;
- }
-
- if (InitiateDraggingIfTransformMode())
- backupowner = LEFT;
-
- CaptureMouse();
- capturemouse_left = true;
- RefreshDisplay();
-
- event.Skip( true );
-}
-
-// End drag the canvas
-void ASSDrawCanvas::OnMouseRightUp(wxMouseEvent& event)
-{
- ProcessOnMouseRightUp();
- event.Skip( true );
-}
-
-void ASSDrawCanvas::ProcessOnMouseRightUp()
-{
- if (!capturemouse_right) return;
-
- if (lastDrag_right && dragAnchor_right != lastDrag_right)
- delete lastDrag_right;
- if (dragAnchor_right)
- delete dragAnchor_right;
- dragAnchor_right = NULL;
- lastDrag_right = NULL;
-
- // don't crash the program
- if (HasCapture())
- ReleaseMouse();
- capturemouse_right = false;
-
- rectbound2upd = -1;
- rectbound2upd2 = -1;
- backupowner = NONE;
-
- if (!undodesc.IsSameAs(_T("")))
- {
- AddUndo( undodesc );
- undodesc = _T("");
- RefreshUndocmds();
- }
-
- RefreshDisplay();
- SetFocus();
-}
-
-// Set up to drag the canvas
-void ASSDrawCanvas::OnMouseRightDown(wxMouseEvent &event)
-{
- wxPoint q = event.GetPosition();
- dragAnchor_right = new wxPoint(q.x, q.y);
- lastDrag_right = dragAnchor_right;
- CaptureMouse();
- capturemouse_right = true;
-
- if (InitiateDraggingIfTransformMode())
- backupowner = RIGHT;
-
- event.Skip( true );
-}
-
-// Reset to point-and-drag mode
-void ASSDrawCanvas::OnMouseRightDClick(wxMouseEvent& event)
-{
- wxMenu* menu = new wxMenu();
-
- if (pointedAt_point)
- {
- ProcessOnMouseLeftUp();
- ProcessOnMouseRightUp();
- dblclicked_point_right = pointedAt_point;
- pointedAt_point = NULL;
- wxMenuItem *cmdmenuitem = new wxMenuItem(menu, MENU_DUMMY, dblclicked_point_right->cmd_main->ToString());
-#ifdef __WINDOWS__
- wxFont f = cmdmenuitem->GetFont();
- f.SetWeight(wxFONTWEIGHT_BOLD);
- cmdmenuitem->SetFont(f);
-#endif
- menu->Append(cmdmenuitem);
- menu->Enable(MENU_DUMMY, false);
- switch (dblclicked_point_right->cmd_main->type)
- {
- case L:
- menu->Append(MENU_DRC_LNTOBEZ, _T("Convert to Bezier curve (B command)"));
- break;
- case B:
- if (dblclicked_point_right->type != MP) break;
- menu->AppendCheckItem(MENU_DRC_BEZTOLN, _T("Convert to line (L command)"));
- if (dblclicked_point_right->cmd_next && dblclicked_point_right->cmd_next->type == B)
- {
- menu->AppendCheckItem(MENU_DRC_C1CONTBEZ, _T("Smooth connection"));
- if (static_cast(dblclicked_point_right->cmd_main)->C1Cont)
- menu->Check(MENU_DRC_C1CONTBEZ, true);
- }
- break;
- }
-
- }
- else
- {
- menu->Append(MENU_DRC_MOVE00, _T("Move [0,0] here"));
- menu->AppendSeparator();
- menu->AppendRadioItem(MODE_ARR, _T("Mode: D&rag"));
- menu->AppendRadioItem(MODE_M, _T("Mode: Draw &M"));
- menu->AppendRadioItem(MODE_L, _T("Mode: Draw &L"));
- menu->AppendRadioItem(MODE_B, _T("Mode: Draw &B"));
- menu->AppendRadioItem(MODE_DEL, _T("Mode: &Delete"));
- menu->Check(GetDrawMode(), true);
- }
-
- if (menu->GetMenuItemCount() > 0) // only if there is menu item
- {
- SetHighlighted(NULL, NULL);
- mousedownAt_point = NULL;
- RefreshDisplay();
- PopupMenu(menu);
- }
- delete menu;
-
- event.Skip( true );
-}
-
-bool ASSDrawCanvas::InitiateDraggingIfTransformMode()
-{
- if (IsTransformMode() && isshapetransformable && backupowner == NONE)
- {
- for (int i = 0; i < 4; i++)
- backup[i] = rectbound2[i];
- UpdateTranformModeRectCenter();
- return true;
- }
- else
- return false;
-}
-
-void ASSDrawCanvas::UpdateTranformModeRectCenter()
-{
- double cx, cy;
- if (agg::calc_intersection(rectbound2[0].x, rectbound2[0].y, rectbound2[2].x, rectbound2[2].y,
- rectbound2[1].x, rectbound2[1].y, rectbound2[3].x, rectbound2[3].y, &cx, &cy))
- {
- rectcenter = wxRealPoint(cx, cy);
- }
-}
-
-bool ASSDrawCanvas::GetThe4thPoint(double ox, double oy, double a1x, double a1y, double a2x, double a2y, double *x, double *y)
-{
- *x = a1x + a2x - ox;
- *y = a1y + a2y - oy;
- return true;
-}
-
-// Mousewheel
-void ASSDrawCanvas::OnMouseWheel(wxMouseEvent &event)
-{
- double amount = event.GetWheelRotation() / event.GetWheelDelta();
- if (event.ControlDown()) amount /= 10.0;
- bgimg.new_center = wxRealPoint(mouse_point.x, mouse_point.y);
- ChangeZoomLevel( amount, mouse_point );
-}
-
-void ASSDrawCanvas::ChangeZoomLevelTo( double zoom, wxPoint bgzoomctr )
-{
- ChangeZoomLevel(zoom - pointsys->scale, bgzoomctr);
-}
-
-void ASSDrawCanvas::ChangeZoomLevel( double amount, wxPoint bgzoomctr )
-{
- double old_scale = pointsys->scale;
- if (CanZoom() && drag_mode.drawing)
- ChangeDrawingZoomLevel( amount );
-
- if (CanZoom() && drag_mode.bgimg)
- if (drag_mode.drawing)
- ChangeBackgroundZoomLevel(bgimg.scale * pointsys->scale / old_scale, wxRealPoint(pointsys->originx, pointsys->originy));
- else
- ChangeBackgroundZoomLevel(bgimg.scale + amount / 10.0, wxRealPoint(bgzoomctr.x, bgzoomctr.y));
-
- RefreshDisplay();
-}
-
-void ASSDrawCanvas::ChangeDrawingZoomLevel( double scrollamount )
-{
- if (!CanZoom()) return;
- double zoom = pointsys->scale + scrollamount;
- if (zoom <= 50.0)
- {
- if (zoom < 1.0) zoom = 1.0;
- pointsys->scale = zoom;
- }
-
- m_frame->UpdateFrameUI();
-}
-
-void ASSDrawCanvas::ChangeBackgroundZoomLevel(double zoom, wxRealPoint newcenter)
-{
- bgimg.new_scale = zoom;
- bgimg.new_center = newcenter;
- if (bgimg.new_scale < 0.01) bgimg.new_scale = 0.01;
- UpdateBackgroundImgScalePosition();
-}
-
-void ASSDrawCanvas::MoveCanvasOriginTo(double originx, double originy)
-{
- MoveCanvas(originx - pointsys->originx, originy - pointsys->originy);
-}
-
-void ASSDrawCanvas::MoveCanvas(double xamount, double yamount)
-{
- if (CanMove() && drag_mode.drawing)
- MoveCanvasDrawing(xamount, yamount);
- if (CanMove() && drag_mode.bgimg)
- MoveCanvasBackground(xamount, yamount);
-}
-
-void ASSDrawCanvas::MoveCanvasDrawing(double xamount, double yamount)
-{
- if (!CanMove()) return;
- pointsys->originx += xamount;
- pointsys->originy += yamount;
- if (IsTransformMode())
- {
- for (int i = 0; i < 4; i++)
- {
- rectbound[i].x += (int) xamount;
- rectbound[i].y += (int) yamount;
- rectbound2[i].x += (int) xamount;
- rectbound2[i].y += (int) yamount;
- }
- unsigned vertices = backupcmds.total_vertices();
- double x, y;
- for (int i = 0; i < vertices; i++)
- {
- backupcmds.vertex(i, &x, &y);
- backupcmds.modify_vertex(i, x + xamount, y + yamount);
- }
- }
-}
-
-void ASSDrawCanvas::MoveCanvasBackground(double xamount, double yamount)
-{
- bgimg.new_disp.x += xamount;
- bgimg.new_disp.y += yamount;
- UpdateBackgroundImgScalePosition();
-}
-
-void ASSDrawCanvas::OnSelect_ConvertLineToBezier(wxCommandEvent&)
-{
- if (!dblclicked_point_right) return;
- AddUndo( _T("Convert Line to Bezier") );
- DrawCmd_B *newB = new DrawCmd_B(dblclicked_point_right->x(), dblclicked_point_right->y(),
- pointsys, dblclicked_point_right->cmd_main);
- InsertCmd ( newB, dblclicked_point_right->cmd_main );
- ClearPointsSelection();
- SetHighlighted(NULL, NULL);
- DeleteCommand(dblclicked_point_right->cmd_main);
- pointedAt_point = newB->m_point;
- newB->Init();
- RefreshDisplay();
- RefreshUndocmds();
-}
-
-void ASSDrawCanvas::OnSelect_ConvertBezierToLine(wxCommandEvent&)
-{
- if (!dblclicked_point_right) return;
- AddUndo( _T("Convert Bezier to Line") );
- DrawCmd_L *newL = new DrawCmd_L(dblclicked_point_right->x(), dblclicked_point_right->y(), pointsys, dblclicked_point_right->cmd_main);
- InsertCmd ( newL, dblclicked_point_right->cmd_main );
- ClearPointsSelection();
- SetHighlighted(NULL, NULL);
- DeleteCommand(dblclicked_point_right->cmd_main);
- pointedAt_point = newL->m_point;
- newL->Init();
- RefreshDisplay();
- RefreshUndocmds();
-}
-
-void ASSDrawCanvas::OnSelect_C1ContinuityBezier(wxCommandEvent&)
-{
- if (!dblclicked_point_right) return;
- DrawCmd_B *cmdb = static_cast(dblclicked_point_right->cmd_main);
- AddUndo( cmdb->C1Cont? _T("Unset continuous"):_T("Set continuous") );
- cmdb->C1Cont = !cmdb->C1Cont;
- RefreshUndocmds();
-}
-
-void ASSDrawCanvas::OnSelect_Move00Here(wxCommandEvent&)
-{
- AddUndo( _T("Move origin") );
- int wx, wy;
- pointsys->FromWxPoint(mouse_point, wx, wy);
- wxPoint wxp = pointsys->ToWxPoint(wx, wy);
- pointsys->originx = wxp.x;
- pointsys->originy = wxp.y;
- MovePoints(-wx, -wy);
- RefreshDisplay();
- RefreshUndocmds();
-}
-
-void ASSDrawCanvas::ConnectSubsequentCmds (DrawCmd* cmd1, DrawCmd* cmd2)
-{
- ASSDrawEngine::ConnectSubsequentCmds(cmd1, cmd2);
- if (cmd1 && cmd1->type == B)
- {
- DrawCmd_B *cmd1b = static_cast< DrawCmd_B* >(cmd1);
- cmd1b->C1Cont = false;
- }
-}
-
-void ASSDrawCanvas::EnforceC1Continuity (DrawCmd* cmd, Point* pnt)
-{
- if (!cmd || !pnt) return;
- if (cmd->type != B && cmd->type != S) return;
- if (pnt->type == MP) return;
- Point *theotherpoint, *mainpoint;
- if (pnt->num == 1)
- {
- if (!cmd->prev || (cmd->prev->type != B && cmd->prev->type != S)) return;
- DrawCmd_B *prevb = static_cast< DrawCmd_B* >(cmd->prev);
- if (!prevb->C1Cont) return;
- PointList::iterator it = prevb->controlpoints.end();
- it--;
- theotherpoint = *it;
- mainpoint = prevb->m_point;
- }
- else if (pnt->num = cmd->controlpoints.size())
- {
- DrawCmd_B *thisb = static_cast< DrawCmd_B* >(cmd);
- if (!thisb->C1Cont) return;
- theotherpoint = *(cmd->m_point->cmd_next->controlpoints.begin());
- mainpoint = thisb->m_point;
- }
- else
- return;
- theotherpoint->setXY( mainpoint->x() + mainpoint->x() - pnt->x(),
- mainpoint->y() + mainpoint->y() - pnt->y() );
-}
-
-// Undo/Redo system
-void ASSDrawCanvas::AddUndo( wxString desc )
-{
- PrepareUndoRedo(_undo, false, _T(""), desc);
- undos.push_back( _undo );
- // also empty redos
- redos.clear();
- m_frame->UpdateUndoRedoMenu();
-}
-
-bool ASSDrawCanvas::UndoOrRedo(bool isundo)
-{
- std::list* main = (isundo? &undos:&redos);
- std::list* sub = (isundo? &redos:&undos);
-
- if (main->empty())
- return false;
-
- UndoRedo r = main->back();
- // push into sub
- UndoRedo nr(r);
- PrepareUndoRedo(nr, true, GenerateASS(), r.desc);
- sub->push_back( nr );
- // parse
- r.Export(this);
- // delete that
- std::list::iterator iter = main->end();
- iter--;
- main->erase(iter);
-
- // reset some values before refreshing
- mousedownAt_point = NULL;
- pointedAt_point = NULL;
- SetHighlighted ( NULL, NULL );
- ClearPointsSelection();
- RefreshDisplay();
- RefreshUndocmds();
- return true;
-}
-
-bool ASSDrawCanvas::Undo()
-{
- return UndoOrRedo( true );
-}
-
-bool ASSDrawCanvas::Redo()
-{
- return UndoOrRedo( false );
-}
-
-wxString ASSDrawCanvas::GetTopUndo()
-{
- if (undos.empty())
- return _T("");
- else
- return undos.back().desc;
-}
-
-wxString ASSDrawCanvas::GetTopRedo()
-{
- if (redos.empty())
- return _T("");
- else
- return redos.back().desc;
-}
-
-void ASSDrawCanvas::RefreshUndocmds()
-{
- _undo.Import(this, true, GenerateASS());
-}
-
-void ASSDrawCanvas::PrepareUndoRedo(UndoRedo& ur, bool prestage, wxString cmds, wxString desc)
-{
- ur.Import(this, prestage, cmds);
- ur.desc = desc;
-}
-
-// set command and point to highlight
-void ASSDrawCanvas::SetHighlighted ( DrawCmd* cmd, Point* point )
-{
- hilite_cmd = cmd;
- hilite_point = point;
-}
-
-int ASSDrawCanvas::SelectPointsWithin( int lx, int rx, int ty, int by, SELECTMODE smode )
-{
-
- DrawCmdList::iterator iterate = cmds.begin();
- for (; iterate != cmds.end(); iterate++)
- {
- wxPoint wx = (*iterate)->m_point->ToWxPoint();
-
- if (wx.x >= lx && wx.x <= rx && wx.y >= ty && wx.y <= by)
- (*iterate)->m_point->isselected = (smode != DEL);
- else
- (*iterate)->m_point->isselected &= (smode != NEW);
-
- if ((*iterate)->m_point->isselected)
- selected_points.insert((*iterate)->m_point);
- else
- selected_points.erase((*iterate)->m_point);
-
- PointList::iterator pnt_iterator = (*iterate)->controlpoints.begin();
- PointList::iterator end = (*iterate)->controlpoints.end();
- for (; pnt_iterator != end; pnt_iterator++)
- {
- wxPoint wx = (*pnt_iterator)->ToWxPoint();
-
- if (wx.x >= lx && wx.x <= rx && wx.y >= ty && wx.y <= by)
- (*pnt_iterator)->isselected = (smode != DEL);
- else
- (*pnt_iterator)->isselected &= (smode != NEW);
-
- if ((*pnt_iterator)->isselected)
- selected_points.insert(*pnt_iterator);
- else
- selected_points.erase(*pnt_iterator);
- }
- }
-
- return selected_points.size();
-
-}
-
-void ASSDrawCanvas::ClearPointsSelection()
-{
- if (!selected_points.empty())
- {
- PointSet::iterator piter = selected_points.begin();
- for (; piter != selected_points.end(); piter++)
- {
- (*piter)->isselected = false;
- }
- selected_points.clear();
- }
-}
-
-SELECTMODE ASSDrawCanvas::GetSelectMode(wxMouseEvent& event)
-{
- SELECTMODE smode = NEW;
- bool CtrlDown = event.CmdDown();
- bool AltDown = event.AltDown();
- if (CtrlDown && !AltDown) smode = ADD;
- else if (!CtrlDown && AltDown) smode = DEL;
- return smode;
-}
-
-void ASSDrawCanvas::DoDraw( RendererBase& rbase, RendererPrimitives& rprim, RendererSolid& rsolid, agg::trans_affine& mtx )
-{
- ASSDrawEngine::Draw_Clear( rbase );
- int ww, hh; GetClientSize(&ww, &hh);
-
- if (bgimg.bgbmp)
- {
- rasterizer.reset();
- interpolator_type interpolator(bgimg.img_mtx);
- PixelFormat::AGGType ipixfmt(bgimg.ibuf);
- span_gen_type spangen(ipixfmt, agg::rgba_pre(0, 0, 0), interpolator);
- agg::conv_transform< agg::path_storage > bg_border(bgimg.bg_path, bgimg.path_mtx);
- agg::conv_clip_polygon< agg::conv_transform< agg::path_storage > > bg_clip(bg_border);
- bg_clip.clip_box(0, 0, ww, hh);
- rasterizer.add_path(bg_clip);
- agg::render_scanlines_aa(rasterizer, scanline, rbase, bgimg.spanalloc, spangen);
- }
-
- ASSDrawEngine::Draw_Draw( rbase, rprim, rsolid, mtx, preview_mode? rgba_shape:rgba_shape_normal );
-
- if (!preview_mode)
- {
- // [0, 0]
- rasterizer.reset();
- agg::path_storage org_path;
- org_path.move_to(0, m_frame->sizes.origincross);
- org_path.line_to(0, -m_frame->sizes.origincross);
- org_path.move_to(m_frame->sizes.origincross, 0);
- org_path.line_to(-m_frame->sizes.origincross, 0);
- agg::conv_transform< agg::path_storage > org_path_t(org_path, mtx);
- agg::conv_curve< agg::conv_transform< agg::path_storage > > crosshair(org_path_t);
- agg::conv_stroke< agg::conv_curve< agg::conv_transform< agg::path_storage > > > chstroke(crosshair);
- rasterizer.add_path(chstroke);
- rsolid.color(rgba_origin);
- render_scanlines(rsolid, false);
-
- if (IsTransformMode() && isshapetransformable)
- {
- if (draw_mode == MODE_SCALEROTATE)
- {
- // rotation centerpoint
- rasterizer.reset();
- double len = 10.0;
- org_path.free_all();
- org_path.move_to(rectcenter.x - len, rectcenter.y - len);
- org_path.line_to(rectcenter.x + len, rectcenter.y + len);
- org_path.move_to(rectcenter.x + len, rectcenter.y - len);
- org_path.line_to(rectcenter.x - len, rectcenter.y + len);
- agg::conv_stroke< agg::path_storage > cstroke(org_path);
- rasterizer.add_path(cstroke);
- agg::ellipse circ(rectcenter.x, rectcenter.y, len, len);
- agg::conv_stroke< agg::ellipse > c(circ);
- rasterizer.add_path(c);
- rsolid.color(rgba_origin);
- render_scanlines(rsolid, false);
- }
-
- rasterizer.reset();
- agg::path_storage org_path;
- org_path.move_to(rectbound2[0].x, rectbound2[0].y);
- org_path.line_to(rectbound2[1].x, rectbound2[1].y);
- org_path.line_to(rectbound2[2].x, rectbound2[2].y);
- org_path.line_to(rectbound2[3].x, rectbound2[3].y);
- org_path.line_to(rectbound2[0].x, rectbound2[0].y);
- agg::conv_stroke chstroke(org_path);
- chstroke.width(1);
- rsolid.color(rgba_origin);
- rasterizer.add_path(chstroke);
- if (rectbound2upd != -1)
- {
- agg::ellipse circ(rectbound2[rectbound2upd].x, rectbound2[rectbound2upd].y,
- pointsys->scale, pointsys->scale);
- agg::conv_contour< agg::ellipse > c(circ);
- rasterizer.add_path(c);
- }
- if (rectbound2upd2 != -1)
- {
- agg::ellipse circ(rectbound2[rectbound2upd2].x, rectbound2[rectbound2upd2].y,
- pointsys->scale, pointsys->scale);
- agg::conv_contour< agg::ellipse > c(circ);
- rasterizer.add_path(c);
- }
- render_scanlines(rsolid, false);
- }
- else
- {
- // outlines
- agg::conv_stroke< agg::conv_transform< agg::path_storage > > bguidestroke(*rb_path);
- bguidestroke.width(1);
- rsolid.color(rgba_guideline);
- rasterizer.add_path(bguidestroke);
- render_scanlines(rsolid);
-
- agg::conv_stroke< agg::conv_curve< agg::conv_transform< agg::path_storage > > > stroke(*rm_curve);
- stroke.width(1);
- rsolid.color(rgba_outline);
- rasterizer.add_path(stroke);
- render_scanlines(rsolid);
-
- double diameter = pointsys->scale;
- double radius = diameter / 2.0;
- // hilite
- if (hilite_cmd && hilite_cmd->type != M)
- {
- rasterizer.reset();
- agg::path_storage h_path;
- AddDrawCmdToAGGPathStorage(hilite_cmd, h_path, HILITE);
- agg::conv_transform< agg::path_storage> h_path_trans(h_path, mtx);
- agg::conv_curve< agg::conv_transform< agg::path_storage> > curve(h_path_trans);
- agg::conv_dash< agg::conv_curve< agg::conv_transform< agg::path_storage > > > d(curve);
- d.add_dash(10,5);
- agg::conv_stroke< agg::conv_dash< agg::conv_curve< agg::conv_transform< agg::path_storage > > > > stroke(d);
- stroke.width(3);
- rsolid.color(rgba_outline);
- rasterizer.add_path(stroke);
- render_scanlines(rsolid);
- }
-
- // m_point
- rasterizer.reset();
- DrawCmdList::iterator ci = cmds.begin();
- while (ci != cmds.end())
- {
- double lx = (*ci)->m_point->x() * pointsys->scale + pointsys->originx - radius;
- double ty = (*ci)->m_point->y() * pointsys->scale + pointsys->originy - radius;
- agg::path_storage sqp = agghelper::RectanglePath(lx, lx + diameter, ty, ty + diameter);
- agg::conv_contour< agg::path_storage > c(sqp);
- rasterizer.add_path(c);
- ci++;
- }
- render_scanlines_aa_solid(rbase, rgba_mainpoint);
-
- // control_points
- rasterizer.reset();
- ci = cmds.begin();
- while (ci != cmds.end())
- {
- PointList::iterator pi = (*ci)->controlpoints.begin();
- while (pi != (*ci)->controlpoints.end())
- {
- agg::ellipse circ((*pi)->x() * pointsys->scale + pointsys->originx,
- (*pi)->y() * pointsys->scale + pointsys->originy, radius, radius);
- agg::conv_contour< agg::ellipse > c(circ);
- rasterizer.add_path(c);
- pi++;
- }
- ci++;
- }
- render_scanlines_aa_solid(rbase, rgba_controlpoint);
-
- // selection
- rasterizer.reset();
- PointSet::iterator si = selected_points.begin();
- while (si != selected_points.end())
- {
- agg::ellipse circ((*si)->x() * pointsys->scale + pointsys->originx,
- (*si)->y() * pointsys->scale + pointsys->originy, radius + 3, radius + 3);
- agg::conv_stroke< agg::ellipse > s(circ);
- rasterizer.add_path(s);
- si++;
- }
- render_scanlines_aa_solid(rbase, rgba_selectpoint);
-
- // hover
- if (hilite_point)
- {
- rasterizer.reset();
- agg::ellipse circ(hilite_point->x() * pointsys->scale + pointsys->originx,
- hilite_point->y() * pointsys->scale + pointsys->originy, radius + 3, radius + 3);
- agg::conv_stroke< agg::ellipse > s(circ);
- s.width(2);
- rasterizer.add_path(s);
- render_scanlines_aa_solid(rbase, rgba_selectpoint);
-
- rasterizer.reset();
- agg::gsv_text t;
- t.flip(true);
- t.size(8.0);
- wxPoint pxy = hilite_point->ToWxPoint(true);
- t.start_point(pxy.x + 5, pxy.y -5 );
- t.text(wxString::Format(_T("%d,%d"), hilite_point->x(), hilite_point->y()).mb_str(wxConvUTF8));
- agg::conv_stroke< agg::gsv_text > pt(t);
- pt.line_cap(agg::round_cap);
- pt.line_join(agg::round_join);
- pt.width(1.5);
- rasterizer.add_path(pt);
- rsolid.color(agg::rgba(0,0,0));
- render_scanlines(rsolid, false);
-
- rasterizer.reset();
- agg::path_storage sb_path;
- sb_path.move_to(pxy.x, 0);
- sb_path.line_to(pxy.x, hh);
- sb_path.move_to(0, pxy.y);
- sb_path.line_to(ww, pxy.y);
- agg::conv_curve< agg::path_storage > curve(sb_path);
- agg::conv_dash< agg::conv_curve< agg::path_storage > > d(curve);
- d.add_dash(10,5);
- agg::conv_stroke< agg::conv_dash< agg::conv_curve< agg::path_storage > > > stroke(d);
- stroke.width(1);
- rsolid.color(agg::rgba(0,0,0,0.5));
- rasterizer.add_path(stroke);
- render_scanlines(rsolid);
- }
-
- // selection box
- if (lastDrag_left)
- {
- double x1 = lastDrag_left->x, y1 = lastDrag_left->y;
- double x2 = dragAnchor_left->x, y2 = dragAnchor_left->y;
- double lx, rx, ty, by;
- if (x1 < x2) lx = x1, rx = x2;
- else lx = x2, rx = x1;
- if (y1 < y2) ty = y1, by = y2;
- else ty = y2, by = y1;
- rasterizer.reset();
- agg::path_storage sb_path = agghelper::RectanglePath(lx, rx, ty, by);
- agg::conv_curve< agg::path_storage > curve(sb_path);
- agg::conv_dash< agg::conv_curve< agg::path_storage > > d(curve);
- d.add_dash(10,5);
- agg::conv_stroke< agg::conv_dash< agg::conv_curve< agg::path_storage > > > stroke(d);
- stroke.width(1.0);
- rsolid.color(agg::rgba(0,0,0,0.5));
- rasterizer.add_path(stroke);
- render_scanlines(rsolid);
- }
- }
- }
-
- // ruler
- int w, h;
- GetClientSize( &w, &h );
- double scale = pointsys->scale;
- double coeff = 9 / scale + 1;
- int numdist = (int) floor(coeff) * 5;
- {
- rsolid.color(rgba_ruler_h);
- rasterizer.reset();
- agg::path_storage rlr_path;
- double start = pointsys->originx;
- int t = - (int) floor(start / scale);
- double s = (start + t * scale);
- double collect = s;
- int len;
-
- for (; s <= w; s += scale)
- {
- bool longtick = t % numdist == 0;
- if (longtick)
- {
- len = 10;
- agg::gsv_text txt;
- txt.flip(true);
- txt.size(6.0);
- txt.start_point(s, 20);
- txt.text(wxString::Format(_T("%d"), t).mb_str(wxConvUTF8));
- agg::conv_stroke< agg::gsv_text > pt(txt);
- rasterizer.add_path(pt);
- }
- else
- len = 5;
- t++ ;
- collect += scale;
- if (collect > 5.0)
- {
- collect = 0.0;
- rlr_path.move_to(s, 0);
- rlr_path.line_to(s, len);
- }
- }
- agg::conv_stroke< agg::path_storage > rlr_stroke(rlr_path);
- rlr_stroke.width(1);
- rasterizer.add_path(rlr_stroke);
- render_scanlines(rsolid, false);
- }
- {
- rasterizer.reset();
- rsolid.color(rgba_ruler_v);
- agg::path_storage rlr_path;
- double start = pointsys->originy;
- int t = - (int) floor(start / scale);
- double s = (start + t * scale);
- double collect = 0;
- int len;
-
- for (; s <= h; s += scale)
- {
- bool longtick = t % numdist == 0;
- if (longtick)
- {
- len = 10;
- agg::gsv_text txt;
- txt.flip(true);
- txt.size(6.0);
- txt.start_point(12, s);
- txt.text(wxString::Format(_T("%d"), t).mb_str(wxConvUTF8));
- agg::conv_stroke< agg::gsv_text > pt(txt);
- rasterizer.add_path(pt);
- }
- else
- len = 5;
- t++ ;
- collect += scale;
- if (collect > 5.0)
- {
- collect = 0.0;
- rlr_path.move_to(0, s);
- rlr_path.line_to(len, s);
- }
- }
- agg::conv_stroke< agg::path_storage > rlr_stroke(rlr_path);
- rlr_stroke.width(1);
- rasterizer.add_path(rlr_stroke);
- render_scanlines(rsolid, false);
- }
-
-}
-
-void ASSDrawCanvas::ReceiveBackgroundImageFileDropEvent(const wxString& filename)
-{
- const wxChar *shortfname = wxFileName::FileName(filename).GetFullName().c_str();
- m_frame->SetStatusText(wxString::Format(_T("Loading '%s' as canvas background ..."), shortfname), 1);
- wxImage img;
- img.LoadFile(filename);
- if (img.IsOk())
- {
- SetBackgroundImage(img, filename);
- }
- m_frame->SetStatusText(_T("Canvas background loaded"), 1);
-}
-
-void ASSDrawCanvas::RemoveBackgroundImage()
-{
- if (bgimg.bgimg) delete bgimg.bgimg;
- bgimg.bgimg = NULL;
- if (bgimg.bgbmp) delete bgimg.bgbmp;
- bgimg.bgbmp = NULL;
- bgimg.bgimgfile = _T("");
- RefreshDisplay();
- drag_mode = DRAGMODE();
- bgimg.alpha_dlg->Show(false);
- m_frame->UpdateFrameUI();
-}
-
-void ASSDrawCanvas::SetBackgroundImage(const wxImage& img, wxString fname, bool ask4alpha)
-{
- if (bgimg.bgimg) delete bgimg.bgimg;
- bgimg.bgimg = new wxImage(img);
- bgimg.bgimgfile = fname;
- PrepareBackgroundBitmap(bgimg.alpha);
- UpdateBackgroundImgScalePosition(true);
- RefreshDisplay();
- m_frame->UpdateFrameUI();
- if (ask4alpha && m_frame->behaviors.autoaskimgopac)
- AskUserForBackgroundAlpha();
-}
-
-void ASSDrawCanvas::AskUserForBackgroundAlpha()
-{
- bgimg.alpha_slider->SetValue((int) (100 - bgimg.alpha * 100));
- bgimg.alpha_dlg->Show();
- SetFocus();
-}
-
-void ASSDrawCanvas::PrepareBackgroundBitmap(double alpha)
-{
- if (alpha >= 0.0 && alpha <= 1.0) bgimg.alpha = alpha;
- if (bgimg.bgimg == NULL) return;
- if (bgimg.bgbmp) delete bgimg.bgbmp;
- bgimg.bgbmp = new wxBitmap(*bgimg.bgimg);
- PixelData data(*bgimg.bgbmp);
- wxAlphaPixelFormat::ChannelType* pd = (wxAlphaPixelFormat::ChannelType*) &data.GetPixels().Data();
- const int stride = data.GetRowStride();
- if (stride < 0)
- pd += (data.GetHeight() - 1) * stride;
- bgimg.ibuf.attach(pd, data.GetWidth(), data.GetHeight(), stride);
-
- // apply alpha
- rasterizer.reset();
- unsigned w = bgimg.bgbmp->GetWidth(), h = bgimg.bgbmp->GetHeight();
- bgimg.bg_path = agghelper::RectanglePath(0, w, 0, h);
- agg::conv_contour< agg::path_storage > cont(bgimg.bg_path);
- rasterizer.add_path(cont);
- PixelFormat::AGGType pxt(bgimg.ibuf);
- RendererBase rpxt(pxt);
- agg::render_scanlines_aa_solid(rasterizer, scanline, rpxt, agg::rgba(color_bg.r / 255.0, color_bg.g / 255.0, color_bg.b / 255.0, bgimg.alpha));
-}
-
-void ASSDrawCanvas::UpdateBackgroundImgScalePosition(bool firsttime)
-{
- if (bgimg.bgbmp == NULL) return;
- // transform the enclosing polygon
- unsigned w = bgimg.bgbmp->GetWidth(), h = bgimg.bgbmp->GetHeight();
- bgimg.bg_path = agghelper::RectanglePath(0, w, 0, h);
- // linear interpolation on image buffer
- wxRealPoint center, disp;
- double scale;
- if (firsttime) // first time
- {
- bgimg.img_mtx = agg::trans_affine();
- scale = 1.0;
- center = wxRealPoint(0.0, 0.0);
- disp = wxRealPoint(0.0, 0.0);
- bgimg.path_mtx = bgimg.img_mtx;
- }
- else
- {
- wxRealPoint d_disp(bgimg.new_disp.x - bgimg.disp.x, bgimg.new_disp.y - bgimg.disp.y);
- scale = bgimg.new_scale;
- disp = bgimg.disp;
- center = bgimg.new_center;
- if (bgimg.scale == scale)
- {
- bgimg.img_mtx.invert();
- bgimg.img_mtx *= agg::trans_affine_translation(d_disp.x, d_disp.y);
- d_disp.x /= scale;
- d_disp.y /= scale;
- }
- else
- {
- d_disp.x /= scale;
- d_disp.y /= scale;
- bgimg.img_mtx = agg::trans_affine();
- disp.x += (center.x - bgimg.center.x) * (1.0 - 1.0 / bgimg.scale);
- disp.y += (center.y - bgimg.center.y) * (1.0 - 1.0 / bgimg.scale);
- bgimg.img_mtx *= agg::trans_affine_translation(-center.x + disp.x, -center.y + disp.y);
- bgimg.img_mtx *= agg::trans_affine_scaling(scale);
- bgimg.img_mtx *= agg::trans_affine_translation(center.x + d_disp.x, center.y + d_disp.y);
- }
- bgimg.path_mtx = bgimg.img_mtx;
- bgimg.img_mtx.invert();
- disp.x += d_disp.x;
- disp.y += d_disp.y;
- }
- //update
- bgimg.scale = scale;
- bgimg.center = center;
- bgimg.disp = disp;
- bgimg.new_scale = scale;
- bgimg.new_center = center;
- bgimg.new_disp = disp;
-}
-
-bool ASSDrawCanvas::GetBackgroundInfo(unsigned& w, unsigned& h, wxRealPoint& disp, double& scale)
-{
- if (!HasBackgroundImage()) return false;
- w = bgimg.bgbmp->GetWidth(), h = bgimg.bgbmp->GetHeight();
- double t, l;
- agg::conv_transform trr(bgimg.bg_path, bgimg.path_mtx);
- trr.rewind(0);
- trr.vertex(&l, &t);
- disp = wxRealPoint(l, t);
- scale = bgimg.scale;
- return true;
-}
-
-void ASSDrawCanvas::UpdateNonUniformTransformation()
-{
- double bound[8] = {
- rectbound2[0].x, rectbound2[0].y,
- rectbound2[1].x, rectbound2[1].y,
- rectbound2[2].x, rectbound2[2].y,
- rectbound2[3].x, rectbound2[3].y };
- agg::path_storage trans;
- unsigned vertices = backupcmds.total_vertices();
-
- agg::trans_bilinear trans_b(rectbound[0].x, rectbound[0].y, rectbound[2].x, rectbound[2].y, bound);
- agg::conv_transform transb(backupcmds, trans_b);
- transb.rewind(0);
- for (int i = 0; i < vertices; i++)
- {
- double x, y;
- transb.vertex(&x, &y);
- trans.move_to(x, y);
- }
-
- trans.rewind(0);
- for (DrawCmdList::iterator iterate = cmds.begin(); iterate != cmds.end(); iterate++)
- {
- DrawCmd* cmd = (*iterate);
- for (PointList::iterator iterate2 = cmd->controlpoints.begin(); iterate2 != cmd->controlpoints.end(); iterate2++)
- {
- double x, y;
- trans.vertex(&x, &y);
- int wx, wy;
- pointsys->FromWxPoint ( wxPoint((int)x, (int)y), wx, wy );
- (*iterate2)->setXY(wx, wy);
- }
- double x, y;
- trans.vertex(&x, &y);
- int wx, wy;
- pointsys->FromWxPoint ( wxPoint((int)x, (int)y), wx, wy );
- (*iterate)->m_point->setXY(wx, wy);
- }
-
-}
-
-void ASSDrawCanvas::CustomOnKeyDown(wxKeyEvent &event)
-{
- int keycode = event.GetKeyCode();
- double scrollamount = (event.GetModifiers() == wxMOD_CMD? 10.0:1.0);
- if (event.GetModifiers() == wxMOD_SHIFT)
- {
- MODE d_mode = GetDrawMode();
- if ((int) d_mode > (int) MODE_ARR && (int) d_mode < (int) MODE_SCALEROTATE)
- {
- mode_b4_shift = d_mode;
- SetDrawMode( MODE_ARR );
- m_frame->UpdateFrameUI();
- }
- }
- else
- {
- switch (keycode)
- {
- case WXK_PAGEUP:
- ChangeZoomLevel( 1.0 /scrollamount, wxPoint( (int) pointsys->originx, (int) pointsys->originy ) );
- RefreshDisplay();
- break;
- case WXK_PAGEDOWN:
- ChangeZoomLevel( - 1.0 /scrollamount, wxPoint( (int) pointsys->originx, (int) pointsys->originy ) );
- RefreshDisplay();
- break;
- case WXK_UP:
- MoveCanvas(0.0, -scrollamount);
- RefreshDisplay();
- break;
- case WXK_DOWN:
- MoveCanvas(0.0, scrollamount);
- RefreshDisplay();
- break;
- case WXK_LEFT:
- MoveCanvas(-scrollamount, 0.0);
- RefreshDisplay();
- break;
- case WXK_RIGHT:
- MoveCanvas(scrollamount, 0.0);
- RefreshDisplay();
- break;
- case WXK_TAB:
- if (mousedownAt_point == NULL && !IsTransformMode() && cmds.size() > 0)
- {
- if (pointedAt_point == NULL)
- {
- Point *nearest = NULL;
- double dist = 0.0;
- DrawCmdList::iterator it = cmds.begin();
- while(it != cmds.end())
- {
- wxPoint point = (*it)->m_point->ToWxPoint();
- double distance = sqrt(pow(double(point.x - mouse_point.x), 2) + pow(double(point.y - mouse_point.y), 2));
- if (nearest == NULL || distance < dist)
- {
- nearest = (*it)->m_point;
- dist = distance;
- }
- PointList::iterator it2 = (*it)->controlpoints.begin();
- while (it2 != (*it)->controlpoints.end())
- {
- wxPoint point = (*it2)->ToWxPoint();
- double distance = sqrt(pow((double)point.x - mouse_point.x, 2) + pow((double)point.y - mouse_point.y, 2));
- if (nearest == NULL || distance < dist)
- {
- nearest = (*it2);
- dist = distance;
- }
- it2++;
- }
- it++;
- }
- if (nearest != NULL)
- {
- wxPoint point = nearest->ToWxPoint();
- WarpPointer(point.x, point.y);
- }
- }
- else
- {
- Point *warpto = NULL;
- if (pointedAt_point->type == MP && pointedAt_point->cmd_next)
- if (pointedAt_point->cmd_next->controlpoints.size() > 0)
- warpto = pointedAt_point->cmd_next->controlpoints.front();
- else
- warpto = pointedAt_point->cmd_next->m_point;
- }
- else
- {
- PointList::iterator it = pointedAt_point->cmd_main->controlpoints.begin();
- while (*it != pointedAt_point) it++;
- it++;
- if (it == pointedAt_point->cmd_main->controlpoints.end())
- warpto = pointedAt_point->cmd_main->m_point;
- else
- warpto = *it;
- }
- if (warpto == NULL)
- warpto = cmds.front()->m_point;
- wxPoint point = warpto->ToWxPoint();
- WarpPointer(point.x, point.y);
- }
- }
- break;
- default:
- event.Skip();
- }
- }
-}
-
-void ASSDrawCanvas::CustomOnKeyUp(wxKeyEvent &event)
-{
- if (event.GetModifiers() != wxMOD_SHIFT && (int) mode_b4_shift > (int) MODE_ARR)
- {
- SetDrawMode( mode_b4_shift );
- m_frame->UpdateFrameUI();
- mode_b4_shift = MODE_ARR;
- }
-}
-
-void ASSDrawCanvas::OnAlphaSliderChanged(wxScrollEvent &event)
-{
- double pos = (double) event.GetPosition();
- PrepareBackgroundBitmap(1.0 - pos / 100.0);
- RefreshDisplay();
-}
-
-void ASSDrawCanvas::CustomOnMouseCaptureLost(wxMouseCaptureLostEvent &)
-{
- if (capturemouse_left)
- ProcessOnMouseLeftUp();
-
- if (capturemouse_right)
- ProcessOnMouseRightUp();
-}
-
-void UndoRedo::Import(ASSDrawCanvas *canvas, bool prestage, wxString cmds)
-{
- if (prestage)
- {
- this->cmds = cmds;
- this->backupcmds.free_all();
- this->backupcmds.concat_path(canvas->backupcmds);
- for (int i = 0; i < 4; i++)
- {
- this->rectbound[i] = canvas->rectbound[i];
- this->rectbound2[i] = canvas->rectbound2[i];
- this->backup[i] = canvas->backup[i];
- }
- this->isshapetransformable = canvas->isshapetransformable;
- }
- else
- {
- this->originx = canvas->pointsys->originx;
- this->originy = canvas->pointsys->originy;
- this->scale = canvas->pointsys->scale;
-
- this->bgimgfile = canvas->bgimg.bgimgfile;
- this->bgdisp = canvas->bgimg.disp;
- this->bgcenter = canvas->bgimg.center;
- this->bgscale = canvas->bgimg.scale;
- this->bgalpha = canvas->bgimg.alpha;
- this->c1cont = canvas->PrepareC1ContData();
- this->draw_mode = canvas->draw_mode;
- }
-}
-
-void UndoRedo::Export(ASSDrawCanvas *canvas)
-{
- canvas->pointsys->originx = this->originx;
- canvas->pointsys->originy = this->originy;
- canvas->pointsys->scale = this->scale;
- canvas->ParseASS( this->cmds );
- DrawCmdList::iterator it1 = canvas->cmds.begin();
- std::vector< bool >::iterator it2 = this->c1cont.begin();
- for(; it1 != canvas->cmds.end() && it2 != this->c1cont.end(); it1++, it2++)
- if (*it2 && (*it1)->type == B)
- static_cast(*it1)->C1Cont = true;
-
- if (canvas->bgimg.bgimgfile != this->bgimgfile)
- {
- canvas->RemoveBackgroundImage();
- if (!this->bgimgfile.IsSameAs(_T("")) && ::wxFileExists(this->bgimgfile))
- {
- canvas->bgimg.alpha = this->bgalpha;
- canvas->ReceiveBackgroundImageFileDropEvent(this->bgimgfile);
- }
- }
- else
- {
- canvas->bgimg.new_scale = this->bgscale;
- canvas->bgimg.new_center = this->bgcenter;
- canvas->bgimg.new_disp = this->bgdisp;
- canvas->bgimg.alpha = this->bgalpha;
- canvas->UpdateBackgroundImgScalePosition();
- }
-
- canvas->draw_mode = this->draw_mode;
- if (canvas->IsTransformMode())
- {
- canvas->backupcmds.free_all();
- canvas->backupcmds.concat_path(this->backupcmds);
- for (int i = 0; i < 4; i++)
- {
- canvas->rectbound[i] = this->rectbound[i];
- canvas->rectbound2[i] = this->rectbound2[i];
- canvas->backup[i] = this->backup[i];
- }
- canvas->UpdateNonUniformTransformation();
- canvas->InitiateDraggingIfTransformMode();
- canvas->rectbound2upd = -1;
- canvas->rectbound2upd2 = -1;
- canvas->isshapetransformable = this->isshapetransformable;
- }
-}
diff --git a/contrib/assdraw/src/canvas.hpp b/contrib/assdraw/src/canvas.hpp
deleted file mode 100644
index aee896ee2..000000000
--- a/contrib/assdraw/src/canvas.hpp
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
-* Copyright (c) 2007, ai-chan
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the ASSDraw3 Team nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-///////////////////////////////////////////////////////////////////////////////
-// Name: canvas.hpp
-// Purpose: header file for ASSDraw main canvas class
-// Author: ai-chan
-// Created: 08/26/06
-// Copyright: (c) ai-chan
-// Licence: 3-clause BSD
-///////////////////////////////////////////////////////////////////////////////
-
-#pragma once
-
-#include
-
-#include "engine.hpp"
-#include "enums.hpp"
-
-#include
-#include
-#include
-
-#include "agg_span_allocator.h"
-#include "agg_span_interpolator_linear.h"
-#include "agg_span_image_filter_rgb.h"
-#include "agg_span_image_filter_rgba.h"
-#include "agg_image_accessors.h"
-#include "agg_conv_clip_polygon.h"
-
-class ASSDrawFrame;
-class ASSDrawCanvas;
-
-struct UndoRedo
-{
- wxString cmds;
- wxString desc;
- double originx, originy, scale;
-
- std::vector< bool > c1cont;
- wxString bgimgfile;
- wxRealPoint bgdisp, bgcenter;
- double bgscale, bgalpha;
-
- MODE draw_mode;
- agg::path_storage backupcmds;
- wxRealPoint rectbound[4], rectbound2[4], backup[4];
- bool isshapetransformable;
-
- void Import(ASSDrawCanvas *canvas, bool prestage, wxString cmds = _T(""));
- void Export(ASSDrawCanvas *canvas);
-
-};
-
-// for multiple point selection
-enum SELECTMODE { NEW, ADD, DEL };
-
-class ASSDrawCanvas: public ASSDrawEngine, public wxClientData
-{
-public:
- ASSDrawCanvas( wxWindow *parent, ASSDrawFrame *frame, int extraflags = 0 );
-
- // destructor
- ~ASSDrawCanvas();
-
- virtual void ResetEngine(bool addM);
- virtual void SetPreviewMode( bool mode );
- virtual bool IsPreviewMode() { return preview_mode; }
- virtual void ParseASS(wxString str, bool addundo = false);
-
- virtual void SetDrawMode( MODE mode );
- virtual MODE GetDrawMode() { return draw_mode; }
- virtual bool IsTransformMode();
- virtual void SetDragMode( DRAGMODE mode );
- virtual DRAGMODE GetDragMode() { return drag_mode; }
- virtual void RefreshDisplay();
- virtual bool CanZoom();
- virtual bool CanMove();
-
- virtual void OnMouseMove(wxMouseEvent &event);
- virtual void OnMouseLeftUp(wxMouseEvent &event);
- virtual void OnMouseLeftDown(wxMouseEvent &event);
- virtual void OnMouseRightUp(wxMouseEvent &event);
- virtual void OnMouseRightDown(wxMouseEvent &event);
- virtual void OnMouseRightDClick(wxMouseEvent &event);
- virtual void OnMouseWheel(wxMouseEvent &event);
- virtual void CustomOnKeyDown(wxKeyEvent &event);
- virtual void CustomOnKeyUp(wxKeyEvent &event);
- virtual void ChangeZoomLevel(double zoomamount, wxPoint bgzoomctr);
- virtual void ChangeZoomLevelTo(double zoom, wxPoint bgzoomctr);
- virtual void ChangeDrawingZoomLevel(double zoom);
- virtual void ChangeBackgroundZoomLevel(double zoom, wxRealPoint newcenter);
- virtual void MoveCanvas(double xamount, double yamount);
- virtual void MoveCanvasOriginTo(double originx, double originy);
- virtual void MoveCanvasDrawing(double xamount, double yamount);
- virtual void MoveCanvasBackground(double xamount, double yamount);
- virtual void OnSelect_ConvertLineToBezier(wxCommandEvent& WXUNUSED(event));
- virtual void OnSelect_ConvertBezierToLine(wxCommandEvent& WXUNUSED(event));
- virtual void OnSelect_C1ContinuityBezier(wxCommandEvent& WXUNUSED(event));
- virtual void OnSelect_Move00Here(wxCommandEvent& WXUNUSED(event));
- void OnAlphaSliderChanged(wxScrollEvent &event);
-
- // to replace _PointSystem() that has been made protected
- double GetScale() { return pointsys->scale; }
- double GetOriginX() { return pointsys->originx; }
- double GetOriginY() { return pointsys->originy; }
-
- // undo/redo system
- virtual void AddUndo( wxString desc );
- virtual bool UndoOrRedo(bool isundo);
- virtual bool Undo();
- virtual bool Redo();
- virtual wxString GetTopUndo();
- virtual wxString GetTopRedo();
- virtual void RefreshUndocmds();
-
- virtual bool HasBackgroundImage() { return bgimg.bgimg != NULL; }
- virtual void RemoveBackgroundImage();
- virtual void ReceiveBackgroundImageFileDropEvent(const wxString& filename);
- virtual void SetBackgroundImage(const wxImage& img, wxString fname = _T(""), bool ask4alpha = true);
- virtual void PrepareBackgroundBitmap(double alpha);
- virtual void AskUserForBackgroundAlpha();
- virtual bool GetBackgroundInfo(unsigned& w, unsigned& h, wxRealPoint& disp, double& scale);
-
- agg::rgba rgba_shape_normal, rgba_outline, rgba_guideline;
- agg::rgba rgba_mainpoint, rgba_controlpoint, rgba_selectpoint;
- agg::rgba rgba_origin, rgba_ruler_h, rgba_ruler_v;
-
-protected:
-
- typedef PixelFormat::AGGType::color_type color_type;
- typedef agg::span_interpolator_linear<> interpolator_type;
- typedef agg::span_image_filter_rgb_bilinear_clip span_gen_type;
-
- // The GUI window
- ASSDrawFrame* m_frame;
-
- // highlight mechanism
- DrawCmd* hilite_cmd;
- Point* hilite_point;
-
- // mouse capture
- bool capturemouse_left, capturemouse_right;
- virtual void CustomOnMouseCaptureLost(wxMouseCaptureLostEvent &event);
- virtual void ProcessOnMouseLeftUp();
- virtual void ProcessOnMouseRightUp();
-
- // selection mechanism
- PointSet selected_points;
-
- // if it has status bar
- bool hasStatusBar;
-
- // some mouse readings
- Point* mousedownAt_point;
- Point* pointedAt_point;
- Point* dblclicked_point_right;
- wxPoint mouse_point;
-
- // The wxPoint being dragged by left button
- wxPoint* dragAnchor_left;
- wxPoint* lastDrag_left;
-
- // The wxPoint being dragged by right button
- wxPoint* dragAnchor_right;
- wxPoint* lastDrag_right;
-
- // true if the drawing origin (0, 0) is being dragged
- bool dragOrigin;
-
- // The newest command being initialized thru dragging action
- DrawCmd* newcommand;
-
- // the draw mode
- MODE draw_mode;
- DRAGMODE drag_mode;
-
- // holding shift key temporarily switches to drag mode (MODE_ARR)
- // so we want to save the mode before the key-down to restore it on key-up
- MODE mode_b4_shift;
-
- // true if preview mode (i.e don't draw anything except the shape itself;
- // also draw the shape as closed)
- bool preview_mode;
-
- // background image!
- struct
- {
- agg::rendering_buffer ibuf;
- wxImage *bgimg;
- wxBitmap *bgbmp;
- wxString bgimgfile;
- agg::path_storage bg_path;
- agg::span_allocator spanalloc;
- //span_gen_type spangen;
- agg::trans_affine img_mtx, path_mtx;
-
- wxRealPoint disp, center, new_disp, new_center;
- double scale, new_scale, alpha;
- wxDialog* alpha_dlg;
- wxSlider* alpha_slider;
- } bgimg;
-
- // Undo/redo system (simply stores the ASS commands)
- std::list undos;
- std::list redos;
- UndoRedo _undo;
-
- // last action and commands (for undo/redo system)
- wxString undodesc;
-
- wxString oldasscmds;
-
- // was preview_mode
- //bool was_preview_mode;
-
- PointSystem* _PointSystem() { return pointsys; }
-
- // for Undo/Redo system
- virtual void PrepareUndoRedo(UndoRedo& ur, bool prestage, wxString cmds, wxString desc);
-
- // -------------------- points highlight/selection ---------------------------
-
- // set command and point to highlight
- virtual void SetHighlighted ( DrawCmd* cmd, Point* point );
-
- // selects all points within (lx, ty) , (rx, by) returns # of selected points
- virtual int SelectPointsWithin( int lx, int rx, int ty, int by, SELECTMODE smode = NEW );
- virtual void ClearPointsSelection();
- virtual SELECTMODE GetSelectMode(wxMouseEvent &event);
-
- // -------------------- misc ---------------------------
-
- // non-uniform transformation
- virtual bool InitiateDraggingIfTransformMode();
- virtual void UpdateTranformModeRectCenter();
- virtual bool GetThe4thPoint(double ox, double oy, double a1x, double a1y, double a2x, double a2y, double *x, double *y);
- enum { NONE, LEFT, RIGHT } backupowner;
- agg::path_storage backupcmds;
- int rectbound2upd, rectbound2upd2;
- wxRealPoint rectbound[4], rectbound2[4], backup[4], rectcenter;
- bool isshapetransformable;
-
- // do the real drawing
- virtual void DoDraw( RendererBase& rbase, RendererPrimitives& rprim, RendererSolid& rsolid, agg::trans_affine& mtx );
-
- // update background image scale & position
- virtual void UpdateBackgroundImgScalePosition(bool firsttime = false);
-
- // perform extra stuff other than calling ASSDrawEngine::ConnectSubsequentCmds
- virtual void ConnectSubsequentCmds (DrawCmd* cmd1, DrawCmd* cmd2);
-
- // make sure the c1 continuity is followed after performing a drag-point action
- virtual void EnforceC1Continuity (DrawCmd* cmd, Point* pnt);
-
- // after the bounding quadrangle has changed, update the shape to fill up inside it
- virtual void UpdateNonUniformTransformation();
-
- friend struct UndoRedo;
-
- DECLARE_EVENT_TABLE()
-};
-
-class ASSDrawFileDropTarget : public wxFileDropTarget
-{
-public:
- ASSDrawFileDropTarget(ASSDrawCanvas *canvas): wxFileDropTarget()
- {
- m_canvas = canvas;
- }
-
- virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames)
- {
- m_canvas->ReceiveBackgroundImageFileDropEvent(filenames.Item(0));
- return true;
- }
-
-protected:
- ASSDrawCanvas *m_canvas;
-
-};
diff --git a/contrib/assdraw/src/canvas_mouse.cpp b/contrib/assdraw/src/canvas_mouse.cpp
deleted file mode 100644
index 22b64a5f4..000000000
--- a/contrib/assdraw/src/canvas_mouse.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-* Copyright (c) 2007, ai-chan
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the ASSDraw3 Team nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "canvas_mouse.hpp"
-#include "canvas.hpp"
-
-DEFINE_EVENT_TYPE( wxEVT_MOUSEONCANVAS )
-
-
-ASSDrawMouseOnCanvasEvent::ASSDrawMouseOnCanvasEvent(const ASSDrawCanvas* canvas)
- : wxNotifyEvent(),
- _canvas(canvas)
-{
- _data = NULL;
-}
-
-wxEvent* ASSDrawMouseOnCanvasEvent::Clone()
-{
- ASSDrawMouseOnCanvasEvent *clone = new ASSDrawMouseOnCanvasEvent(_canvas);
- clone->SetData(_data);
- return clone;
-}
-
-void ASSDrawMouseOnCanvasEvent::SetData(MouseOnCanvasData *data)
-{
- _data = data;
-}
-
-MouseOnCanvasData* ASSDrawMouseOnCanvasEvent::GetData()
-{
- return _data;
-}
diff --git a/contrib/assdraw/src/canvas_mouse.hpp b/contrib/assdraw/src/canvas_mouse.hpp
deleted file mode 100644
index d64011336..000000000
--- a/contrib/assdraw/src/canvas_mouse.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-* Copyright (c) 2007, ai-chan
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the ASSDraw3 Team nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#pragma once
-
-#include "_common.hpp"
-#include "enums.hpp"
-#include "engine.hpp"
-
-#include
-
-struct MouseOnCanvasData
-{
- MODE mode;
- wxMouseEvent event;
- enum { NONE, LEFT, RIGHT, BOTH } button;
-
- Point* mousedownAt_point;
- Point* pointedAt_point;
- Point* dblclicked_point_right;
-
- wxPoint mouse_point;
- wxPoint* dragAnchor_left;
- wxPoint* lastDrag_left;
- wxPoint* dragAnchor_right;
- wxPoint* lastDrag_right;
-};
-
-class ASSDrawCanvas;
-
-class ASSDrawMouseOnCanvasEvent : public wxNotifyEvent
-{
-public:
- ASSDrawMouseOnCanvasEvent(const ASSDrawCanvas* canvas);
-
- wxEvent* Clone();
-
- void SetData(MouseOnCanvasData *data);
-
- MouseOnCanvasData* GetData();
-
-private:
- const ASSDrawCanvas* _canvas;
- MouseOnCanvasData* _data;
-
-};
-
-DECLARE_EVENT_TYPE( wxEVT_MOUSEONCANVAS, -1 )
-
-typedef void (wxEvtHandler::*wxMouseOnCanvasEventFunction)(ASSDrawMouseOnCanvasEvent&);
-
-#define EVT_MOUSEONCANVAS(fn) \
- DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOUSEONCANVAS, -1, -1, \
- (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNotifyEventFunction) \
- wxStaticCastEvent( wxMouseOnCanvasEventFunction, & fn ), (wxObject *) NULL ),
-
-class ASSDrawMouseOnCanvasHandler
-{
-
-
-};
diff --git a/contrib/assdraw/src/cmd.cpp b/contrib/assdraw/src/cmd.cpp
deleted file mode 100644
index 58668f68f..000000000
--- a/contrib/assdraw/src/cmd.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
-* Copyright (c) 2007, ai-chan
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the ASSDraw3 Team nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-///////////////////////////////////////////////////////////////////////////////
-// Name: cmd.cpp
-// Purpose: ASSDraw drawing command classes
-// Author: ai-chan
-// Created: 08/26/06
-// Copyright: (c) ai-chan
-// Licence: 3-clause BSD
-///////////////////////////////////////////////////////////////////////////////
-
-#include "cmd.hpp" // the header for this file
-#include
-// ----------------------------------------------------------------------------
-// DrawCmd_M
-// ----------------------------------------------------------------------------
-
-// constructor
-DrawCmd_M::DrawCmd_M ( int x, int y, PointSystem *ps, DrawCmd *prev )
- : DrawCmd ( x, y, ps, prev )
-{
- type = M;
-}
-
-// to ASS drawing command
-wxString DrawCmd_M::ToString()
-{
- return wxString::Format(_T("m %d %d"), m_point->x(), m_point->y());
-}
-
-
-
-// ----------------------------------------------------------------------------
-// DrawCmd_L
-// ----------------------------------------------------------------------------
-
-// constructor
-DrawCmd_L::DrawCmd_L ( int x, int y, PointSystem *ps, DrawCmd *prev )
- : DrawCmd ( x, y, ps, prev )
-{
- type = L;
-}
-
-// to ASS drawing command
-wxString DrawCmd_L::ToString()
-{
- return wxString::Format(_T("l %d %d"), m_point->x(), m_point->y());
-}
-
-
-
-// ----------------------------------------------------------------------------
-// DrawCmd_B
-// ----------------------------------------------------------------------------
-
-// constructor
-DrawCmd_B::DrawCmd_B
-( int x, int y, int x1, int y1, int x2, int y2, PointSystem *ps, DrawCmd *prev )
- : DrawCmd ( x, y, ps, prev )
-{
- type = B;
- controlpoints.push_back( new Point(x1, y1, ps, CP, this, 1) );
- controlpoints.push_back( new Point(x2, y2, ps, CP, this, 2) );
- initialized = true;
- C1Cont = false;
-}
-
-// constructor
-DrawCmd_B::DrawCmd_B ( int x, int y, PointSystem *ps, DrawCmd *prev )
- : DrawCmd ( x, y, ps, prev )
-{
- type = B;
- initialized = false;
- C1Cont = false;
-}
-
-// initialize; generate control points
-void DrawCmd_B::Init ( unsigned n )
-{
- // Ignore if this is already initted
- if (initialized) return;
-
- wxPoint wx0 = prev->m_point->ToWxPoint();
- wxPoint wx1 = m_point->ToWxPoint();
- int xdiff = (wx1.x - wx0.x) / 3;
- int ydiff = (wx1.y - wx0.y) / 3;
- int xg, yg;
-
- // first control
- m_point->pointsys->FromWxPoint( wx0.x + xdiff, wx0.y + ydiff, xg, yg );
- controlpoints.push_back( new Point( xg, yg, m_point->pointsys, CP, this, 1 ) );
-
- // second control
- m_point->pointsys->FromWxPoint( wx1.x - xdiff, wx1.y - ydiff, xg, yg );
- controlpoints.push_back( new Point( xg, yg, m_point->pointsys, CP, this, 2 ) );
-
- initialized = true;
-
-}
-
-// to ASS drawing command
-wxString DrawCmd_B::ToString()
-{
- if (initialized) {
- PointList::iterator iterate = controlpoints.begin();
- Point* c1 = (*iterate++);
- Point* c2 = (*iterate);
- return wxString::Format(_T("b %d %d %d %d %d %d"), c1->x(), c1->y(), c2->x(), c2->y(), m_point->x(), m_point->y());
- }
- else
- return wxString::Format(_T("b ? ? ? ? %d %d"), m_point->x(), m_point->y());
-}
-
-
-// ----------------------------------------------------------------------------
-// DrawCmd_S
-// ----------------------------------------------------------------------------
-
-// constructor
-DrawCmd_S::DrawCmd_S
- ( int x, int y, PointSystem *ps, DrawCmd *prev )
- : DrawCmd ( x, y, ps, prev )
-{
- type = S;
- initialized = false;
- closed = false;
-}
-
-// constructor
-DrawCmd_S::DrawCmd_S
- ( int x, int y, std::vector< int > vals, PointSystem *ps, DrawCmd *prev )
- : DrawCmd ( x, y, ps, prev )
-{
- type = S;
- std::vector< int >::iterator it = vals.begin();
- unsigned n = 0;
- while (it != vals.end())
- {
- int ix = *it; it++;
- int iy = *it; it++;
- n++;
- //::wxLogMessage(_T("%d %d\n"), ix, iy);
- controlpoints.push_back( new Point( ix, iy, ps, CP, this, n ) );
- }
-
- initialized = true;
- closed = false;
-}
-
-// initialize; generate control points
-void DrawCmd_S::Init(unsigned n)
-{
- // Ignore if this is already initted
- if (initialized) return;
-
- wxPoint wx0 = prev->m_point->ToWxPoint();
- wxPoint wx1 = m_point->ToWxPoint();
- int xdiff = (wx1.x - wx0.x) / 3;
- int ydiff = (wx1.y - wx0.y) / 3;
- int xg, yg;
-
- // first control
- m_point->pointsys->FromWxPoint( wx0.x + xdiff, wx0.y + ydiff, xg, yg );
- controlpoints.push_back( new Point( xg, yg, m_point->pointsys, CP, this, 1 ) );
-
- // second control
- m_point->pointsys->FromWxPoint( wx1.x - xdiff, wx1.y - ydiff, xg, yg );
- controlpoints.push_back( new Point( xg, yg, m_point->pointsys, CP, this, 2 ) );
-
- initialized = true;
-
-}
-
-// to ASS drawing command
-wxString DrawCmd_S::ToString()
-{
- PointList::iterator iterate = controlpoints.begin();
- wxString assout = _T("s");
- for (; iterate != controlpoints.end(); iterate++)
- {
- if (initialized)
- assout = wxString::Format(_T("%s %d %d"), assout.c_str(), (*iterate)->x(), (*iterate)->y());
- else
- assout = wxString::Format(_T("%s ? ?"), assout.c_str());
- }
- assout = wxString::Format(_T("%s %d %d"), assout.c_str(), m_point->x(), m_point->y());
- if (closed) assout = wxString::Format(_T("%s c"), assout.c_str());
- return assout;
-}
diff --git a/contrib/assdraw/src/cmd.hpp b/contrib/assdraw/src/cmd.hpp
deleted file mode 100644
index 25ef16102..000000000
--- a/contrib/assdraw/src/cmd.hpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-* Copyright (c) 2007, ai-chan
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the ASSDraw3 Team nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-///////////////////////////////////////////////////////////////////////////////
-// Name: cmd.hpp
-// Purpose: header file for ASSDraw drawing command classes
-// Author: ai-chan
-// Created: 08/26/06
-// Copyright: (c) ai-chan
-// Licence: 3-clause BSD
-///////////////////////////////////////////////////////////////////////////////
-
-#pragma once
-
-#include "engine.hpp" // include the engine header for DrawCmd
-#include // ok, we use vector too
-
-// this header file declares the following classes
-class DrawCmd_M;
-class DrawCmd_L;
-class DrawCmd_B;
-
-// The M command
-class DrawCmd_M: public DrawCmd
-{
-public:
- // Constructor
- DrawCmd_M ( int x, int y, PointSystem *ps, DrawCmd *prev );
-
- // to ASS drawing command
- wxString ToString();
-
-};
-
-// The L command
-class DrawCmd_L: public DrawCmd
-{
-public:
- // Constructor
- DrawCmd_L ( int x, int y, PointSystem *ps, DrawCmd *prev );
-
- // to ASS drawing command
- wxString ToString();
-
-};
-
-// The B command
-class DrawCmd_B: public DrawCmd
-{
-public:
- // Constructor
- DrawCmd_B ( int x, int y, int x1, int y1, int x2, int y2, PointSystem *ps, DrawCmd *prev );
-
- // Special constructor where only m_point is defined
- // Need to call Init() to generate the controls
- DrawCmd_B ( int x, int y, PointSystem *ps, DrawCmd *prev );
-
- // Init this B command; generate controlpoints
- void Init ( unsigned n = 0 );
-
- // to ASS drawing command
- wxString ToString();
-
- //special
- bool C1Cont;
-
-};
-
-// The S command
-class DrawCmd_S: public DrawCmd
-{
-public:
- // Constructor
- DrawCmd_S ( int x, int y, PointSystem *ps, DrawCmd *prev );
-
- // Constructor (with points info)
- DrawCmd_S ( int x, int y, std::vector< int > vals, PointSystem *ps, DrawCmd *prev );
-
- // Init this S command; generate controlpoints
- void Init ( unsigned n = 0 );
-
- // to ASS drawing command
- wxString ToString();
-
- // special
- bool closed;
-};
-
diff --git a/contrib/assdraw/src/convert.bat b/contrib/assdraw/src/convert.bat
deleted file mode 100644
index 255b89fc4..000000000
--- a/contrib/assdraw/src/convert.bat
+++ /dev/null
@@ -1,2 +0,0 @@
-perl t-stringifier.pl agg_bcspline.h agg_conv_bcspline.h agg_vcgen_bcspline.h resource.h agg_bcspline.cpp agg_vcgen_bcspline.cpp assdraw.cpp assdraw_settings.cpp canvas.cpp canvas_mouse.cpp cmd.cpp dlgctrl.cpp engine.cpp library.cpp settings.cpp
-pause
\ No newline at end of file
diff --git a/contrib/assdraw/src/dlgctrl.cpp b/contrib/assdraw/src/dlgctrl.cpp
deleted file mode 100644
index 10a57d0d7..000000000
--- a/contrib/assdraw/src/dlgctrl.cpp
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
-* Copyright (c) 2007, ai-chan
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-* * Neither the name of the ASSDraw3 Team nor the
-* names of its contributors may be used to endorse or promote products
-* derived from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY AI-CHAN ``AS IS'' AND ANY
-* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL AI-CHAN BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-///////////////////////////////////////////////////////////////////////////////
-// Name: dlgctrl.cpp
-// Purpose: custom dialogs and controls
-// Author: ai-chan
-// Created: 08/26/06
-// Copyright: (c) ai-chan
-// Licence: 3-clause BSD
-///////////////////////////////////////////////////////////////////////////////
-
-#include "assdraw.hpp"
-
-#if !defined(__WINDOWS__)
-#include "xpm/res.h"
-#endif
-
-BEGIN_EVENT_TABLE(ASSDrawSrcTxtCtrl, wxTextCtrl)
- EVT_CHAR(ASSDrawSrcTxtCtrl::CustomOnChar)
- EVT_TEXT(wxID_ANY, ASSDrawSrcTxtCtrl::CustomOnText)
-END_EVENT_TABLE()
-
-BEGIN_EVENT_TABLE(ASSDrawTransformDlg, wxDialog)
- EVT_COMBOBOX(-1, ASSDrawTransformDlg::OnTemplatesCombo)
-END_EVENT_TABLE()
-
-//BEGIN_EVENT_TABLE(ASSDrawCanvasRecenterButton, wxWindow)
-//END_EVENT_TABLE()
-
-// ----------------------------------------------------------------------------
-// ASSDrawSrcTxtCtrl
-// ----------------------------------------------------------------------------
-
-ASSDrawSrcTxtCtrl::ASSDrawSrcTxtCtrl(wxWindow *parent, ASSDrawFrame *frame)
- : wxTextCtrl(parent, wxID_ANY, _T(""), __DPDS__ , wxTE_MULTILINE )
-{
- m_frame = frame;
-}
-
-void ASSDrawSrcTxtCtrl::CustomOnChar(wxKeyEvent &event)
-{
- switch (event.GetKeyCode())
- {
- case WXK_RETURN:
- m_frame->UpdateASSCommandStringFromSrcTxtCtrl(GetValue());
- break;
- case WXK_TAB:
- break; //do nothing
- default:
- //m_frame->SetTitle(wxString::Format(_T("Key: %d"), event.GetKeyCode()));
- event.Skip(true);
- }
-
- //SetBackgroundColour(IsModified()? wxColour(0xFF, 0xFF, 0x99):*wxWHITE);
-}
-
-void ASSDrawSrcTxtCtrl::CustomOnText(wxCommandEvent &event)
-{
- //SetBackgroundColour(IsModified()? wxColour(0xFF, 0xFF, 0x99):*wxWHITE);
-}
-
-// ----------------------------------------------------------------------------
-// ASSDrawTransformDlg
-// ----------------------------------------------------------------------------
-
-ASSDrawTransformDlg::ASSDrawTransformDlg(ASSDrawFrame* parent)
- : wxDialog(parent, -1, wxString(_T("Transform")))
-{
- m_frame = parent;
-
- wxBoxSizer* sizer_main = new wxBoxSizer(wxVERTICAL);
- this->SetSizer(sizer_main);
-
- wxBoxSizer* sizer_templates = new wxBoxSizer(wxHORIZONTAL);
- sizer_main->Add(sizer_templates, 0, wxGROW|wxLEFT, 5);
-
- sizer_templates->Add(new wxStaticText( this, -1, _("Templates"), __DPDS__ , 0 ),
- 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
-
- combo_templates = new wxComboBox( this, -1, combo_templatesStrings[0], __DPDS__ , 10, combo_templatesStrings, wxCB_READONLY );
- sizer_templates->Add(combo_templates, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
-
- wxFlexGridSizer* sizer_fields = new wxFlexGridSizer(3, 4, 0, 0);
- sizer_main->Add(sizer_fields, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT, 5);
-
- int flag_txtctrl = wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL;
- int flag_statictxt = wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL;
-
- sizer_fields->Add(new wxStaticText( this, -1, _("m11"), __DPDS__ , 0 ),
- 0, flag_statictxt, 5);
-
- txtctrl_m11 = new wxTextCtrl( this, -1, _T("1.0"), __DPDS__ , wxTE_RIGHT );
- sizer_fields->Add(txtctrl_m11, 0, flag_txtctrl, 5);
-
- sizer_fields->Add(new wxStaticText( this, -1, _("m12"), __DPDS__ , 0 ),
- 0, flag_statictxt, 5);
-
- txtctrl_m12 = new wxTextCtrl( this, -1, _T("0.0"), __DPDS__ , wxTE_RIGHT );
- sizer_fields->Add(txtctrl_m12, 0, flag_txtctrl, 5);
-
- sizer_fields->Add(new wxStaticText( this, -1, _("m21"), __DPDS__ , 0 ),
- 0, flag_statictxt, 5);
-
- txtctrl_m21 = new wxTextCtrl( this, -1, _T("0.0"), __DPDS__ , wxTE_RIGHT );
- sizer_fields->Add(txtctrl_m21, 0, flag_txtctrl, 5);
-
- sizer_fields->Add(new wxStaticText( this, -1, _("m22"), __DPDS__ , 0 ),
- 0, flag_statictxt, 5);
-
- txtctrl_m22 = new wxTextCtrl( this, -1, _T("1.0"), __DPDS__ , wxTE_RIGHT );
- sizer_fields->Add(txtctrl_m22, 0, flag_txtctrl, 5);
-
- sizer_fields->Add(new wxStaticText( this, -1, _("mx"), __DPDS__ , 0 ),
- 0, flag_statictxt, 5);
-
- txtctrl_mx = new wxTextCtrl( this, -1, _T("0.0"), __DPDS__ , wxTE_RIGHT );
- sizer_fields->Add(txtctrl_mx, 0, flag_txtctrl, 5);
-
- sizer_fields->Add(new wxStaticText( this, -1, _("my"), __DPDS__ , 0 ),
- 0, flag_statictxt, 5);
-
- txtctrl_my = new wxTextCtrl( this, -1, _T("0.0"), __DPDS__ , wxTE_RIGHT );
- sizer_fields->Add(txtctrl_my, 0, flag_txtctrl, 5);
-
- sizer_fields->Add(new wxStaticText( this, -1, _("nx"), __DPDS__ , 0 ),
- 0, flag_statictxt, 5);
-
- txtctrl_nx = new wxTextCtrl( this, -1, _T("0.0"), __DPDS__ , wxTE_RIGHT );
- sizer_fields->Add(txtctrl_nx, 0, flag_txtctrl, 5);
-
- sizer_fields->Add(new wxStaticText( this, -1, _("ny"), __DPDS__ , 0 ),
- 0, flag_statictxt, 5);
-
- txtctrl_ny = new wxTextCtrl( this, -1, _T("0.0"), __DPDS__ , wxTE_RIGHT );
- sizer_fields->Add(txtctrl_ny, 0, flag_txtctrl, 5);
-
- wxStaticBitmap* staticbmp = new wxStaticBitmap( this, -1, wxBITMAP(transform), wxDefaultPosition, wxSize(224, 56), 0 );
- sizer_main->Add(staticbmp, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
-
- wxStdDialogButtonSizer* sizer_stdbutt = new wxStdDialogButtonSizer;
-
- sizer_main->Add(sizer_stdbutt, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
- wxButton* button_ok = new wxButton( this, wxID_OK, _("&OK"), __DPDS__ , 0 );
- sizer_stdbutt->AddButton(button_ok);
-
- wxButton* button_cancel = new wxButton( this, wxID_CANCEL, _("&Cancel"), __DPDS__ , 0 );
- sizer_stdbutt->AddButton(button_cancel);
-
- sizer_stdbutt->Realize();
-
- sizer_main->Fit(this);
-
-}
-
-void ASSDrawTransformDlg::OnTemplatesCombo(wxCommandEvent &event)
-{
- int pos = -1;
- for (int i = 0; i < combo_templatesCount; i++)
- if (combo_templatesStrings[i].IsSameAs(((wxComboBox *) event.GetEventObject())->GetValue()))
- {
- pos = i;
- break;
- }
- if (pos == -1)
- return;
-
- txtctrl_m11->SetValue( wxString::Format(_T("%.1f"), combo_templatesValues[pos].f1) );
- txtctrl_m12->SetValue( wxString::Format(_T("%.1f"), combo_templatesValues[pos].f2) );
- txtctrl_m21->SetValue( wxString::Format(_T("%.1f"), combo_templatesValues[pos].f3) );
- txtctrl_m22->SetValue( wxString::Format(_T("%.1f"), combo_templatesValues[pos].f4) );
- txtctrl_mx->SetValue( wxString::Format(_T("%.1f"), combo_templatesValues[pos].f5) );
- txtctrl_my->SetValue( wxString::Format(_T("%.1f"), combo_templatesValues[pos].f6) );
- txtctrl_nx->SetValue( wxString::Format(_T("%.1f"), combo_templatesValues[pos].f7) );
- txtctrl_ny->SetValue( wxString::Format(_T("%.1f"), combo_templatesValues[pos].f8) );
-}
-
-void ASSDrawTransformDlg::EndModal(int retCode)
-{
- if (retCode != wxID_OK)
- {
- wxDialog::EndModal(retCode);
- return;
- }
-
- bool ok = true;
-
- ok = ok && txtctrl_m11->GetValue().ToDouble( &xformvals.f1 );
- ok = ok && txtctrl_m12->GetValue().ToDouble( &xformvals.f2 );
- ok = ok && txtctrl_m21->GetValue().ToDouble( &xformvals.f3 );
- ok = ok && txtctrl_m22->GetValue().ToDouble( &xformvals.f4 );
- ok = ok && txtctrl_mx->GetValue().ToDouble( &xformvals.f5 );
- ok = ok && txtctrl_my->GetValue().ToDouble( &xformvals.f6 );
- ok = ok && txtctrl_nx->GetValue().ToDouble( &xformvals.f7 );
- ok = ok && txtctrl_ny->GetValue().ToDouble( &xformvals.f8 );
-
- if (ok)
- wxDialog::EndModal(wxID_OK);
- else
- wxMessageBox(_T("One or more values entered are not real numbers.\nPlease fix."), _T("Value error"), wxOK | wxICON_INFORMATION, m_frame);
-
-}
-
-
-ASSDrawAboutDlg::ASSDrawAboutDlg(ASSDrawFrame *parent, unsigned timeout)
- : wxDialog(parent, wxID_ANY, wxString(TITLE), __DPDS__ , wxSIMPLE_BORDER), time_out(timeout)
-{
- SetBackgroundColour(*wxWHITE);
- htmlwin = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxSize(396, 200), wxHW_DEFAULT_STYLE | wxSIMPLE_BORDER);
- htmlwin->SetPage(
-_T(" \
-
ASSDraw3 is a tool for designing shapes to be used in ASS subtitle file. \
-
To add lines or curves, initiate the draw mode by clicking on the drawing tools. \
-Then, either click on empty space or drag from an existing point to add the new lines/curves. \
-Control points for Bezier curves are generated once you release the mouse button. \
-
To modify shapes, drag their points (squares) and control points (circles) in the drag mode. \
-
Some tips & tricks: \
-
\
-
Set background image by dragging image file from explorer onto the canvas \
-
Use the Shapes Library to store your drawings \
-
Ctrl-Z for undo, Ctrl-Y for redo \
-
Use your mousewheel to zoom in/out (PageUp/PageDown keys work too) \
-
Dragging with right mouse button moves the drawing and/or background image around. \
-
Double clicking with right mouse button for popup menus. \
-
Holding shift key while in the draw mode temporarily switches to the drag mode \
-
The shapes origin (coordinate [0, 0] depicted by the small cross) is draggable \
-
\
-
Acknowledgements: \
-
\
-
Maxim Shemanarev http://www.antigrain.com for his Anti-Grain Geometry (AGG) graphic toolkit. \
-