Initial commit

This commit is contained in:
Mario Voigt
2020-07-30 01:16:18 +02:00
parent 9ead5330fa
commit fc012a2896
2983 changed files with 568355 additions and 0 deletions

View File

@ -0,0 +1,770 @@
#ifndef Py_CONFIG_H
#define Py_CONFIG_H
/* pyconfig.h. NOT Generated automatically by configure.
This is a manually maintained version used for the Watcom,
Borland and Microsoft Visual C++ compilers. It is a
standard part of the Python distribution.
WINDOWS DEFINES:
The code specific to Windows should be wrapped around one of
the following #defines
MS_WIN64 - Code specific to the MS Win64 API
MS_WIN32 - Code specific to the MS Win32 (and Win64) API (obsolete, this covers all supported APIs)
MS_WINDOWS - Code specific to Windows, but all versions.
MS_WINCE - Code specific to Windows CE
Py_ENABLE_SHARED - Code if the Python core is built as a DLL.
Also note that neither "_M_IX86" or "_MSC_VER" should be used for
any purpose other than "Windows Intel x86 specific" and "Microsoft
compiler specific". Therefore, these should be very rare.
NOTE: The following symbols are deprecated:
NT, USE_DL_EXPORT, USE_DL_IMPORT, DL_EXPORT, DL_IMPORT
MS_CORE_DLL.
WIN32 is still required for the locale module.
*/
#ifdef _WIN32_WCE
#define MS_WINCE
#endif
/* Deprecated USE_DL_EXPORT macro - please use Py_BUILD_CORE */
#ifdef USE_DL_EXPORT
# define Py_BUILD_CORE
#endif /* USE_DL_EXPORT */
/* Visual Studio 2005 introduces deprecation warnings for
"insecure" and POSIX functions. The insecure functions should
be replaced by *_s versions (according to Microsoft); the
POSIX functions by _* versions (which, according to Microsoft,
would be ISO C conforming). Neither renaming is feasible, so
we just silence the warnings. */
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
#ifndef _CRT_NONSTDC_NO_DEPRECATE
#define _CRT_NONSTDC_NO_DEPRECATE 1
#endif
/* Windows CE does not have these */
#ifndef MS_WINCE
#define HAVE_IO_H
#define HAVE_SYS_UTIME_H
#define HAVE_TEMPNAM
#define HAVE_TMPFILE
#define HAVE_TMPNAM
#define HAVE_CLOCK
#define HAVE_STRERROR
#endif
#ifdef HAVE_IO_H
#include <io.h>
#endif
#define HAVE_HYPOT
#define HAVE_STRFTIME
#define DONT_HAVE_SIG_ALARM
#define DONT_HAVE_SIG_PAUSE
#define LONG_BIT 32
#define WORD_BIT 32
#define PREFIX ""
#define EXEC_PREFIX ""
#define MS_WIN32 /* only support win32 and greater. */
#define MS_WINDOWS
#ifndef PYTHONPATH
# define PYTHONPATH ".\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk"
#endif
#define NT_THREADS
#define WITH_THREAD
#ifndef NETSCAPE_PI
#define USE_SOCKET
#endif
/* CE6 doesn't have strdup() but _strdup(). Assume the same for earlier versions. */
#if defined(MS_WINCE)
# include <stdlib.h>
# define strdup _strdup
#endif
#ifdef MS_WINCE
/* Windows CE does not support environment variables */
#define getenv(v) (NULL)
#define environ (NULL)
#endif
/* Compiler specific defines */
/* ------------------------------------------------------------------------*/
/* Microsoft C defines _MSC_VER */
#ifdef _MSC_VER
/* We want COMPILER to expand to a string containing _MSC_VER's *value*.
* This is horridly tricky, because the stringization operator only works
* on macro arguments, and doesn't evaluate macros passed *as* arguments.
* Attempts simpler than the following appear doomed to produce "_MSC_VER"
* literally in the string.
*/
#define _Py_PASTE_VERSION(SUFFIX) \
("[MSC v." _Py_STRINGIZE(_MSC_VER) " " SUFFIX "]")
/* e.g., this produces, after compile-time string catenation,
* ("[MSC v.1200 32 bit (Intel)]")
*
* _Py_STRINGIZE(_MSC_VER) expands to
* _Py_STRINGIZE1((_MSC_VER)) expands to
* _Py_STRINGIZE2(_MSC_VER) but as this call is the result of token-pasting
* it's scanned again for macros and so further expands to (under MSVC 6)
* _Py_STRINGIZE2(1200) which then expands to
* "1200"
*/
#define _Py_STRINGIZE(X) _Py_STRINGIZE1((X))
#define _Py_STRINGIZE1(X) _Py_STRINGIZE2 ## X
#define _Py_STRINGIZE2(X) #X
/* MSVC defines _WINxx to differentiate the windows platform types
Note that for compatibility reasons _WIN32 is defined on Win32
*and* on Win64. For the same reasons, in Python, MS_WIN32 is
defined on Win32 *and* Win64. Win32 only code must therefore be
guarded as follows:
#if defined(MS_WIN32) && !defined(MS_WIN64)
Some modules are disabled on Itanium processors, therefore we
have MS_WINI64 set for those targets, otherwise MS_WINX64
*/
#ifdef _WIN64
#define MS_WIN64
#endif
/* set the COMPILER */
#ifdef MS_WIN64
#if defined(_M_IA64)
#define COMPILER _Py_PASTE_VERSION("64 bit (Itanium)")
#define MS_WINI64
#elif defined(_M_X64) || defined(_M_AMD64)
#ifdef __INTEL_COMPILER
#define COMPILER ("[ICC v." _Py_STRINGIZE(__INTEL_COMPILER) " 64 bit (amd64) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]")
#else
#define COMPILER _Py_PASTE_VERSION("64 bit (AMD64)")
#endif /* __INTEL_COMPILER */
#define MS_WINX64
#else
#define COMPILER _Py_PASTE_VERSION("64 bit (Unknown)")
#endif
#endif /* MS_WIN64 */
/* set the version macros for the windows headers */
#ifdef MS_WINX64
/* 64 bit only runs on XP or greater */
#define Py_WINVER _WIN32_WINNT_WINXP
#define Py_NTDDI NTDDI_WINXP
#else
/* Python 2.6+ requires Windows 2000 or greater */
#ifdef _WIN32_WINNT_WIN2K
#define Py_WINVER _WIN32_WINNT_WIN2K
#else
#define Py_WINVER 0x0500
#endif
#define Py_NTDDI NTDDI_WIN2KSP4
#endif
/* We only set these values when building Python - we don't want to force
these values on extensions, as that will affect the prototypes and
structures exposed in the Windows headers. Even when building Python, we
allow a single source file to override this - they may need access to
structures etc so it can optionally use new Windows features if it
determines at runtime they are available.
*/
#if defined(Py_BUILD_CORE) || defined(Py_BUILD_CORE_MODULE)
#ifndef NTDDI_VERSION
#define NTDDI_VERSION Py_NTDDI
#endif
#ifndef WINVER
#define WINVER Py_WINVER
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT Py_WINVER
#endif
#endif
/* _W64 is not defined for VC6 or eVC4 */
#ifndef _W64
#define _W64
#endif
/* Define like size_t, omitting the "unsigned" */
#ifdef MS_WIN64
typedef __int64 ssize_t;
#else
typedef _W64 int ssize_t;
#endif
#define HAVE_SSIZE_T 1
#if defined(MS_WIN32) && !defined(MS_WIN64)
#ifdef _M_IX86
#ifdef __INTEL_COMPILER
#define COMPILER ("[ICC v." _Py_STRINGIZE(__INTEL_COMPILER) " 32 bit (Intel) with MSC v." _Py_STRINGIZE(_MSC_VER) " CRT]")
#else
#define COMPILER _Py_PASTE_VERSION("32 bit (Intel)")
#endif /* __INTEL_COMPILER */
#else
#define COMPILER _Py_PASTE_VERSION("32 bit (Unknown)")
#endif
#endif /* MS_WIN32 && !MS_WIN64 */
typedef int pid_t;
#include <float.h>
#define Py_IS_NAN _isnan
#define Py_IS_INFINITY(X) (!_finite(X) && !_isnan(X))
#define Py_IS_FINITE(X) _finite(X)
#define copysign _copysign
#endif /* _MSC_VER */
/* define some ANSI types that are not defined in earlier Win headers */
#if defined(_MSC_VER) && _MSC_VER >= 1200
/* This file only exists in VC 6.0 or higher */
#include <basetsd.h>
#endif
/* ------------------------------------------------------------------------*/
/* The Borland compiler defines __BORLANDC__ */
/* XXX These defines are likely incomplete, but should be easy to fix. */
#ifdef __BORLANDC__
#define COMPILER "[Borland]"
#ifdef _WIN32
/* tested with BCC 5.5 (__BORLANDC__ >= 0x0550)
*/
typedef int pid_t;
/* BCC55 seems to understand __declspec(dllimport), it is used in its
own header files (winnt.h, ...) - so we can do nothing and get the default*/
#undef HAVE_SYS_UTIME_H
#define HAVE_UTIME_H
#define HAVE_DIRENT_H
/* rename a few functions for the Borland compiler */
#include <io.h>
#define _chsize chsize
#define _setmode setmode
#else /* !_WIN32 */
#error "Only Win32 and later are supported"
#endif /* !_WIN32 */
#endif /* BORLANDC */
/* ------------------------------------------------------------------------*/
/* egcs/gnu-win32 defines __GNUC__ and _WIN32 */
#if defined(__GNUC__) && defined(_WIN32)
/* XXX These defines are likely incomplete, but should be easy to fix.
They should be complete enough to build extension modules. */
/* Suggested by Rene Liebscher <R.Liebscher@gmx.de> to avoid a GCC 2.91.*
bug that requires structure imports. More recent versions of the
compiler don't exhibit this bug.
*/
#if (__GNUC__==2) && (__GNUC_MINOR__<=91)
#warning "Please use an up-to-date version of gcc! (>2.91 recommended)"
#endif
#define COMPILER "[gcc]"
#define PY_LONG_LONG long long
#define PY_LLONG_MIN LLONG_MIN
#define PY_LLONG_MAX LLONG_MAX
#define PY_ULLONG_MAX ULLONG_MAX
#endif /* GNUC */
/* ------------------------------------------------------------------------*/
/* lcc-win32 defines __LCC__ */
#if defined(__LCC__)
/* XXX These defines are likely incomplete, but should be easy to fix.
They should be complete enough to build extension modules. */
#define COMPILER "[lcc-win32]"
typedef int pid_t;
/* __declspec() is supported here too - do nothing to get the defaults */
#endif /* LCC */
/* ------------------------------------------------------------------------*/
/* End of compilers - finish up */
#ifndef NO_STDIO_H
# include <stdio.h>
#endif
/* 64 bit ints are usually spelt __int64 unless compiler has overridden */
#define HAVE_LONG_LONG 1
#ifndef PY_LONG_LONG
# define PY_LONG_LONG __int64
# define PY_LLONG_MAX _I64_MAX
# define PY_LLONG_MIN _I64_MIN
# define PY_ULLONG_MAX _UI64_MAX
#endif
/* For Windows the Python core is in a DLL by default. Test
Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
#if !defined(MS_NO_COREDLL) && !defined(Py_NO_ENABLE_SHARED)
# define Py_ENABLE_SHARED 1 /* standard symbol for shared library */
# define MS_COREDLL /* deprecated old symbol */
#endif /* !MS_NO_COREDLL && ... */
/* All windows compilers that use this header support __declspec */
#define HAVE_DECLSPEC_DLL
/* For an MSVC DLL, we can nominate the .lib files used by extensions */
#ifdef MS_COREDLL
# ifndef Py_BUILD_CORE /* not building the core - must be an ext */
# if defined(_MSC_VER)
/* So MSVC users need not specify the .lib file in
their Makefile (other compilers are generally
taken care of by distutils.) */
# ifdef _DEBUG
# pragma comment(lib,"python27_d.lib")
# else
# pragma comment(lib,"python27.lib")
# endif /* _DEBUG */
# endif /* _MSC_VER */
# endif /* Py_BUILD_CORE */
#endif /* MS_COREDLL */
#if defined(MS_WIN64)
/* maintain "win32" sys.platform for backward compatibility of Python code,
the Win64 API should be close enough to the Win32 API to make this
preferable */
# define PLATFORM "win32"
# define SIZEOF_VOID_P 8
# define SIZEOF_TIME_T 8
# define SIZEOF_OFF_T 4
# define SIZEOF_FPOS_T 8
# define SIZEOF_HKEY 8
# define SIZEOF_SIZE_T 8
/* configure.ac defines HAVE_LARGEFILE_SUPPORT iff HAVE_LONG_LONG,
sizeof(off_t) > sizeof(long), and sizeof(PY_LONG_LONG) >= sizeof(off_t).
On Win64 the second condition is not true, but if fpos_t replaces off_t
then this is true. The uses of HAVE_LARGEFILE_SUPPORT imply that Win64
should define this. */
# define HAVE_LARGEFILE_SUPPORT
#elif defined(MS_WIN32)
# define PLATFORM "win32"
# define HAVE_LARGEFILE_SUPPORT
# define SIZEOF_VOID_P 4
# define SIZEOF_OFF_T 4
# define SIZEOF_FPOS_T 8
# define SIZEOF_HKEY 4
# define SIZEOF_SIZE_T 4
/* MS VS2005 changes time_t to a 64-bit type on all platforms */
# if defined(_MSC_VER) && _MSC_VER >= 1400
# define SIZEOF_TIME_T 8
# else
# define SIZEOF_TIME_T 4
# endif
#endif
#ifdef _DEBUG
# define Py_DEBUG
#endif
#ifdef MS_WIN32
#define SIZEOF_SHORT 2
#define SIZEOF_INT 4
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF_DOUBLE 8
#define SIZEOF_FLOAT 4
/* VC 7.1 has them and VC 6.0 does not. VC 6.0 has a version number of 1200.
Microsoft eMbedded Visual C++ 4.0 has a version number of 1201 and doesn't
define these.
If some compiler does not provide them, modify the #if appropriately. */
#if defined(_MSC_VER)
#if _MSC_VER > 1300
#define HAVE_UINTPTR_T 1
#define HAVE_INTPTR_T 1
#else
/* VC6, VS 2002 and eVC4 don't support the C99 LL suffix for 64-bit integer literals */
#define Py_LL(x) x##I64
#endif /* _MSC_VER > 1200 */
#endif /* _MSC_VER */
#endif
/* define signed and unsigned exact-width 32-bit and 64-bit types, used in the
implementation of Python long integers. */
#ifndef PY_UINT32_T
#if SIZEOF_INT == 4
#define HAVE_UINT32_T 1
#define PY_UINT32_T unsigned int
#elif SIZEOF_LONG == 4
#define HAVE_UINT32_T 1
#define PY_UINT32_T unsigned long
#endif
#endif
#ifndef PY_UINT64_T
#if SIZEOF_LONG_LONG == 8
#define HAVE_UINT64_T 1
#define PY_UINT64_T unsigned PY_LONG_LONG
#endif
#endif
#ifndef PY_INT32_T
#if SIZEOF_INT == 4
#define HAVE_INT32_T 1
#define PY_INT32_T int
#elif SIZEOF_LONG == 4
#define HAVE_INT32_T 1
#define PY_INT32_T long
#endif
#endif
#ifndef PY_INT64_T
#if SIZEOF_LONG_LONG == 8
#define HAVE_INT64_T 1
#define PY_INT64_T PY_LONG_LONG
#endif
#endif
/* Fairly standard from here! */
/* Define to 1 if you have the `copysign' function. */
#define HAVE_COPYSIGN 1
/* Define to 1 if you have the `round' function. */
#if _MSC_VER >= 1800
#define HAVE_ROUND 1
#endif
/* Define to 1 if you have the `isinf' macro. */
#define HAVE_DECL_ISINF 1
/* Define to 1 if you have the `isnan' function. */
#define HAVE_DECL_ISNAN 1
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
/* #undef _ALL_SOURCE */
#endif
/* Define to empty if the keyword does not work. */
/* #define const */
/* Define to 1 if you have the <conio.h> header file. */
#ifndef MS_WINCE
#define HAVE_CONIO_H 1
#endif
/* Define to 1 if you have the <direct.h> header file. */
#ifndef MS_WINCE
#define HAVE_DIRECT_H 1
#endif
/* Define if you have dirent.h. */
/* #define DIRENT 1 */
/* Define to the type of elements in the array set by `getgroups'.
Usually this is either `int' or `gid_t'. */
/* #undef GETGROUPS_T */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef gid_t */
/* Define if your struct tm has tm_zone. */
/* #undef HAVE_TM_ZONE */
/* Define if you don't have tm_zone but do have the external array
tzname. */
#define HAVE_TZNAME
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef mode_t */
/* Define if you don't have dirent.h, but have ndir.h. */
/* #undef NDIR */
/* Define to `long' if <sys/types.h> doesn't define. */
/* #undef off_t */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef pid_t */
/* Define if the system does not provide POSIX.1 features except
with this defined. */
/* #undef _POSIX_1_SOURCE */
/* Define if you need to in order for stat and other things to work. */
/* #undef _POSIX_SOURCE */
/* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE void
/* Define to `unsigned' if <sys/types.h> doesn't define. */
/* #undef size_t */
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if you don't have dirent.h, but have sys/dir.h. */
/* #undef SYSDIR */
/* Define if you don't have dirent.h, but have sys/ndir.h. */
/* #undef SYSNDIR */
/* Define if you can safely include both <sys/time.h> and <time.h>. */
/* #undef TIME_WITH_SYS_TIME */
/* Define if your <sys/time.h> declares struct tm. */
/* #define TM_IN_SYS_TIME 1 */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef uid_t */
/* Define if the closedir function returns void instead of int. */
/* #undef VOID_CLOSEDIR */
/* Define if getpgrp() must be called as getpgrp(0)
and (consequently) setpgrp() as setpgrp(0, 0). */
/* #undef GETPGRP_HAVE_ARGS */
/* Define this if your time.h defines altzone */
/* #define HAVE_ALTZONE */
/* Define if you have the putenv function. */
#ifndef MS_WINCE
#define HAVE_PUTENV
#endif
/* Define if your compiler supports function prototypes */
#define HAVE_PROTOTYPES
/* Define if you can safely include both <sys/select.h> and <sys/time.h>
(which you can't on SCO ODT 3.0). */
/* #undef SYS_SELECT_WITH_SYS_TIME */
/* Define if you want documentation strings in extension modules */
#define WITH_DOC_STRINGS 1
/* Define if you want to compile in rudimentary thread support */
/* #undef WITH_THREAD */
/* Define if you want to use the GNU readline library */
/* #define WITH_READLINE 1 */
/* Define if you want to have a Unicode type. */
#define Py_USING_UNICODE
/* Define as the size of the unicode type. */
/* This is enough for unicodeobject.h to do the "right thing" on Windows. */
#define Py_UNICODE_SIZE 2
/* Use Python's own small-block memory-allocator. */
#define WITH_PYMALLOC 1
/* Define if you have clock. */
/* #define HAVE_CLOCK */
/* Define when any dynamic module loading is enabled */
#define HAVE_DYNAMIC_LOADING
/* Define if you have ftime. */
#ifndef MS_WINCE
#define HAVE_FTIME
#endif
/* Define if you have getpeername. */
#define HAVE_GETPEERNAME
/* Define if you have getpgrp. */
/* #undef HAVE_GETPGRP */
/* Define if you have getpid. */
#ifndef MS_WINCE
#define HAVE_GETPID
#endif
/* Define if you have gettimeofday. */
/* #undef HAVE_GETTIMEOFDAY */
/* Define if you have getwd. */
/* #undef HAVE_GETWD */
/* Define if you have lstat. */
/* #undef HAVE_LSTAT */
/* Define if you have the mktime function. */
#define HAVE_MKTIME
/* Define if you have nice. */
/* #undef HAVE_NICE */
/* Define if you have readlink. */
/* #undef HAVE_READLINK */
/* Define if you have select. */
/* #undef HAVE_SELECT */
/* Define if you have setpgid. */
/* #undef HAVE_SETPGID */
/* Define if you have setpgrp. */
/* #undef HAVE_SETPGRP */
/* Define if you have setsid. */
/* #undef HAVE_SETSID */
/* Define if you have setvbuf. */
#define HAVE_SETVBUF
/* Define if you have siginterrupt. */
/* #undef HAVE_SIGINTERRUPT */
/* Define if you have symlink. */
/* #undef HAVE_SYMLINK */
/* Define if you have tcgetpgrp. */
/* #undef HAVE_TCGETPGRP */
/* Define if you have tcsetpgrp. */
/* #undef HAVE_TCSETPGRP */
/* Define if you have times. */
/* #undef HAVE_TIMES */
/* Define if you have uname. */
/* #undef HAVE_UNAME */
/* Define if you have waitpid. */
/* #undef HAVE_WAITPID */
/* Define to 1 if you have the `wcscoll' function. */
#ifndef MS_WINCE
#define HAVE_WCSCOLL 1
#endif
/* Define if the zlib library has inflateCopy */
#define HAVE_ZLIB_COPY 1
/* Define if you have the <dlfcn.h> header file. */
/* #undef HAVE_DLFCN_H */
/* Define to 1 if you have the <errno.h> header file. */
#ifndef MS_WINCE
#define HAVE_ERRNO_H 1
#endif
/* Define if you have the <fcntl.h> header file. */
#ifndef MS_WINCE
#define HAVE_FCNTL_H 1
#endif
/* Define to 1 if you have the <process.h> header file. */
#ifndef MS_WINCE
#define HAVE_PROCESS_H 1
#endif
/* Define to 1 if you have the <signal.h> header file. */
#ifndef MS_WINCE
#define HAVE_SIGNAL_H 1
#endif
/* Define if you have the <stdarg.h> prototypes. */
#define HAVE_STDARG_PROTOTYPES
/* Define if you have the <stddef.h> header file. */
#define HAVE_STDDEF_H 1
/* Define if you have the <sys/audioio.h> header file. */
/* #undef HAVE_SYS_AUDIOIO_H */
/* Define if you have the <sys/param.h> header file. */
/* #define HAVE_SYS_PARAM_H 1 */
/* Define if you have the <sys/select.h> header file. */
/* #define HAVE_SYS_SELECT_H 1 */
/* Define to 1 if you have the <sys/stat.h> header file. */
#ifndef MS_WINCE
#define HAVE_SYS_STAT_H 1
#endif
/* Define if you have the <sys/time.h> header file. */
/* #define HAVE_SYS_TIME_H 1 */
/* Define if you have the <sys/times.h> header file. */
/* #define HAVE_SYS_TIMES_H 1 */
/* Define to 1 if you have the <sys/types.h> header file. */
#ifndef MS_WINCE
#define HAVE_SYS_TYPES_H 1
#endif
/* Define if you have the <sys/un.h> header file. */
/* #define HAVE_SYS_UN_H 1 */
/* Define if you have the <sys/utime.h> header file. */
/* #define HAVE_SYS_UTIME_H 1 */
/* Define if you have the <sys/utsname.h> header file. */
/* #define HAVE_SYS_UTSNAME_H 1 */
/* Define if you have the <thread.h> header file. */
/* #undef HAVE_THREAD_H */
/* Define if you have the <unistd.h> header file. */
/* #define HAVE_UNISTD_H 1 */
/* Define if you have the <utime.h> header file. */
/* #define HAVE_UTIME_H 1 */
/* Define if the compiler provides a wchar.h header file. */
#define HAVE_WCHAR_H 1
/* Define if you have the dl library (-ldl). */
/* #undef HAVE_LIBDL */
/* Define if you have the mpc library (-lmpc). */
/* #undef HAVE_LIBMPC */
/* Define if you have the nsl library (-lnsl). */
#define HAVE_LIBNSL 1
/* Define if you have the seq library (-lseq). */
/* #undef HAVE_LIBSEQ */
/* Define if you have the socket library (-lsocket). */
#define HAVE_LIBSOCKET 1
/* Define if you have the sun library (-lsun). */
/* #undef HAVE_LIBSUN */
/* Define if you have the termcap library (-ltermcap). */
/* #undef HAVE_LIBTERMCAP */
/* Define if you have the termlib library (-ltermlib). */
/* #undef HAVE_LIBTERMLIB */
/* Define if you have the thread library (-lthread). */
/* #undef HAVE_LIBTHREAD */
/* WinSock does not use a bitmask in select, and uses
socket handles greater than FD_SETSIZE */
#define Py_SOCKET_FD_CAN_BE_GE_FD_SETSIZE
/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the
least significant byte first */
#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 1
#endif /* !Py_CONFIG_H */

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<noInheritable/>
<assemblyIdentity name="Microsoft.VC90.CRT" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" type="win32" version="9.0.30729.9518"/>
<file hash="51ceebf0fa523575b0317bf9e12c1c97ea974b2c" hashalg="SHA1" name="msvcr90.dll"/>
<file hash="12cfc564bc51bb535bfa8fcf2120f4331ed1f4e5" hashalg="SHA1" name="msvcp90.dll"/>
<file hash="3f071c72524d591f8ce5ba1fb0be8a426d4d7117" hashalg="SHA1" name="msvcm90.dll"/>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
</assembly>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<noInheritable/>
<assemblyIdentity name="Microsoft.VC90.MFC" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" type="win32" version="9.0.21022.8"/>
<file name="mfc90.dll"/>
<file name="mfc90u.dll"/>
<file name="mfcm90.dll"/>
<file name="mfcm90u.dll"/>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
</assembly>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 734 B

Binary file not shown.

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity name="inkstitch" processorArchitecture="x86" type="win32" version="1.0.0.0"/>
<dependency>
<dependentAssembly>
<assemblyIdentity name="Microsoft.VC90.CRT" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" type="win32" version="9.0.30729.9518"/>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"/>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity language="*" name="Microsoft.Windows.Common-Controls" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" type="win32" version="6.0.0.0"/>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"/>
</dependentAssembly>
</dependency>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
</assembly>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Creator: CorelDRAW X7 -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xml:space="preserve"
width="75.204422mm"
height="67.78524mm"
version="1.1"
style="clip-rule:evenodd;fill-rule:evenodd;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
viewBox="0 0 11362.647 10242"
id="svg20"
sodipodi:docname="inkstitch-logo.svg"
inkscape:version="0.92.4 (unknown)"><metadata
id="metadata24"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1918"
inkscape:window-height="973"
id="namedview22"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="0.647537"
inkscape:cx="145.20721"
inkscape:cy="128.09809"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_x0020_1" />
<defs
id="defs4">
<style
type="text/css"
id="style2">
<![CDATA[
.fil0 {fill:none}
.fil3 {fill:black}
.fil1 {fill:#003399}
.fil4 {fill:gray}
.fil2 {fill:white}
]]>
</style>
</defs>
<g
id="Layer_x0020_1"
transform="translate(-1873.2349,-2164)">
<metadata
id="CorelCorpID_0Corel-Layer" />
<path
class="fil1"
d="m 9857,7480 v -51 c 0,-15 12,-27 27,-27 h 295 c 15,0 27,12 27,27 v 51 c 0,15 -12,28 -27,28 h -295 c -15,0 -27,-13 -27,-28 z m 2819,-1566 c 10,66 67,116 135,116 v 0 c 75,0 137,-61 137,-137 v -144 c 0,-37 18,-68 49,-88 32,-19 69,-20 101,-2 83,43 138,125 138,232 v 2788 c 0,147 -121,268 -268,268 h -292 v 443 c 0,1659 -1357,3016 -3016,3016 H 5450 c -1659,0 -3017,-1357 -3017,-3016 v -402 h -286 c -151,0 -274,-123 -274,-273 V 5937 c 0,-150 123,-273 274,-273 h 286 v -484 c 0,-1659 1358,-3016 3017,-3016 h 4210 c 1659,0 3016,1357 3016,3016 z M 2220,7600 h 107 c 43,0 81,21 106,52 v 170 c -25,32 -63,52 -106,52 h -107 c -75,0 -136,-62 -136,-137 v 0 c 0,-75 61,-137 136,-137 z m 54,710 c 75,0 136,61 136,136 0,76 -61,137 -136,137 -76,0 -137,-61 -137,-137 0,-75 61,-136 137,-136 z m 10515,-710 h 107 c 75,0 137,62 137,137 v 0 c 0,75 -62,137 -137,137 h -107 c -47,0 -88,-24 -113,-61 v -152 c 25,-36 66,-61 113,-61 z m 54,711 c 75,0 135,60 135,135 0,75 -60,136 -135,136 -75,0 -136,-61 -136,-136 0,-75 61,-135 136,-135 z m -1957,-838 c -676,154 -776,166 -1566,74 l -1848,18 c -374,4 -659,116 -1029,116 H 4373 l -138,-75 v -302 l 138,-75 h 2070 c 370,0 655,111 1029,115 l 1848,19 c 790,-92 890,-80 1566,73 9,2 15,10 15,19 0,9 -6,16 -15,18 z M 4562,6641 V 4478 h 516 v 2163 z m 1562,0 V 4407 h 50 L 7521,5670 V 4478 h 477 v 2246 h -45 L 6601,5461 v 1180 z m 2865,0 V 4478 h 510 v 941 l 715,-941 h 614 l -816,1029 881,1134 h -624 l -770,-996 v 996 z M 4180,9422 c 86,52 160,89 220,111 60,21 119,31 177,31 57,0 104,-13 139,-38 35,-26 53,-58 53,-98 0,-57 -63,-122 -188,-193 -20,-12 -36,-21 -46,-27 l -95,-54 c -92,-52 -161,-111 -205,-177 -45,-66 -67,-140 -67,-223 0,-113 43,-206 128,-278 85,-72 195,-108 330,-108 50,0 103,5 161,17 58,12 123,30 194,54 v 329 c -68,-43 -132,-75 -193,-98 -61,-23 -112,-35 -155,-35 -47,0 -84,10 -111,30 -27,21 -41,48 -41,83 0,24 8,47 25,68 16,22 40,41 72,58 l 165,91 c 137,76 230,147 277,211 48,65 72,141 72,230 0,136 -47,247 -140,331 -93,84 -217,126 -371,126 -52,0 -109,-5 -171,-16 -61,-11 -128,-28 -202,-51 z m 1440,396 V 8708 h -445 v -293 h 1224 v 293 h -444 v 1110 z m 986,0 V 8415 h 335 v 1403 z m 989,0 V 8708 h -446 v -293 h 1225 v 293 h -444 v 1110 z m 1983,-959 c -60,-63 -122,-109 -184,-139 -62,-30 -128,-45 -196,-45 -119,0 -216,41 -291,122 -76,82 -113,188 -113,316 0,128 37,232 112,312 75,79 172,119 292,119 71,0 142,-14 213,-44 70,-30 141,-74 211,-134 l -22,373 c -60,40 -125,71 -196,92 -72,22 -146,32 -223,32 -82,0 -161,-12 -237,-38 -76,-26 -146,-64 -209,-115 -91,-71 -160,-157 -208,-259 -48,-102 -72,-214 -72,-335 0,-104 18,-201 53,-292 36,-91 87,-171 155,-241 68,-70 147,-123 237,-160 90,-37 184,-55 283,-55 79,0 154,10 226,33 72,21 140,55 205,99 z m 261,959 V 8415 h 331 v 515 h 541 v -515 h 329 v 1403 h -329 v -589 h -541 v 589 z M 5450,2676 c -1376,0 -2504,1128 -2504,2504 v 4210 c 0,1376 1128,2504 2504,2504 h 4210 c 1376,0 2504,-1128 2504,-2504 V 5180 c 0,-1376 -1128,-2504 -2504,-2504 z"
id="path9"
inkscape:connector-curvature="0"
style="fill:#003399" />
<path
class="fil2"
d="m 5450,2676 c -1376,0 -2504,1128 -2504,2504 v 4210 c 0,1376 1128,2504 2504,2504 h 4210 c 1376,0 2504,-1128 2504,-2504 V 5180 c 0,-1376 -1128,-2504 -2504,-2504 z"
id="path11"
inkscape:connector-curvature="0"
style="fill:#ffffff" />
<path
class="fil3"
d="M 9839,9818 V 8415 h 331 v 515 h 541 v -515 h 329 v 1403 h -329 v -589 h -541 v 589 z m -261,-959 c -60,-63 -122,-109 -184,-139 -62,-30 -128,-45 -196,-45 -119,0 -216,41 -291,122 -76,82 -113,188 -113,316 0,128 37,232 112,312 75,79 172,119 292,119 71,0 142,-14 213,-44 70,-30 141,-74 211,-134 l -22,373 c -60,40 -125,71 -196,92 -72,22 -146,32 -223,32 -82,0 -161,-12 -237,-38 -76,-26 -146,-64 -209,-115 -91,-71 -160,-157 -208,-259 -48,-102 -72,-214 -72,-335 0,-104 18,-201 53,-292 36,-91 87,-171 155,-241 68,-70 147,-123 237,-160 90,-37 184,-55 283,-55 79,0 154,10 226,33 72,21 140,55 205,99 z M 7595,9818 V 8708 h -446 v -293 h 1225 v 293 h -444 v 1110 z m -989,0 V 8415 h 335 v 1403 z m -986,0 V 8708 h -445 v -293 h 1224 v 293 H 5955 V 9818 Z M 4180,9422 c 86,52 160,89 220,111 60,21 119,31 177,31 57,0 104,-13 139,-38 35,-26 53,-58 53,-98 0,-57 -63,-122 -188,-193 -20,-12 -36,-21 -46,-27 l -95,-54 c -92,-52 -161,-111 -205,-177 -45,-66 -67,-140 -67,-223 0,-113 43,-206 128,-278 85,-72 195,-108 330,-108 50,0 103,5 161,17 58,12 123,30 194,54 v 329 c -68,-43 -132,-75 -193,-98 -61,-23 -112,-35 -155,-35 -47,0 -84,10 -111,30 -27,21 -41,48 -41,83 0,24 8,47 25,68 16,22 40,41 72,58 l 165,91 c 137,76 230,147 277,211 48,65 72,141 72,230 0,136 -47,247 -140,331 -93,84 -217,126 -371,126 -52,0 -109,-5 -171,-16 -61,-11 -128,-28 -202,-51 z"
id="path13"
inkscape:connector-curvature="0"
style="fill:#000000" />
<path
class="fil3"
d="M 8989,6641 V 4478 h 510 v 941 l 715,-941 h 614 l -816,1029 881,1134 h -624 l -770,-996 v 996 z m -2865,0 V 4407 h 50 L 7521,5670 V 4478 h 477 v 2246 h -45 L 6601,5461 v 1180 z m -1562,0 V 4478 h 516 v 2163 z"
id="path15"
inkscape:connector-curvature="0"
style="fill:#000000" />
<path
class="fil4"
d="m 10886,7473 c -676,154 -776,166 -1566,74 l -1848,18 c -374,4 -659,116 -1029,116 H 4373 l -138,-75 v -302 l 138,-75 h 2070 c 370,0 655,111 1029,115 l 1848,19 c 790,-92 890,-80 1566,73 9,2 15,10 15,19 0,9 -6,16 -15,18 z m -1029,7 v -51 c 0,-15 12,-27 27,-27 h 295 c 15,0 27,12 27,27 v 51 c 0,15 -12,28 -27,28 h -295 c -15,0 -27,-13 -27,-28 z"
id="path17"
inkscape:connector-curvature="0"
style="fill:#808080" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@ -0,0 +1,734 @@
var electron = require('electron');
$.postJSON = function(url, data, success=null) {
return $.ajax(url, {
type: 'POST',
data: JSON.stringify(data),
contentType: 'application/json',
success: success
});
};
var realistic_rendering = {};
var realistic_cache = {};
var normal_rendering = {};
//function to chunk opd view into pieces
// source: https://stackoverflow.com/questions/3366529/wrap-every-3-divs-in-a-div
$.fn.chunk = function(size) {
var arr = [];
for (var i = 0; i < this.length; i += size) {
arr.push(this.slice(i, i + size));
}
return this.pushStack(arr, "chunk", size);
}
// build operator detailed view (opd)
function buildOpd(thumbnail_size = $('#operator-detailedview-thumbnail-size').val() ) {
var thumbnail_size = parseInt(thumbnail_size);
var thumbnail_size_mm = thumbnail_size + 'mm';
var thumbnail_layout = (thumbnail_size >= 60) ? 'medium' : 'small';
// remove old settings
$('div.page.operator-detailedview header').remove();
$('div.page.operator-detailedview footer').remove();
$('div.page.operator-detailedview .job-headline').remove();
$('div.page.operator-detailedview .opd-color-block').parentsUntil('div.page.operator-detailedview').addBack().unwrap();
$('.opd-color-block').removeClass('medium large');
$('.opd-color-block').removeAttr('style');
// set thumbnail size
$('.operator-svg.operator-preview').css({
'width': thumbnail_size_mm,
'height': thumbnail_size_mm,
'max-width': thumbnail_size_mm
});
// calculate number of blocks per page
var num_blocks_per_page = 1;
if(thumbnail_layout == 'medium') {
$('.opd-color-block').addClass('medium');
// set width to be able to calculate the height
$('.opd-color-block').css({ 'width': thumbnail_size_mm });
// calculate max height -> source: https://stackoverflow.com/questions/6060992/element-with-the-max-height-from-a-set-of-elements
var color_box_height = Math.max.apply(null, $('.opd-color-block').map(function () { return $(this).height(); }).get());
var container_height = $('#opd-info').height();
var num_rows = Math.floor(container_height / color_box_height);
var num_columns = Math.floor(175 / thumbnail_size);
// if only two blocks fit into one row, use 50% of the space for each of them
if(num_columns == 2) { $('.opd-color-block').css({ 'width': 'calc(50% - 2mm)' }); }
// set equal height for all color blocks
$('.opd-color-block').css({ 'height': color_box_height });
// set number of color blocks per page for medium thumbnails
num_blocks_per_page = num_columns * num_rows;
// use layout for large thumbnails if only 2 or less color blocks fit on one page
if(num_blocks_per_page <= 2) {
$('.opd-color-block').removeClass('medium').removeAttr('style').addClass('large');
thumbnail_layout = 'large';
// set number of color blocks per page for large thumbnails
num_blocks_per_page = 2;
}
} else {
// set number of color blocks per page for small thumbnails
num_blocks_per_page = Math.floor(220 / thumbnail_size);
}
// set number of color blocks per page to 1 if it defaults to zero
// this should never happen, but we want to avoid the browser to crash
num_blocks_per_page = (num_blocks_per_page <= 0) ? '1' : num_blocks_per_page;
// adjust to new settings
var header = $('#opd-info header').prop('outerHTML');
var footer = $('#opd-info footer').prop('outerHTML');
var job_headline = $('#opd-info .job-headline').prop('outerHTML');
var opd_visibility = ($('#operator-detailedview').is(':checked')) ? 'block' :'none';
var paper_size = $('#printing-size').val();
$('.opd-color-block').chunk(num_blocks_per_page).wrap('<div class="page operator-detailedview ' + paper_size + ' ' + thumbnail_layout +'" style="display:'+ opd_visibility +'"><main class="operator-detailedview"><div class="operator-job-info"></div></main></div>');
$('div.operator-detailedview').prepend(header);
$('.operator-job-info').prepend(job_headline);
$('div.operator-detailedview').append(footer);
// update page numbers
setPageNumbers();
}
// set pagenumbers
function setPageNumbers() {
var totalPageNum = $('body').find('.page:visible').length;
$('span.total-page-num').text(totalPageNum);
$('.page:visible span.page-num').each(function( index ) {
$(this).text(index + 1);
});
}
// Calculate estimated time
function setEstimatedTime() {
var speed = Math.floor($('#machine-speed').val() / 60); // convert to seconds
speed = (speed <= 0) ? 1 : speed;
var timeTrim = ($('#time-trims').val() == '') ? 0 : parseInt($('#time-trims').val());
var addToTotal = ($('#time-additional').val() == '') ? 0 : parseInt($('#time-additional').val());
var timeColorChange = ($('#time-color-change').val() == '') ? 0 : parseInt($('#time-color-change').val());
// operator detailed view
$('.estimated-time').each(function(index, item) {
var selector = $(this);
var stitchCount = parseInt($(selector).closest('p').find('.num-stitches').text().match(/\d+/));
var numTrims = parseInt($( selector ).closest('div').find('p span.num-trims').text().match(/\d+/));
var estimatedTime = stitchCount/speed + (timeTrim * numTrims);
writeEstimatedTime( selector, estimatedTime );
});
// client detailed view
$('.cld-estimated-time').each(function(index, item) {
var selector = $(this);
var stitchCount = parseInt($(selector).closest('div.page').find('main .detailed .color-info span.num-stitches').text().match(/\d+/));
var numTrims = parseInt($( selector ).closest('div.page').find('main .detailed .color-info span.num-trims').text().match(/\d+/));
var estimatedTime = stitchCount/speed + (timeTrim * numTrims);
writeEstimatedTime( selector, estimatedTime );
});
var stitchCount = parseInt($('.total-num-stitches').first().text().match(/\d+/));
var numTrims = parseInt($('.total-trims').first().text().match(/\d+/));
var numColorBlocks = parseInt($('.num-color-blocks').first().text().match(/\d+/))-1; // the last color-block is not a color change
var selector = '.total-estimated-time';
var estimatedTime = stitchCount/speed + (timeTrim * numTrims) + (timeColorChange * numColorBlocks) + addToTotal;
writeEstimatedTime( selector, estimatedTime );
}
function attachLeadingZero(n) {
return (n < 10) ? ("0" + n) : n;
}
function writeEstimatedTime( selector, estimatedTime ) {
var hours = attachLeadingZero(Math.floor(estimatedTime / 3600));
var minutes = attachLeadingZero(Math.floor((estimatedTime - (hours*3600)) / 60));
var seconds = attachLeadingZero(Math.floor(estimatedTime % 60));
$(selector).text( hours + ':' + minutes + ':' + seconds );
}
// Scale SVG (fit || full size)
function scaleSVG(element, scale = 'fit') {
// always center svg
transform = "translate(-50%, -50%)";
if(scale == 'fit') {
var scale = Math.min(
element.width() / element.find('svg').width(),
element.height() / element.find('svg').height()
);
}
transform += " scale(" + scale + ")";
var label = parseInt(scale*100);
element.find('svg').css({ transform: transform });
element.find('.scale').text(label);
}
// set preview svg scale to fit into its box if display block and transform is not set
function scaleAllSvg() {
$('.page').each(function() {
if( $(this).css('display') == 'block' ) {
if( $(this).find('.inksimulation svg').css('transform') == 'none') {
scaleSVG($(this).find('.inksimulation'), 'fit');
}
}
});
}
var saveTimerHandles = {};
function setSVGTransform(figure, transform) {
var field_name = $(figure).data('field-name');
var scale = transform.match(/-?[\d\.]+/g)[0];
figure.find('svg').css({ transform: transform });
figure.find(".scale").text(parseInt(scale*100));
// avoid spamming updates
if (saveTimerHandles[field_name] != null)
clearTimeout(saveTimerHandles[field_name]);
saveTimerHandles[field_name] = setTimeout(function() {
$.postJSON('/settings/' + field_name, {value: transform});
}, 250);
}
$(function() {
/* SCALING AND MOVING SVG */
/* Mousewheel scaling */
$('figure.inksimulation').on( 'DOMMouseScroll mousewheel', function (e) {
if(e.ctrlKey == true) {
var svg = $(this).find('svg');
var transform = svg.css('transform').match(/-?[\d\.]+/g);
var scale = parseFloat(transform[0]);
if (e.originalEvent.detail > 0 || e.originalEvent.wheelDelta < 0) {
// scroll down = zoom out
scale *= 0.97;
if (scale < 0.01)
scale = 0.01;
} else {
//scroll up
scale *= 1.03;
}
// set modified scale
transform[0] = scale;
transform[3] = scale;
setSVGTransform($(this), 'matrix(' + transform + ')');
//prevent page fom scrolling
return false;
}
});
/* Fit SVG */
$('button.svg-fit').click(function() {
var svgfigure = $(this).closest('figure');
scaleSVG(svgfigure, 'fit');
});
/* Full Size SVG */
$('button.svg-full').click(function() {
var svgfigure = $(this).closest('figure');
scaleSVG(svgfigure, '1');
});
/* Drag SVG */
$('figure.inksimulation').on('mousedown', function(e) {
var p0 = { x: e.pageX, y: e.pageY };
var start_transform = $(this).find('svg').css('transform').match(/-?[\d\.]+/g);
var start_offset = { x: parseFloat(start_transform[4]), y: parseFloat(start_transform[5]) };
$(this).css({cursor: 'move'});
$(this).on('mousemove', function(e) {
var p1 = { x: e.pageX, y: e.pageY };
// set modified translate
var transform = $(this).find('svg').css('transform').match(/-?[\d\.]+/g);
transform[4] = start_offset.x + (p1.x - p0.x);
transform[5] = start_offset.y + (p1.y - p0.y);
// I'd ike to use setSVGTransform() here but this code runs many
// times per second and it's just too CPU-intensive.
$(this).find('svg').css({transform: 'matrix(' + transform + ')'});
});
}).on('mouseup', function(e) {
$(this).css({cursor: 'auto'});
$(this).data('p0', null);
$(this).off('mousemove');
// set it using setSVGTransform() to ensure that it's saved to the server
setSVGTransform($(this), $(this).find('svg').css('transform'));
});
// ignore mouse events on the buttons (Fill, 100%, Apply to All)
$('figure.inksimulation div').on('mousedown mouseup', function(e) {
e.stopPropagation();
});
/* Apply transforms to All */
$('button.svg-apply').click(function() {
var transform = $(this).parent().siblings('svg').css('transform');
$('.inksimulation').each(function() {
setSVGTransform($(this), transform);
})
});
/* Contendeditable Fields */
$('body').on('focusout', '[contenteditable="true"]:not(.info-text)', function() {
/* change svg scale */
var content = $(this).text();
var field_name = $(this).attr('data-field-name');
if(field_name == 'svg-scale') {
var scale = parseInt(content);
var svg = $(this).parent().siblings('svg');
var transform = svg.css('transform').match(/-?[\d\.]+/g);
transform[0] = scale / 100;
transform[3] = scale / 100;
svg.css({ transform: 'matrix(' + transform + ')' });
} else {
/* When we focus out from a contenteditable field, we want to
* set the same content to all fields with the same classname */
$('[data-field-name="' + field_name + '"]').text(content);
$.postJSON('/settings/' + field_name, {value: content});
}
});
// load up initial metadata values
$.getJSON('/settings', function(settings) {
$.each(settings, function(field_name, value) {
$('[data-field-name="' + field_name + '"]').each(function(i, item) {
var item = $(item);
if (item.is(':checkbox')) {
item.prop('checked', value).trigger('initialize');
} else if (item.is('img')) {
item.attr('src', value);
} else if (item.is('select')) {
item.val(value).trigger('initialize');
} else if (item.is('input[type=range]')) {
item.val(value).trigger('initialize');
$('#display-thumbnail-size').text(value + 'mm');
} else if (item.is('input[type=number]')) {
item.val(value).trigger('initialize');
} else if (item.is('figure.inksimulation')) {
setSVGTransform(item, value);
} else if (item.is('div.footer-info')) {
$('#footer-info-text').html($.parseHTML(value));
item.html($.parseHTML(value));
} else if (item.is('#custom-page-content')) {
$('#custom-page-content').html($.parseHTML(value));
} else {
item.text(value);
}
});
});
// wait until page size is set (if they've specified one) and then scale SVGs to fit and build operator detailed view
setTimeout(function() {
scaleAllSvg();
buildOpd();
}, 500);
});
$('body').on('keypress', '[contenteditable="true"]:not(.info-text)', function(e) {
if (e.which == 13) {
// pressing enter defocuses the element
this.blur();
// also suppress the enter keystroke to avoid adding a new line
return false;
} else {
return true;
}
});
$('#footer-info-text[contenteditable="true"]').keypress(function(e) {
if (e.which == 13) {
if($(this).find('div').length > 2) {
return false;
} else {
return true;
}
}
});
$('.info-text[contenteditable="true"]').focusout(function() {
updateEditableText($(this));
});
/* Settings Bar */
$('button.close').click(function() {
window.close();
});
$('button.print').click(function() {
var pageSize = $('select#printing-size').find(':selected').text();
electron.ipcRenderer.send('open-pdf', pageSize)
});
$('button.save-pdf').click(function() {
var pageSize = $('select#printing-size').find(':selected').text();
electron.ipcRenderer.send('save-pdf', pageSize)
});
$('button.settings').click(function(){
$('#settings-ui').show();
});
$('#close-settings').click(function(){
$('#settings-ui').hide();
});
/* Settings */
// Settings Tabs
$('#tabs button').click(function() {
var active_fieldset_position = $(this).index() +1;
$('#settings-ui #fieldsets-ui > fieldset').css({'display': 'none'});
$('#settings-ui #fieldsets-ui > fieldset:nth-child('+active_fieldset_position+')').css({'display': 'block'});
$('#tabs .tab.active').removeClass("active");
$(this).addClass("active");
});
// Footer
function getEditMode(element){
return element.closest('fieldset').find('.switch-mode').prop('checked');
}
$('.switch-mode').change(function() {
var element = $(this);
var info_text = element.closest('fieldset').find('.info-text');
var editMode = getEditMode(element);
if (editMode) {
info_text.text( info_text.html() );
element.closest('.tool-bar').find('.tb-button.edit-only').prop("disabled", true);
} else {
info_text.css('display', 'block');
var sourceText = info_text.text();
info_text.html( $.parseHTML(sourceText) );
element.closest('.tool-bar').find('.tb-button.edit-only').prop('disabled', false);
}
});
function updateEditableText(element) {
var editMode = getEditMode(element);
var info_text = element.closest('fieldset').find('.info-text');
var editableText = '';
if (editMode) {
editableText = info_text.text();
} else {
editableText = info_text.html();
}
if(info_text.is('#footer-info-text')) {
$('div.footer-info').html($.parseHTML(editableText));
$.postJSON('/settings/footer-info', {value: editableText});
} else {
$.postJSON('/settings/custom-page-content', {value: editableText});
}
}
function formatText(selection, value) {
if(window.getSelection().toString()){
document.execCommand(selection, false, value);
}
}
$('.tb-bold').click(function() {
if(!getEditMode($(this))) {
formatText('bold');
updateEditableText($(this));
}
});
$('.tb-italic').click(function() {
if(!getEditMode($(this))) {
formatText('italic');
updateEditableText($(this));
}
});
$('.tb-underline').click(function() {
if(!getEditMode($(this))) {
formatText('underline');
updateEditableText($(this));
}
});
$('.tb-remove').click(function() {
if(!getEditMode($(this))) {
formatText('removeFormat');
updateEditableText($(this));
}
});
$('.tb-hyperlink').click(function() {
if(!getEditMode($(this))) {
formatText('createlink', 'tempurl');
updateEditableText($(this));
$(this).closest('.tool-bar').children('.url-window').css('display', 'block');
}
});
$('.url-ok').click(function() {
var link = $(this).closest('.tool-bar').find('.user-url').val();
$(this).closest('fieldset').find('.info-text').find('a[href="tempurl"]').attr('href', link);
$('.user-url').val('https://');
$('.url-window').css('display', 'none');
updateEditableText($(this));
});
$('.url-cancel').click(function() {
$(this).closest('fieldset').find('.info-text').find('a[href="tempurl"]').contents().unwrap();
$('.user-url').val('https://');
$('.url-window').css('display', 'none');
updateEditableText($(this));
});
$('.tb-mail').click(function() {
if(!getEditMode($(this))) {
formatText('createlink', 'tempurl');
updateEditableText($(this));
$(this).closest('.tool-bar').find('.mail-window').css('display', 'block');
}
});
$('.mail-ok').click(function() {
var link = 'mailto:' + $(this).closest('.tool-bar').find('.user-mail').val();
$(this).closest('fieldset').find('.info-text').find('a[href="tempurl"]').attr('href', link);
$('.user-mail').val('@');
$('.mail-window').css('display', 'none');
updateEditableText($(this));
});
$('.mail-cancel').click(function() {
$(this).closest('fieldset').find('.info-text').find('a[href="tempurl"]').contents().unwrap();
$('.user-mail').val('@');
$('.mail-window').css('display', 'none');
updateEditableText($(this));
});
$('.tb-reset').click(function() {
$(this).closest('.tool-bar').find('.reset-window').css('display', 'block');
});
$('.reset-ok').click(function() {
var htmlMode = getEditMode($(this));
if(!htmlMode) {
$(this).closest('fieldset').find('.info-text').html($(this).closest('.tool-bar').find('.original-info').html());
} else {
$(this).closest('fieldset').find('.info-text').text($(this).closest('.tool-bar').find('.original-info').html());
}
$('.reset-window').css('display', 'none');
updateEditableText($(this));
});
$('.reset-cancel').click(function() {
$('.reset-window').css('display', 'none');
});
$('body').on("click", ".edit-footer-link", function() {
$("button.settings").trigger("click");
$("#branding-tab").trigger("click");
});
// Paper Size
$('select#printing-size').on('change initialize', function(){
$('.page').toggleClass('a4', $(this).find(':selected').val() == 'a4');
}).on('change', function() {
$.postJSON('/settings/paper-size', {value: $(this).find(':selected').val()});
});
// Operator detailed view: thumbnail size setting
$(document).on('input', '#operator-detailedview-thumbnail-size', function() {
var thumbnail_size_mm = $(this).val() + 'mm';
$('#display-thumbnail-size').text( thumbnail_size_mm );
});
// Operator detailed view: thumbnail size setting action
$('#operator-detailedview-thumbnail-size').change(function() {
// set thumbnail size
var thumbnail_size = $(this).val();
// set page break positions
buildOpd(thumbnail_size);
$.postJSON('/settings/operator-detailedview-thumbnail-size', {value: thumbnail_size});
});
// Thread Palette
$('select#thread-palette').change(function(){
$('.modal').show();
}).on('update', function() {
$(this).data('current-value', $(this).find(':selected').val());
}).trigger('update');
$('#modal-yes').on('click', function(){
$("select#thread-palette").trigger("update");
$('.modal').hide();
var body = {'name': $('select#thread-palette').find(':selected').val()};
$.postJSON('/palette', body, function() {
$.getJSON('/threads', function(threads) {
console.log("threads: " + JSON.stringify(threads));
$.each(threads, function(i, thread) {
console.log("doing: " + JSON.stringify(thread));
$('[data-field-name="color-' + thread.hex + '"]').text(thread.name);
var thread_description = thread.manufacturer;
if (thread.number) {
thread_description += " #" + thread.number;
}
$('[data-field-name="thread-' + thread.hex + '"]').text(thread_description);
});
});
});
});
$('#modal-no').on('click', function(){
var select = $("select#thread-palette");
select.find('[value="' + select.data('current-value') + '"]').prop('selected', true);
$('.modal').hide();
});
// View selection checkboxes
$(':checkbox.view').on('change initialize', function() {
var field_name = $(this).attr('data-field-name');
$('.' + field_name).toggle($(this).prop('checked'));
scaleAllSvg();
setPageNumbers();
}).on('change', function() {
var field_name = $(this).attr('data-field-name');
$.postJSON('/settings/' + field_name, {value: $(this).prop('checked')});
});
// Estimated Time
$('#machine-speed, #time-additional, #time-color-change, #time-trims').on('input initialize', function() {
setEstimatedTime();
}).on('change', function() {
var field_name = $(this).attr('data-field-name');
$.postJSON('/settings/' + field_name, {value: $(this).val()});
});
// Display Estimated Time checkboxes
$(':checkbox.time-display').on('input initialize', function() {
var field_name = $(this).attr('data-field-name');
$('.' + field_name).toggle($(this).prop('checked'));
}).on('change', function() {
var field_name = $(this).attr('data-field-name');
$.postJSON('/settings/' + field_name, {value: $(this).prop('checked')});
});
// Realistic rendering checkboxes
$(':checkbox.realistic').on('change', function(e) {
console.log("realistic rendering checkbox");
var item = $(this).data('field-name');
var figure = $(this).closest('figure');
var svg = figure.find('svg');
var transform = svg.css('transform');
var checked = $(this).prop('checked');
console.log("" + item + " " + transform);
function finalize(svg_content) {
svg[0].outerHTML = svg_content;
// can't use the svg variable here because setting outerHTML created a new tag
figure.find('svg').css({transform: transform});
}
// do this later to allow this event handler to return now,
// which will cause the checkbox to be checked or unchecked
// immediately even if SVG rendering takes awhile
setTimeout(function() {
if (checked) {
if (!(item in normal_rendering)) {
normal_rendering[item] = svg[0].outerHTML;
}
if (!(item in realistic_cache)) {
// pre-render the realistic SVG to a raster image to spare the poor browser
var image = document.createElement('img');
image.onload = function() {
console.log("rendering!");
var canvas = document.createElement('canvas');
// maybe make DPI configurable? for now, use 600
canvas.width = image.width / 96 * 600;
canvas.height = image.height / 96 * 600;
var ctx = canvas.getContext('2d');
ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, canvas.width, canvas.height);
realistic_cache[item] = '<svg width=' + image.width + ' height=' + image.height + ' xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' +
'<image x=0 y=0 width=' + image.width + ' height=' + image.height + ' xlink:href="' + canvas.toDataURL() + '" />' +
'</svg>';
finalize(realistic_cache[item]);
};
image.src = '/realistic/' + item;
} else {
finalize(realistic_cache[item]);
}
} else {
finalize(normal_rendering[item]);
}
}, 100);
e.stopPropagation();
return true;
});
setTimeout(function() {
setEstimatedTime();
}, 100);
$('button.svg-realistic').click(function(e){
$(this).find('input').click();
});
// Logo
$(document).on("change", ".logo-picker", function(e) {
var file = e.currentTarget.files[0];
var reader = new FileReader();
reader.onloadend = function() {
var data = reader.result;
$('figure.brandlogo img').attr('src', data);
$.postJSON('/settings/logo', {value: data});
};
reader.readAsDataURL(file);
});
// "save as defaults" button
$('button.save-settings').click(function(e) {
var settings = {};
settings["client-overview"] = $("[data-field-name='client-overview']").is(':checked');
settings["client-detailedview"] = $("[data-field-name='client-detailedview']").is(':checked');
settings["operator-overview"] = $("[data-field-name='operator-overview']").is(':checked');
settings["operator-detailedview"] = $("[data-field-name='operator-detailedview']").is(':checked');
settings["operator-detailedview-thumbnail-size"] = $("[data-field-name='operator-detailedview-thumbnail-size']").val();
settings["custom-page"] = $("[data-field-name='custom-page']").is(':checked');
settings["paper-size"] = $('select#printing-size').find(':selected').val();
var logo = $("figure.brandlogo img").attr('src');
if (logo.startsWith("data:")) {
settings["logo"] = logo;
}
settings["footer-info"] = $("[data-field-name='footer-info']").html();
settings["machine-speed"] = $("[data-field-name='machine-speed']").val();
settings["time-additional"] = $("[data-field-name='time-additional']").val();
settings["time-color-change"] = $("[data-field-name='time-color-change']").val();
settings["time-trims"] = $("[data-field-name='time-trims']").val();
settings["time-clo"] = $("[data-field-name='time-clo']").val();
settings["time-cld"] = $("[data-field-name='time-cld']").val();
settings["time-opo"] = $("[data-field-name='time-opo']").val();
settings["time-opd"] = $("[data-field-name='time-opd']").val();
$.postJSON('/defaults', {'value': settings});
});
});

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,51 @@
{% if printview != 'detailedview' %}
<div class="color-swatch">
<div class="swatch-info">
<svg width="100%" height="100%" class="color-swatch-svg" xmlns="http://www.w3.org/2000/svg">
<rect fill="rgb{{ color_block.color.rgb }}" stroke="rgb(192, 192, 192)" stroke-width="1px" width="100%" height="100%" />
<text fill="rgb{{ color_block.color.font_color }}">
<tspan dy="1.2em" x="2mm" y="2mm" class="color-name">{{ _('Color') }}: </tspan><tspan data-field-name="color-{{ color_block.color.hex_digits }}">{{ color_block.color.name }}</tspan>
{# We don't want to see rgb if we have more than 7 colorSwatches #}
{% if color_blocks|length < 7 %}
<tspan dy="1.2em" x="2mm" class="color-rgb">{{ _('rgb') }}: {{ color_block.color.rgb }}</tspan>
{% endif %}
{# We don't want to see thread_used if we have more than 7 colorSwatches to show #}
{% if color_blocks|length < 7 %}
<tspan dy="1.2em" x="2mm" class="swatch-thread" data-field-name="thread-{{ color_block.color.hex_digits }}">{{ _('thread') }}: {{ color_block.color.manufacturer }} {{ "#" + color_block.color.number if color_block.color.number }}</tspan>
{% endif %}
{# We don't want to see num_stitch if we have more than 49 colorSwatches to show #}
{% if color_blocks|length < 49 %}
<tspan dy="1.2em" x="2mm" class="swatch-stitches">{{ _('# stitches') }}: {{ color_block.num_stitches }}</tspan>
{% endif %}
{# We don't want to see stops and trims if we have more than 13 colorSwatches to show #}
{% if color_blocks|length < 13 %}
<tspan dy="1.2em" x="2mm" class="swatch-trims">{{ _('# trims') }}: {{ color_block.num_trims }}</tspan>
<tspan dy="1.2em" x="2mm" class="swatch-stops">{{ _('stop after?') }}: {{ _("yes") if color_block.stop_after else _("no") }}</tspan>
{% endif %}
</text>
</svg>
</div>
</div>
{% else %}
<div class="color-swatch">
<div class="swatch-info">
<svg width="100%" height="100%" class="colorSwatchSVG" xmlns="http://www.w3.org/2000/svg">
<rect fill="rgb{{ color_block.color.rgb }}" stroke="rgb(192, 192, 192)" width="40mm" height="100%" />
</svg>
<div class="color-info">
<div>
<p><span class="color-name">{{ _('Color') }}:</span><span data-field-name="color-{{ color_block.color.hex_digits }}" contenteditable="true" data-placeholder="{{ _('Enter thread name...') }}">{{ color_block.color.name }}</span></p>
<p><span class="color-rgb">{{ _('rgb') }}:</span><span>{{ color_block.color.rgb }}</span></p>
<p><span class="swatch-thread">{{ _('thread') }}:</span><span data-field-name="thread-{{ color_block.color.hex_digits }}" contenteditable="true">{{ color_block.color.manufacturer }} {{ "#" + color_block.color.number if color_block.color.number }}</span></p>
<p><span class="swatch-stitches">{{ _('# stitches') }}:</span><span class="num-stitches">{{ color_block.num_stitches }}</span></p>
<p><span class="swatch-trims">{{ _('# trims') }}:</span><span class="num-trims">{{ color_block.num_trims }}</span></p>
<p><span class="swatch-stops">{{ _('stop after?') }}:</span><span>{{ _("yes") if color_block.stop_after else _("no") }}</span></p>
</div>
</div>
</div>
</div>
{%endif %}

View File

@ -0,0 +1,40 @@
<header>
{% include 'headline.html' %}
</header>
<main>
<fieldset id="edit-custom-page">
<div id="custom-page-tool-bar" class="tool-bar">
<button id="custom-page-bold" class="tb-button tb-bold ff-serif edit-only" title="Bold"><b>B</b></button>
<button id="custom-page-italic" class="tb-button tb-italic ff-serif edit-only" title="Italic"><i>I</i></button>
<button id="custom-page-underline" class="tb-button tb-underline ff-serif edit-only" title="Underline"><u>U</u></button>
<button id="custom-page-remove" class="tb-button tb-remove ff-serif edit-only" title="Remove formatting">
<u style="vertical-align: super; font-size: 60%;">A</u>
<span style="vertical-align: sub; font-size: 80%;">A</span>
</button>
<button id="custom-page-hyperlink" class="tb-button tb-hyperlink edit-only" title="Hyperlink"></button>
<button id="custom-page-mail" class="tb-button tb-mail edit-only" title="E-Mail"></button>
<button id="custom-page-reset" class="tb-button tb-reset" title="Reset text"></button>
<p id="custom-page-edit-mode" class="edit-mode">
<input type="checkbox" id="custom-page-switch-mode" class="switch-mode" name="custom-page-switch-mode" />
<label for="custom-page-switch-mode">{{ ('Show HTML') }}</label>
</p>
<div id="custom-page-url" class="tb-popup url-window">
<p>{{ _("Enter URL") }}: <input type="text" id="custom-page-link" class="user-url" name="custom-page-link" value="https://" /></p>
<p><button id="custom-page-url-ok" class="url-ok">{{ _("OK") }}</button> <button id="custom-page-url-cancel" class="url-cancel">{{ _("Cancel") }}</button></p>
</div>
<div id="custom-page-email" class="tb-popup mail-window">
<p>{{ _("Enter E-Mail") }}: <input type="text" id="custom-page-mail" class="user-mail" name="custom-page-mail" value="@" /></p>
<p><button id="custom-page-mail-ok" class="mail-ok">{{ _("OK") }}</button> <button id="custom-page-mail-cancel" class="mail-cancel">{{ _("Cancel") }}</button></p>
</div>
<div id="custom-page-info-original" class="original-info"><b>{{ _("Custom Information Sheet") }}</b></div>
<div id="custom-page-reset" class="tb-popup reset-window">
<p>{{ _("This will reset your custom text to the default.") }}</p>
<p>{{ _("All changes will be lost.") }}</p>
<p><button id="custom-page-reset-ok" class="reset-ok">{{ _("OK") }}</button> <button id="custom-page-reset-cancel" class="reset-cancel">{{ _("Cancel") }}</button></p>
</div>
</div>
<div id="custom-page-content" class="info-text" contenteditable="true" data-field-name="custom-page-content">{{ _("Custom Information Sheet") }}</div>
<p class="notice--warning"><b>Note</b>: If you are using Firefox, use visible URLs. Links will not be printed to PDF with this browser.</p>
</fieldset>
</main>
{% include 'footer.html' %}

View File

@ -0,0 +1,8 @@
<footer>
<p class="num_pages">{{ _('Page') }} <span class="page-num"></span>/<span class="total-page-num"></span></p>
<div class="footer-info" data-field-name="footer-info">{{ _('Proudly generated with') }} <a href="http://inkstitch.org/" target="_blank">Ink/Stitch</a></div>
<div class="edit-footer-link"></div>
</footer>

View File

@ -0,0 +1,16 @@
<figure class="brandlogo">
<label class="logo-upload">
<img src="{{ logo.src or "resources/inkstitch-logo.svg" }}" alt="{{ logo.title }}" title="{{ logo.title }}" data-field-name="logo">
<input type=file class="logo-picker" />
<span class="logo-instructions">{{ _("Click to choose another logo") }}</span>
</label>
</figure>
<div class="headline">
<div class="pageTitle">
<h1><span class="jobtitle" contenteditable="true" data-placeholder="{{ _('Enter job title...') }}" data-field-name="title"></span></h1>
<p class="header-field" data-label="{{ _('CLIENT') }}:" contenteditable="true" data-placeholder="{{ _('Enter client name...') }}" data-field-name="client-name"></p>
<p class="header-field" data-label="{{ _('PURCHASE ORDER #:') }}" contenteditable="true" data-placeholder="{{ _('Enter purchase order number...') }}" data-field-name="purchase-order"></p>
</div>
<div class="currentDate">{{ date|datetimeformat(_('%m/%d/%Y')) }}</div>
</div>

View File

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<title>Ink/Stitch Print Preview</title>
<!-- https://stackoverflow.com/a/37480521/4249120 -->
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
<script src="resources/jquery-3.3.1.min.js"></script>
<script src="resources/inkstitch.js"></script>
<link rel="stylesheet" href="resources/style.css" />
<link rel="shortcut icon" type="image/png" href="/favicon.png"/>
</head>
<body>
{% include 'ui.html' %}
{# client overview #}
<div class="page client-overview" style="display: {{ 'block' if view.client_overview else 'none' }}">{% include 'print_overview.html' %}</div>
{# client detailedview #}
{% set printview = 'detailedview' %}
{% for color_block in color_blocks %}
{% set outer_loop = loop %}
<div class="page client-detailedview" style="display: {{ 'block' if view.client_detailedview else 'none' }}">{% include 'print_detail.html' %}</div>
{% endfor %}
{# operator overview #}
<div class="page operator-overview" style="display: {{ 'block' if view.operator_overview else 'none' }}">{% include 'operator_overview.html' %}</div>
{# operator detailed view #}
{% include 'operator_detailedview.html' %}
{# custom pages #}
<div class="page custom-page" style="display: {{ 'block' if view.custom_page else 'none' }}">{% include 'custom-page.html' %}</div>
</body>
</html>

View File

@ -0,0 +1,75 @@
<div id="opd-info" style="display: none; height: 220mm; width: 175mm;">
<header>
{% include 'headline.html' %}
</header>
{% include 'footer.html' %}
<div class="job-headline">
<p class="operator-svg operator-colorswatch">{# svg color #}</p>
<p>{# svg preview #}</p>
<p>{{ _('Color') }}</p>
<p>{{ _('Thread Consumption') }}</p>
<p>{{ _('Stops and Trims') }}</p>
<p>{{ _('Notes') }}</p>
</div>
</div>
<div class="opd-summary opd-color-block">
<p class="operator-svg operator-colorswatch">
<span>##</span>
</p>
<p class="operator-svg operator-preview">
{{ svg_overview|replace("<li>", "")|replace("</li>", "")|safe }}
</p>
<p>
<span>{{ _('Unique Colors') }}: {{ job.num_colors }}</span>
<span class="num-color-blocks">{{ _('Color Blocks') }}: {{ job.num_color_blocks }}</span>
</p>
<p>
<span>{{ _('Design box size') }}: {{ "%0.1fmm X %0.1fmm" | format(*job.dimensions) }}</span>
<!-- <span>{{ _('Total thread used') }}: {{job.estimated_thread }}</span> -->
<span class="total-num-stitches">{{ _('Total stitch count') }}: {{job.num_stitches }}</span>
<span class="time-opd">{{ ('Estimated time') }}: <span class="total-estimated-time"></span></span>
</p>
<p>
<span class="total-stops">{{ _('Total stops') }}: {{ job.num_stops }}</span>
<span class="total-trims">{{ _('Total trims') }}: {{ job.num_trims }}</span>
</p>
<p>
<span></span>
</p>
</div>
{% for color_block in color_blocks %}
<div class="opd-color-block">
<p class="operator-svg operator-colorswatch">
<svg xmlns="http://www.w3.org/2000/svg">
<rect fill="rgb{{ color_block.color.rgb }}" width="15mm" height="100%" />
<text fill="rgb{{ color_block.color.font_color }}">
<tspan x="2mm" y="5mm" class="color-index">#{{ loop.index }}</tspan>
</text>
</svg>
</p>
<p class="operator-svg operator-preview">
{{ color_block.svg_preview|replace("<li>", "")|replace("</li>", "")|safe }}
</p>
<p>
<span data-field-name="color-{{ color_block.color.hex_digits }}" contenteditable="true" data-placeholder="{{ _('Enter thread name...') }}">{{ color_block.color.name }}</span>
<span>{{ color_block.color.rgb }}</span>
<span data-field-name="thread-{{ color_block.color.hex_digits }}" contenteditable="true">{{ color_block.color.manufacturer }} {{ "#" + color_block.color.number if color_block.color.number }}</span>
</p>
<p>
<!-- <span>{{ _('thread used') }}:</span> -->
<span class="num-stitches">{{ _('# stitches') }}: {{ color_block.num_stitches }}</span>
<span class="time-opd">{{ _('estimated time') }}: <span class="estimated-time"></span></span>
</p>
<p>
<span class="num-trims">{{ _('trims') }}: {{ color_block.num_trims }}</span>
<span>{{ _('stop after?') }}: {{ _("yes") if color_block.stop_after else _("no") }}</span>
<input type="hidden" class="num-stops" value="{{ '1' if color_block.stop_after else '0' }}" />
</p>
<p>
<span class="notes" contenteditable="true" data-field-name="operator-notes-block{{ loop.index }}" data-placeholder="{{ _('Enter operator notes...') }}"></span>
</p>
</div>
{% endfor %}

View File

@ -0,0 +1,36 @@
<header>
{% include 'headline.html' %}
<div class="job-details">
<div>
<div class="table">
<p><span>{{ _('Unique Colors') }}:</span><span>{{ job.num_colors }}</span></p>
<p><span>{{ _('Color Blocks') }}:</span><span>{{ job.num_color_blocks }}</span></p>
<p><span>{{ _('Total stops') }}:</span><span>{{ job.num_stops }}</span></p>
<p><span>{{ _('Total trims') }}:</span><span>{{ job.num_trims }}</span></p>
</div>
</div>
<div>
<div class="table">
<p><span>{{ _('Design box size') }}:</span><span>{{ "%0.1fmm X %0.1fmm" | format(*job.dimensions) }}</span></p>
<p><span>{{ _('Total stitch count') }}:</span><span>{{job.num_stitches }}</span></p>
<p><span>{{ _('Total thread used') }}:</span><span>{{job.total_thread_used }}</span></p>
</div>
</div>
<div>
<div class="table time-opo">
<p><span>{{ _('Job estimated time') }}:</span></p>
<p><span class="total-estimated-time"></span></p>
</div>
</div>
</div>
</header>
<main>
<figure class="inksimulation operator" data-field-name="operator-overview-transform" title="{{ _('Ctrl + Scroll to Zoom') }}">
{{ svg_overview|replace("<li>", "")|replace("</li>", "")|safe }}
{% with %}
{% set realistic_id='realistic-operator-overview' %}
{% include 'ui_svg_action_buttons.html' with context %}
{% endwith %}
</figure>
</main>
{% include 'footer.html' %}

View File

@ -0,0 +1,30 @@
<header>
{% include 'headline.html' %}
<div class="job-details">
<div>
<div class="table">
<p><span>{{ _('COLOR') }}:</span><span data-field-name="color-{{ color_block.color.hex_digits }}" contenteditable="true" data-placeholder="{{ _('Enter thread name...') }}">{{ color_block.color.thread_name }}</span></p>
</div>
</div>
<div>
<div class="table time-cld">
<p><span>{{ _('Estimated time') }}:</span></p>
<p><span class="cld-estimated-time"></span></p>
</div>
</div>
</div>
</header>
<main>
<figure class="inksimulation" data-field-name="client-detail-transform-block{{ loop.index0 }}" title="{{ _('Ctrl + Scroll to Zoom') }}">
{{color_block.svg_preview|replace("<li>", "")|replace("</li>", "")|safe}}
{% with %}
{% set loop_index=loop.index0 %}
{% include 'ui_svg_action_buttons.html' with context %}
{% endwith %}
</figure>
<div class="color-palette detailed">
{% include 'color_swatch.html' %}
</div>
</main>
{% include 'footer.html' %}

View File

@ -0,0 +1,45 @@
<header>
{% include 'headline.html' %}
<div class="job-details">
<div>
<div class="table">
<p><span>{{ _('Unique Colors') }}:</span><span>{{ job.num_colors }}</span></p>
<p><span>{{ _('Color Blocks') }}:</span><span>{{ job.num_color_blocks }}</span></p>
<p><span>{{ _('Total stops') }}:</span><span>{{ job.num_stops }}</span></p>
<p><span>{{ _('Total trims') }}:</span><span>{{ job.num_trims }}</span></p>
</div>
</div>
<div>
<div class="table">
<p><span>{{ _('Design box size') }}:</span><span>{{ "%0.1fmm X %0.1fmm" | format(*job.dimensions) }}</span></p>
<p><span>{{ _('Total stitch count') }}:</span><span>{{job.num_stitches }}</span></p>
<p><span>{{ _('Total thread used') }}:</span><span>{{job.estimated_thread }}</span></p>
</div>
</div>
<div>
<div class="table time-clo">
<p><span>{{ _('Job estimated time') }}:</span></p>
<p><span class="total-estimated-time"></span></p>
</div>
</div>
</div>
</header>
<main class="client-overview-main">
<figure class="inksimulation" data-field-name="client-overview-transform" title="{{ _('Ctrl + Scroll to Zoom') }}">
{{ svg_overview|replace("<li>", "")|replace("</li>", "")|safe }}
{% with %}
{% set realistic_id='realistic-client-overview' %}
{% include 'ui_svg_action_buttons.html' with context %}
{% endwith %}
</figure>
<div class="color-palette">
{% for color_block in color_blocks %}
{% include 'color_swatch.html' %}
{% endfor %}
</div>
<div class="signature">{{ _('Client Signature') }}</div>
</main>
{% include 'footer.html' %}

View File

@ -0,0 +1,172 @@
<div class="ui">
<p class="header">{{ _('Ink/Stitch Print Preview') }}</p>
<div class="buttons">
<button class="print">{{ _('Print') }}</button>
<button class="save-pdf">{{ _('Save PDF') }}</button>
<button class="settings">{{ _('Settings') }}</button>
<button class="close">{{ _('Close') }}</button>
</div>
<div id="errors">
{{ _('⚠ lost connection to Ink/Stitch') }}
</div>
</div>
<div id="settings-ui">
<p id="close-settings">X</p>
<h1>{{ _('Settings') }}</h1>
<div id="tabs">
<button class="tab active">{{ _('Page Setup') }}</button>
<button class="tab" id="branding-tab">{{ _('Branding') }}</button>
<button class="tab">{{ _('Estimated Time') }}</button>
<button class="tab">{{ _('Design') }}</button>
</div>
<div id="fieldsets-ui">
<fieldset id="ui-page-setup">
<fieldset>
<legend>{{ _('Page Setup') }}</legend>
<p class="select-container">
<label for="printing-size">{{ _('Printing Size') }}:</label>
<select id="printing-size" data-field-name="paper-size">
<option value="letter" selected="selected">Letter</option>
<option value="a4">A4</option>
</select>
</p>
</fieldset>
<fieldset>
<legend>{{ _('Print Layouts') }}</legend>
<p>
<input type="checkbox" class="view" id="client-overview" data-field-name="client-overview" />
<label for="client-overview">{{ _('Client Overview') }}</label>
</p>
<p>
<input type="checkbox" class="view" id="client-detailedview" data-field-name="client-detailedview" />
<label for="client-detailedview">{{ _('Client Detailed View') }}</label>
</p>
<p>
<input type="checkbox" class="view" id="operator-overview" data-field-name="operator-overview" CHECKED />
<label for="operator-overview">{{ _('Operator Overview') }}</label>
</p>
<p>
<input type="checkbox" class="view" id="operator-detailedview" data-field-name="operator-detailedview" CHECKED />
<label for="operator-detailedview">{{ _('Operator Detailed View') }}</label>
</p>
<p style="text-indent: 1.5em;">{{ _('Thumbnail size') }}:
<input type="range" min="15" max="110" value="15" step="5" id="operator-detailedview-thumbnail-size" data-field-name="operator-detailedview-thumbnail-size" style="vertical-align: middle;" />
<span id="display-thumbnail-size">15mm</span>
</p>
<p>
<input type="checkbox" class="view" id="custom-page" data-field-name="custom-page" />
<label for="custom-page">{{ _('Custom information sheet') }}</label>
</p>
</fieldset>
<button class="save-settings" title="{{ _("Includes these Page Setup, estimated time settings and also the icon.") }}">{{ _("Save as defaults") }}</button>
</fieldset>
<fieldset id="ui-branding" class="ui-tab">
<fieldset>
<legend>{{ _('Logo') }}</legend>
<figure class="brandlogo brandlogo-ui">
<label class="logo-legend">
{{ ('Choose File') }}
<img src="{{ logo.src or "resources/inkstitch-logo.svg" }}" alt="{{ logo.title }}" title="{{ logo.title }}" data-field-name="logo" class="logo-ui">
<input type=file class="logo-picker" />
</label>
</figure>
</fieldset>
<fieldset id="edit-footer">
<legend>{{ _('Footer: Operator contact information') }}</legend>
<div id="tool-bar" class="tool-bar">
<button id="tb-bold" class="tb-button tb-bold ff-serif edit-only" title="Bold"><b>B</b></button>
<button id="tb-italic" class="tb-button tb-italic ff-serif edit-only" title="Italic"><i>I</i></button>
<button id="tb-underline" class="tb-button tb-underline ff-serif edit-only" title="Underline"><u>U</u></button>
<button id="tb-remove" class="tb-button tb-remove ff-serif edit-only" title="Remove formatting"><u style="vertical-align: super; font-size: 60%;">A</u><span style="vertical-align: sub; font-size: 80%;">A</span></button>
<button id="tb-hyperlink" class="tb-button tb-hyperlink edit-only" title="Hyperlink"></button>
<button id="tb-mail" class="tb-button tb-mail edit-only" title="E-Mail"></button>
<button id="tb-reset" class="tb-button tb-reset" title="Reset text"></button>
<p id="edit-mode" class="edit-mode"><input type="checkbox" id="switch-mode" class="switch-mode" name="switch-mode" /> <label for="switch-mode">{{ ('Show HTML') }}</label></p>
<div id="footer-url" class="tb-popup url-window">
<p>{{ _("Enter URL") }}: <input type="text" id="footer-link" class="user-url" name="footer-link" value="https://" /></p>
<p><button id="url-ok" class="url-ok">{{ _("OK") }}</button> <button id="url-cancel" class="url-cancel">{{ _("Cancel") }}</button></p>
</div>
<div id="footer-email" class="tb-popup mail-window">
<p>{{ _("Enter E-Mail") }}: <input type="text" id="footer-mail" class="user-mail" name="footer-mail" value="@" /></p>
<p><button id="mail-ok" class="mail-ok">{{ _("OK") }}</button> <button id="mail-cancel" class="mail-cancel">{{ _("Cancel") }}</button></p>
</div>
<div id="footer-info-original" class="original-info">{{ _("Proudly generated with") }} <a href="http://inkstitch.org/" target="_blank">Ink/Stitch</a></div>
<div id="footer-reset" class="tb-popup reset-window">
<p>{{ _("This will reset your custom text to the default.") }}</p>
<p>{{ _("All changes will be lost.") }}</p>
<p><button id="reset-ok" class="reset-ok">{{ _("OK") }}</button> <button id="reset-cancel" class="reset-cancel">{{ _("Cancel") }}</button></p>
</div>
</div>
<div id="footer-info-text" class="info-text" contenteditable="true"><div>{{ _("Proudly generated with") }} <a href="http://inkstitch.org/" target="_blank">Ink/Stitch</a></div></div>
<p class="notice--warning"><b>Note</b>: If you are using Firefox, use visible URLs. Links will not be printed to PDF with this browser.</p>
</fieldset>
<button class="save-settings" title="{{ _('Includes these Page Setup, estimated time settings and also the icon.') }}">{{ _("Save as defaults") }}</button>
</fieldset>
<fieldset id="ui-time" class="ui-tab">
<legend>{{ _('Estimated Time') }}</legend>
<fieldset>
<legend>{{ _('Machine Settings') }}</legend>
<p>
<input class="view" type="number" id="machine-speed" data-field-name="machine-speed" min="0" value="700" title="{{ _('Average Machine Speed') }}" />
<label for="machine-speed">{{ _('stitches per minute ') }}</label>
</p>
</fieldset>
<fieldset>
<legend>{{ _('Time Factors') }}</legend>
<p>
<input type="number" id="time-additional" data-field-name="time-additional" min="0" value="0" />
<label for="time-additional" title="{{ _('Includes average time for preparing the machine, thread breaks and/or bobbin changes, etc.') }}">{{ _('seconds to add to total time*') }}</label>
</p>
<p>
<input type="number" id="time-color-change" data-field-name="time-color-change" min="0" value="10" />
<label for="time-color-change" title="{{ _('This will be added to the total time.') }}">{{ _('seconds needed for a color change*') }}</label></p>
<p>
<input type="number" id="time-trims" data-field-name="time-trims" min="0" value="10" />
<label for="time-trims">{{ _('seconds needed for trim') }}</label></p>
</fieldset>
<fieldset>
<legend>{{ _('Display Time On') }}</legend>
<div>
<p><input type="checkbox" class="time-display" id="time-clo" data-field-name="time-clo" /><label for="time-clo">{{ _('Client Overview') }}</label></p>
<p><input type="checkbox" class="time-display" id="time-cld" data-field-name="time-cld" /><label for="time-cld">{{ _('Client Detailed View') }}</label></p>
<p><input type="checkbox" class="time-display" id="time-opo" data-field-name="time-opo" CHECKED /><label for="time-opo">{{ _('Operator Overview') }}</label></p>
<p><input type="checkbox" class="time-display" id="time-opd" data-field-name="time-opd" CHECKED /><label for="time-opd">{{ _('Operator Detailed View') }}</label></p>
</div>
</fieldset>
<button class="save-settings" title="{{ _('Includes page setup, estimated time and also the branding.') }}">{{ _("Save as defaults") }}</button>
</fieldset>
<fieldset id="ui-design" class="ui-tab">
<legend>{{ _('Design') }}</legend>
<p class="select-container"><label for="thread-palette">{{ _('Thread Palette') }}:</label>
<select id="thread-palette" data-field-name="thread-palette">
{% if selected_palette is none %}
<option value="" selected>{{ _('None') }}</option>
{% endif %}
{% for palette in palettes %}
<option value="{{ palette }}" {{ "selected" if palette == selected_palette.name else "" }}>{{ palette }}</option>
{% endfor %}
</select>
</p>
</fieldset>
</div><!-- END FIELDSETS-UI -->
</div><!-- END SETTINGS-UI-->
<div id="modal-background" class="modal"></div>
<div id="modal-content" class="modal">
<p>
{{ _("Changing the thread palette will cause thread names and catalog numbers to be recalculated based on the new palette. Any changes you have made to color or thread names will be lost. Are you sure?") }}
</p>
<p>
<button id="modal-yes">{{ _("Yes") }}</button>
<button id="modal-no">{{ _("No") }}</button>
</p>
</div>

View File

@ -0,0 +1,15 @@
<figcaption>{{ _('Scale') }} <span class="scale" data-field-name="svg-scale" contenteditable="true" data-placeholder=""></span>%</figcaption>
<div>
<button class="svg-fit">{{ _('Fit') }}</button>
<button class="svg-full">100%</button>
<button class="svg-apply">{{ _('Apply to all') }}</button>
<button class="svg-realistic">
{% if loop_index is defined %}
<input type="checkbox" id="realistic-color-block-{{ loop_index }}" data-field-name="block{{ loop_index }}" class="realistic" />
<label for="realistic-color-block-{{ loop_index }}" class="realistic">{{ _('Realistic') }}</label>
{% else %}
<input type="checkbox" id="{{ realistic_id }}" data-field-name="overview" class="realistic" />
<label for="{{ realistic_id }}" class="realistic">{{ _('Realistic') }}</label>
{% endif %}
</button>
</div>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,618 @@
# auto.tcl --
#
# utility procs formerly in init.tcl dealing with auto execution
# of commands and can be auto loaded themselves.
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994-1998 Sun Microsystems, Inc.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# auto_reset --
#
# Destroy all cached information for auto-loading and auto-execution,
# so that the information gets recomputed the next time it's needed.
# Also delete any commands that are listed in the auto-load index.
#
# Arguments:
# None.
proc auto_reset {} {
global auto_execs auto_index auto_path
if {[array exists auto_index]} {
foreach cmdName [array names auto_index] {
set fqcn [namespace which $cmdName]
if {$fqcn eq ""} {continue}
rename $fqcn {}
}
}
unset -nocomplain auto_execs auto_index ::tcl::auto_oldpath
if {[catch {llength $auto_path}]} {
set auto_path [list [info library]]
} else {
if {[info library] ni $auto_path} {
lappend auto_path [info library]
}
}
}
# tcl_findLibrary --
#
# This is a utility for extensions that searches for a library directory
# using a canonical searching algorithm. A side effect is to source
# the initialization script and set a global library variable.
#
# Arguments:
# basename Prefix of the directory name, (e.g., "tk")
# version Version number of the package, (e.g., "8.0")
# patch Patchlevel of the package, (e.g., "8.0.3")
# initScript Initialization script to source (e.g., tk.tcl)
# enVarName environment variable to honor (e.g., TK_LIBRARY)
# varName Global variable to set when done (e.g., tk_library)
proc tcl_findLibrary {basename version patch initScript enVarName varName} {
upvar #0 $varName the_library
global auto_path env tcl_platform
set dirs {}
set errors {}
# The C application may have hardwired a path, which we honor
if {[info exists the_library] && $the_library ne ""} {
lappend dirs $the_library
} else {
# Do the canonical search
# 1. From an environment variable, if it exists.
# Placing this first gives the end-user ultimate control
# to work-around any bugs, or to customize.
if {[info exists env($enVarName)]} {
lappend dirs $env($enVarName)
}
# 2. In the package script directory registered within
# the configuration of the package itself.
if {[catch {
::${basename}::pkgconfig get scriptdir,runtime
} value] == 0} {
lappend dirs $value
}
# 3. Relative to auto_path directories. This checks relative to the
# Tcl library as well as allowing loading of libraries added to the
# auto_path that is not relative to the core library or binary paths.
foreach d $auto_path {
lappend dirs [file join $d $basename$version]
if {$tcl_platform(platform) eq "unix"
&& $tcl_platform(os) eq "Darwin"} {
# 4. On MacOSX, check the Resources/Scripts subdir too
lappend dirs [file join $d $basename$version Resources Scripts]
}
}
# 3. Various locations relative to the executable
# ../lib/foo1.0 (From bin directory in install hierarchy)
# ../../lib/foo1.0 (From bin/arch directory in install hierarchy)
# ../library (From unix directory in build hierarchy)
#
# Remaining locations are out of date (when relevant, they ought
# to be covered by the $::auto_path seach above) and disabled.
#
# ../../library (From unix/arch directory in build hierarchy)
# ../../foo1.0.1/library
# (From unix directory in parallel build hierarchy)
# ../../../foo1.0.1/library
# (From unix/arch directory in parallel build hierarchy)
set parentDir [file dirname [file dirname [info nameofexecutable]]]
set grandParentDir [file dirname $parentDir]
lappend dirs [file join $parentDir lib $basename$version]
lappend dirs [file join $grandParentDir lib $basename$version]
lappend dirs [file join $parentDir library]
if {0} {
lappend dirs [file join $grandParentDir library]
lappend dirs [file join $grandParentDir $basename$patch library]
lappend dirs [file join [file dirname $grandParentDir] \
$basename$patch library]
}
}
# uniquify $dirs in order
array set seen {}
foreach i $dirs {
# Take note that the [file normalize] below has been noted to
# cause difficulties for the freewrap utility. See Bug 1072136.
# Until freewrap resolves the matter, one might work around the
# problem by disabling that branch.
if {[interp issafe]} {
set norm $i
} else {
set norm [file normalize $i]
}
if {[info exists seen($norm)]} { continue }
set seen($norm) ""
lappend uniqdirs $i
}
set dirs $uniqdirs
foreach i $dirs {
set the_library $i
set file [file join $i $initScript]
# source everything when in a safe interpreter because
# we have a source command, but no file exists command
if {[interp issafe] || [file exists $file]} {
if {![catch {uplevel #0 [list source $file]} msg opts]} {
return
} else {
append errors "$file: $msg\n"
append errors [dict get $opts -errorinfo]\n
}
}
}
unset -nocomplain the_library
set msg "Can't find a usable $initScript in the following directories: \n"
append msg " $dirs\n\n"
append msg "$errors\n\n"
append msg "This probably means that $basename wasn't installed properly.\n"
error $msg
}
# ----------------------------------------------------------------------
# auto_mkindex
# ----------------------------------------------------------------------
# The following procedures are used to generate the tclIndex file
# from Tcl source files. They use a special safe interpreter to
# parse Tcl source files, writing out index entries as "proc"
# commands are encountered. This implementation won't work in a
# safe interpreter, since a safe interpreter can't create the
# special parser and mess with its commands.
if {[interp issafe]} {
return ;# Stop sourcing the file here
}
# auto_mkindex --
# Regenerate a tclIndex file from Tcl source files. Takes as argument
# the name of the directory in which the tclIndex file is to be placed,
# followed by any number of glob patterns to use in that directory to
# locate all of the relevant files.
#
# Arguments:
# dir - Name of the directory in which to create an index.
# args - Any number of additional arguments giving the
# names of files within dir. If no additional
# are given auto_mkindex will look for *.tcl.
proc auto_mkindex {dir args} {
if {[interp issafe]} {
error "can't generate index within safe interpreter"
}
set oldDir [pwd]
cd $dir
set dir [pwd]
append index "# Tcl autoload index file, version 2.0\n"
append index "# This file is generated by the \"auto_mkindex\" command\n"
append index "# and sourced to set up indexing information for one or\n"
append index "# more commands. Typically each line is a command that\n"
append index "# sets an element in the auto_index array, where the\n"
append index "# element name is the name of a command and the value is\n"
append index "# a script that loads the command.\n\n"
if {[llength $args] == 0} {
set args *.tcl
}
auto_mkindex_parser::init
foreach file [glob -- {*}$args] {
if {[catch {auto_mkindex_parser::mkindex $file} msg opts] == 0} {
append index $msg
} else {
cd $oldDir
return -options $opts $msg
}
}
auto_mkindex_parser::cleanup
set fid [open "tclIndex" w]
puts -nonewline $fid $index
close $fid
cd $oldDir
}
# Original version of auto_mkindex that just searches the source
# code for "proc" at the beginning of the line.
proc auto_mkindex_old {dir args} {
set oldDir [pwd]
cd $dir
set dir [pwd]
append index "# Tcl autoload index file, version 2.0\n"
append index "# This file is generated by the \"auto_mkindex\" command\n"
append index "# and sourced to set up indexing information for one or\n"
append index "# more commands. Typically each line is a command that\n"
append index "# sets an element in the auto_index array, where the\n"
append index "# element name is the name of a command and the value is\n"
append index "# a script that loads the command.\n\n"
if {[llength $args] == 0} {
set args *.tcl
}
foreach file [glob -- {*}$args] {
set f ""
set error [catch {
set f [open $file]
while {[gets $f line] >= 0} {
if {[regexp {^proc[ ]+([^ ]*)} $line match procName]} {
set procName [lindex [auto_qualify $procName "::"] 0]
append index "set [list auto_index($procName)]"
append index " \[list source \[file join \$dir [list $file]\]\]\n"
}
}
close $f
} msg opts]
if {$error} {
catch {close $f}
cd $oldDir
return -options $opts $msg
}
}
set f ""
set error [catch {
set f [open tclIndex w]
puts -nonewline $f $index
close $f
cd $oldDir
} msg opts]
if {$error} {
catch {close $f}
cd $oldDir
error $msg $info $code
return -options $opts $msg
}
}
# Create a safe interpreter that can be used to parse Tcl source files
# generate a tclIndex file for autoloading. This interp contains
# commands for things that need index entries. Each time a command
# is executed, it writes an entry out to the index file.
namespace eval auto_mkindex_parser {
variable parser "" ;# parser used to build index
variable index "" ;# maintains index as it is built
variable scriptFile "" ;# name of file being processed
variable contextStack "" ;# stack of namespace scopes
variable imports "" ;# keeps track of all imported cmds
variable initCommands ;# list of commands that create aliases
if {![info exists initCommands]} {
set initCommands [list]
}
proc init {} {
variable parser
variable initCommands
if {![interp issafe]} {
set parser [interp create -safe]
$parser hide info
$parser hide rename
$parser hide proc
$parser hide namespace
$parser hide eval
$parser hide puts
$parser invokehidden namespace delete ::
$parser invokehidden proc unknown {args} {}
# We'll need access to the "namespace" command within the
# interp. Put it back, but move it out of the way.
$parser expose namespace
$parser invokehidden rename namespace _%@namespace
$parser expose eval
$parser invokehidden rename eval _%@eval
# Install all the registered psuedo-command implementations
foreach cmd $initCommands {
eval $cmd
}
}
}
proc cleanup {} {
variable parser
interp delete $parser
unset parser
}
}
# auto_mkindex_parser::mkindex --
#
# Used by the "auto_mkindex" command to create a "tclIndex" file for
# the given Tcl source file. Executes the commands in the file, and
# handles things like the "proc" command by adding an entry for the
# index file. Returns a string that represents the index file.
#
# Arguments:
# file Name of Tcl source file to be indexed.
proc auto_mkindex_parser::mkindex {file} {
variable parser
variable index
variable scriptFile
variable contextStack
variable imports
set scriptFile $file
set fid [open $file]
set contents [read $fid]
close $fid
# There is one problem with sourcing files into the safe
# interpreter: references like "$x" will fail since code is not
# really being executed and variables do not really exist.
# To avoid this, we replace all $ with \0 (literally, the null char)
# later, when getting proc names we will have to reverse this replacement,
# in case there were any $ in the proc name. This will cause a problem
# if somebody actually tries to have a \0 in their proc name. Too bad
# for them.
set contents [string map [list \$ \0] $contents]
set index ""
set contextStack ""
set imports ""
$parser eval $contents
foreach name $imports {
catch {$parser eval [list _%@namespace forget $name]}
}
return $index
}
# auto_mkindex_parser::hook command
#
# Registers a Tcl command to evaluate when initializing the
# slave interpreter used by the mkindex parser.
# The command is evaluated in the master interpreter, and can
# use the variable auto_mkindex_parser::parser to get to the slave
proc auto_mkindex_parser::hook {cmd} {
variable initCommands
lappend initCommands $cmd
}
# auto_mkindex_parser::slavehook command
#
# Registers a Tcl command to evaluate when initializing the
# slave interpreter used by the mkindex parser.
# The command is evaluated in the slave interpreter.
proc auto_mkindex_parser::slavehook {cmd} {
variable initCommands
# The $parser variable is defined to be the name of the
# slave interpreter when this command is used later.
lappend initCommands "\$parser eval [list $cmd]"
}
# auto_mkindex_parser::command --
#
# Registers a new command with the "auto_mkindex_parser" interpreter
# that parses Tcl files. These commands are fake versions of things
# like the "proc" command. When you execute them, they simply write
# out an entry to a "tclIndex" file for auto-loading.
#
# This procedure allows extensions to register their own commands
# with the auto_mkindex facility. For example, a package like
# [incr Tcl] might register a "class" command so that class definitions
# could be added to a "tclIndex" file for auto-loading.
#
# Arguments:
# name Name of command recognized in Tcl files.
# arglist Argument list for command.
# body Implementation of command to handle indexing.
proc auto_mkindex_parser::command {name arglist body} {
hook [list auto_mkindex_parser::commandInit $name $arglist $body]
}
# auto_mkindex_parser::commandInit --
#
# This does the actual work set up by auto_mkindex_parser::command
# This is called when the interpreter used by the parser is created.
#
# Arguments:
# name Name of command recognized in Tcl files.
# arglist Argument list for command.
# body Implementation of command to handle indexing.
proc auto_mkindex_parser::commandInit {name arglist body} {
variable parser
set ns [namespace qualifiers $name]
set tail [namespace tail $name]
if {$ns eq ""} {
set fakeName [namespace current]::_%@fake_$tail
} else {
set fakeName [namespace current]::[string map {:: _} _%@fake_$name]
}
proc $fakeName $arglist $body
# YUK! Tcl won't let us alias fully qualified command names,
# so we can't handle names like "::itcl::class". Instead,
# we have to build procs with the fully qualified names, and
# have the procs point to the aliases.
if {[string match *::* $name]} {
set exportCmd [list _%@namespace export [namespace tail $name]]
$parser eval [list _%@namespace eval $ns $exportCmd]
# The following proc definition does not work if you
# want to tolerate space or something else diabolical
# in the procedure name, (i.e., space in $alias)
# The following does not work:
# "_%@eval {$alias} \$args"
# because $alias gets concat'ed to $args.
# The following does not work because $cmd is somehow undefined
# "set cmd {$alias} \; _%@eval {\$cmd} \$args"
# A gold star to someone that can make test
# autoMkindex-3.3 work properly
set alias [namespace tail $fakeName]
$parser invokehidden proc $name {args} "_%@eval {$alias} \$args"
$parser alias $alias $fakeName
} else {
$parser alias $name $fakeName
}
return
}
# auto_mkindex_parser::fullname --
# Used by commands like "proc" within the auto_mkindex parser.
# Returns the qualified namespace name for the "name" argument.
# If the "name" does not start with "::", elements are added from
# the current namespace stack to produce a qualified name. Then,
# the name is examined to see whether or not it should really be
# qualified. If the name has more than the leading "::", it is
# returned as a fully qualified name. Otherwise, it is returned
# as a simple name. That way, the Tcl autoloader will recognize
# it properly.
#
# Arguments:
# name - Name that is being added to index.
proc auto_mkindex_parser::fullname {name} {
variable contextStack
if {![string match ::* $name]} {
foreach ns $contextStack {
set name "${ns}::$name"
if {[string match ::* $name]} {
break
}
}
}
if {[namespace qualifiers $name] eq ""} {
set name [namespace tail $name]
} elseif {![string match ::* $name]} {
set name "::$name"
}
# Earlier, mkindex replaced all $'s with \0. Now, we have to reverse
# that replacement.
return [string map [list \0 \$] $name]
}
if {[llength $::auto_mkindex_parser::initCommands]} {
return
}
# Register all of the procedures for the auto_mkindex parser that
# will build the "tclIndex" file.
# AUTO MKINDEX: proc name arglist body
# Adds an entry to the auto index list for the given procedure name.
auto_mkindex_parser::command proc {name args} {
variable index
variable scriptFile
# Do some fancy reformatting on the "source" call to handle platform
# differences with respect to pathnames. Use format just so that the
# command is a little easier to read (otherwise it'd be full of
# backslashed dollar signs, etc.
append index [list set auto_index([fullname $name])] \
[format { [list source [file join $dir %s]]} \
[file split $scriptFile]] "\n"
}
# Conditionally add support for Tcl byte code files. There are some
# tricky details here. First, we need to get the tbcload library
# initialized in the current interpreter. We cannot load tbcload into the
# slave until we have done so because it needs access to the tcl_patchLevel
# variable. Second, because the package index file may defer loading the
# library until we invoke a command, we need to explicitly invoke auto_load
# to force it to be loaded. This should be a noop if the package has
# already been loaded
auto_mkindex_parser::hook {
if {![catch {package require tbcload}]} {
if {[namespace which -command tbcload::bcproc] eq ""} {
auto_load tbcload::bcproc
}
load {} tbcload $auto_mkindex_parser::parser
# AUTO MKINDEX: tbcload::bcproc name arglist body
# Adds an entry to the auto index list for the given pre-compiled
# procedure name.
auto_mkindex_parser::commandInit tbcload::bcproc {name args} {
variable index
variable scriptFile
# Do some nice reformatting of the "source" call, to get around
# path differences on different platforms. We use the format
# command just so that the code is a little easier to read.
append index [list set auto_index([fullname $name])] \
[format { [list source [file join $dir %s]]} \
[file split $scriptFile]] "\n"
}
}
}
# AUTO MKINDEX: namespace eval name command ?arg arg...?
# Adds the namespace name onto the context stack and evaluates the
# associated body of commands.
#
# AUTO MKINDEX: namespace import ?-force? pattern ?pattern...?
# Performs the "import" action in the parser interpreter. This is
# important for any commands contained in a namespace that affect
# the index. For example, a script may say "itcl::class ...",
# or it may import "itcl::*" and then say "class ...". This
# procedure does the import operation, but keeps track of imported
# patterns so we can remove the imports later.
auto_mkindex_parser::command namespace {op args} {
switch -- $op {
eval {
variable parser
variable contextStack
set name [lindex $args 0]
set args [lrange $args 1 end]
set contextStack [linsert $contextStack 0 $name]
$parser eval [list _%@namespace eval $name] $args
set contextStack [lrange $contextStack 1 end]
}
import {
variable parser
variable imports
foreach pattern $args {
if {$pattern ne "-force"} {
lappend imports $pattern
}
}
catch {$parser eval "_%@namespace import $args"}
}
ensemble {
variable parser
variable contextStack
if {[lindex $args 0] eq "create"} {
set name ::[join [lreverse $contextStack] ::]
# create artifical proc to force an entry in the tclIndex
$parser eval [list ::proc $name {} {}]
}
}
}
}
return

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
# Encoding file: ascii, single-byte
S
003F 0 1
00
0000000100020003000400050006000700080009000A000B000C000D000E000F
0010001100120013001400150016001700180019001A001B001C001D001E001F
0020002100220023002400250026002700280029002A002B002C002D002E002F
0030003100320033003400350036003700380039003A003B003C003D003E003F
0040004100420043004400450046004700480049004A004B004C004D004E004F
0050005100520053005400550056005700580059005A005B005C005D005E005F
0060006100620063006400650066006700680069006A006B006C006D006E006F
0070007100720073007400750076007700780079007A007B007C007D007E0000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000

Some files were not shown because too many files have changed in this diff Show More