From a3ba9a6feb9fae925288e36fcf5cbb38b4a044fd Mon Sep 17 00:00:00 2001 From: Samuel Gomes Date: Tue, 9 May 2023 02:23:53 +0530 Subject: [PATCH] Initial cleanup --- .clang-format | 166 - InForm/FreeTypeAmalgam.h | 10115 -------------------------- InForm/InForm.bi | 456 +- InForm/InForm.ui | 151 +- InForm/InFormVersion.bas | 13 +- InForm/UiEditor.bas | 5990 ++++++++------- InForm/UiEditorPreview.bas | 5446 +++++++------- InForm/extensions/download.bas | 124 +- InForm/extensions/gifplay.bi | 99 +- InForm/extensions/gifplay.bm | 38 +- InForm/extensions/gifplaySample.bas | 10 +- InForm/extensions/gifplaySample.frm | 1 + InForm/falcon.h | 254 - InForm/ini.bi | 31 +- InForm/ini.bm | 1386 ++-- InForm/vbdos2inform.bas | 28 +- LICENSE.md | 2 +- README.md | 8 +- makefile.inform | 53 +- setup_inform_lnx.sh | 27 +- setup_inform_osx.command | 58 +- setup_inform_win.cmd | 26 +- 22 files changed, 6908 insertions(+), 17574 deletions(-) delete mode 100644 .clang-format delete mode 100644 InForm/FreeTypeAmalgam.h delete mode 100644 InForm/falcon.h diff --git a/.clang-format b/.clang-format deleted file mode 100644 index 28f3375..0000000 --- a/.clang-format +++ /dev/null @@ -1,166 +0,0 @@ ---- -Language: Cpp -# BasedOnStyle: LLVM -AccessModifierOffset: -2 -AlignAfterOpenBracket: Align -AlignConsecutiveMacros: None -AlignConsecutiveAssignments: None -AlignConsecutiveBitFields: None -AlignConsecutiveDeclarations: None -AlignEscapedNewlines: Right -AlignOperands: Align -AlignTrailingComments: true -AllowAllArgumentsOnNextLine: true -AllowAllConstructorInitializersOnNextLine: true -AllowAllParametersOfDeclarationOnNextLine: true -AllowShortEnumsOnASingleLine: true -AllowShortBlocksOnASingleLine: Never -AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: All -AllowShortLambdasOnASingleLine: All -AllowShortIfStatementsOnASingleLine: Never -AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: MultiLine -AttributeMacros: - - __capability -BinPackArguments: true -BinPackParameters: true -BraceWrapping: - AfterCaseLabel: false - AfterClass: false - AfterControlStatement: Never - AfterEnum: false - AfterFunction: false - AfterNamespace: false - AfterObjCDeclaration: false - AfterStruct: false - AfterUnion: false - AfterExternBlock: false - BeforeCatch: false - BeforeElse: false - BeforeLambdaBody: false - BeforeWhile: false - IndentBraces: false - SplitEmptyFunction: true - SplitEmptyRecord: true - SplitEmptyNamespace: true -BreakBeforeBinaryOperators: None -BreakBeforeConceptDeclarations: true -BreakBeforeBraces: Attach -BreakBeforeInheritanceComma: false -BreakInheritanceList: BeforeColon -BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false -BreakConstructorInitializers: BeforeColon -BreakAfterJavaFieldAnnotations: false -BreakStringLiterals: true -ColumnLimit: 160 -CommentPragmas: '^ IWYU pragma:' -CompactNamespaces: false -ConstructorInitializerAllOnOneLineOrOnePerLine: false -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 4 -Cpp11BracedListStyle: true -DeriveLineEnding: true -DerivePointerAlignment: false -DisableFormat: false -EmptyLineBeforeAccessModifier: LogicalBlock -ExperimentalAutoDetectBinPacking: false -FixNamespaceComments: true -ForEachMacros: - - foreach - - Q_FOREACH - - BOOST_FOREACH -StatementAttributeLikeMacros: - - Q_EMIT -IncludeBlocks: Preserve -IncludeCategories: - - Regex: '^"(llvm|llvm-c|clang|clang-c)/' - Priority: 2 - SortPriority: 0 - CaseSensitive: false - - Regex: '^(<|"(gtest|gmock|isl|json)/)' - Priority: 3 - SortPriority: 0 - CaseSensitive: false - - Regex: '.*' - Priority: 1 - SortPriority: 0 - CaseSensitive: false -IncludeIsMainRegex: '(Test)?$' -IncludeIsMainSourceRegex: '' -IndentCaseLabels: false -IndentCaseBlocks: false -IndentGotoLabels: true -IndentPPDirectives: AfterHash -IndentExternBlock: AfterExternBlock -IndentRequires: false -IndentWidth: 4 -IndentWrappedFunctionNames: false -InsertTrailingCommas: None -JavaScriptQuotes: Leave -JavaScriptWrapImports: true -KeepEmptyLinesAtTheStartOfBlocks: true -MacroBlockBegin: '' -MacroBlockEnd: '' -MaxEmptyLinesToKeep: 1 -NamespaceIndentation: None -ObjCBinPackProtocolList: Auto -ObjCBlockIndentWidth: 2 -ObjCBreakBeforeNestedBlockParam: true -ObjCSpaceAfterProperty: false -ObjCSpaceBeforeProtocolList: true -PenaltyBreakAssignment: 2 -PenaltyBreakBeforeFirstCallParameter: 19 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakString: 1000 -PenaltyBreakTemplateDeclaration: 10 -PenaltyExcessCharacter: 1000000 -PenaltyReturnTypeOnItsOwnLine: 60 -PenaltyIndentedWhitespace: 0 -PointerAlignment: Right -ReflowComments: true -SortIncludes: true -SortJavaStaticImport: Before -SortUsingDeclarations: true -SpaceAfterCStyleCast: false -SpaceAfterLogicalNot: false -SpaceAfterTemplateKeyword: true -SpaceBeforeAssignmentOperators: true -SpaceBeforeCaseColon: false -SpaceBeforeCpp11BracedList: false -SpaceBeforeCtorInitializerColon: true -SpaceBeforeInheritanceColon: true -SpaceBeforeParens: ControlStatements -SpaceAroundPointerQualifiers: Default -SpaceBeforeRangeBasedForLoopColon: true -SpaceInEmptyBlock: false -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 1 -SpacesInAngles: false -SpacesInConditionalStatement: false -SpacesInContainerLiterals: true -SpacesInCStyleCastParentheses: false -SpacesInParentheses: false -SpacesInSquareBrackets: false -SpaceBeforeSquareBrackets: false -BitFieldColonSpacing: Both -Standard: Latest -StatementMacros: - - Q_UNUSED - - QT_REQUIRE_VERSION -TabWidth: 8 -UseCRLF: false -UseTab: Never -WhitespaceSensitiveMacros: - - STRINGIZE - - PP_STRINGIZE - - BOOST_PP_STRINGIZE - - NS_SWIFT_NAME - - CF_SWIFT_NAME -... - diff --git a/InForm/FreeTypeAmalgam.h b/InForm/FreeTypeAmalgam.h deleted file mode 100644 index dc7b141..0000000 --- a/InForm/FreeTypeAmalgam.h +++ /dev/null @@ -1,10115 +0,0 @@ -/***************************************************************************/ -/* */ -/* FreeTypeAmalgam.h */ -/* */ -/* Copyright 2003-2007, 2011 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - -#ifdef _MSC_VER -#pragma push_macro("_CRT_SECURE_NO_WARNINGS") -#ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS -#endif -#endif - - -/*** Start of inlined file: ft2build.h ***/ -/* */ -/* ft2build.h */ -/* */ -/* FreeType 2 build and setup macros. */ -/* (Generic version) */ -/* */ -/* Copyright 1996-2001, 2006 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - /*************************************************************************/ - /* */ - /* This file corresponds to the default `ft2build.h' file for */ - /* FreeType 2. It uses the `freetype' include root. */ - /* */ - /* Note that specific platforms might use a different configuration. */ - /* See builds/unix/ft2unix.h for an example. */ - /* */ - /*************************************************************************/ - -#ifndef __FT2_BUILD_GENERIC_H__ -#define __FT2_BUILD_GENERIC_H__ - - -/*** Start of inlined file: ftheader.h ***/ -/* */ -/* ftheader.h */ -/* */ -/* Build macros of the FreeType 2 library. */ -/* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - -#ifndef __FT_HEADER_H__ -#define __FT_HEADER_H__ - - /*@***********************************************************************/ - /* */ - /* */ - /* FT_BEGIN_HEADER */ - /* */ - /* */ - /* This macro is used in association with @FT_END_HEADER in header */ - /* files to ensure that the declarations within are properly */ - /* encapsulated in an `extern "C" { .. }' block when included from a */ - /* C++ compiler. */ - /* */ -#ifdef __cplusplus -#define FT_BEGIN_HEADER extern "C" { -#else -#define FT_BEGIN_HEADER /* nothing */ -#endif - - /*@***********************************************************************/ - /* */ - /* */ - /* FT_END_HEADER */ - /* */ - /* */ - /* This macro is used in association with @FT_BEGIN_HEADER in header */ - /* files to ensure that the declarations within are properly */ - /* encapsulated in an `extern "C" { .. }' block when included from a */ - /* C++ compiler. */ - /* */ -#ifdef __cplusplus -#define FT_END_HEADER } -#else -#define FT_END_HEADER /* nothing */ -#endif - - /*************************************************************************/ - /* */ - /* Aliases for the FreeType 2 public and configuration files. */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /*
*/ - /* header_file_macros */ - /* */ - /* */ - /* Header File Macros */ - /* */ - /* <Abstract> */ - /* Macro definitions used to #include specific header files. */ - /* */ - /* <Description> */ - /* The following macros are defined to the name of specific */ - /* FreeType~2 header files. They can be used directly in #include */ - /* statements as in: */ - /* */ - /* { */ - /* #include FT_FREETYPE_H */ - /* #include FT_MULTIPLE_MASTERS_H */ - /* #include FT_GLYPH_H */ - /* } */ - /* */ - /* There are several reasons why we are now using macros to name */ - /* public header files. The first one is that such macros are not */ - /* limited to the infamous 8.3~naming rule required by DOS (and */ - /* `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h'). */ - /* */ - /* The second reason is that it allows for more flexibility in the */ - /* way FreeType~2 is installed on a given system. */ - /* */ - /*************************************************************************/ - - /* configuration files */ - - /************************************************************************* - * - * @macro: - * FT_CONFIG_CONFIG_H - * - * @description: - * A macro used in #include statements to name the file containing - * FreeType~2 configuration data. - * - */ -#ifndef FT_CONFIG_CONFIG_H -#define FT_CONFIG_CONFIG_H <freetype/config/ftconfig.h> -#endif - - /************************************************************************* - * - * @macro: - * FT_CONFIG_STANDARD_LIBRARY_H - * - * @description: - * A macro used in #include statements to name the file containing - * FreeType~2 interface to the standard C library functions. - * - */ -#ifndef FT_CONFIG_STANDARD_LIBRARY_H -#define FT_CONFIG_STANDARD_LIBRARY_H <freetype/config/ftstdlib.h> -#endif - - /************************************************************************* - * - * @macro: - * FT_CONFIG_OPTIONS_H - * - * @description: - * A macro used in #include statements to name the file containing - * FreeType~2 project-specific configuration options. - * - */ -#ifndef FT_CONFIG_OPTIONS_H -#define FT_CONFIG_OPTIONS_H <freetype/config/ftoption.h> -#endif - - /************************************************************************* - * - * @macro: - * FT_CONFIG_MODULES_H - * - * @description: - * A macro used in #include statements to name the file containing the - * list of FreeType~2 modules that are statically linked to new library - * instances in @FT_Init_FreeType. - * - */ -#ifndef FT_CONFIG_MODULES_H -#define FT_CONFIG_MODULES_H <freetype/config/ftmodule.h> -#endif - - /* */ - - /* public headers */ - - /************************************************************************* - * - * @macro: - * FT_FREETYPE_H - * - * @description: - * A macro used in #include statements to name the file containing the - * base FreeType~2 API. - * - */ -#define FT_FREETYPE_H <freetype/freetype.h> - - /************************************************************************* - * - * @macro: - * FT_ERRORS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * list of FreeType~2 error codes (and messages). - * - * It is included by @FT_FREETYPE_H. - * - */ -#define FT_ERRORS_H <freetype/fterrors.h> - - /************************************************************************* - * - * @macro: - * FT_MODULE_ERRORS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * list of FreeType~2 module error offsets (and messages). - * - */ -#define FT_MODULE_ERRORS_H <freetype/ftmoderr.h> - - /************************************************************************* - * - * @macro: - * FT_SYSTEM_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 interface to low-level operations (i.e., memory management - * and stream i/o). - * - * It is included by @FT_FREETYPE_H. - * - */ -#define FT_SYSTEM_H <freetype/ftsystem.h> - - /************************************************************************* - * - * @macro: - * FT_IMAGE_H - * - * @description: - * A macro used in #include statements to name the file containing type - * definitions related to glyph images (i.e., bitmaps, outlines, - * scan-converter parameters). - * - * It is included by @FT_FREETYPE_H. - * - */ -#define FT_IMAGE_H <freetype/ftimage.h> - - /************************************************************************* - * - * @macro: - * FT_TYPES_H - * - * @description: - * A macro used in #include statements to name the file containing the - * basic data types defined by FreeType~2. - * - * It is included by @FT_FREETYPE_H. - * - */ -#define FT_TYPES_H <freetype/fttypes.h> - - /************************************************************************* - * - * @macro: - * FT_LIST_H - * - * @description: - * A macro used in #include statements to name the file containing the - * list management API of FreeType~2. - * - * (Most applications will never need to include this file.) - * - */ -#define FT_LIST_H <freetype/ftlist.h> - - /************************************************************************* - * - * @macro: - * FT_OUTLINE_H - * - * @description: - * A macro used in #include statements to name the file containing the - * scalable outline management API of FreeType~2. - * - */ -#define FT_OUTLINE_H <freetype/ftoutln.h> - - /************************************************************************* - * - * @macro: - * FT_SIZES_H - * - * @description: - * A macro used in #include statements to name the file containing the - * API which manages multiple @FT_Size objects per face. - * - */ -#define FT_SIZES_H <freetype/ftsizes.h> - - /************************************************************************* - * - * @macro: - * FT_MODULE_H - * - * @description: - * A macro used in #include statements to name the file containing the - * module management API of FreeType~2. - * - */ -#define FT_MODULE_H <freetype/ftmodapi.h> - - /************************************************************************* - * - * @macro: - * FT_RENDER_H - * - * @description: - * A macro used in #include statements to name the file containing the - * renderer module management API of FreeType~2. - * - */ -#define FT_RENDER_H <freetype/ftrender.h> - - /************************************************************************* - * - * @macro: - * FT_TYPE1_TABLES_H - * - * @description: - * A macro used in #include statements to name the file containing the - * types and API specific to the Type~1 format. - * - */ -#define FT_TYPE1_TABLES_H <freetype/t1tables.h> - - /************************************************************************* - * - * @macro: - * FT_TRUETYPE_IDS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * enumeration values which identify name strings, languages, encodings, - * etc. This file really contains a _large_ set of constant macro - * definitions, taken from the TrueType and OpenType specifications. - * - */ -#define FT_TRUETYPE_IDS_H <freetype/ttnameid.h> - - /************************************************************************* - * - * @macro: - * FT_TRUETYPE_TABLES_H - * - * @description: - * A macro used in #include statements to name the file containing the - * types and API specific to the TrueType (as well as OpenType) format. - * - */ -#define FT_TRUETYPE_TABLES_H <freetype/tttables.h> - - /************************************************************************* - * - * @macro: - * FT_TRUETYPE_TAGS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * definitions of TrueType four-byte `tags' which identify blocks in - * SFNT-based font formats (i.e., TrueType and OpenType). - * - */ -#define FT_TRUETYPE_TAGS_H <freetype/tttags.h> - - /************************************************************************* - * - * @macro: - * FT_BDF_H - * - * @description: - * A macro used in #include statements to name the file containing the - * definitions of an API which accesses BDF-specific strings from a - * face. - * - */ -#define FT_BDF_H <freetype/ftbdf.h> - - /************************************************************************* - * - * @macro: - * FT_CID_H - * - * @description: - * A macro used in #include statements to name the file containing the - * definitions of an API which access CID font information from a - * face. - * - */ -#define FT_CID_H <freetype/ftcid.h> - - /************************************************************************* - * - * @macro: - * FT_GZIP_H - * - * @description: - * A macro used in #include statements to name the file containing the - * definitions of an API which supports gzip-compressed files. - * - */ -#define FT_GZIP_H <freetype/ftgzip.h> - - /************************************************************************* - * - * @macro: - * FT_LZW_H - * - * @description: - * A macro used in #include statements to name the file containing the - * definitions of an API which supports LZW-compressed files. - * - */ -#define FT_LZW_H <freetype/ftlzw.h> - - /************************************************************************* - * - * @macro: - * FT_BZIP2_H - * - * @description: - * A macro used in #include statements to name the file containing the - * definitions of an API which supports bzip2-compressed files. - * - */ -#define FT_BZIP2_H <freetype/ftbzip2.h> - - /************************************************************************* - * - * @macro: - * FT_WINFONTS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * definitions of an API which supports Windows FNT files. - * - */ -#define FT_WINFONTS_H <freetype/ftwinfnt.h> - - /************************************************************************* - * - * @macro: - * FT_GLYPH_H - * - * @description: - * A macro used in #include statements to name the file containing the - * API of the optional glyph management component. - * - */ -#define FT_GLYPH_H <freetype/ftglyph.h> - - /************************************************************************* - * - * @macro: - * FT_BITMAP_H - * - * @description: - * A macro used in #include statements to name the file containing the - * API of the optional bitmap conversion component. - * - */ -#define FT_BITMAP_H <freetype/ftbitmap.h> - - /************************************************************************* - * - * @macro: - * FT_BBOX_H - * - * @description: - * A macro used in #include statements to name the file containing the - * API of the optional exact bounding box computation routines. - * - */ -#define FT_BBOX_H <freetype/ftbbox.h> - - /************************************************************************* - * - * @macro: - * FT_CACHE_H - * - * @description: - * A macro used in #include statements to name the file containing the - * API of the optional FreeType~2 cache sub-system. - * - */ -#define FT_CACHE_H <freetype/ftcache.h> - - /************************************************************************* - * - * @macro: - * FT_CACHE_IMAGE_H - * - * @description: - * A macro used in #include statements to name the file containing the - * `glyph image' API of the FreeType~2 cache sub-system. - * - * It is used to define a cache for @FT_Glyph elements. You can also - * use the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to - * store small glyph bitmaps, as it will use less memory. - * - * This macro is deprecated. Simply include @FT_CACHE_H to have all - * glyph image-related cache declarations. - * - */ -#define FT_CACHE_IMAGE_H FT_CACHE_H - - /************************************************************************* - * - * @macro: - * FT_CACHE_SMALL_BITMAPS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * `small bitmaps' API of the FreeType~2 cache sub-system. - * - * It is used to define a cache for small glyph bitmaps in a relatively - * memory-efficient way. You can also use the API defined in - * @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images, - * including scalable outlines. - * - * This macro is deprecated. Simply include @FT_CACHE_H to have all - * small bitmaps-related cache declarations. - * - */ -#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H - - /************************************************************************* - * - * @macro: - * FT_CACHE_CHARMAP_H - * - * @description: - * A macro used in #include statements to name the file containing the - * `charmap' API of the FreeType~2 cache sub-system. - * - * This macro is deprecated. Simply include @FT_CACHE_H to have all - * charmap-based cache declarations. - * - */ -#define FT_CACHE_CHARMAP_H FT_CACHE_H - - /************************************************************************* - * - * @macro: - * FT_MAC_H - * - * @description: - * A macro used in #include statements to name the file containing the - * Macintosh-specific FreeType~2 API. The latter is used to access - * fonts embedded in resource forks. - * - * This header file must be explicitly included by client applications - * compiled on the Mac (note that the base API still works though). - * - */ -#define FT_MAC_H <freetype/ftmac.h> - - /************************************************************************* - * - * @macro: - * FT_MULTIPLE_MASTERS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * optional multiple-masters management API of FreeType~2. - * - */ -#define FT_MULTIPLE_MASTERS_H <freetype/ftmm.h> - - /************************************************************************* - * - * @macro: - * FT_SFNT_NAMES_H - * - * @description: - * A macro used in #include statements to name the file containing the - * optional FreeType~2 API which accesses embedded `name' strings in - * SFNT-based font formats (i.e., TrueType and OpenType). - * - */ -#define FT_SFNT_NAMES_H <freetype/ftsnames.h> - - /************************************************************************* - * - * @macro: - * FT_OPENTYPE_VALIDATE_H - * - * @description: - * A macro used in #include statements to name the file containing the - * optional FreeType~2 API which validates OpenType tables (BASE, GDEF, - * GPOS, GSUB, JSTF). - * - */ -#define FT_OPENTYPE_VALIDATE_H <freetype/ftotval.h> - - /************************************************************************* - * - * @macro: - * FT_GX_VALIDATE_H - * - * @description: - * A macro used in #include statements to name the file containing the - * optional FreeType~2 API which validates TrueTypeGX/AAT tables (feat, - * mort, morx, bsln, just, kern, opbd, trak, prop). - * - */ -#define FT_GX_VALIDATE_H <freetype/ftgxval.h> - - /************************************************************************* - * - * @macro: - * FT_PFR_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which accesses PFR-specific data. - * - */ -#define FT_PFR_H <freetype/ftpfr.h> - - /************************************************************************* - * - * @macro: - * FT_STROKER_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which provides functions to stroke outline paths. - */ -#define FT_STROKER_H <freetype/ftstroke.h> - - /************************************************************************* - * - * @macro: - * FT_SYNTHESIS_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which performs artificial obliquing and emboldening. - */ -#define FT_SYNTHESIS_H <freetype/ftsynth.h> - - /************************************************************************* - * - * @macro: - * FT_XFREE86_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which provides functions specific to the XFree86 and - * X.Org X11 servers. - */ -#define FT_XFREE86_H <freetype/ftxf86.h> - - /************************************************************************* - * - * @macro: - * FT_TRIGONOMETRY_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which performs trigonometric computations (e.g., - * cosines and arc tangents). - */ -#define FT_TRIGONOMETRY_H <freetype/fttrigon.h> - - /************************************************************************* - * - * @macro: - * FT_LCD_FILTER_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which performs color filtering for subpixel rendering. - */ -#define FT_LCD_FILTER_H <freetype/ftlcdfil.h> - - /************************************************************************* - * - * @macro: - * FT_UNPATENTED_HINTING_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which performs color filtering for subpixel rendering. - */ -#define FT_UNPATENTED_HINTING_H <freetype/ttunpat.h> - - /************************************************************************* - * - * @macro: - * FT_INCREMENTAL_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which performs color filtering for subpixel rendering. - */ -#define FT_INCREMENTAL_H <freetype/ftincrem.h> - - /************************************************************************* - * - * @macro: - * FT_GASP_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which returns entries from the TrueType GASP table. - */ -#define FT_GASP_H <freetype/ftgasp.h> - - /************************************************************************* - * - * @macro: - * FT_ADVANCES_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which returns individual and ranged glyph advances. - */ -#define FT_ADVANCES_H <freetype/ftadvanc.h> - - /* */ - -#define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h> - - /* The internals of the cache sub-system are no longer exposed. We */ - /* default to FT_CACHE_H at the moment just in case, but we know of */ - /* no rogue client that uses them. */ - /* */ -#define FT_CACHE_MANAGER_H <freetype/ftcache.h> -#define FT_CACHE_INTERNAL_MRU_H <freetype/ftcache.h> -#define FT_CACHE_INTERNAL_MANAGER_H <freetype/ftcache.h> -#define FT_CACHE_INTERNAL_CACHE_H <freetype/ftcache.h> -#define FT_CACHE_INTERNAL_GLYPH_H <freetype/ftcache.h> -#define FT_CACHE_INTERNAL_IMAGE_H <freetype/ftcache.h> -#define FT_CACHE_INTERNAL_SBITS_H <freetype/ftcache.h> - -#define FT_INCREMENTAL_H <freetype/ftincrem.h> - -#define FT_TRUETYPE_UNPATENTED_H <freetype/ttunpat.h> - - /* - * Include internal headers definitions from <freetype/internal/...> - * only when building the library. - */ -#ifdef FT2_BUILD_LIBRARY -#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h> - -/*** Start of inlined file: internal.h ***/ -/* */ -/* internal.h */ -/* */ -/* Internal header files (specification only). */ -/* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - /*************************************************************************/ - /* */ - /* This file is automatically included by `ft2build.h'. */ - /* Do not include it manually! */ - /* */ - /*************************************************************************/ - -#define FT_INTERNAL_OBJECTS_H <freetype/internal/ftobjs.h> -#define FT_INTERNAL_PIC_H <freetype/internal/ftpic.h> -#define FT_INTERNAL_STREAM_H <freetype/internal/ftstream.h> -#define FT_INTERNAL_MEMORY_H <freetype/internal/ftmemory.h> -#define FT_INTERNAL_DEBUG_H <freetype/internal/ftdebug.h> -#define FT_INTERNAL_CALC_H <freetype/internal/ftcalc.h> -#define FT_INTERNAL_DRIVER_H <freetype/internal/ftdriver.h> -#define FT_INTERNAL_TRACE_H <freetype/internal/fttrace.h> -#define FT_INTERNAL_GLYPH_LOADER_H <freetype/internal/ftgloadr.h> -#define FT_INTERNAL_SFNT_H <freetype/internal/sfnt.h> -#define FT_INTERNAL_SERVICE_H <freetype/internal/ftserv.h> -#define FT_INTERNAL_RFORK_H <freetype/internal/ftrfork.h> -#define FT_INTERNAL_VALIDATE_H <freetype/internal/ftvalid.h> - -#define FT_INTERNAL_TRUETYPE_TYPES_H <freetype/internal/tttypes.h> -#define FT_INTERNAL_TYPE1_TYPES_H <freetype/internal/t1types.h> - -#define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h> -#define FT_INTERNAL_POSTSCRIPT_HINTS_H <freetype/internal/pshints.h> -#define FT_INTERNAL_POSTSCRIPT_GLOBALS_H <freetype/internal/psglobal.h> - -#define FT_INTERNAL_AUTOHINT_H <freetype/internal/autohint.h> - -/* END */ - -/*** End of inlined file: internal.h ***/ - - -#endif /* FT2_BUILD_LIBRARY */ - -#endif /* __FT2_BUILD_H__ */ - -/* END */ - -/*** End of inlined file: ftheader.h ***/ - -#endif /* __FT2_BUILD_GENERIC_H__ */ - -/* END */ - -/*** End of inlined file: ft2build.h ***/ - - -/*** Start of inlined file: freetype.h ***/ -/* */ -/* freetype.h */ -/* */ -/* FreeType high-level API and common types (specification only). */ -/* */ -/* Copyright 1996-2012 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - -#ifndef __FREETYPE_H__ -#define __FREETYPE_H__ - -#ifndef FT_FREETYPE_H -#error "`ft2build.h' hasn't been included yet!" -#error "Please always use macros to include FreeType header files." -#error "Example:" -#error " #include <ft2build.h>" -#error " #include FT_FREETYPE_H" -#endif - - -/*** Start of inlined file: ftconfig.h ***/ -/* */ -/* ftconfig.h */ -/* */ -/* ANSI-specific configuration file (specification only). */ -/* */ -/* Copyright 1996-2004, 2006-2008, 2010-2011 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - /*************************************************************************/ - /* */ - /* This header file contains a number of macro definitions that are used */ - /* by the rest of the engine. Most of the macros here are automatically */ - /* determined at compile time, and you should not need to change it to */ - /* port FreeType, except to compile the library with a non-ANSI */ - /* compiler. */ - /* */ - /* Note however that if some specific modifications are needed, we */ - /* advise you to place a modified copy in your build directory. */ - /* */ - /* The build directory is usually `freetype/builds/<system>', and */ - /* contains system-specific files that are always included first when */ - /* building the library. */ - /* */ - /* This ANSI version should stay in `include/freetype/config'. */ - /* */ - /*************************************************************************/ - -#ifndef __FTCONFIG_H__ -#define __FTCONFIG_H__ - - -/*** Start of inlined file: ftoption.h ***/ -/* */ -/* ftoption.h */ -/* */ -/* User-selectable configuration macros (specification only). */ -/* */ -/* Copyright 1996-2012 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - -#ifndef __FTOPTION_H__ -#define __FTOPTION_H__ - -FT_BEGIN_HEADER - - /*************************************************************************/ - /* */ - /* USER-SELECTABLE CONFIGURATION MACROS */ - /* */ - /* This file contains the default configuration macro definitions for */ - /* a standard build of the FreeType library. There are three ways to */ - /* use this file to build project-specific versions of the library: */ - /* */ - /* - You can modify this file by hand, but this is not recommended in */ - /* cases where you would like to build several versions of the */ - /* library from a single source directory. */ - /* */ - /* - You can put a copy of this file in your build directory, more */ - /* precisely in `$BUILD/freetype/config/ftoption.h', where `$BUILD' */ - /* is the name of a directory that is included _before_ the FreeType */ - /* include path during compilation. */ - /* */ - /* The default FreeType Makefiles and Jamfiles use the build */ - /* directory `builds/<system>' by default, but you can easily change */ - /* that for your own projects. */ - /* */ - /* - Copy the file <ft2build.h> to `$BUILD/ft2build.h' and modify it */ - /* slightly to pre-define the macro FT_CONFIG_OPTIONS_H used to */ - /* locate this file during the build. For example, */ - /* */ - /* #define FT_CONFIG_OPTIONS_H <myftoptions.h> */ - /* #include <freetype/config/ftheader.h> */ - /* */ - /* will use `$BUILD/myftoptions.h' instead of this file for macro */ - /* definitions. */ - /* */ - /* Note also that you can similarly pre-define the macro */ - /* FT_CONFIG_MODULES_H used to locate the file listing of the modules */ - /* that are statically linked to the library at compile time. By */ - /* default, this file is <freetype/config/ftmodule.h>. */ - /* */ - /* We highly recommend using the third method whenever possible. */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* Uncomment the line below if you want to activate sub-pixel rendering */ - /* (a.k.a. LCD rendering, or ClearType) in this build of the library. */ - /* */ - /* Note that this feature is covered by several Microsoft patents */ - /* and should not be activated in any default build of the library. */ - /* */ - /* This macro has no impact on the FreeType API, only on its */ - /* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */ - /* FT_Render_Glyph still generates a bitmap that is 3 times wider than */ - /* the original size in case this macro isn't defined; however, each */ - /* triplet of subpixels has R=G=B. */ - /* */ - /* This is done to allow FreeType clients to run unmodified, forcing */ - /* them to display normal gray-level anti-aliased glyphs. */ - /* */ -/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - - /*************************************************************************/ - /* */ - /* Many compilers provide a non-ANSI 64-bit data type that can be used */ - /* by FreeType to speed up some computations. However, this will create */ - /* some problems when compiling the library in strict ANSI mode. */ - /* */ - /* For this reason, the use of 64-bit integers is normally disabled when */ - /* the __STDC__ macro is defined. You can however disable this by */ - /* defining the macro FT_CONFIG_OPTION_FORCE_INT64 here. */ - /* */ - /* For most compilers, this will only create compilation warnings when */ - /* building the library. */ - /* */ - /* ObNote: The compiler-specific 64-bit integers are detected in the */ - /* file `ftconfig.h' either statically or through the */ - /* `configure' script on supported platforms. */ - /* */ -#undef FT_CONFIG_OPTION_FORCE_INT64 - - /*************************************************************************/ - /* */ - /* If this macro is defined, do not try to use an assembler version of */ - /* performance-critical functions (e.g. FT_MulFix). You should only do */ - /* that to verify that the assembler function works properly, or to */ - /* execute benchmark tests of the various implementations. */ -/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */ - - /*************************************************************************/ - /* */ - /* If this macro is defined, try to use an inlined assembler version of */ - /* the `FT_MulFix' function, which is a `hotspot' when loading and */ - /* hinting glyphs, and which should be executed as fast as possible. */ - /* */ - /* Note that if your compiler or CPU is not supported, this will default */ - /* to the standard and portable implementation found in `ftcalc.c'. */ - /* */ -#define FT_CONFIG_OPTION_INLINE_MULFIX - - /*************************************************************************/ - /* */ - /* LZW-compressed file support. */ - /* */ - /* FreeType now handles font files that have been compressed with the */ - /* `compress' program. This is mostly used to parse many of the PCF */ - /* files that come with various X11 distributions. The implementation */ - /* uses NetBSD's `zopen' to partially uncompress the file on the fly */ - /* (see src/lzw/ftgzip.c). */ - /* */ - /* Define this macro if you want to enable this `feature'. */ - /* */ -#define FT_CONFIG_OPTION_USE_LZW - - /*************************************************************************/ - /* */ - /* Gzip-compressed file support. */ - /* */ - /* FreeType now handles font files that have been compressed with the */ - /* `gzip' program. This is mostly used to parse many of the PCF files */ - /* that come with XFree86. The implementation uses `zlib' to */ - /* partially uncompress the file on the fly (see src/gzip/ftgzip.c). */ - /* */ - /* Define this macro if you want to enable this `feature'. See also */ - /* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */ - /* */ -#define FT_CONFIG_OPTION_USE_ZLIB - - /*************************************************************************/ - /* */ - /* ZLib library selection */ - /* */ - /* This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined. */ - /* It allows FreeType's `ftgzip' component to link to the system's */ - /* installation of the ZLib library. This is useful on systems like */ - /* Unix or VMS where it generally is already available. */ - /* */ - /* If you let it undefined, the component will use its own copy */ - /* of the zlib sources instead. These have been modified to be */ - /* included directly within the component and *not* export external */ - /* function names. This allows you to link any program with FreeType */ - /* _and_ ZLib without linking conflicts. */ - /* */ - /* Do not #undef this macro here since the build system might define */ - /* it for certain configurations only. */ - /* */ -/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */ - - /*************************************************************************/ - /* */ - /* Bzip2-compressed file support. */ - /* */ - /* FreeType now handles font files that have been compressed with the */ - /* `bzip2' program. This is mostly used to parse many of the PCF */ - /* files that come with XFree86. The implementation uses `libbz2' to */ - /* partially uncompress the file on the fly (see src/bzip2/ftbzip2.c). */ - /* Contrary to gzip, bzip2 currently is not included and need to use */ - /* the system available bzip2 implementation. */ - /* */ - /* Define this macro if you want to enable this `feature'. */ - /* */ -/* #define FT_CONFIG_OPTION_USE_BZIP2 */ - - /*************************************************************************/ - /* */ - /* Define to disable the use of file stream functions and types, FILE, */ - /* fopen() etc. Enables the use of smaller system libraries on embedded */ - /* systems that have multiple system libraries, some with or without */ - /* file stream support, in the cases where file stream support is not */ - /* necessary such as memory loading of font files. */ - /* */ -/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */ - - /*************************************************************************/ - /* */ - /* DLL export compilation */ - /* */ - /* When compiling FreeType as a DLL, some systems/compilers need a */ - /* special keyword in front OR after the return type of function */ - /* declarations. */ - /* */ - /* Two macros are used within the FreeType source code to define */ - /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ - /* */ - /* FT_EXPORT( return_type ) */ - /* */ - /* is used in a function declaration, as in */ - /* */ - /* FT_EXPORT( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ); */ - /* */ - /* */ - /* FT_EXPORT_DEF( return_type ) */ - /* */ - /* is used in a function definition, as in */ - /* */ - /* FT_EXPORT_DEF( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ) */ - /* { */ - /* ... some code ... */ - /* return FT_Err_Ok; */ - /* } */ - /* */ - /* You can provide your own implementation of FT_EXPORT and */ - /* FT_EXPORT_DEF here if you want. If you leave them undefined, they */ - /* will be later automatically defined as `extern return_type' to */ - /* allow normal compilation. */ - /* */ - /* Do not #undef these macros here since the build system might define */ - /* them for certain configurations only. */ - /* */ -/* #define FT_EXPORT(x) extern x */ -/* #define FT_EXPORT_DEF(x) x */ - - /*************************************************************************/ - /* */ - /* Glyph Postscript Names handling */ - /* */ - /* By default, FreeType 2 is compiled with the `psnames' module. This */ - /* module is in charge of converting a glyph name string into a */ - /* Unicode value, or return a Macintosh standard glyph name for the */ - /* use with the TrueType `post' table. */ - /* */ - /* Undefine this macro if you do not want `psnames' compiled in your */ - /* build of FreeType. This has the following effects: */ - /* */ - /* - The TrueType driver will provide its own set of glyph names, */ - /* if you build it to support postscript names in the TrueType */ - /* `post' table. */ - /* */ - /* - The Type 1 driver will not be able to synthesize a Unicode */ - /* charmap out of the glyphs found in the fonts. */ - /* */ - /* You would normally undefine this configuration macro when building */ - /* a version of FreeType that doesn't contain a Type 1 or CFF driver. */ - /* */ -#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES - - /*************************************************************************/ - /* */ - /* Postscript Names to Unicode Values support */ - /* */ - /* By default, FreeType 2 is built with the `PSNames' module compiled */ - /* in. Among other things, the module is used to convert a glyph name */ - /* into a Unicode value. This is especially useful in order to */ - /* synthesize on the fly a Unicode charmap from the CFF/Type 1 driver */ - /* through a big table named the `Adobe Glyph List' (AGL). */ - /* */ - /* Undefine this macro if you do not want the Adobe Glyph List */ - /* compiled in your `PSNames' module. The Type 1 driver will not be */ - /* able to synthesize a Unicode charmap out of the glyphs found in the */ - /* fonts. */ - /* */ -#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST - - /*************************************************************************/ - /* */ - /* Support for Mac fonts */ - /* */ - /* Define this macro if you want support for outline fonts in Mac */ - /* format (mac dfont, mac resource, macbinary containing a mac */ - /* resource) on non-Mac platforms. */ - /* */ - /* Note that the `FOND' resource isn't checked. */ - /* */ -#define FT_CONFIG_OPTION_MAC_FONTS - - /*************************************************************************/ - /* */ - /* Guessing methods to access embedded resource forks */ - /* */ - /* Enable extra Mac fonts support on non-Mac platforms (e.g. */ - /* GNU/Linux). */ - /* */ - /* Resource forks which include fonts data are stored sometimes in */ - /* locations which users or developers don't expected. In some cases, */ - /* resource forks start with some offset from the head of a file. In */ - /* other cases, the actual resource fork is stored in file different */ - /* from what the user specifies. If this option is activated, */ - /* FreeType tries to guess whether such offsets or different file */ - /* names must be used. */ - /* */ - /* Note that normal, direct access of resource forks is controlled via */ - /* the FT_CONFIG_OPTION_MAC_FONTS option. */ - /* */ -#ifdef FT_CONFIG_OPTION_MAC_FONTS -#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK -#endif - - /*************************************************************************/ - /* */ - /* Allow the use of FT_Incremental_Interface to load typefaces that */ - /* contain no glyph data, but supply it via a callback function. */ - /* This is required by clients supporting document formats which */ - /* supply font data incrementally as the document is parsed, such */ - /* as the Ghostscript interpreter for the PostScript language. */ - /* */ -#define FT_CONFIG_OPTION_INCREMENTAL - - /*************************************************************************/ - /* */ - /* The size in bytes of the render pool used by the scan-line converter */ - /* to do all of its work. */ - /* */ - /* This must be greater than 4KByte if you use FreeType to rasterize */ - /* glyphs; otherwise, you may set it to zero to avoid unnecessary */ - /* allocation of the render pool. */ - /* */ -#define FT_RENDER_POOL_SIZE 16384L - - /*************************************************************************/ - /* */ - /* FT_MAX_MODULES */ - /* */ - /* The maximum number of modules that can be registered in a single */ - /* FreeType library object. 32 is the default. */ - /* */ -#define FT_MAX_MODULES 32 - - /*************************************************************************/ - /* */ - /* Debug level */ - /* */ - /* FreeType can be compiled in debug or trace mode. In debug mode, */ - /* errors are reported through the `ftdebug' component. In trace */ - /* mode, additional messages are sent to the standard output during */ - /* execution. */ - /* */ - /* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */ - /* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */ - /* */ - /* Don't define any of these macros to compile in `release' mode! */ - /* */ - /* Do not #undef these macros here since the build system might define */ - /* them for certain configurations only. */ - /* */ -/* #define FT_DEBUG_LEVEL_ERROR */ -/* #define FT_DEBUG_LEVEL_TRACE */ - - /*************************************************************************/ - /* */ - /* Autofitter debugging */ - /* */ - /* If FT_DEBUG_AUTOFIT is defined, FreeType provides some means to */ - /* control the autofitter behaviour for debugging purposes with global */ - /* boolean variables (consequently, you should *never* enable this */ - /* while compiling in `release' mode): */ - /* */ - /* _af_debug_disable_horz_hints */ - /* _af_debug_disable_vert_hints */ - /* _af_debug_disable_blue_hints */ - /* */ - /* Additionally, the following functions provide dumps of various */ - /* internal autofit structures to stdout (using `printf'): */ - /* */ - /* af_glyph_hints_dump_points */ - /* af_glyph_hints_dump_segments */ - /* af_glyph_hints_dump_edges */ - /* */ - /* As an argument, they use another global variable: */ - /* */ - /* _af_debug_hints */ - /* */ - /* Please have a look at the `ftgrid' demo program to see how those */ - /* variables and macros should be used. */ - /* */ - /* Do not #undef these macros here since the build system might define */ - /* them for certain configurations only. */ - /* */ -/* #define FT_DEBUG_AUTOFIT */ - - /*************************************************************************/ - /* */ - /* Memory Debugging */ - /* */ - /* FreeType now comes with an integrated memory debugger that is */ - /* capable of detecting simple errors like memory leaks or double */ - /* deletes. To compile it within your build of the library, you */ - /* should define FT_DEBUG_MEMORY here. */ - /* */ - /* Note that the memory debugger is only activated at runtime when */ - /* when the _environment_ variable `FT2_DEBUG_MEMORY' is defined also! */ - /* */ - /* Do not #undef this macro here since the build system might define */ - /* it for certain configurations only. */ - /* */ -/* #define FT_DEBUG_MEMORY */ - - /*************************************************************************/ - /* */ - /* Module errors */ - /* */ - /* If this macro is set (which is _not_ the default), the higher byte */ - /* of an error code gives the module in which the error has occurred, */ - /* while the lower byte is the real error code. */ - /* */ - /* Setting this macro makes sense for debugging purposes only, since */ - /* it would break source compatibility of certain programs that use */ - /* FreeType 2. */ - /* */ - /* More details can be found in the files ftmoderr.h and fterrors.h. */ - /* */ -#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS - - /*************************************************************************/ - /* */ - /* Position Independent Code */ - /* */ - /* If this macro is set (which is _not_ the default), FreeType2 will */ - /* avoid creating constants that require address fixups. Instead the */ - /* constants will be moved into a struct and additional intialization */ - /* code will be used. */ - /* */ - /* Setting this macro is needed for systems that prohibit address */ - /* fixups, such as BREW. */ - /* */ -/* #define FT_CONFIG_OPTION_PIC */ - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** S F N T D R I V E R C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_EMBEDDED_BITMAPS if you want to support */ - /* embedded bitmaps in all formats using the SFNT module (namely */ - /* TrueType & OpenType). */ - /* */ -#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to */ - /* load and enumerate the glyph Postscript names in a TrueType or */ - /* OpenType file. */ - /* */ - /* Note that when you do not compile the `PSNames' module by undefining */ - /* the above FT_CONFIG_OPTION_POSTSCRIPT_NAMES, the `sfnt' module will */ - /* contain additional code used to read the PS Names table from a font. */ - /* */ - /* (By default, the module uses `PSNames' to extract glyph names.) */ - /* */ -#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to */ - /* access the internal name table in a SFNT-based format like TrueType */ - /* or OpenType. The name table contains various strings used to */ - /* describe the font, like family name, copyright, version, etc. It */ - /* does not contain any glyph name though. */ - /* */ - /* Accessing SFNT names is done through the functions declared in */ - /* `freetype/ftsnames.h'. */ - /* */ -#define TT_CONFIG_OPTION_SFNT_NAMES - - /*************************************************************************/ - /* */ - /* TrueType CMap support */ - /* */ - /* Here you can fine-tune which TrueType CMap table format shall be */ - /* supported. */ -#define TT_CONFIG_CMAP_FORMAT_0 -#define TT_CONFIG_CMAP_FORMAT_2 -#define TT_CONFIG_CMAP_FORMAT_4 -#define TT_CONFIG_CMAP_FORMAT_6 -#define TT_CONFIG_CMAP_FORMAT_8 -#define TT_CONFIG_CMAP_FORMAT_10 -#define TT_CONFIG_CMAP_FORMAT_12 -#define TT_CONFIG_CMAP_FORMAT_13 -#define TT_CONFIG_CMAP_FORMAT_14 - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile */ - /* a bytecode interpreter in the TrueType driver. */ - /* */ - /* By undefining this, you will only compile the code necessary to load */ - /* TrueType glyphs without hinting. */ - /* */ - /* Do not #undef this macro here, since the build system might */ - /* define it for certain configurations only. */ - /* */ -#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER - - /*************************************************************************/ - /* */ - /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */ - /* of the TrueType bytecode interpreter is used that doesn't implement */ - /* any of the patented opcodes and algorithms. The patents related to */ - /* TrueType hinting have expired worldwide since May 2010; this option */ - /* is now deprecated. */ - /* */ - /* Note that the TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* */ - /* if you define TT_CONFIG_OPTION_BYTECODE_INTERPRETER; in other words, */ - /* either define TT_CONFIG_OPTION_BYTECODE_INTERPRETER or */ - /* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time. */ - /* */ - /* This macro is only useful for a small number of font files (mostly */ - /* for Asian scripts) that require bytecode interpretation to properly */ - /* load glyphs. For all other fonts, this produces unpleasant results, */ - /* thus the unpatented interpreter is never used to load glyphs from */ - /* TrueType fonts unless one of the following two options is used. */ - /* */ - /* - The unpatented interpreter is explicitly activated by the user */ - /* through the FT_PARAM_TAG_UNPATENTED_HINTING parameter tag */ - /* when opening the FT_Face. */ - /* */ - /* - FreeType detects that the FT_Face corresponds to one of the */ - /* `trick' fonts (e.g., `Mingliu') it knows about. The font engine */ - /* contains a hard-coded list of font names and other matching */ - /* parameters (see function `tt_face_init' in file */ - /* `src/truetype/ttobjs.c'). */ - /* */ - /* Here a sample code snippet for using FT_PARAM_TAG_UNPATENTED_HINTING. */ - /* */ - /* { */ - /* FT_Parameter parameter; */ - /* FT_Open_Args open_args; */ - /* */ - /* */ - /* parameter.tag = FT_PARAM_TAG_UNPATENTED_HINTING; */ - /* */ - /* open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; */ - /* open_args.pathname = my_font_pathname; */ - /* open_args.num_params = 1; */ - /* open_args.params = ¶meter; */ - /* */ - /* error = FT_Open_Face( library, &open_args, index, &face ); */ - /* ... */ - /* } */ - /* */ -/* #define TT_CONFIG_OPTION_UNPATENTED_HINTING */ - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_INTERPRETER_SWITCH to compile the TrueType */ - /* bytecode interpreter with a huge switch statement, rather than a call */ - /* table. This results in smaller and faster code for a number of */ - /* architectures. */ - /* */ - /* Note however that on some compiler/processor combinations, undefining */ - /* this macro will generate faster, though larger, code. */ - /* */ -#define TT_CONFIG_OPTION_INTERPRETER_SWITCH - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the */ - /* TrueType glyph loader to use Apple's definition of how to handle */ - /* component offsets in composite glyphs. */ - /* */ - /* Apple and MS disagree on the default behavior of component offsets */ - /* in composites. Apple says that they should be scaled by the scaling */ - /* factors in the transformation matrix (roughly, it's more complex) */ - /* while MS says they should not. OpenType defines two bits in the */ - /* composite flags array which can be used to disambiguate, but old */ - /* fonts will not have them. */ - /* */ - /* http://www.microsoft.com/typography/otspec/glyf.htm */ - /* http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html */ - /* */ -#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_GX_VAR_SUPPORT if you want to include */ - /* support for Apple's distortable font technology (fvar, gvar, cvar, */ - /* and avar tables). This has many similarities to Type 1 Multiple */ - /* Masters support. */ - /* */ -#define TT_CONFIG_OPTION_GX_VAR_SUPPORT - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_BDF if you want to include support for */ - /* an embedded `BDF ' table within SFNT-based bitmap formats. */ - /* */ -#define TT_CONFIG_OPTION_BDF - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* T1_MAX_DICT_DEPTH is the maximum depth of nest dictionaries and */ - /* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */ - /* required. */ - /* */ -#define T1_MAX_DICT_DEPTH 5 - - /*************************************************************************/ - /* */ - /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */ - /* calls during glyph loading. */ - /* */ -#define T1_MAX_SUBRS_CALLS 16 - - /*************************************************************************/ - /* */ - /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */ - /* minimum of 16 is required. */ - /* */ - /* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */ - /* */ -#define T1_MAX_CHARSTRINGS_OPERANDS 256 - - /*************************************************************************/ - /* */ - /* Define this configuration macro if you want to prevent the */ - /* compilation of `t1afm', which is in charge of reading Type 1 AFM */ - /* files into an existing face. Note that if set, the T1 driver will be */ - /* unable to produce kerning distances. */ - /* */ -#undef T1_CONFIG_OPTION_NO_AFM - - /*************************************************************************/ - /* */ - /* Define this configuration macro if you want to prevent the */ - /* compilation of the Multiple Masters font support in the Type 1 */ - /* driver. */ - /* */ -#undef T1_CONFIG_OPTION_NO_MM_SUPPORT - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* Compile autofit module with CJK (Chinese, Japanese, Korean) script */ - /* support. */ - /* */ -#define AF_CONFIG_OPTION_CJK - - /*************************************************************************/ - /* */ - /* Compile autofit module with Indic script support. */ - /* */ -#define AF_CONFIG_OPTION_INDIC - - /*************************************************************************/ - /* */ - /* Compile autofit module with warp hinting. The idea of the warping */ - /* code is to slightly scale and shift a glyph within a single dimension */ - /* so that as much of its segments are aligned (more or less) on the */ - /* grid. To find out the optimal scaling and shifting value, various */ - /* parameter combinations are tried and scored. */ - /* */ - /* This experimental option is only active if the render mode is */ - /* FT_RENDER_MODE_LIGHT. */ - /* */ -/* #define AF_CONFIG_OPTION_USE_WARPER */ - - /* */ - - /* - * Define this variable if you want to keep the layout of internal - * structures that was used prior to FreeType 2.2. This also compiles in - * a few obsolete functions to avoid linking problems on typical Unix - * distributions. - * - * For embedded systems or building a new distribution from scratch, it - * is recommended to disable the macro since it reduces the library's code - * size and activates a few memory-saving optimizations as well. - */ -#define FT_CONFIG_OPTION_OLD_INTERNALS - - /* - * To detect legacy cache-lookup call from a rogue client (<= 2.1.7), - * we restrict the number of charmaps in a font. The current API of - * FTC_CMapCache_Lookup() takes cmap_index & charcode, but old API - * takes charcode only. To determine the passed value is for cmap_index - * or charcode, the possible cmap_index is restricted not to exceed - * the minimum possible charcode by a rogue client. It is also very - * unlikely that a rogue client is interested in Unicode values 0 to 15. - * - * NOTE: The original threshold was 4 deduced from popular number of - * cmap subtables in UCS-4 TrueType fonts, but now it is not - * irregular for OpenType fonts to have more than 4 subtables, - * because variation selector subtables are available for Apple - * and Microsoft platforms. - */ - -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS -#define FT_MAX_CHARMAP_CACHEABLE 15 -#endif - - /* - * This macro is defined if either unpatented or native TrueType - * hinting is requested by the definitions above. - */ -#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER -#define TT_USE_BYTECODE_INTERPRETER -#undef TT_CONFIG_OPTION_UNPATENTED_HINTING -#elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING -#define TT_USE_BYTECODE_INTERPRETER -#endif - -FT_END_HEADER - -#endif /* __FTOPTION_H__ */ - -/* END */ - -/*** End of inlined file: ftoption.h ***/ - - -/*** Start of inlined file: ftstdlib.h ***/ -/* */ -/* ftstdlib.h */ -/* */ -/* ANSI-specific library and header configuration file (specification */ -/* only). */ -/* */ -/* Copyright 2002-2007, 2009, 2011 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - /*************************************************************************/ - /* */ - /* This file is used to group all #includes to the ANSI C library that */ - /* FreeType normally requires. It also defines macros to rename the */ - /* standard functions within the FreeType source code. */ - /* */ - /* Load a file which defines __FTSTDLIB_H__ before this one to override */ - /* it. */ - /* */ - /*************************************************************************/ - -#ifndef __FTSTDLIB_H__ -#define __FTSTDLIB_H__ - -#include <stddef.h> - -#define ft_ptrdiff_t ptrdiff_t - - /**********************************************************************/ - /* */ - /* integer limits */ - /* */ - /* UINT_MAX and ULONG_MAX are used to automatically compute the size */ - /* of `int' and `long' in bytes at compile-time. So far, this works */ - /* for all platforms the library has been tested on. */ - /* */ - /* Note that on the extremely rare platforms that do not provide */ - /* integer types that are _exactly_ 16 and 32 bits wide (e.g. some */ - /* old Crays where `int' is 36 bits), we do not make any guarantee */ - /* about the correct behaviour of FT2 with all fonts. */ - /* */ - /* In these case, `ftconfig.h' will refuse to compile anyway with a */ - /* message like `couldn't find 32-bit type' or something similar. */ - /* */ - /**********************************************************************/ - -#include <limits.h> - -#define FT_CHAR_BIT CHAR_BIT -#define FT_USHORT_MAX USHRT_MAX -#define FT_INT_MAX INT_MAX -#define FT_INT_MIN INT_MIN -#define FT_UINT_MAX UINT_MAX -#define FT_ULONG_MAX ULONG_MAX - - /**********************************************************************/ - /* */ - /* character and string processing */ - /* */ - /**********************************************************************/ - -#include <string.h> - -#define ft_memchr memchr -#define ft_memcmp memcmp -#define ft_memcpy memcpy -#define ft_memmove memmove -#define ft_memset memset -#define ft_strcat strcat -#define ft_strcmp strcmp -#define ft_strcpy strcpy -#define ft_strlen strlen -#define ft_strncmp strncmp -#define ft_strncpy strncpy -#define ft_strrchr strrchr -#define ft_strstr strstr - - /**********************************************************************/ - /* */ - /* file handling */ - /* */ - /**********************************************************************/ - -#include <stdio.h> - -#define FT_FILE FILE -#define ft_fclose fclose -#define ft_fopen fopen -#define ft_fread fread -#define ft_fseek fseek -#define ft_ftell ftell -#define ft_sprintf sprintf - - /**********************************************************************/ - /* */ - /* sorting */ - /* */ - /**********************************************************************/ - -#include <stdlib.h> - -#define ft_qsort qsort - - /**********************************************************************/ - /* */ - /* memory allocation */ - /* */ - /**********************************************************************/ - -#define ft_scalloc calloc -#define ft_sfree free -#define ft_smalloc malloc -#define ft_srealloc realloc - - /**********************************************************************/ - /* */ - /* miscellaneous */ - /* */ - /**********************************************************************/ - -#define ft_atol atol -#define ft_labs labs - - /**********************************************************************/ - /* */ - /* execution control */ - /* */ - /**********************************************************************/ - -#include <setjmp.h> - -#define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */ - /* jmp_buf is defined as a macro */ - /* on certain platforms */ - -#define ft_longjmp longjmp -#define ft_setjmp( b ) setjmp( *(jmp_buf*) &(b) ) /* same thing here */ - - /* the following is only used for debugging purposes, i.e., if */ - /* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined */ - -#include <stdarg.h> - -#endif /* __FTSTDLIB_H__ */ - -/* END */ - -/*** End of inlined file: ftstdlib.h ***/ - -FT_BEGIN_HEADER - - /*************************************************************************/ - /* */ - /* PLATFORM-SPECIFIC CONFIGURATION MACROS */ - /* */ - /* These macros can be toggled to suit a specific system. The current */ - /* ones are defaults used to compile FreeType in an ANSI C environment */ - /* (16bit compilers are also supported). Copy this file to your own */ - /* `freetype/builds/<system>' directory, and edit it to port the engine. */ - /* */ - /*************************************************************************/ - - /* There are systems (like the Texas Instruments 'C54x) where a `char' */ - /* has 16 bits. ANSI C says that sizeof(char) is always 1. Since an */ - /* `int' has 16 bits also for this system, sizeof(int) gives 1 which */ - /* is probably unexpected. */ - /* */ - /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */ - /* `char' type. */ - -#ifndef FT_CHAR_BIT -#define FT_CHAR_BIT CHAR_BIT -#endif - - /* The size of an `int' type. */ -#if FT_UINT_MAX == 0xFFFFUL -#define FT_SIZEOF_INT (16 / FT_CHAR_BIT) -#elif FT_UINT_MAX == 0xFFFFFFFFUL -#define FT_SIZEOF_INT (32 / FT_CHAR_BIT) -#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL -#define FT_SIZEOF_INT (64 / FT_CHAR_BIT) -#else -#error "Unsupported size of `int' type!" -#endif - - /* The size of a `long' type. A five-byte `long' (as used e.g. on the */ - /* DM642) is recognized but avoided. */ -#if FT_ULONG_MAX == 0xFFFFFFFFUL -#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) -#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL -#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) -#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL -#define FT_SIZEOF_LONG (64 / FT_CHAR_BIT) -#else -#error "Unsupported size of `long' type!" -#endif - - /* FT_UNUSED is a macro used to indicate that a given parameter is not */ - /* used -- this is only used to get rid of unpleasant compiler warnings */ -#ifndef FT_UNUSED -#define FT_UNUSED( arg ) ( (arg) = (arg) ) -#endif - - /*************************************************************************/ - /* */ - /* AUTOMATIC CONFIGURATION MACROS */ - /* */ - /* These macros are computed from the ones defined above. Don't touch */ - /* their definition, unless you know precisely what you are doing. No */ - /* porter should need to mess with them. */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* Mac support */ - /* */ - /* This is the only necessary change, so it is defined here instead */ - /* providing a new configuration file. */ - /* */ -#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) ) - /* no Carbon frameworks for 64bit 10.4.x */ - /* AvailabilityMacros.h is available since Mac OS X 10.2, */ - /* so guess the system version by maximum errno before inclusion */ -#include <errno.h> -#ifdef ECANCELED /* defined since 10.2 */ -#include "AvailabilityMacros.h" -#endif -#if defined( __LP64__ ) && \ - ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 ) -#undef FT_MACINTOSH -#endif - -#elif defined( __SC__ ) || defined( __MRC__ ) - /* Classic MacOS compilers */ -#include "ConditionalMacros.h" -#if TARGET_OS_MAC -#define FT_MACINTOSH 1 -#endif - -#endif - - /*************************************************************************/ - /* */ - /* <Section> */ - /* basic_types */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Int16 */ - /* */ - /* <Description> */ - /* A typedef for a 16bit signed integer type. */ - /* */ - typedef signed short FT_Int16; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_UInt16 */ - /* */ - /* <Description> */ - /* A typedef for a 16bit unsigned integer type. */ - /* */ - typedef unsigned short FT_UInt16; - - /* */ - - /* this #if 0 ... #endif clause is for documentation purposes */ -#if 0 - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Int32 */ - /* */ - /* <Description> */ - /* A typedef for a 32bit signed integer type. The size depends on */ - /* the configuration. */ - /* */ - typedef signed XXX FT_Int32; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_UInt32 */ - /* */ - /* A typedef for a 32bit unsigned integer type. The size depends on */ - /* the configuration. */ - /* */ - typedef unsigned XXX FT_UInt32; - - /* */ - -#endif - -#if FT_SIZEOF_INT == (32 / FT_CHAR_BIT) - - typedef signed int FT_Int32; - typedef unsigned int FT_UInt32; - -#elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT) - - typedef signed long FT_Int32; - typedef unsigned long FT_UInt32; - -#else -#error "no 32bit type found -- please check your configuration files" -#endif - - /* look up an integer type that is at least 32 bits */ -#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT) - - typedef int FT_Fast; - typedef unsigned int FT_UFast; - -#elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT) - - typedef long FT_Fast; - typedef unsigned long FT_UFast; - -#endif - - /* determine whether we have a 64-bit int type for platforms without */ - /* Autoconf */ -#if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) - - /* FT_LONG64 must be defined if a 64-bit type is available */ -#define FT_LONG64 -#define FT_INT64 long - -#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */ - - /* this compiler provides the __int64 type */ -#define FT_LONG64 -#define FT_INT64 __int64 - -#elif defined( __BORLANDC__ ) /* Borland C++ */ - - /* XXXX: We should probably check the value of __BORLANDC__ in order */ - /* to test the compiler version. */ - - /* this compiler provides the __int64 type */ -#define FT_LONG64 -#define FT_INT64 __int64 - -#elif defined( __WATCOMC__ ) /* Watcom C++ */ - - /* Watcom doesn't provide 64-bit data types */ - -#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */ - -#define FT_LONG64 -#define FT_INT64 long long int - -#elif defined( __GNUC__ ) - - /* GCC provides the `long long' type */ -#define FT_LONG64 -#define FT_INT64 long long int - -#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */ - - /*************************************************************************/ - /* */ - /* A 64-bit data type will create compilation problems if you compile */ - /* in strict ANSI mode. To avoid them, we disable its use if __STDC__ */ - /* is defined. You can however ignore this rule by defining the */ - /* FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */ - /* */ -#if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 ) - -#ifdef __STDC__ - - /* undefine the 64-bit macros in strict ANSI compilation mode */ -#undef FT_LONG64 -#undef FT_INT64 - -#endif /* __STDC__ */ - -#endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */ - -#define FT_BEGIN_STMNT do { -#define FT_END_STMNT } while ( 0 ) -#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT - -#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER - /* Provide assembler fragments for performance-critical functions. */ - /* These must be defined `static __inline__' with GCC. */ - -#if defined( __CC_ARM ) || defined( __ARMCC__ ) /* RVCT */ -#define FT_MULFIX_ASSEMBLER FT_MulFix_arm - - /* documentation is in freetype.h */ - - static __inline FT_Int32 - FT_MulFix_arm( FT_Int32 a, - FT_Int32 b ) - { - register FT_Int32 t, t2; - - __asm - { - smull t2, t, b, a /* (lo=t2,hi=t) = a*b */ - mov a, t, asr #31 /* a = (hi >> 31) */ - add a, a, #0x8000 /* a += 0x8000 */ - adds t2, t2, a /* t2 += a */ - adc t, t, #0 /* t += carry */ - mov a, t2, lsr #16 /* a = t2 >> 16 */ - orr a, a, t, lsl #16 /* a |= t << 16 */ - } - return a; - } - -#endif /* __CC_ARM || __ARMCC__ */ - -#ifdef __GNUC__ - -#if defined( __arm__ ) && !defined( __thumb__ ) && \ - !( defined( __CC_ARM ) || defined( __ARMCC__ ) ) -#define FT_MULFIX_ASSEMBLER FT_MulFix_arm - - /* documentation is in freetype.h */ - - static __inline__ FT_Int32 - FT_MulFix_arm( FT_Int32 a, - FT_Int32 b ) - { - register FT_Int32 t, t2; - - __asm__ __volatile__ ( - "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */ - "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */ - "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */ - "adds %1, %1, %0\n\t" /* %1 += %0 */ - "adc %2, %2, #0\n\t" /* %2 += carry */ - "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */ - "orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */ - : "=r"(a), "=&r"(t2), "=&r"(t) - : "r"(a), "r"(b) ); - return a; - } - -#endif /* __arm__ && !__thumb__ && !( __CC_ARM || __ARMCC__ ) */ - -#if defined( __i386__ ) -#define FT_MULFIX_ASSEMBLER FT_MulFix_i386 - - /* documentation is in freetype.h */ - - static __inline__ FT_Int32 - FT_MulFix_i386( FT_Int32 a, - FT_Int32 b ) - { - register FT_Int32 result; - - __asm__ __volatile__ ( - "imul %%edx\n" - "movl %%edx, %%ecx\n" - "sarl $31, %%ecx\n" - "addl $0x8000, %%ecx\n" - "addl %%ecx, %%eax\n" - "adcl $0, %%edx\n" - "shrl $16, %%eax\n" - "shll $16, %%edx\n" - "addl %%edx, %%eax\n" - : "=a"(result), "=d"(b) - : "a"(a), "d"(b) - : "%ecx", "cc" ); - return result; - } - -#endif /* i386 */ - -#endif /* __GNUC__ */ - -#ifdef _MSC_VER /* Visual C++ */ - -#ifdef _M_IX86 - -#define FT_MULFIX_ASSEMBLER FT_MulFix_i386 - - /* documentation is in freetype.h */ - - static __inline FT_Int32 - FT_MulFix_i386( FT_Int32 a, - FT_Int32 b ) - { - register FT_Int32 result; - - __asm - { - mov eax, a - mov edx, b - imul edx - mov ecx, edx - sar ecx, 31 - add ecx, 8000h - add eax, ecx - adc edx, 0 - shr eax, 16 - shl edx, 16 - add eax, edx - mov result, eax - } - return result; - } - -#endif /* _M_IX86 */ - -#endif /* _MSC_VER */ - -#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */ - -#ifdef FT_CONFIG_OPTION_INLINE_MULFIX -#ifdef FT_MULFIX_ASSEMBLER -#define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER -#endif -#endif - -#ifdef FT_MAKE_OPTION_SINGLE_OBJECT - -#define FT_LOCAL( x ) static x -#define FT_LOCAL_DEF( x ) static x - -#else - -#ifdef __cplusplus -#define FT_LOCAL( x ) extern "C" x -#define FT_LOCAL_DEF( x ) extern "C" x -#else -#define FT_LOCAL( x ) extern x -#define FT_LOCAL_DEF( x ) x -#endif - -#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */ - -#ifndef FT_BASE - -#ifdef __cplusplus -#define FT_BASE( x ) extern "C" x -#else -#define FT_BASE( x ) extern x -#endif - -#endif /* !FT_BASE */ - -#ifndef FT_BASE_DEF - -#ifdef __cplusplus -#define FT_BASE_DEF( x ) x -#else -#define FT_BASE_DEF( x ) x -#endif - -#endif /* !FT_BASE_DEF */ - -#ifndef FT_EXPORT - -#ifdef __cplusplus -#define FT_EXPORT( x ) extern "C" x -#else -#define FT_EXPORT( x ) extern x -#endif - -#endif /* !FT_EXPORT */ - -#ifndef FT_EXPORT_DEF - -#ifdef __cplusplus -#define FT_EXPORT_DEF( x ) extern "C" x -#else -#define FT_EXPORT_DEF( x ) extern x -#endif - -#endif /* !FT_EXPORT_DEF */ - -#ifndef FT_EXPORT_VAR - -#ifdef __cplusplus -#define FT_EXPORT_VAR( x ) extern "C" x -#else -#define FT_EXPORT_VAR( x ) extern x -#endif - -#endif /* !FT_EXPORT_VAR */ - - /* The following macros are needed to compile the library with a */ - /* C++ compiler and with 16bit compilers. */ - /* */ - - /* This is special. Within C++, you must specify `extern "C"' for */ - /* functions which are used via function pointers, and you also */ - /* must do that for structures which contain function pointers to */ - /* assure C linkage -- it's not possible to have (local) anonymous */ - /* functions which are accessed by (global) function pointers. */ - /* */ - /* */ - /* FT_CALLBACK_DEF is used to _define_ a callback function. */ - /* */ - /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ - /* contains pointers to callback functions. */ - /* */ - /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */ - /* that contains pointers to callback functions. */ - /* */ - /* */ - /* Some 16bit compilers have to redefine these macros to insert */ - /* the infamous `_cdecl' or `__fastcall' declarations. */ - /* */ -#ifndef FT_CALLBACK_DEF -#ifdef __cplusplus -#define FT_CALLBACK_DEF( x ) extern "C" x -#else -#define FT_CALLBACK_DEF( x ) static x -#endif -#endif /* FT_CALLBACK_DEF */ - -#ifndef FT_CALLBACK_TABLE -#ifdef __cplusplus -#define FT_CALLBACK_TABLE extern "C" -#define FT_CALLBACK_TABLE_DEF extern "C" -#else -#define FT_CALLBACK_TABLE extern -#define FT_CALLBACK_TABLE_DEF /* nothing */ -#endif -#endif /* FT_CALLBACK_TABLE */ - -FT_END_HEADER - -#endif /* __FTCONFIG_H__ */ - -/* END */ - -/*** End of inlined file: ftconfig.h ***/ - - -/*** Start of inlined file: fterrors.h ***/ -/* */ -/* fterrors.h */ -/* */ -/* FreeType error code handling (specification). */ -/* */ -/* Copyright 1996-2001, 2002, 2004, 2007 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - /*************************************************************************/ - /* */ - /* This special header file is used to define the handling of FT2 */ - /* enumeration constants. It can also be used to generate error message */ - /* strings with a small macro trick explained below. */ - /* */ - /* I - Error Formats */ - /* ----------------- */ - /* */ - /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */ - /* defined in ftoption.h in order to make the higher byte indicate */ - /* the module where the error has happened (this is not compatible */ - /* with standard builds of FreeType 2). You can then use the macro */ - /* FT_ERROR_BASE macro to extract the generic error code from an */ - /* FT_Error value. */ - /* */ - /* */ - /* II - Error Message strings */ - /* -------------------------- */ - /* */ - /* The error definitions below are made through special macros that */ - /* allow client applications to build a table of error message strings */ - /* if they need it. The strings are not included in a normal build of */ - /* FreeType 2 to save space (most client applications do not use */ - /* them). */ - /* */ - /* To do so, you have to define the following macros before including */ - /* this file: */ - /* */ - /* FT_ERROR_START_LIST :: */ - /* This macro is called before anything else to define the start of */ - /* the error list. It is followed by several FT_ERROR_DEF calls */ - /* (see below). */ - /* */ - /* FT_ERROR_DEF( e, v, s ) :: */ - /* This macro is called to define one single error. */ - /* `e' is the error code identifier (e.g. FT_Err_Invalid_Argument). */ - /* `v' is the error numerical value. */ - /* `s' is the corresponding error string. */ - /* */ - /* FT_ERROR_END_LIST :: */ - /* This macro ends the list. */ - /* */ - /* Additionally, you have to undefine __FTERRORS_H__ before #including */ - /* this file. */ - /* */ - /* Here is a simple example: */ - /* */ - /* { */ - /* #undef __FTERRORS_H__ */ - /* #define FT_ERRORDEF( e, v, s ) { e, s }, */ - /* #define FT_ERROR_START_LIST { */ - /* #define FT_ERROR_END_LIST { 0, 0 } }; */ - /* */ - /* const struct */ - /* { */ - /* int err_code; */ - /* const char* err_msg; */ - /* } ft_errors[] = */ - /* */ - /* #include FT_ERRORS_H */ - /* } */ - /* */ - /*************************************************************************/ - -#ifndef __FTERRORS_H__ -#define __FTERRORS_H__ - - /* include module base error codes */ - -/*** Start of inlined file: ftmoderr.h ***/ -/* */ -/* ftmoderr.h */ -/* */ -/* FreeType module error offsets (specification). */ -/* */ -/* Copyright 2001, 2002, 2003, 2004, 2005, 2010 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - /*************************************************************************/ - /* */ - /* This file is used to define the FreeType module error offsets. */ - /* */ - /* The lower byte gives the error code, the higher byte gives the */ - /* module. The base module has error offset 0. For example, the error */ - /* `FT_Err_Invalid_File_Format' has value 0x003, the error */ - /* `TT_Err_Invalid_File_Format' has value 0x1103, the error */ - /* `T1_Err_Invalid_File_Format' has value 0x1203, etc. */ - /* */ - /* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in ftoption.h */ - /* to make the higher byte always zero (disabling the module error */ - /* mechanism). */ - /* */ - /* It can also be used to create a module error message table easily */ - /* with something like */ - /* */ - /* { */ - /* #undef __FTMODERR_H__ */ - /* #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, */ - /* #define FT_MODERR_START_LIST { */ - /* #define FT_MODERR_END_LIST { 0, 0 } }; */ - /* */ - /* const struct */ - /* { */ - /* int mod_err_offset; */ - /* const char* mod_err_msg */ - /* } ft_mod_errors[] = */ - /* */ - /* #include FT_MODULE_ERRORS_H */ - /* } */ - /* */ - /* To use such a table, all errors must be ANDed with 0xFF00 to remove */ - /* the error code. */ - /* */ - /*************************************************************************/ - -#ifndef __FTMODERR_H__ -#define __FTMODERR_H__ - - /*******************************************************************/ - /*******************************************************************/ - /***** *****/ - /***** SETUP MACROS *****/ - /***** *****/ - /*******************************************************************/ - /*******************************************************************/ - -#undef FT_NEED_EXTERN_C - -#ifndef FT_MODERRDEF - -#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS -#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v, -#else -#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0, -#endif - -#define FT_MODERR_START_LIST enum { -#define FT_MODERR_END_LIST FT_Mod_Err_Max }; - -#ifdef __cplusplus -#define FT_NEED_EXTERN_C - extern "C" { -#endif - -#endif /* !FT_MODERRDEF */ - - /*******************************************************************/ - /*******************************************************************/ - /***** *****/ - /***** LIST MODULE ERROR BASES *****/ - /***** *****/ - /*******************************************************************/ - /*******************************************************************/ - -#ifdef FT_MODERR_START_LIST - FT_MODERR_START_LIST -#endif - - FT_MODERRDEF( Base, 0x000, "base module" ) - FT_MODERRDEF( Autofit, 0x100, "autofitter module" ) - FT_MODERRDEF( BDF, 0x200, "BDF module" ) - FT_MODERRDEF( Bzip2, 0x300, "Bzip2 module" ) - FT_MODERRDEF( Cache, 0x400, "cache module" ) - FT_MODERRDEF( CFF, 0x500, "CFF module" ) - FT_MODERRDEF( CID, 0x600, "CID module" ) - FT_MODERRDEF( Gzip, 0x700, "Gzip module" ) - FT_MODERRDEF( LZW, 0x800, "LZW module" ) - FT_MODERRDEF( OTvalid, 0x900, "OpenType validation module" ) - FT_MODERRDEF( PCF, 0xA00, "PCF module" ) - FT_MODERRDEF( PFR, 0xB00, "PFR module" ) - FT_MODERRDEF( PSaux, 0xC00, "PS auxiliary module" ) - FT_MODERRDEF( PShinter, 0xD00, "PS hinter module" ) - FT_MODERRDEF( PSnames, 0xE00, "PS names module" ) - FT_MODERRDEF( Raster, 0xF00, "raster module" ) - FT_MODERRDEF( SFNT, 0x1000, "SFNT module" ) - FT_MODERRDEF( Smooth, 0x1100, "smooth raster module" ) - FT_MODERRDEF( TrueType, 0x1200, "TrueType module" ) - FT_MODERRDEF( Type1, 0x1300, "Type 1 module" ) - FT_MODERRDEF( Type42, 0x1400, "Type 42 module" ) - FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" ) - -#ifdef FT_MODERR_END_LIST - FT_MODERR_END_LIST -#endif - - /*******************************************************************/ - /*******************************************************************/ - /***** *****/ - /***** CLEANUP *****/ - /***** *****/ - /*******************************************************************/ - /*******************************************************************/ - -#ifdef FT_NEED_EXTERN_C - } -#endif - -#undef FT_MODERR_START_LIST -#undef FT_MODERR_END_LIST -#undef FT_MODERRDEF -#undef FT_NEED_EXTERN_C - -#endif /* __FTMODERR_H__ */ - -/* END */ - -/*** End of inlined file: ftmoderr.h ***/ - - - /*******************************************************************/ - /*******************************************************************/ - /***** *****/ - /***** SETUP MACROS *****/ - /***** *****/ - /*******************************************************************/ - /*******************************************************************/ - -#undef FT_NEED_EXTERN_C - -#undef FT_ERR_XCAT -#undef FT_ERR_CAT - -#define FT_ERR_XCAT( x, y ) x ## y -#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y ) - - /* FT_ERR_PREFIX is used as a prefix for error identifiers. */ - /* By default, we use `FT_Err_'. */ - /* */ -#ifndef FT_ERR_PREFIX -#define FT_ERR_PREFIX FT_Err_ -#endif - - /* FT_ERR_BASE is used as the base for module-specific errors. */ - /* */ -#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS - -#ifndef FT_ERR_BASE -#define FT_ERR_BASE FT_Mod_Err_Base -#endif - -#else - -#undef FT_ERR_BASE -#define FT_ERR_BASE 0 - -#endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */ - - /* If FT_ERRORDEF is not defined, we need to define a simple */ - /* enumeration type. */ - /* */ -#ifndef FT_ERRORDEF - -#define FT_ERRORDEF( e, v, s ) e = v, -#define FT_ERROR_START_LIST enum { -#define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) }; - -#ifdef __cplusplus -#define FT_NEED_EXTERN_C - extern "C" { -#endif - -#endif /* !FT_ERRORDEF */ - - /* this macro is used to define an error */ -#define FT_ERRORDEF_( e, v, s ) \ - FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s ) - - /* this is only used for <module>_Err_Ok, which must be 0! */ -#define FT_NOERRORDEF_( e, v, s ) \ - FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s ) - -#ifdef FT_ERROR_START_LIST - FT_ERROR_START_LIST -#endif - - /* now include the error codes */ - -/*** Start of inlined file: fterrdef.h ***/ -/* */ -/* fterrdef.h */ -/* */ -/* FreeType error codes (specification). */ -/* */ -/* Copyright 2002, 2004, 2006, 2007, 2010-2011 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - /*******************************************************************/ - /*******************************************************************/ - /***** *****/ - /***** LIST OF ERROR CODES/MESSAGES *****/ - /***** *****/ - /*******************************************************************/ - /*******************************************************************/ - - /* You need to define both FT_ERRORDEF_ and FT_NOERRORDEF_ before */ - /* including this file. */ - - /* generic errors */ - - FT_NOERRORDEF_( Ok, 0x00, \ - "no error" ) - - FT_ERRORDEF_( Cannot_Open_Resource, 0x01, \ - "cannot open resource" ) - FT_ERRORDEF_( Unknown_File_Format, 0x02, \ - "unknown file format" ) - FT_ERRORDEF_( Invalid_File_Format, 0x03, \ - "broken file" ) - FT_ERRORDEF_( Invalid_Version, 0x04, \ - "invalid FreeType version" ) - FT_ERRORDEF_( Lower_Module_Version, 0x05, \ - "module version is too low" ) - FT_ERRORDEF_( Invalid_Argument, 0x06, \ - "invalid argument" ) - FT_ERRORDEF_( Unimplemented_Feature, 0x07, \ - "unimplemented feature" ) - FT_ERRORDEF_( Invalid_Table, 0x08, \ - "broken table" ) - FT_ERRORDEF_( Invalid_Offset, 0x09, \ - "broken offset within table" ) - FT_ERRORDEF_( Array_Too_Large, 0x0A, \ - "array allocation size too large" ) - FT_ERRORDEF_( Missing_Module, 0x0B, \ - "missing module" ) - - /* glyph/character errors */ - - FT_ERRORDEF_( Invalid_Glyph_Index, 0x10, \ - "invalid glyph index" ) - FT_ERRORDEF_( Invalid_Character_Code, 0x11, \ - "invalid character code" ) - FT_ERRORDEF_( Invalid_Glyph_Format, 0x12, \ - "unsupported glyph image format" ) - FT_ERRORDEF_( Cannot_Render_Glyph, 0x13, \ - "cannot render this glyph format" ) - FT_ERRORDEF_( Invalid_Outline, 0x14, \ - "invalid outline" ) - FT_ERRORDEF_( Invalid_Composite, 0x15, \ - "invalid composite glyph" ) - FT_ERRORDEF_( Too_Many_Hints, 0x16, \ - "too many hints" ) - FT_ERRORDEF_( Invalid_Pixel_Size, 0x17, \ - "invalid pixel size" ) - - /* handle errors */ - - FT_ERRORDEF_( Invalid_Handle, 0x20, \ - "invalid object handle" ) - FT_ERRORDEF_( Invalid_Library_Handle, 0x21, \ - "invalid library handle" ) - FT_ERRORDEF_( Invalid_Driver_Handle, 0x22, \ - "invalid module handle" ) - FT_ERRORDEF_( Invalid_Face_Handle, 0x23, \ - "invalid face handle" ) - FT_ERRORDEF_( Invalid_Size_Handle, 0x24, \ - "invalid size handle" ) - FT_ERRORDEF_( Invalid_Slot_Handle, 0x25, \ - "invalid glyph slot handle" ) - FT_ERRORDEF_( Invalid_CharMap_Handle, 0x26, \ - "invalid charmap handle" ) - FT_ERRORDEF_( Invalid_Cache_Handle, 0x27, \ - "invalid cache manager handle" ) - FT_ERRORDEF_( Invalid_Stream_Handle, 0x28, \ - "invalid stream handle" ) - - /* driver errors */ - - FT_ERRORDEF_( Too_Many_Drivers, 0x30, \ - "too many modules" ) - FT_ERRORDEF_( Too_Many_Extensions, 0x31, \ - "too many extensions" ) - - /* memory errors */ - - FT_ERRORDEF_( Out_Of_Memory, 0x40, \ - "out of memory" ) - FT_ERRORDEF_( Unlisted_Object, 0x41, \ - "unlisted object" ) - - /* stream errors */ - - FT_ERRORDEF_( Cannot_Open_Stream, 0x51, \ - "cannot open stream" ) - FT_ERRORDEF_( Invalid_Stream_Seek, 0x52, \ - "invalid stream seek" ) - FT_ERRORDEF_( Invalid_Stream_Skip, 0x53, \ - "invalid stream skip" ) - FT_ERRORDEF_( Invalid_Stream_Read, 0x54, \ - "invalid stream read" ) - FT_ERRORDEF_( Invalid_Stream_Operation, 0x55, \ - "invalid stream operation" ) - FT_ERRORDEF_( Invalid_Frame_Operation, 0x56, \ - "invalid frame operation" ) - FT_ERRORDEF_( Nested_Frame_Access, 0x57, \ - "nested frame access" ) - FT_ERRORDEF_( Invalid_Frame_Read, 0x58, \ - "invalid frame read" ) - - /* raster errors */ - - FT_ERRORDEF_( Raster_Uninitialized, 0x60, \ - "raster uninitialized" ) - FT_ERRORDEF_( Raster_Corrupted, 0x61, \ - "raster corrupted" ) - FT_ERRORDEF_( Raster_Overflow, 0x62, \ - "raster overflow" ) - FT_ERRORDEF_( Raster_Negative_Height, 0x63, \ - "negative height while rastering" ) - - /* cache errors */ - - FT_ERRORDEF_( Too_Many_Caches, 0x70, \ - "too many registered caches" ) - - /* TrueType and SFNT errors */ - - FT_ERRORDEF_( Invalid_Opcode, 0x80, \ - "invalid opcode" ) - FT_ERRORDEF_( Too_Few_Arguments, 0x81, \ - "too few arguments" ) - FT_ERRORDEF_( Stack_Overflow, 0x82, \ - "stack overflow" ) - FT_ERRORDEF_( Code_Overflow, 0x83, \ - "code overflow" ) - FT_ERRORDEF_( Bad_Argument, 0x84, \ - "bad argument" ) - FT_ERRORDEF_( Divide_By_Zero, 0x85, \ - "division by zero" ) - FT_ERRORDEF_( Invalid_Reference, 0x86, \ - "invalid reference" ) - FT_ERRORDEF_( Debug_OpCode, 0x87, \ - "found debug opcode" ) - FT_ERRORDEF_( ENDF_In_Exec_Stream, 0x88, \ - "found ENDF opcode in execution stream" ) - FT_ERRORDEF_( Nested_DEFS, 0x89, \ - "nested DEFS" ) - FT_ERRORDEF_( Invalid_CodeRange, 0x8A, \ - "invalid code range" ) - FT_ERRORDEF_( Execution_Too_Long, 0x8B, \ - "execution context too long" ) - FT_ERRORDEF_( Too_Many_Function_Defs, 0x8C, \ - "too many function definitions" ) - FT_ERRORDEF_( Too_Many_Instruction_Defs, 0x8D, \ - "too many instruction definitions" ) - FT_ERRORDEF_( Table_Missing, 0x8E, \ - "SFNT font table missing" ) - FT_ERRORDEF_( Horiz_Header_Missing, 0x8F, \ - "horizontal header (hhea) table missing" ) - FT_ERRORDEF_( Locations_Missing, 0x90, \ - "locations (loca) table missing" ) - FT_ERRORDEF_( Name_Table_Missing, 0x91, \ - "name table missing" ) - FT_ERRORDEF_( CMap_Table_Missing, 0x92, \ - "character map (cmap) table missing" ) - FT_ERRORDEF_( Hmtx_Table_Missing, 0x93, \ - "horizontal metrics (hmtx) table missing" ) - FT_ERRORDEF_( Post_Table_Missing, 0x94, \ - "PostScript (post) table missing" ) - FT_ERRORDEF_( Invalid_Horiz_Metrics, 0x95, \ - "invalid horizontal metrics" ) - FT_ERRORDEF_( Invalid_CharMap_Format, 0x96, \ - "invalid character map (cmap) format" ) - FT_ERRORDEF_( Invalid_PPem, 0x97, \ - "invalid ppem value" ) - FT_ERRORDEF_( Invalid_Vert_Metrics, 0x98, \ - "invalid vertical metrics" ) - FT_ERRORDEF_( Could_Not_Find_Context, 0x99, \ - "could not find context" ) - FT_ERRORDEF_( Invalid_Post_Table_Format, 0x9A, \ - "invalid PostScript (post) table format" ) - FT_ERRORDEF_( Invalid_Post_Table, 0x9B, \ - "invalid PostScript (post) table" ) - - /* CFF, CID, and Type 1 errors */ - - FT_ERRORDEF_( Syntax_Error, 0xA0, \ - "opcode syntax error" ) - FT_ERRORDEF_( Stack_Underflow, 0xA1, \ - "argument stack underflow" ) - FT_ERRORDEF_( Ignore, 0xA2, \ - "ignore" ) - FT_ERRORDEF_( No_Unicode_Glyph_Name, 0xA3, \ - "no Unicode glyph name found" ) - - /* BDF errors */ - - FT_ERRORDEF_( Missing_Startfont_Field, 0xB0, \ - "`STARTFONT' field missing" ) - FT_ERRORDEF_( Missing_Font_Field, 0xB1, \ - "`FONT' field missing" ) - FT_ERRORDEF_( Missing_Size_Field, 0xB2, \ - "`SIZE' field missing" ) - FT_ERRORDEF_( Missing_Fontboundingbox_Field, 0xB3, \ - "`FONTBOUNDINGBOX' field missing" ) - FT_ERRORDEF_( Missing_Chars_Field, 0xB4, \ - "`CHARS' field missing" ) - FT_ERRORDEF_( Missing_Startchar_Field, 0xB5, \ - "`STARTCHAR' field missing" ) - FT_ERRORDEF_( Missing_Encoding_Field, 0xB6, \ - "`ENCODING' field missing" ) - FT_ERRORDEF_( Missing_Bbx_Field, 0xB7, \ - "`BBX' field missing" ) - FT_ERRORDEF_( Bbx_Too_Big, 0xB8, \ - "`BBX' too big" ) - FT_ERRORDEF_( Corrupted_Font_Header, 0xB9, \ - "Font header corrupted or missing fields" ) - FT_ERRORDEF_( Corrupted_Font_Glyphs, 0xBA, \ - "Font glyphs corrupted or missing fields" ) - -/* END */ - -/*** End of inlined file: fterrdef.h ***/ - - -#ifdef FT_ERROR_END_LIST - FT_ERROR_END_LIST -#endif - - /*******************************************************************/ - /*******************************************************************/ - /***** *****/ - /***** SIMPLE CLEANUP *****/ - /***** *****/ - /*******************************************************************/ - /*******************************************************************/ - -#ifdef FT_NEED_EXTERN_C - } -#endif - -#undef FT_ERROR_START_LIST -#undef FT_ERROR_END_LIST - -#undef FT_ERRORDEF -#undef FT_ERRORDEF_ -#undef FT_NOERRORDEF_ - -#undef FT_NEED_EXTERN_C -#undef FT_ERR_BASE - - /* FT_KEEP_ERR_PREFIX is needed for ftvalid.h */ -#ifndef FT_KEEP_ERR_PREFIX -#undef FT_ERR_PREFIX -#else -#undef FT_KEEP_ERR_PREFIX -#endif - -#endif /* __FTERRORS_H__ */ - -/* END */ - -/*** End of inlined file: fterrors.h ***/ - - -/*** Start of inlined file: fttypes.h ***/ -/* */ -/* fttypes.h */ -/* */ -/* FreeType simple types definitions (specification only). */ -/* */ -/* Copyright 1996-2002, 2004, 2006-2009, 2012 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - -#ifndef __FTTYPES_H__ -#define __FTTYPES_H__ - - -/*** Start of inlined file: ftsystem.h ***/ -/* */ -/* ftsystem.h */ -/* */ -/* FreeType low-level system interface definition (specification). */ -/* */ -/* Copyright 1996-2001, 2002, 2005, 2010 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - -#ifndef __FTSYSTEM_H__ -#define __FTSYSTEM_H__ - -FT_BEGIN_HEADER - - /*************************************************************************/ - /* */ - /* <Section> */ - /* system_interface */ - /* */ - /* <Title> */ - /* System Interface */ - /* */ - /* <Abstract> */ - /* How FreeType manages memory and i/o. */ - /* */ - /* <Description> */ - /* This section contains various definitions related to memory */ - /* management and i/o access. You need to understand this */ - /* information if you want to use a custom memory manager or you own */ - /* i/o streams. */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* M E M O R Y M A N A G E M E N T */ - /* */ - /*************************************************************************/ - - /************************************************************************* - * - * @type: - * FT_Memory - * - * @description: - * A handle to a given memory manager object, defined with an - * @FT_MemoryRec structure. - * - */ - typedef struct FT_MemoryRec_* FT_Memory; - - /************************************************************************* - * - * @functype: - * FT_Alloc_Func - * - * @description: - * A function used to allocate `size' bytes from `memory'. - * - * @input: - * memory :: - * A handle to the source memory manager. - * - * size :: - * The size in bytes to allocate. - * - * @return: - * Address of new memory block. 0~in case of failure. - * - */ - typedef void* - (*FT_Alloc_Func)( FT_Memory memory, - long size ); - - /************************************************************************* - * - * @functype: - * FT_Free_Func - * - * @description: - * A function used to release a given block of memory. - * - * @input: - * memory :: - * A handle to the source memory manager. - * - * block :: - * The address of the target memory block. - * - */ - typedef void - (*FT_Free_Func)( FT_Memory memory, - void* block ); - - /************************************************************************* - * - * @functype: - * FT_Realloc_Func - * - * @description: - * A function used to re-allocate a given block of memory. - * - * @input: - * memory :: - * A handle to the source memory manager. - * - * cur_size :: - * The block's current size in bytes. - * - * new_size :: - * The block's requested new size. - * - * block :: - * The block's current address. - * - * @return: - * New block address. 0~in case of memory shortage. - * - * @note: - * In case of error, the old block must still be available. - * - */ - typedef void* - (*FT_Realloc_Func)( FT_Memory memory, - long cur_size, - long new_size, - void* block ); - - /************************************************************************* - * - * @struct: - * FT_MemoryRec - * - * @description: - * A structure used to describe a given memory manager to FreeType~2. - * - * @fields: - * user :: - * A generic typeless pointer for user data. - * - * alloc :: - * A pointer type to an allocation function. - * - * free :: - * A pointer type to an memory freeing function. - * - * realloc :: - * A pointer type to a reallocation function. - * - */ - struct FT_MemoryRec_ - { - void* user; - FT_Alloc_Func alloc; - FT_Free_Func free; - FT_Realloc_Func realloc; - }; - - /*************************************************************************/ - /* */ - /* I / O M A N A G E M E N T */ - /* */ - /*************************************************************************/ - - /************************************************************************* - * - * @type: - * FT_Stream - * - * @description: - * A handle to an input stream. - * - */ - typedef struct FT_StreamRec_* FT_Stream; - - /************************************************************************* - * - * @struct: - * FT_StreamDesc - * - * @description: - * A union type used to store either a long or a pointer. This is used - * to store a file descriptor or a `FILE*' in an input stream. - * - */ - typedef union FT_StreamDesc_ - { - long value; - void* pointer; - - } FT_StreamDesc; - - /************************************************************************* - * - * @functype: - * FT_Stream_IoFunc - * - * @description: - * A function used to seek and read data from a given input stream. - * - * @input: - * stream :: - * A handle to the source stream. - * - * offset :: - * The offset of read in stream (always from start). - * - * buffer :: - * The address of the read buffer. - * - * count :: - * The number of bytes to read from the stream. - * - * @return: - * The number of bytes effectively read by the stream. - * - * @note: - * This function might be called to perform a seek or skip operation - * with a `count' of~0. A non-zero return value then indicates an - * error. - * - */ - typedef unsigned long - (*FT_Stream_IoFunc)( FT_Stream stream, - unsigned long offset, - unsigned char* buffer, - unsigned long count ); - - /************************************************************************* - * - * @functype: - * FT_Stream_CloseFunc - * - * @description: - * A function used to close a given input stream. - * - * @input: - * stream :: - * A handle to the target stream. - * - */ - typedef void - (*FT_Stream_CloseFunc)( FT_Stream stream ); - - /************************************************************************* - * - * @struct: - * FT_StreamRec - * - * @description: - * A structure used to describe an input stream. - * - * @input: - * base :: - * For memory-based streams, this is the address of the first stream - * byte in memory. This field should always be set to NULL for - * disk-based streams. - * - * size :: - * The stream size in bytes. - * - * pos :: - * The current position within the stream. - * - * descriptor :: - * This field is a union that can hold an integer or a pointer. It is - * used by stream implementations to store file descriptors or `FILE*' - * pointers. - * - * pathname :: - * This field is completely ignored by FreeType. However, it is often - * useful during debugging to use it to store the stream's filename - * (where available). - * - * read :: - * The stream's input function. - * - * close :: - * The stream's close function. - * - * memory :: - * The memory manager to use to preload frames. This is set - * internally by FreeType and shouldn't be touched by stream - * implementations. - * - * cursor :: - * This field is set and used internally by FreeType when parsing - * frames. - * - * limit :: - * This field is set and used internally by FreeType when parsing - * frames. - * - */ - typedef struct FT_StreamRec_ - { - unsigned char* base; - unsigned long size; - unsigned long pos; - - FT_StreamDesc descriptor; - FT_StreamDesc pathname; - FT_Stream_IoFunc read; - FT_Stream_CloseFunc close; - - FT_Memory memory; - unsigned char* cursor; - unsigned char* limit; - - } FT_StreamRec; - - /* */ - -FT_END_HEADER - -#endif /* __FTSYSTEM_H__ */ - -/* END */ - -/*** End of inlined file: ftsystem.h ***/ - - -/*** Start of inlined file: ftimage.h ***/ -/* */ -/* ftimage.h */ -/* */ -/* FreeType glyph image formats and default raster interface */ -/* (specification). */ -/* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - /*************************************************************************/ - /* */ - /* Note: A `raster' is simply a scan-line converter, used to render */ - /* FT_Outlines into FT_Bitmaps. */ - /* */ - /*************************************************************************/ - -#ifndef __FTIMAGE_H__ -#define __FTIMAGE_H__ - - /* _STANDALONE_ is from ftgrays.c */ -#ifndef _STANDALONE_ - -#endif - -FT_BEGIN_HEADER - - /*************************************************************************/ - /* */ - /* <Section> */ - /* basic_types */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Pos */ - /* */ - /* <Description> */ - /* The type FT_Pos is used to store vectorial coordinates. Depending */ - /* on the context, these can represent distances in integer font */ - /* units, or 16.16, or 26.6 fixed float pixel coordinates. */ - /* */ - typedef signed long FT_Pos; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Vector */ - /* */ - /* <Description> */ - /* A simple structure used to store a 2D vector; coordinates are of */ - /* the FT_Pos type. */ - /* */ - /* <Fields> */ - /* x :: The horizontal coordinate. */ - /* y :: The vertical coordinate. */ - /* */ - typedef struct FT_Vector_ - { - FT_Pos x; - FT_Pos y; - - } FT_Vector; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_BBox */ - /* */ - /* <Description> */ - /* A structure used to hold an outline's bounding box, i.e., the */ - /* coordinates of its extrema in the horizontal and vertical */ - /* directions. */ - /* */ - /* <Fields> */ - /* xMin :: The horizontal minimum (left-most). */ - /* */ - /* yMin :: The vertical minimum (bottom-most). */ - /* */ - /* xMax :: The horizontal maximum (right-most). */ - /* */ - /* yMax :: The vertical maximum (top-most). */ - /* */ - /* <Note> */ - /* The bounding box is specified with the coordinates of the lower */ - /* left and the upper right corner. In PostScript, those values are */ - /* often called (llx,lly) and (urx,ury), respectively. */ - /* */ - /* If `yMin' is negative, this value gives the glyph's descender. */ - /* Otherwise, the glyph doesn't descend below the baseline. */ - /* Similarly, if `ymax' is positive, this value gives the glyph's */ - /* ascender. */ - /* */ - /* `xMin' gives the horizontal distance from the glyph's origin to */ - /* the left edge of the glyph's bounding box. If `xMin' is negative, */ - /* the glyph extends to the left of the origin. */ - /* */ - typedef struct FT_BBox_ - { - FT_Pos xMin, yMin; - FT_Pos xMax, yMax; - - } FT_BBox; - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_Pixel_Mode */ - /* */ - /* <Description> */ - /* An enumeration type used to describe the format of pixels in a */ - /* given bitmap. Note that additional formats may be added in the */ - /* future. */ - /* */ - /* <Values> */ - /* FT_PIXEL_MODE_NONE :: */ - /* Value~0 is reserved. */ - /* */ - /* FT_PIXEL_MODE_MONO :: */ - /* A monochrome bitmap, using 1~bit per pixel. Note that pixels */ - /* are stored in most-significant order (MSB), which means that */ - /* the left-most pixel in a byte has value 128. */ - /* */ - /* FT_PIXEL_MODE_GRAY :: */ - /* An 8-bit bitmap, generally used to represent anti-aliased glyph */ - /* images. Each pixel is stored in one byte. Note that the number */ - /* of `gray' levels is stored in the `num_grays' field of the */ - /* @FT_Bitmap structure (it generally is 256). */ - /* */ - /* FT_PIXEL_MODE_GRAY2 :: */ - /* A 2-bit per pixel bitmap, used to represent embedded */ - /* anti-aliased bitmaps in font files according to the OpenType */ - /* specification. We haven't found a single font using this */ - /* format, however. */ - /* */ - /* FT_PIXEL_MODE_GRAY4 :: */ - /* A 4-bit per pixel bitmap, representing embedded anti-aliased */ - /* bitmaps in font files according to the OpenType specification. */ - /* We haven't found a single font using this format, however. */ - /* */ - /* FT_PIXEL_MODE_LCD :: */ - /* An 8-bit bitmap, representing RGB or BGR decimated glyph images */ - /* used for display on LCD displays; the bitmap is three times */ - /* wider than the original glyph image. See also */ - /* @FT_RENDER_MODE_LCD. */ - /* */ - /* FT_PIXEL_MODE_LCD_V :: */ - /* An 8-bit bitmap, representing RGB or BGR decimated glyph images */ - /* used for display on rotated LCD displays; the bitmap is three */ - /* times taller than the original glyph image. See also */ - /* @FT_RENDER_MODE_LCD_V. */ - /* */ - typedef enum FT_Pixel_Mode_ - { - FT_PIXEL_MODE_NONE = 0, - FT_PIXEL_MODE_MONO, - FT_PIXEL_MODE_GRAY, - FT_PIXEL_MODE_GRAY2, - FT_PIXEL_MODE_GRAY4, - FT_PIXEL_MODE_LCD, - FT_PIXEL_MODE_LCD_V, - - FT_PIXEL_MODE_MAX /* do not remove */ - - } FT_Pixel_Mode; - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* ft_pixel_mode_xxx */ - /* */ - /* <Description> */ - /* A list of deprecated constants. Use the corresponding */ - /* @FT_Pixel_Mode values instead. */ - /* */ - /* <Values> */ - /* ft_pixel_mode_none :: See @FT_PIXEL_MODE_NONE. */ - /* ft_pixel_mode_mono :: See @FT_PIXEL_MODE_MONO. */ - /* ft_pixel_mode_grays :: See @FT_PIXEL_MODE_GRAY. */ - /* ft_pixel_mode_pal2 :: See @FT_PIXEL_MODE_GRAY2. */ - /* ft_pixel_mode_pal4 :: See @FT_PIXEL_MODE_GRAY4. */ - /* */ -#define ft_pixel_mode_none FT_PIXEL_MODE_NONE -#define ft_pixel_mode_mono FT_PIXEL_MODE_MONO -#define ft_pixel_mode_grays FT_PIXEL_MODE_GRAY -#define ft_pixel_mode_pal2 FT_PIXEL_MODE_GRAY2 -#define ft_pixel_mode_pal4 FT_PIXEL_MODE_GRAY4 - - /* */ - -#if 0 - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_Palette_Mode */ - /* */ - /* <Description> */ - /* THIS TYPE IS DEPRECATED. DO NOT USE IT! */ - /* */ - /* An enumeration type to describe the format of a bitmap palette, */ - /* used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8. */ - /* */ - /* <Values> */ - /* ft_palette_mode_rgb :: The palette is an array of 3-byte RGB */ - /* records. */ - /* */ - /* ft_palette_mode_rgba :: The palette is an array of 4-byte RGBA */ - /* records. */ - /* */ - /* <Note> */ - /* As ft_pixel_mode_pal2, pal4 and pal8 are currently unused by */ - /* FreeType, these types are not handled by the library itself. */ - /* */ - typedef enum FT_Palette_Mode_ - { - ft_palette_mode_rgb = 0, - ft_palette_mode_rgba, - - ft_palette_mode_max /* do not remove */ - - } FT_Palette_Mode; - - /* */ - -#endif - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Bitmap */ - /* */ - /* <Description> */ - /* A structure used to describe a bitmap or pixmap to the raster. */ - /* Note that we now manage pixmaps of various depths through the */ - /* `pixel_mode' field. */ - /* */ - /* <Fields> */ - /* rows :: The number of bitmap rows. */ - /* */ - /* width :: The number of pixels in bitmap row. */ - /* */ - /* pitch :: The pitch's absolute value is the number of bytes */ - /* taken by one bitmap row, including padding. */ - /* However, the pitch is positive when the bitmap has */ - /* a `down' flow, and negative when it has an `up' */ - /* flow. In all cases, the pitch is an offset to add */ - /* to a bitmap pointer in order to go down one row. */ - /* */ - /* Note that `padding' means the alignment of a */ - /* bitmap to a byte border, and FreeType functions */ - /* normally align to the smallest possible integer */ - /* value. */ - /* */ - /* For the B/W rasterizer, `pitch' is always an even */ - /* number. */ - /* */ - /* To change the pitch of a bitmap (say, to make it a */ - /* multiple of 4), use @FT_Bitmap_Convert. */ - /* Alternatively, you might use callback functions to */ - /* directly render to the application's surface; see */ - /* the file `example2.cpp' in the tutorial for a */ - /* demonstration. */ - /* */ - /* buffer :: A typeless pointer to the bitmap buffer. This */ - /* value should be aligned on 32-bit boundaries in */ - /* most cases. */ - /* */ - /* num_grays :: This field is only used with */ - /* @FT_PIXEL_MODE_GRAY; it gives the number of gray */ - /* levels used in the bitmap. */ - /* */ - /* pixel_mode :: The pixel mode, i.e., how pixel bits are stored. */ - /* See @FT_Pixel_Mode for possible values. */ - /* */ - /* palette_mode :: This field is intended for paletted pixel modes; */ - /* it indicates how the palette is stored. Not */ - /* used currently. */ - /* */ - /* palette :: A typeless pointer to the bitmap palette; this */ - /* field is intended for paletted pixel modes. Not */ - /* used currently. */ - /* */ - /* <Note> */ - /* For now, the only pixel modes supported by FreeType are mono and */ - /* grays. However, drivers might be added in the future to support */ - /* more `colorful' options. */ - /* */ - typedef struct FT_Bitmap_ - { - int rows; - int width; - int pitch; - unsigned char* buffer; - short num_grays; - char pixel_mode; - char palette_mode; - void* palette; - - } FT_Bitmap; - - /*************************************************************************/ - /* */ - /* <Section> */ - /* outline_processing */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Outline */ - /* */ - /* <Description> */ - /* This structure is used to describe an outline to the scan-line */ - /* converter. */ - /* */ - /* <Fields> */ - /* n_contours :: The number of contours in the outline. */ - /* */ - /* n_points :: The number of points in the outline. */ - /* */ - /* points :: A pointer to an array of `n_points' @FT_Vector */ - /* elements, giving the outline's point coordinates. */ - /* */ - /* tags :: A pointer to an array of `n_points' chars, giving */ - /* each outline point's type. */ - /* */ - /* If bit~0 is unset, the point is `off' the curve, */ - /* i.e., a Bézier control point, while it is `on' if */ - /* set. */ - /* */ - /* Bit~1 is meaningful for `off' points only. If set, */ - /* it indicates a third-order Bézier arc control point; */ - /* and a second-order control point if unset. */ - /* */ - /* If bit~2 is set, bits 5-7 contain the drop-out mode */ - /* (as defined in the OpenType specification; the value */ - /* is the same as the argument to the SCANMODE */ - /* instruction). */ - /* */ - /* Bits 3 and~4 are reserved for internal purposes. */ - /* */ - /* contours :: An array of `n_contours' shorts, giving the end */ - /* point of each contour within the outline. For */ - /* example, the first contour is defined by the points */ - /* `0' to `contours[0]', the second one is defined by */ - /* the points `contours[0]+1' to `contours[1]', etc. */ - /* */ - /* flags :: A set of bit flags used to characterize the outline */ - /* and give hints to the scan-converter and hinter on */ - /* how to convert/grid-fit it. See @FT_OUTLINE_FLAGS. */ - /* */ - /* <Note> */ - /* The B/W rasterizer only checks bit~2 in the `tags' array for the */ - /* first point of each contour. The drop-out mode as given with */ - /* @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, and */ - /* @FT_OUTLINE_INCLUDE_STUBS in `flags' is then overridden. */ - /* */ - typedef struct FT_Outline_ - { - short n_contours; /* number of contours in glyph */ - short n_points; /* number of points in the glyph */ - - FT_Vector* points; /* the outline's points */ - char* tags; /* the points flags */ - short* contours; /* the contour end points */ - - int flags; /* outline masks */ - - } FT_Outline; - - /* Following limits must be consistent with */ - /* FT_Outline.{n_contours,n_points} */ -#define FT_OUTLINE_CONTOURS_MAX SHRT_MAX -#define FT_OUTLINE_POINTS_MAX SHRT_MAX - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_OUTLINE_FLAGS */ - /* */ - /* <Description> */ - /* A list of bit-field constants use for the flags in an outline's */ - /* `flags' field. */ - /* */ - /* <Values> */ - /* FT_OUTLINE_NONE :: */ - /* Value~0 is reserved. */ - /* */ - /* FT_OUTLINE_OWNER :: */ - /* If set, this flag indicates that the outline's field arrays */ - /* (i.e., `points', `flags', and `contours') are `owned' by the */ - /* outline object, and should thus be freed when it is destroyed. */ - /* */ - /* FT_OUTLINE_EVEN_ODD_FILL :: */ - /* By default, outlines are filled using the non-zero winding rule. */ - /* If set to 1, the outline will be filled using the even-odd fill */ - /* rule (only works with the smooth rasterizer). */ - /* */ - /* FT_OUTLINE_REVERSE_FILL :: */ - /* By default, outside contours of an outline are oriented in */ - /* clock-wise direction, as defined in the TrueType specification. */ - /* This flag is set if the outline uses the opposite direction */ - /* (typically for Type~1 fonts). This flag is ignored by the scan */ - /* converter. */ - /* */ - /* FT_OUTLINE_IGNORE_DROPOUTS :: */ - /* By default, the scan converter will try to detect drop-outs in */ - /* an outline and correct the glyph bitmap to ensure consistent */ - /* shape continuity. If set, this flag hints the scan-line */ - /* converter to ignore such cases. See below for more information. */ - /* */ - /* FT_OUTLINE_SMART_DROPOUTS :: */ - /* Select smart dropout control. If unset, use simple dropout */ - /* control. Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See */ - /* below for more information. */ - /* */ - /* FT_OUTLINE_INCLUDE_STUBS :: */ - /* If set, turn pixels on for `stubs', otherwise exclude them. */ - /* Ignored if @FT_OUTLINE_IGNORE_DROPOUTS is set. See below for */ - /* more information. */ - /* */ - /* FT_OUTLINE_HIGH_PRECISION :: */ - /* This flag indicates that the scan-line converter should try to */ - /* convert this outline to bitmaps with the highest possible */ - /* quality. It is typically set for small character sizes. Note */ - /* that this is only a hint that might be completely ignored by a */ - /* given scan-converter. */ - /* */ - /* FT_OUTLINE_SINGLE_PASS :: */ - /* This flag is set to force a given scan-converter to only use a */ - /* single pass over the outline to render a bitmap glyph image. */ - /* Normally, it is set for very large character sizes. It is only */ - /* a hint that might be completely ignored by a given */ - /* scan-converter. */ - /* */ - /* <Note> */ - /* The flags @FT_OUTLINE_IGNORE_DROPOUTS, @FT_OUTLINE_SMART_DROPOUTS, */ - /* and @FT_OUTLINE_INCLUDE_STUBS are ignored by the smooth */ - /* rasterizer. */ - /* */ - /* There exists a second mechanism to pass the drop-out mode to the */ - /* B/W rasterizer; see the `tags' field in @FT_Outline. */ - /* */ - /* Please refer to the description of the `SCANTYPE' instruction in */ - /* the OpenType specification (in file `ttinst1.doc') how simple */ - /* drop-outs, smart drop-outs, and stubs are defined. */ - /* */ -#define FT_OUTLINE_NONE 0x0 -#define FT_OUTLINE_OWNER 0x1 -#define FT_OUTLINE_EVEN_ODD_FILL 0x2 -#define FT_OUTLINE_REVERSE_FILL 0x4 -#define FT_OUTLINE_IGNORE_DROPOUTS 0x8 -#define FT_OUTLINE_SMART_DROPOUTS 0x10 -#define FT_OUTLINE_INCLUDE_STUBS 0x20 - -#define FT_OUTLINE_HIGH_PRECISION 0x100 -#define FT_OUTLINE_SINGLE_PASS 0x200 - - /************************************************************************* - * - * @enum: - * ft_outline_flags - * - * @description: - * These constants are deprecated. Please use the corresponding - * @FT_OUTLINE_FLAGS values. - * - * @values: - * ft_outline_none :: See @FT_OUTLINE_NONE. - * ft_outline_owner :: See @FT_OUTLINE_OWNER. - * ft_outline_even_odd_fill :: See @FT_OUTLINE_EVEN_ODD_FILL. - * ft_outline_reverse_fill :: See @FT_OUTLINE_REVERSE_FILL. - * ft_outline_ignore_dropouts :: See @FT_OUTLINE_IGNORE_DROPOUTS. - * ft_outline_high_precision :: See @FT_OUTLINE_HIGH_PRECISION. - * ft_outline_single_pass :: See @FT_OUTLINE_SINGLE_PASS. - */ -#define ft_outline_none FT_OUTLINE_NONE -#define ft_outline_owner FT_OUTLINE_OWNER -#define ft_outline_even_odd_fill FT_OUTLINE_EVEN_ODD_FILL -#define ft_outline_reverse_fill FT_OUTLINE_REVERSE_FILL -#define ft_outline_ignore_dropouts FT_OUTLINE_IGNORE_DROPOUTS -#define ft_outline_high_precision FT_OUTLINE_HIGH_PRECISION -#define ft_outline_single_pass FT_OUTLINE_SINGLE_PASS - - /* */ - -#define FT_CURVE_TAG( flag ) ( flag & 3 ) - -#define FT_CURVE_TAG_ON 1 -#define FT_CURVE_TAG_CONIC 0 -#define FT_CURVE_TAG_CUBIC 2 - -#define FT_CURVE_TAG_HAS_SCANMODE 4 - -#define FT_CURVE_TAG_TOUCH_X 8 /* reserved for the TrueType hinter */ -#define FT_CURVE_TAG_TOUCH_Y 16 /* reserved for the TrueType hinter */ - -#define FT_CURVE_TAG_TOUCH_BOTH ( FT_CURVE_TAG_TOUCH_X | \ - FT_CURVE_TAG_TOUCH_Y ) - -#define FT_Curve_Tag_On FT_CURVE_TAG_ON -#define FT_Curve_Tag_Conic FT_CURVE_TAG_CONIC -#define FT_Curve_Tag_Cubic FT_CURVE_TAG_CUBIC -#define FT_Curve_Tag_Touch_X FT_CURVE_TAG_TOUCH_X -#define FT_Curve_Tag_Touch_Y FT_CURVE_TAG_TOUCH_Y - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Outline_MoveToFunc */ - /* */ - /* <Description> */ - /* A function pointer type used to describe the signature of a `move */ - /* to' function during outline walking/decomposition. */ - /* */ - /* A `move to' is emitted to start a new contour in an outline. */ - /* */ - /* <Input> */ - /* to :: A pointer to the target point of the `move to'. */ - /* */ - /* user :: A typeless pointer which is passed from the caller of the */ - /* decomposition function. */ - /* */ - /* <Return> */ - /* Error code. 0~means success. */ - /* */ - typedef int - (*FT_Outline_MoveToFunc)( const FT_Vector* to, - void* user ); - -#define FT_Outline_MoveTo_Func FT_Outline_MoveToFunc - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Outline_LineToFunc */ - /* */ - /* <Description> */ - /* A function pointer type used to describe the signature of a `line */ - /* to' function during outline walking/decomposition. */ - /* */ - /* A `line to' is emitted to indicate a segment in the outline. */ - /* */ - /* <Input> */ - /* to :: A pointer to the target point of the `line to'. */ - /* */ - /* user :: A typeless pointer which is passed from the caller of the */ - /* decomposition function. */ - /* */ - /* <Return> */ - /* Error code. 0~means success. */ - /* */ - typedef int - (*FT_Outline_LineToFunc)( const FT_Vector* to, - void* user ); - -#define FT_Outline_LineTo_Func FT_Outline_LineToFunc - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Outline_ConicToFunc */ - /* */ - /* <Description> */ - /* A function pointer type used to describe the signature of a `conic */ - /* to' function during outline walking or decomposition. */ - /* */ - /* A `conic to' is emitted to indicate a second-order Bézier arc in */ - /* the outline. */ - /* */ - /* <Input> */ - /* control :: An intermediate control point between the last position */ - /* and the new target in `to'. */ - /* */ - /* to :: A pointer to the target end point of the conic arc. */ - /* */ - /* user :: A typeless pointer which is passed from the caller of */ - /* the decomposition function. */ - /* */ - /* <Return> */ - /* Error code. 0~means success. */ - /* */ - typedef int - (*FT_Outline_ConicToFunc)( const FT_Vector* control, - const FT_Vector* to, - void* user ); - -#define FT_Outline_ConicTo_Func FT_Outline_ConicToFunc - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Outline_CubicToFunc */ - /* */ - /* <Description> */ - /* A function pointer type used to describe the signature of a `cubic */ - /* to' function during outline walking or decomposition. */ - /* */ - /* A `cubic to' is emitted to indicate a third-order Bézier arc. */ - /* */ - /* <Input> */ - /* control1 :: A pointer to the first Bézier control point. */ - /* */ - /* control2 :: A pointer to the second Bézier control point. */ - /* */ - /* to :: A pointer to the target end point. */ - /* */ - /* user :: A typeless pointer which is passed from the caller of */ - /* the decomposition function. */ - /* */ - /* <Return> */ - /* Error code. 0~means success. */ - /* */ - typedef int - (*FT_Outline_CubicToFunc)( const FT_Vector* control1, - const FT_Vector* control2, - const FT_Vector* to, - void* user ); - -#define FT_Outline_CubicTo_Func FT_Outline_CubicToFunc - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Outline_Funcs */ - /* */ - /* <Description> */ - /* A structure to hold various function pointers used during outline */ - /* decomposition in order to emit segments, conic, and cubic Béziers. */ - /* */ - /* <Fields> */ - /* move_to :: The `move to' emitter. */ - /* */ - /* line_to :: The segment emitter. */ - /* */ - /* conic_to :: The second-order Bézier arc emitter. */ - /* */ - /* cubic_to :: The third-order Bézier arc emitter. */ - /* */ - /* shift :: The shift that is applied to coordinates before they */ - /* are sent to the emitter. */ - /* */ - /* delta :: The delta that is applied to coordinates before they */ - /* are sent to the emitter, but after the shift. */ - /* */ - /* <Note> */ - /* The point coordinates sent to the emitters are the transformed */ - /* version of the original coordinates (this is important for high */ - /* accuracy during scan-conversion). The transformation is simple: */ - /* */ - /* { */ - /* x' = (x << shift) - delta */ - /* y' = (x << shift) - delta */ - /* } */ - /* */ - /* Set the values of `shift' and `delta' to~0 to get the original */ - /* point coordinates. */ - /* */ - typedef struct FT_Outline_Funcs_ - { - FT_Outline_MoveToFunc move_to; - FT_Outline_LineToFunc line_to; - FT_Outline_ConicToFunc conic_to; - FT_Outline_CubicToFunc cubic_to; - - int shift; - FT_Pos delta; - - } FT_Outline_Funcs; - - /*************************************************************************/ - /* */ - /* <Section> */ - /* basic_types */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Macro> */ - /* FT_IMAGE_TAG */ - /* */ - /* <Description> */ - /* This macro converts four-letter tags to an unsigned long type. */ - /* */ - /* <Note> */ - /* Since many 16-bit compilers don't like 32-bit enumerations, you */ - /* should redefine this macro in case of problems to something like */ - /* this: */ - /* */ - /* { */ - /* #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value */ - /* } */ - /* */ - /* to get a simple enumeration without assigning special numbers. */ - /* */ -#ifndef FT_IMAGE_TAG -#define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) \ - value = ( ( (unsigned long)_x1 << 24 ) | \ - ( (unsigned long)_x2 << 16 ) | \ - ( (unsigned long)_x3 << 8 ) | \ - (unsigned long)_x4 ) -#endif /* FT_IMAGE_TAG */ - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_Glyph_Format */ - /* */ - /* <Description> */ - /* An enumeration type used to describe the format of a given glyph */ - /* image. Note that this version of FreeType only supports two image */ - /* formats, even though future font drivers will be able to register */ - /* their own format. */ - /* */ - /* <Values> */ - /* FT_GLYPH_FORMAT_NONE :: */ - /* The value~0 is reserved. */ - /* */ - /* FT_GLYPH_FORMAT_COMPOSITE :: */ - /* The glyph image is a composite of several other images. This */ - /* format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to */ - /* report compound glyphs (like accented characters). */ - /* */ - /* FT_GLYPH_FORMAT_BITMAP :: */ - /* The glyph image is a bitmap, and can be described as an */ - /* @FT_Bitmap. You generally need to access the `bitmap' field of */ - /* the @FT_GlyphSlotRec structure to read it. */ - /* */ - /* FT_GLYPH_FORMAT_OUTLINE :: */ - /* The glyph image is a vectorial outline made of line segments */ - /* and Bézier arcs; it can be described as an @FT_Outline; you */ - /* generally want to access the `outline' field of the */ - /* @FT_GlyphSlotRec structure to read it. */ - /* */ - /* FT_GLYPH_FORMAT_PLOTTER :: */ - /* The glyph image is a vectorial path with no inside and outside */ - /* contours. Some Type~1 fonts, like those in the Hershey family, */ - /* contain glyphs in this format. These are described as */ - /* @FT_Outline, but FreeType isn't currently capable of rendering */ - /* them correctly. */ - /* */ - typedef enum FT_Glyph_Format_ - { - FT_IMAGE_TAG( FT_GLYPH_FORMAT_NONE, 0, 0, 0, 0 ), - - FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ), - FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP, 'b', 'i', 't', 's' ), - FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE, 'o', 'u', 't', 'l' ), - FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't' ) - - } FT_Glyph_Format; - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* ft_glyph_format_xxx */ - /* */ - /* <Description> */ - /* A list of deprecated constants. Use the corresponding */ - /* @FT_Glyph_Format values instead. */ - /* */ - /* <Values> */ - /* ft_glyph_format_none :: See @FT_GLYPH_FORMAT_NONE. */ - /* ft_glyph_format_composite :: See @FT_GLYPH_FORMAT_COMPOSITE. */ - /* ft_glyph_format_bitmap :: See @FT_GLYPH_FORMAT_BITMAP. */ - /* ft_glyph_format_outline :: See @FT_GLYPH_FORMAT_OUTLINE. */ - /* ft_glyph_format_plotter :: See @FT_GLYPH_FORMAT_PLOTTER. */ - /* */ -#define ft_glyph_format_none FT_GLYPH_FORMAT_NONE -#define ft_glyph_format_composite FT_GLYPH_FORMAT_COMPOSITE -#define ft_glyph_format_bitmap FT_GLYPH_FORMAT_BITMAP -#define ft_glyph_format_outline FT_GLYPH_FORMAT_OUTLINE -#define ft_glyph_format_plotter FT_GLYPH_FORMAT_PLOTTER - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** R A S T E R D E F I N I T I O N S *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* A raster is a scan converter, in charge of rendering an outline into */ - /* a a bitmap. This section contains the public API for rasters. */ - /* */ - /* Note that in FreeType 2, all rasters are now encapsulated within */ - /* specific modules called `renderers'. See `freetype/ftrender.h' for */ - /* more details on renderers. */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Section> */ - /* raster */ - /* */ - /* <Title> */ - /* Scanline Converter */ - /* */ - /* <Abstract> */ - /* How vectorial outlines are converted into bitmaps and pixmaps. */ - /* */ - /* <Description> */ - /* This section contains technical definitions. */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Raster */ - /* */ - /* <Description> */ - /* A handle (pointer) to a raster object. Each object can be used */ - /* independently to convert an outline into a bitmap or pixmap. */ - /* */ - typedef struct FT_RasterRec_* FT_Raster; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Span */ - /* */ - /* <Description> */ - /* A structure used to model a single span of gray (or black) pixels */ - /* when rendering a monochrome or anti-aliased bitmap. */ - /* */ - /* <Fields> */ - /* x :: The span's horizontal start position. */ - /* */ - /* len :: The span's length in pixels. */ - /* */ - /* coverage :: The span color/coverage, ranging from 0 (background) */ - /* to 255 (foreground). Only used for anti-aliased */ - /* rendering. */ - /* */ - /* <Note> */ - /* This structure is used by the span drawing callback type named */ - /* @FT_SpanFunc which takes the y~coordinate of the span as a */ - /* a parameter. */ - /* */ - /* The coverage value is always between 0 and 255. If you want less */ - /* gray values, the callback function has to reduce them. */ - /* */ - typedef struct FT_Span_ - { - short x; - unsigned short len; - unsigned char coverage; - - } FT_Span; - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_SpanFunc */ - /* */ - /* <Description> */ - /* A function used as a call-back by the anti-aliased renderer in */ - /* order to let client applications draw themselves the gray pixel */ - /* spans on each scan line. */ - /* */ - /* <Input> */ - /* y :: The scanline's y~coordinate. */ - /* */ - /* count :: The number of spans to draw on this scanline. */ - /* */ - /* spans :: A table of `count' spans to draw on the scanline. */ - /* */ - /* user :: User-supplied data that is passed to the callback. */ - /* */ - /* <Note> */ - /* This callback allows client applications to directly render the */ - /* gray spans of the anti-aliased bitmap to any kind of surfaces. */ - /* */ - /* This can be used to write anti-aliased outlines directly to a */ - /* given background bitmap, and even perform translucency. */ - /* */ - /* Note that the `count' field cannot be greater than a fixed value */ - /* defined by the `FT_MAX_GRAY_SPANS' configuration macro in */ - /* `ftoption.h'. By default, this value is set to~32, which means */ - /* that if there are more than 32~spans on a given scanline, the */ - /* callback is called several times with the same `y' parameter in */ - /* order to draw all callbacks. */ - /* */ - /* Otherwise, the callback is only called once per scan-line, and */ - /* only for those scanlines that do have `gray' pixels on them. */ - /* */ - typedef void - (*FT_SpanFunc)( int y, - int count, - const FT_Span* spans, - void* user ); - -#define FT_Raster_Span_Func FT_SpanFunc - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Raster_BitTest_Func */ - /* */ - /* <Description> */ - /* THIS TYPE IS DEPRECATED. DO NOT USE IT. */ - /* */ - /* A function used as a call-back by the monochrome scan-converter */ - /* to test whether a given target pixel is already set to the drawing */ - /* `color'. These tests are crucial to implement drop-out control */ - /* per-se the TrueType spec. */ - /* */ - /* <Input> */ - /* y :: The pixel's y~coordinate. */ - /* */ - /* x :: The pixel's x~coordinate. */ - /* */ - /* user :: User-supplied data that is passed to the callback. */ - /* */ - /* <Return> */ - /* 1~if the pixel is `set', 0~otherwise. */ - /* */ - typedef int - (*FT_Raster_BitTest_Func)( int y, - int x, - void* user ); - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Raster_BitSet_Func */ - /* */ - /* <Description> */ - /* THIS TYPE IS DEPRECATED. DO NOT USE IT. */ - /* */ - /* A function used as a call-back by the monochrome scan-converter */ - /* to set an individual target pixel. This is crucial to implement */ - /* drop-out control according to the TrueType specification. */ - /* */ - /* <Input> */ - /* y :: The pixel's y~coordinate. */ - /* */ - /* x :: The pixel's x~coordinate. */ - /* */ - /* user :: User-supplied data that is passed to the callback. */ - /* */ - /* <Return> */ - /* 1~if the pixel is `set', 0~otherwise. */ - /* */ - typedef void - (*FT_Raster_BitSet_Func)( int y, - int x, - void* user ); - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_RASTER_FLAG_XXX */ - /* */ - /* <Description> */ - /* A list of bit flag constants as used in the `flags' field of a */ - /* @FT_Raster_Params structure. */ - /* */ - /* <Values> */ - /* FT_RASTER_FLAG_DEFAULT :: This value is 0. */ - /* */ - /* FT_RASTER_FLAG_AA :: This flag is set to indicate that an */ - /* anti-aliased glyph image should be */ - /* generated. Otherwise, it will be */ - /* monochrome (1-bit). */ - /* */ - /* FT_RASTER_FLAG_DIRECT :: This flag is set to indicate direct */ - /* rendering. In this mode, client */ - /* applications must provide their own span */ - /* callback. This lets them directly */ - /* draw or compose over an existing bitmap. */ - /* If this bit is not set, the target */ - /* pixmap's buffer _must_ be zeroed before */ - /* rendering. */ - /* */ - /* Note that for now, direct rendering is */ - /* only possible with anti-aliased glyphs. */ - /* */ - /* FT_RASTER_FLAG_CLIP :: This flag is only used in direct */ - /* rendering mode. If set, the output will */ - /* be clipped to a box specified in the */ - /* `clip_box' field of the */ - /* @FT_Raster_Params structure. */ - /* */ - /* Note that by default, the glyph bitmap */ - /* is clipped to the target pixmap, except */ - /* in direct rendering mode where all spans */ - /* are generated if no clipping box is set. */ - /* */ -#define FT_RASTER_FLAG_DEFAULT 0x0 -#define FT_RASTER_FLAG_AA 0x1 -#define FT_RASTER_FLAG_DIRECT 0x2 -#define FT_RASTER_FLAG_CLIP 0x4 - - /* deprecated */ -#define ft_raster_flag_default FT_RASTER_FLAG_DEFAULT -#define ft_raster_flag_aa FT_RASTER_FLAG_AA -#define ft_raster_flag_direct FT_RASTER_FLAG_DIRECT -#define ft_raster_flag_clip FT_RASTER_FLAG_CLIP - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Raster_Params */ - /* */ - /* <Description> */ - /* A structure to hold the arguments used by a raster's render */ - /* function. */ - /* */ - /* <Fields> */ - /* target :: The target bitmap. */ - /* */ - /* source :: A pointer to the source glyph image (e.g., an */ - /* @FT_Outline). */ - /* */ - /* flags :: The rendering flags. */ - /* */ - /* gray_spans :: The gray span drawing callback. */ - /* */ - /* black_spans :: The black span drawing callback. UNIMPLEMENTED! */ - /* */ - /* bit_test :: The bit test callback. UNIMPLEMENTED! */ - /* */ - /* bit_set :: The bit set callback. UNIMPLEMENTED! */ - /* */ - /* user :: User-supplied data that is passed to each drawing */ - /* callback. */ - /* */ - /* clip_box :: An optional clipping box. It is only used in */ - /* direct rendering mode. Note that coordinates here */ - /* should be expressed in _integer_ pixels (and not in */ - /* 26.6 fixed-point units). */ - /* */ - /* <Note> */ - /* An anti-aliased glyph bitmap is drawn if the @FT_RASTER_FLAG_AA */ - /* bit flag is set in the `flags' field, otherwise a monochrome */ - /* bitmap is generated. */ - /* */ - /* If the @FT_RASTER_FLAG_DIRECT bit flag is set in `flags', the */ - /* raster will call the `gray_spans' callback to draw gray pixel */ - /* spans, in the case of an aa glyph bitmap, it will call */ - /* `black_spans', and `bit_test' and `bit_set' in the case of a */ - /* monochrome bitmap. This allows direct composition over a */ - /* pre-existing bitmap through user-provided callbacks to perform the */ - /* span drawing/composition. */ - /* */ - /* Note that the `bit_test' and `bit_set' callbacks are required when */ - /* rendering a monochrome bitmap, as they are crucial to implement */ - /* correct drop-out control as defined in the TrueType specification. */ - /* */ - typedef struct FT_Raster_Params_ - { - const FT_Bitmap* target; - const void* source; - int flags; - FT_SpanFunc gray_spans; - FT_SpanFunc black_spans; /* doesn't work! */ - FT_Raster_BitTest_Func bit_test; /* doesn't work! */ - FT_Raster_BitSet_Func bit_set; /* doesn't work! */ - void* user; - FT_BBox clip_box; - - } FT_Raster_Params; - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Raster_NewFunc */ - /* */ - /* <Description> */ - /* A function used to create a new raster object. */ - /* */ - /* <Input> */ - /* memory :: A handle to the memory allocator. */ - /* */ - /* <Output> */ - /* raster :: A handle to the new raster object. */ - /* */ - /* <Return> */ - /* Error code. 0~means success. */ - /* */ - /* <Note> */ - /* The `memory' parameter is a typeless pointer in order to avoid */ - /* un-wanted dependencies on the rest of the FreeType code. In */ - /* practice, it is an @FT_Memory object, i.e., a handle to the */ - /* standard FreeType memory allocator. However, this field can be */ - /* completely ignored by a given raster implementation. */ - /* */ - typedef int - (*FT_Raster_NewFunc)( void* memory, - FT_Raster* raster ); - -#define FT_Raster_New_Func FT_Raster_NewFunc - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Raster_DoneFunc */ - /* */ - /* <Description> */ - /* A function used to destroy a given raster object. */ - /* */ - /* <Input> */ - /* raster :: A handle to the raster object. */ - /* */ - typedef void - (*FT_Raster_DoneFunc)( FT_Raster raster ); - -#define FT_Raster_Done_Func FT_Raster_DoneFunc - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Raster_ResetFunc */ - /* */ - /* <Description> */ - /* FreeType provides an area of memory called the `render pool', */ - /* available to all registered rasters. This pool can be freely used */ - /* during a given scan-conversion but is shared by all rasters. Its */ - /* content is thus transient. */ - /* */ - /* This function is called each time the render pool changes, or just */ - /* after a new raster object is created. */ - /* */ - /* <Input> */ - /* raster :: A handle to the new raster object. */ - /* */ - /* pool_base :: The address in memory of the render pool. */ - /* */ - /* pool_size :: The size in bytes of the render pool. */ - /* */ - /* <Note> */ - /* Rasters can ignore the render pool and rely on dynamic memory */ - /* allocation if they want to (a handle to the memory allocator is */ - /* passed to the raster constructor). However, this is not */ - /* recommended for efficiency purposes. */ - /* */ - typedef void - (*FT_Raster_ResetFunc)( FT_Raster raster, - unsigned char* pool_base, - unsigned long pool_size ); - -#define FT_Raster_Reset_Func FT_Raster_ResetFunc - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Raster_SetModeFunc */ - /* */ - /* <Description> */ - /* This function is a generic facility to change modes or attributes */ - /* in a given raster. This can be used for debugging purposes, or */ - /* simply to allow implementation-specific `features' in a given */ - /* raster module. */ - /* */ - /* <Input> */ - /* raster :: A handle to the new raster object. */ - /* */ - /* mode :: A 4-byte tag used to name the mode or property. */ - /* */ - /* args :: A pointer to the new mode/property to use. */ - /* */ - typedef int - (*FT_Raster_SetModeFunc)( FT_Raster raster, - unsigned long mode, - void* args ); - -#define FT_Raster_Set_Mode_Func FT_Raster_SetModeFunc - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Raster_RenderFunc */ - /* */ - /* <Description> */ - /* Invoke a given raster to scan-convert a given glyph image into a */ - /* target bitmap. */ - /* */ - /* <Input> */ - /* raster :: A handle to the raster object. */ - /* */ - /* params :: A pointer to an @FT_Raster_Params structure used to */ - /* store the rendering parameters. */ - /* */ - /* <Return> */ - /* Error code. 0~means success. */ - /* */ - /* <Note> */ - /* The exact format of the source image depends on the raster's glyph */ - /* format defined in its @FT_Raster_Funcs structure. It can be an */ - /* @FT_Outline or anything else in order to support a large array of */ - /* glyph formats. */ - /* */ - /* Note also that the render function can fail and return a */ - /* `FT_Err_Unimplemented_Feature' error code if the raster used does */ - /* not support direct composition. */ - /* */ - /* XXX: For now, the standard raster doesn't support direct */ - /* composition but this should change for the final release (see */ - /* the files `demos/src/ftgrays.c' and `demos/src/ftgrays2.c' */ - /* for examples of distinct implementations which support direct */ - /* composition). */ - /* */ - typedef int - (*FT_Raster_RenderFunc)( FT_Raster raster, - const FT_Raster_Params* params ); - -#define FT_Raster_Render_Func FT_Raster_RenderFunc - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Raster_Funcs */ - /* */ - /* <Description> */ - /* A structure used to describe a given raster class to the library. */ - /* */ - /* <Fields> */ - /* glyph_format :: The supported glyph format for this raster. */ - /* */ - /* raster_new :: The raster constructor. */ - /* */ - /* raster_reset :: Used to reset the render pool within the raster. */ - /* */ - /* raster_render :: A function to render a glyph into a given bitmap. */ - /* */ - /* raster_done :: The raster destructor. */ - /* */ - typedef struct FT_Raster_Funcs_ - { - FT_Glyph_Format glyph_format; - FT_Raster_NewFunc raster_new; - FT_Raster_ResetFunc raster_reset; - FT_Raster_SetModeFunc raster_set_mode; - FT_Raster_RenderFunc raster_render; - FT_Raster_DoneFunc raster_done; - - } FT_Raster_Funcs; - - /* */ - -FT_END_HEADER - -#endif /* __FTIMAGE_H__ */ - -/* END */ - -/* Local Variables: */ -/* coding: utf-8 */ -/* End: */ - -/*** End of inlined file: ftimage.h ***/ - -#include <stddef.h> - -FT_BEGIN_HEADER - - /*************************************************************************/ - /* */ - /* <Section> */ - /* basic_types */ - /* */ - /* <Title> */ - /* Basic Data Types */ - /* */ - /* <Abstract> */ - /* The basic data types defined by the library. */ - /* */ - /* <Description> */ - /* This section contains the basic data types defined by FreeType~2, */ - /* ranging from simple scalar types to bitmap descriptors. More */ - /* font-specific structures are defined in a different section. */ - /* */ - /* <Order> */ - /* FT_Byte */ - /* FT_Bytes */ - /* FT_Char */ - /* FT_Int */ - /* FT_UInt */ - /* FT_Int16 */ - /* FT_UInt16 */ - /* FT_Int32 */ - /* FT_UInt32 */ - /* FT_Short */ - /* FT_UShort */ - /* FT_Long */ - /* FT_ULong */ - /* FT_Bool */ - /* FT_Offset */ - /* FT_PtrDist */ - /* FT_String */ - /* FT_Tag */ - /* FT_Error */ - /* FT_Fixed */ - /* FT_Pointer */ - /* FT_Pos */ - /* FT_Vector */ - /* FT_BBox */ - /* FT_Matrix */ - /* FT_FWord */ - /* FT_UFWord */ - /* FT_F2Dot14 */ - /* FT_UnitVector */ - /* FT_F26Dot6 */ - /* */ - /* */ - /* FT_Generic */ - /* FT_Generic_Finalizer */ - /* */ - /* FT_Bitmap */ - /* FT_Pixel_Mode */ - /* FT_Palette_Mode */ - /* FT_Glyph_Format */ - /* FT_IMAGE_TAG */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Bool */ - /* */ - /* <Description> */ - /* A typedef of unsigned char, used for simple booleans. As usual, */ - /* values 1 and~0 represent true and false, respectively. */ - /* */ - typedef unsigned char FT_Bool; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_FWord */ - /* */ - /* <Description> */ - /* A signed 16-bit integer used to store a distance in original font */ - /* units. */ - /* */ - typedef signed short FT_FWord; /* distance in FUnits */ - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_UFWord */ - /* */ - /* <Description> */ - /* An unsigned 16-bit integer used to store a distance in original */ - /* font units. */ - /* */ - typedef unsigned short FT_UFWord; /* unsigned distance */ - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Char */ - /* */ - /* <Description> */ - /* A simple typedef for the _signed_ char type. */ - /* */ - typedef signed char FT_Char; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Byte */ - /* */ - /* <Description> */ - /* A simple typedef for the _unsigned_ char type. */ - /* */ - typedef unsigned char FT_Byte; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Bytes */ - /* */ - /* <Description> */ - /* A typedef for constant memory areas. */ - /* */ - typedef const FT_Byte* FT_Bytes; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Tag */ - /* */ - /* <Description> */ - /* A typedef for 32-bit tags (as used in the SFNT format). */ - /* */ - typedef FT_UInt32 FT_Tag; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_String */ - /* */ - /* <Description> */ - /* A simple typedef for the char type, usually used for strings. */ - /* */ - typedef char FT_String; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Short */ - /* */ - /* <Description> */ - /* A typedef for signed short. */ - /* */ - typedef signed short FT_Short; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_UShort */ - /* */ - /* <Description> */ - /* A typedef for unsigned short. */ - /* */ - typedef unsigned short FT_UShort; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Int */ - /* */ - /* <Description> */ - /* A typedef for the int type. */ - /* */ - typedef signed int FT_Int; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_UInt */ - /* */ - /* <Description> */ - /* A typedef for the unsigned int type. */ - /* */ - typedef unsigned int FT_UInt; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Long */ - /* */ - /* <Description> */ - /* A typedef for signed long. */ - /* */ - typedef signed long FT_Long; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_ULong */ - /* */ - /* <Description> */ - /* A typedef for unsigned long. */ - /* */ - typedef unsigned long FT_ULong; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_F2Dot14 */ - /* */ - /* <Description> */ - /* A signed 2.14 fixed float type used for unit vectors. */ - /* */ - typedef signed short FT_F2Dot14; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_F26Dot6 */ - /* */ - /* <Description> */ - /* A signed 26.6 fixed float type used for vectorial pixel */ - /* coordinates. */ - /* */ - typedef signed long FT_F26Dot6; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Fixed */ - /* */ - /* <Description> */ - /* This type is used to store 16.16 fixed float values, like scaling */ - /* values or matrix coefficients. */ - /* */ - typedef signed long FT_Fixed; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Error */ - /* */ - /* <Description> */ - /* The FreeType error code type. A value of~0 is always interpreted */ - /* as a successful operation. */ - /* */ - typedef int FT_Error; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Pointer */ - /* */ - /* <Description> */ - /* A simple typedef for a typeless pointer. */ - /* */ - typedef void* FT_Pointer; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Offset */ - /* */ - /* <Description> */ - /* This is equivalent to the ANSI~C `size_t' type, i.e., the largest */ - /* _unsigned_ integer type used to express a file size or position, */ - /* or a memory block size. */ - /* */ - typedef size_t FT_Offset; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_PtrDist */ - /* */ - /* <Description> */ - /* This is equivalent to the ANSI~C `ptrdiff_t' type, i.e., the */ - /* largest _signed_ integer type used to express the distance */ - /* between two pointers. */ - /* */ - typedef ft_ptrdiff_t FT_PtrDist; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_UnitVector */ - /* */ - /* <Description> */ - /* A simple structure used to store a 2D vector unit vector. Uses */ - /* FT_F2Dot14 types. */ - /* */ - /* <Fields> */ - /* x :: Horizontal coordinate. */ - /* */ - /* y :: Vertical coordinate. */ - /* */ - typedef struct FT_UnitVector_ - { - FT_F2Dot14 x; - FT_F2Dot14 y; - - } FT_UnitVector; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Matrix */ - /* */ - /* <Description> */ - /* A simple structure used to store a 2x2 matrix. Coefficients are */ - /* in 16.16 fixed float format. The computation performed is: */ - /* */ - /* { */ - /* x' = x*xx + y*xy */ - /* y' = x*yx + y*yy */ - /* } */ - /* */ - /* <Fields> */ - /* xx :: Matrix coefficient. */ - /* */ - /* xy :: Matrix coefficient. */ - /* */ - /* yx :: Matrix coefficient. */ - /* */ - /* yy :: Matrix coefficient. */ - /* */ - typedef struct FT_Matrix_ - { - FT_Fixed xx, xy; - FT_Fixed yx, yy; - - } FT_Matrix; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Data */ - /* */ - /* <Description> */ - /* Read-only binary data represented as a pointer and a length. */ - /* */ - /* <Fields> */ - /* pointer :: The data. */ - /* */ - /* length :: The length of the data in bytes. */ - /* */ - typedef struct FT_Data_ - { - const FT_Byte* pointer; - FT_Int length; - - } FT_Data; - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* FT_Generic_Finalizer */ - /* */ - /* <Description> */ - /* Describe a function used to destroy the `client' data of any */ - /* FreeType object. See the description of the @FT_Generic type for */ - /* details of usage. */ - /* */ - /* <Input> */ - /* The address of the FreeType object which is under finalization. */ - /* Its client data is accessed through its `generic' field. */ - /* */ - typedef void (*FT_Generic_Finalizer)(void* object); - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Generic */ - /* */ - /* <Description> */ - /* Client applications often need to associate their own data to a */ - /* variety of FreeType core objects. For example, a text layout API */ - /* might want to associate a glyph cache to a given size object. */ - /* */ - /* Some FreeType object contains a `generic' field, of type */ - /* FT_Generic, which usage is left to client applications and font */ - /* servers. */ - /* */ - /* It can be used to store a pointer to client-specific data, as well */ - /* as the address of a `finalizer' function, which will be called by */ - /* FreeType when the object is destroyed (for example, the previous */ - /* client example would put the address of the glyph cache destructor */ - /* in the `finalizer' field). */ - /* */ - /* <Fields> */ - /* data :: A typeless pointer to any client-specified data. This */ - /* field is completely ignored by the FreeType library. */ - /* */ - /* finalizer :: A pointer to a `generic finalizer' function, which */ - /* will be called when the object is destroyed. If this */ - /* field is set to NULL, no code will be called. */ - /* */ - typedef struct FT_Generic_ - { - void* data; - FT_Generic_Finalizer finalizer; - - } FT_Generic; - - /*************************************************************************/ - /* */ - /* <Macro> */ - /* FT_MAKE_TAG */ - /* */ - /* <Description> */ - /* This macro converts four-letter tags which are used to label */ - /* TrueType tables into an unsigned long to be used within FreeType. */ - /* */ - /* <Note> */ - /* The produced values *must* be 32-bit integers. Don't redefine */ - /* this macro. */ - /* */ -#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \ - (FT_Tag) \ - ( ( (FT_ULong)_x1 << 24 ) | \ - ( (FT_ULong)_x2 << 16 ) | \ - ( (FT_ULong)_x3 << 8 ) | \ - (FT_ULong)_x4 ) - - /*************************************************************************/ - /*************************************************************************/ - /* */ - /* L I S T M A N A G E M E N T */ - /* */ - /*************************************************************************/ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Section> */ - /* list_processing */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_ListNode */ - /* */ - /* <Description> */ - /* Many elements and objects in FreeType are listed through an */ - /* @FT_List record (see @FT_ListRec). As its name suggests, an */ - /* FT_ListNode is a handle to a single list element. */ - /* */ - typedef struct FT_ListNodeRec_* FT_ListNode; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_List */ - /* */ - /* <Description> */ - /* A handle to a list record (see @FT_ListRec). */ - /* */ - typedef struct FT_ListRec_* FT_List; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_ListNodeRec */ - /* */ - /* <Description> */ - /* A structure used to hold a single list element. */ - /* */ - /* <Fields> */ - /* prev :: The previous element in the list. NULL if first. */ - /* */ - /* next :: The next element in the list. NULL if last. */ - /* */ - /* data :: A typeless pointer to the listed object. */ - /* */ - typedef struct FT_ListNodeRec_ - { - FT_ListNode prev; - FT_ListNode next; - void* data; - - } FT_ListNodeRec; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_ListRec */ - /* */ - /* <Description> */ - /* A structure used to hold a simple doubly-linked list. These are */ - /* used in many parts of FreeType. */ - /* */ - /* <Fields> */ - /* head :: The head (first element) of doubly-linked list. */ - /* */ - /* tail :: The tail (last element) of doubly-linked list. */ - /* */ - typedef struct FT_ListRec_ - { - FT_ListNode head; - FT_ListNode tail; - - } FT_ListRec; - - /* */ - -#define FT_IS_EMPTY( list ) ( (list).head == 0 ) - - /* return base error code (without module-specific prefix) */ -#define FT_ERROR_BASE( x ) ( (x) & 0xFF ) - - /* return module error code */ -#define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U ) - -#define FT_BOOL( x ) ( (FT_Bool)( x ) ) - -FT_END_HEADER - -#endif /* __FTTYPES_H__ */ - -/* END */ - -/*** End of inlined file: fttypes.h ***/ - -FT_BEGIN_HEADER - - /*************************************************************************/ - /* */ - /* <Section> */ - /* user_allocation */ - /* */ - /* <Title> */ - /* User allocation */ - /* */ - /* <Abstract> */ - /* How client applications should allocate FreeType data structures. */ - /* */ - /* <Description> */ - /* FreeType assumes that structures allocated by the user and passed */ - /* as arguments are zeroed out except for the actual data. In other */ - /* words, it is recommended to use `calloc' (or variants of it) */ - /* instead of `malloc' for allocation. */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /*************************************************************************/ - /* */ - /* B A S I C T Y P E S */ - /* */ - /*************************************************************************/ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Section> */ - /* base_interface */ - /* */ - /* <Title> */ - /* Base Interface */ - /* */ - /* <Abstract> */ - /* The FreeType~2 base font interface. */ - /* */ - /* <Description> */ - /* This section describes the public high-level API of FreeType~2. */ - /* */ - /* <Order> */ - /* FT_Library */ - /* FT_Face */ - /* FT_Size */ - /* FT_GlyphSlot */ - /* FT_CharMap */ - /* FT_Encoding */ - /* */ - /* FT_FaceRec */ - /* */ - /* FT_FACE_FLAG_SCALABLE */ - /* FT_FACE_FLAG_FIXED_SIZES */ - /* FT_FACE_FLAG_FIXED_WIDTH */ - /* FT_FACE_FLAG_HORIZONTAL */ - /* FT_FACE_FLAG_VERTICAL */ - /* FT_FACE_FLAG_SFNT */ - /* FT_FACE_FLAG_KERNING */ - /* FT_FACE_FLAG_MULTIPLE_MASTERS */ - /* FT_FACE_FLAG_GLYPH_NAMES */ - /* FT_FACE_FLAG_EXTERNAL_STREAM */ - /* FT_FACE_FLAG_FAST_GLYPHS */ - /* FT_FACE_FLAG_HINTER */ - /* */ - /* FT_STYLE_FLAG_BOLD */ - /* FT_STYLE_FLAG_ITALIC */ - /* */ - /* FT_SizeRec */ - /* FT_Size_Metrics */ - /* */ - /* FT_GlyphSlotRec */ - /* FT_Glyph_Metrics */ - /* FT_SubGlyph */ - /* */ - /* FT_Bitmap_Size */ - /* */ - /* FT_Init_FreeType */ - /* FT_Done_FreeType */ - /* */ - /* FT_New_Face */ - /* FT_Done_Face */ - /* FT_New_Memory_Face */ - /* FT_Open_Face */ - /* FT_Open_Args */ - /* FT_Parameter */ - /* FT_Attach_File */ - /* FT_Attach_Stream */ - /* */ - /* FT_Set_Char_Size */ - /* FT_Set_Pixel_Sizes */ - /* FT_Request_Size */ - /* FT_Select_Size */ - /* FT_Size_Request_Type */ - /* FT_Size_Request */ - /* FT_Set_Transform */ - /* FT_Load_Glyph */ - /* FT_Get_Char_Index */ - /* FT_Get_Name_Index */ - /* FT_Load_Char */ - /* */ - /* FT_OPEN_MEMORY */ - /* FT_OPEN_STREAM */ - /* FT_OPEN_PATHNAME */ - /* FT_OPEN_DRIVER */ - /* FT_OPEN_PARAMS */ - /* */ - /* FT_LOAD_DEFAULT */ - /* FT_LOAD_RENDER */ - /* FT_LOAD_MONOCHROME */ - /* FT_LOAD_LINEAR_DESIGN */ - /* FT_LOAD_NO_SCALE */ - /* FT_LOAD_NO_HINTING */ - /* FT_LOAD_NO_BITMAP */ - /* FT_LOAD_CROP_BITMAP */ - /* */ - /* FT_LOAD_VERTICAL_LAYOUT */ - /* FT_LOAD_IGNORE_TRANSFORM */ - /* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH */ - /* FT_LOAD_FORCE_AUTOHINT */ - /* FT_LOAD_NO_RECURSE */ - /* FT_LOAD_PEDANTIC */ - /* */ - /* FT_LOAD_TARGET_NORMAL */ - /* FT_LOAD_TARGET_LIGHT */ - /* FT_LOAD_TARGET_MONO */ - /* FT_LOAD_TARGET_LCD */ - /* FT_LOAD_TARGET_LCD_V */ - /* */ - /* FT_Render_Glyph */ - /* FT_Render_Mode */ - /* FT_Get_Kerning */ - /* FT_Kerning_Mode */ - /* FT_Get_Track_Kerning */ - /* FT_Get_Glyph_Name */ - /* FT_Get_Postscript_Name */ - /* */ - /* FT_CharMapRec */ - /* FT_Select_Charmap */ - /* FT_Set_Charmap */ - /* FT_Get_Charmap_Index */ - /* */ - /* FT_FSTYPE_INSTALLABLE_EMBEDDING */ - /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING */ - /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING */ - /* FT_FSTYPE_EDITABLE_EMBEDDING */ - /* FT_FSTYPE_NO_SUBSETTING */ - /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY */ - /* */ - /* FT_Get_FSType_Flags */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Glyph_Metrics */ - /* */ - /* <Description> */ - /* A structure used to model the metrics of a single glyph. The */ - /* values are expressed in 26.6 fractional pixel format; if the flag */ - /* @FT_LOAD_NO_SCALE has been used while loading the glyph, values */ - /* are expressed in font units instead. */ - /* */ - /* <Fields> */ - /* width :: */ - /* The glyph's width. */ - /* */ - /* height :: */ - /* The glyph's height. */ - /* */ - /* horiBearingX :: */ - /* Left side bearing for horizontal layout. */ - /* */ - /* horiBearingY :: */ - /* Top side bearing for horizontal layout. */ - /* */ - /* horiAdvance :: */ - /* Advance width for horizontal layout. */ - /* */ - /* vertBearingX :: */ - /* Left side bearing for vertical layout. */ - /* */ - /* vertBearingY :: */ - /* Top side bearing for vertical layout. Larger positive values */ - /* mean further below the vertical glyph origin. */ - /* */ - /* vertAdvance :: */ - /* Advance height for vertical layout. Positive values mean the */ - /* glyph has a positive advance downward. */ - /* */ - /* <Note> */ - /* If not disabled with @FT_LOAD_NO_HINTING, the values represent */ - /* dimensions of the hinted glyph (in case hinting is applicable). */ - /* */ - typedef struct FT_Glyph_Metrics_ - { - FT_Pos width; - FT_Pos height; - - FT_Pos horiBearingX; - FT_Pos horiBearingY; - FT_Pos horiAdvance; - - FT_Pos vertBearingX; - FT_Pos vertBearingY; - FT_Pos vertAdvance; - - } FT_Glyph_Metrics; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Bitmap_Size */ - /* */ - /* <Description> */ - /* This structure models the metrics of a bitmap strike (i.e., a set */ - /* of glyphs for a given point size and resolution) in a bitmap font. */ - /* It is used for the `available_sizes' field of @FT_Face. */ - /* */ - /* <Fields> */ - /* height :: The vertical distance, in pixels, between two */ - /* consecutive baselines. It is always positive. */ - /* */ - /* width :: The average width, in pixels, of all glyphs in the */ - /* strike. */ - /* */ - /* size :: The nominal size of the strike in 26.6 fractional */ - /* points. This field is not very useful. */ - /* */ - /* x_ppem :: The horizontal ppem (nominal width) in 26.6 fractional */ - /* pixels. */ - /* */ - /* y_ppem :: The vertical ppem (nominal height) in 26.6 fractional */ - /* pixels. */ - /* */ - /* <Note> */ - /* Windows FNT: */ - /* The nominal size given in a FNT font is not reliable. Thus when */ - /* the driver finds it incorrect, it sets `size' to some calculated */ - /* values and sets `x_ppem' and `y_ppem' to the pixel width and */ - /* height given in the font, respectively. */ - /* */ - /* TrueType embedded bitmaps: */ - /* `size', `width', and `height' values are not contained in the */ - /* bitmap strike itself. They are computed from the global font */ - /* parameters. */ - /* */ - typedef struct FT_Bitmap_Size_ - { - FT_Short height; - FT_Short width; - - FT_Pos size; - - FT_Pos x_ppem; - FT_Pos y_ppem; - - } FT_Bitmap_Size; - - /*************************************************************************/ - /*************************************************************************/ - /* */ - /* O B J E C T C L A S S E S */ - /* */ - /*************************************************************************/ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Library */ - /* */ - /* <Description> */ - /* A handle to a FreeType library instance. Each `library' is */ - /* completely independent from the others; it is the `root' of a set */ - /* of objects like fonts, faces, sizes, etc. */ - /* */ - /* It also embeds a memory manager (see @FT_Memory), as well as a */ - /* scan-line converter object (see @FT_Raster). */ - /* */ - /* For multi-threading applications each thread should have its own */ - /* FT_Library object. */ - /* */ - /* <Note> */ - /* Library objects are normally created by @FT_Init_FreeType, and */ - /* destroyed with @FT_Done_FreeType. */ - /* */ - typedef struct FT_LibraryRec_ *FT_Library; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Module */ - /* */ - /* <Description> */ - /* A handle to a given FreeType module object. Each module can be a */ - /* font driver, a renderer, or anything else that provides services */ - /* to the formers. */ - /* */ - typedef struct FT_ModuleRec_* FT_Module; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Driver */ - /* */ - /* <Description> */ - /* A handle to a given FreeType font driver object. Each font driver */ - /* is a special module capable of creating faces from font files. */ - /* */ - typedef struct FT_DriverRec_* FT_Driver; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Renderer */ - /* */ - /* <Description> */ - /* A handle to a given FreeType renderer. A renderer is a special */ - /* module in charge of converting a glyph image to a bitmap, when */ - /* necessary. Each renderer supports a given glyph image format, and */ - /* one or more target surface depths. */ - /* */ - typedef struct FT_RendererRec_* FT_Renderer; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Face */ - /* */ - /* <Description> */ - /* A handle to a given typographic face object. A face object models */ - /* a given typeface, in a given style. */ - /* */ - /* <Note> */ - /* Each face object also owns a single @FT_GlyphSlot object, as well */ - /* as one or more @FT_Size objects. */ - /* */ - /* Use @FT_New_Face or @FT_Open_Face to create a new face object from */ - /* a given filepathname or a custom input stream. */ - /* */ - /* Use @FT_Done_Face to destroy it (along with its slot and sizes). */ - /* */ - /* <Also> */ - /* See @FT_FaceRec for the publicly accessible fields of a given face */ - /* object. */ - /* */ - typedef struct FT_FaceRec_* FT_Face; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Size */ - /* */ - /* <Description> */ - /* A handle to an object used to model a face scaled to a given */ - /* character size. */ - /* */ - /* <Note> */ - /* Each @FT_Face has an _active_ @FT_Size object that is used by */ - /* functions like @FT_Load_Glyph to determine the scaling */ - /* transformation which is used to load and hint glyphs and metrics. */ - /* */ - /* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, */ - /* @FT_Request_Size or even @FT_Select_Size to change the content */ - /* (i.e., the scaling values) of the active @FT_Size. */ - /* */ - /* You can use @FT_New_Size to create additional size objects for a */ - /* given @FT_Face, but they won't be used by other functions until */ - /* you activate it through @FT_Activate_Size. Only one size can be */ - /* activated at any given time per face. */ - /* */ - /* <Also> */ - /* See @FT_SizeRec for the publicly accessible fields of a given size */ - /* object. */ - /* */ - typedef struct FT_SizeRec_* FT_Size; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_GlyphSlot */ - /* */ - /* <Description> */ - /* A handle to a given `glyph slot'. A slot is a container where it */ - /* is possible to load any of the glyphs contained in its parent */ - /* face. */ - /* */ - /* In other words, each time you call @FT_Load_Glyph or */ - /* @FT_Load_Char, the slot's content is erased by the new glyph data, */ - /* i.e., the glyph's metrics, its image (bitmap or outline), and */ - /* other control information. */ - /* */ - /* <Also> */ - /* See @FT_GlyphSlotRec for the publicly accessible glyph fields. */ - /* */ - typedef struct FT_GlyphSlotRec_* FT_GlyphSlot; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_CharMap */ - /* */ - /* <Description> */ - /* A handle to a given character map. A charmap is used to translate */ - /* character codes in a given encoding into glyph indexes for its */ - /* parent's face. Some font formats may provide several charmaps per */ - /* font. */ - /* */ - /* Each face object owns zero or more charmaps, but only one of them */ - /* can be `active' and used by @FT_Get_Char_Index or @FT_Load_Char. */ - /* */ - /* The list of available charmaps in a face is available through the */ - /* `face->num_charmaps' and `face->charmaps' fields of @FT_FaceRec. */ - /* */ - /* The currently active charmap is available as `face->charmap'. */ - /* You should call @FT_Set_Charmap to change it. */ - /* */ - /* <Note> */ - /* When a new face is created (either through @FT_New_Face or */ - /* @FT_Open_Face), the library looks for a Unicode charmap within */ - /* the list and automatically activates it. */ - /* */ - /* <Also> */ - /* See @FT_CharMapRec for the publicly accessible fields of a given */ - /* character map. */ - /* */ - typedef struct FT_CharMapRec_* FT_CharMap; - - /*************************************************************************/ - /* */ - /* <Macro> */ - /* FT_ENC_TAG */ - /* */ - /* <Description> */ - /* This macro converts four-letter tags into an unsigned long. It is */ - /* used to define `encoding' identifiers (see @FT_Encoding). */ - /* */ - /* <Note> */ - /* Since many 16-bit compilers don't like 32-bit enumerations, you */ - /* should redefine this macro in case of problems to something like */ - /* this: */ - /* */ - /* { */ - /* #define FT_ENC_TAG( value, a, b, c, d ) value */ - /* } */ - /* */ - /* to get a simple enumeration without assigning special numbers. */ - /* */ - -#ifndef FT_ENC_TAG -#define FT_ENC_TAG( value, a, b, c, d ) \ - value = ( ( (FT_UInt32)(a) << 24 ) | \ - ( (FT_UInt32)(b) << 16 ) | \ - ( (FT_UInt32)(c) << 8 ) | \ - (FT_UInt32)(d) ) - -#endif /* FT_ENC_TAG */ - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_Encoding */ - /* */ - /* <Description> */ - /* An enumeration used to specify character sets supported by */ - /* charmaps. Used in the @FT_Select_Charmap API function. */ - /* */ - /* <Note> */ - /* Despite the name, this enumeration lists specific character */ - /* repertories (i.e., charsets), and not text encoding methods (e.g., */ - /* UTF-8, UTF-16, etc.). */ - /* */ - /* Other encodings might be defined in the future. */ - /* */ - /* <Values> */ - /* FT_ENCODING_NONE :: */ - /* The encoding value~0 is reserved. */ - /* */ - /* FT_ENCODING_UNICODE :: */ - /* Corresponds to the Unicode character set. This value covers */ - /* all versions of the Unicode repertoire, including ASCII and */ - /* Latin-1. Most fonts include a Unicode charmap, but not all */ - /* of them. */ - /* */ - /* For example, if you want to access Unicode value U+1F028 (and */ - /* the font contains it), use value 0x1F028 as the input value for */ - /* @FT_Get_Char_Index. */ - /* */ - /* FT_ENCODING_MS_SYMBOL :: */ - /* Corresponds to the Microsoft Symbol encoding, used to encode */ - /* mathematical symbols in the 32..255 character code range. For */ - /* more information, see `http://www.ceviz.net/symbol.htm'. */ - /* */ - /* FT_ENCODING_SJIS :: */ - /* Corresponds to Japanese SJIS encoding. More info at */ - /* at `http://langsupport.japanreference.com/encoding.shtml'. */ - /* See note on multi-byte encodings below. */ - /* */ - /* FT_ENCODING_GB2312 :: */ - /* Corresponds to an encoding system for Simplified Chinese as used */ - /* used in mainland China. */ - /* */ - /* FT_ENCODING_BIG5 :: */ - /* Corresponds to an encoding system for Traditional Chinese as */ - /* used in Taiwan and Hong Kong. */ - /* */ - /* FT_ENCODING_WANSUNG :: */ - /* Corresponds to the Korean encoding system known as Wansung. */ - /* For more information see */ - /* `http://www.microsoft.com/typography/unicode/949.txt'. */ - /* */ - /* FT_ENCODING_JOHAB :: */ - /* The Korean standard character set (KS~C 5601-1992), which */ - /* corresponds to MS Windows code page 1361. This character set */ - /* includes all possible Hangeul character combinations. */ - /* */ - /* FT_ENCODING_ADOBE_LATIN_1 :: */ - /* Corresponds to a Latin-1 encoding as defined in a Type~1 */ - /* PostScript font. It is limited to 256 character codes. */ - /* */ - /* FT_ENCODING_ADOBE_STANDARD :: */ - /* Corresponds to the Adobe Standard encoding, as found in Type~1, */ - /* CFF, and OpenType/CFF fonts. It is limited to 256 character */ - /* codes. */ - /* */ - /* FT_ENCODING_ADOBE_EXPERT :: */ - /* Corresponds to the Adobe Expert encoding, as found in Type~1, */ - /* CFF, and OpenType/CFF fonts. It is limited to 256 character */ - /* codes. */ - /* */ - /* FT_ENCODING_ADOBE_CUSTOM :: */ - /* Corresponds to a custom encoding, as found in Type~1, CFF, and */ - /* OpenType/CFF fonts. It is limited to 256 character codes. */ - /* */ - /* FT_ENCODING_APPLE_ROMAN :: */ - /* Corresponds to the 8-bit Apple roman encoding. Many TrueType */ - /* and OpenType fonts contain a charmap for this encoding, since */ - /* older versions of Mac OS are able to use it. */ - /* */ - /* FT_ENCODING_OLD_LATIN_2 :: */ - /* This value is deprecated and was never used nor reported by */ - /* FreeType. Don't use or test for it. */ - /* */ - /* FT_ENCODING_MS_SJIS :: */ - /* Same as FT_ENCODING_SJIS. Deprecated. */ - /* */ - /* FT_ENCODING_MS_GB2312 :: */ - /* Same as FT_ENCODING_GB2312. Deprecated. */ - /* */ - /* FT_ENCODING_MS_BIG5 :: */ - /* Same as FT_ENCODING_BIG5. Deprecated. */ - /* */ - /* FT_ENCODING_MS_WANSUNG :: */ - /* Same as FT_ENCODING_WANSUNG. Deprecated. */ - /* */ - /* FT_ENCODING_MS_JOHAB :: */ - /* Same as FT_ENCODING_JOHAB. Deprecated. */ - /* */ - /* <Note> */ - /* By default, FreeType automatically synthesizes a Unicode charmap */ - /* for PostScript fonts, using their glyph names dictionaries. */ - /* However, it also reports the encodings defined explicitly in the */ - /* font file, for the cases when they are needed, with the Adobe */ - /* values as well. */ - /* */ - /* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */ - /* is neither Unicode nor ISO-8859-1 (otherwise it is set to */ - /* FT_ENCODING_UNICODE). Use @FT_Get_BDF_Charset_ID to find out */ - /* which encoding is really present. If, for example, the */ - /* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */ - /* the font is encoded in KOI8-R. */ - /* */ - /* FT_ENCODING_NONE is always set (with a single exception) by the */ - /* winfonts driver. Use @FT_Get_WinFNT_Header and examine the */ - /* `charset' field of the @FT_WinFNT_HeaderRec structure to find out */ - /* which encoding is really present. For example, */ - /* @FT_WinFNT_ID_CP1251 (204) means Windows code page 1251 (for */ - /* Russian). */ - /* */ - /* FT_ENCODING_NONE is set if `platform_id' is @TT_PLATFORM_MACINTOSH */ - /* and `encoding_id' is not @TT_MAC_ID_ROMAN (otherwise it is set to */ - /* FT_ENCODING_APPLE_ROMAN). */ - /* */ - /* If `platform_id' is @TT_PLATFORM_MACINTOSH, use the function */ - /* @FT_Get_CMap_Language_ID to query the Mac language ID which may */ - /* be needed to be able to distinguish Apple encoding variants. See */ - /* */ - /* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT */ - /* */ - /* to get an idea how to do that. Basically, if the language ID */ - /* is~0, don't use it, otherwise subtract 1 from the language ID. */ - /* Then examine `encoding_id'. If, for example, `encoding_id' is */ - /* @TT_MAC_ID_ROMAN and the language ID (minus~1) is */ - /* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */ - /* @TT_MAC_ID_ARABIC with `TT_MAC_LANGID_FARSI' means the Farsi */ - /* variant the Arabic encoding. */ - /* */ - typedef enum FT_Encoding_ - { - FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ), - - FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ), - FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ), - - FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ), - FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ), - FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ), - FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ), - FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ), - - /* for backwards compatibility */ - FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS, - FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312, - FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5, - FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG, - FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB, - - FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ), - FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ), - FT_ENC_TAG( FT_ENCODING_ADOBE_CUSTOM, 'A', 'D', 'B', 'C' ), - FT_ENC_TAG( FT_ENCODING_ADOBE_LATIN_1, 'l', 'a', 't', '1' ), - - FT_ENC_TAG( FT_ENCODING_OLD_LATIN_2, 'l', 'a', 't', '2' ), - - FT_ENC_TAG( FT_ENCODING_APPLE_ROMAN, 'a', 'r', 'm', 'n' ) - - } FT_Encoding; - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* ft_encoding_xxx */ - /* */ - /* <Description> */ - /* These constants are deprecated; use the corresponding @FT_Encoding */ - /* values instead. */ - /* */ -#define ft_encoding_none FT_ENCODING_NONE -#define ft_encoding_unicode FT_ENCODING_UNICODE -#define ft_encoding_symbol FT_ENCODING_MS_SYMBOL -#define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1 -#define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2 -#define ft_encoding_sjis FT_ENCODING_SJIS -#define ft_encoding_gb2312 FT_ENCODING_GB2312 -#define ft_encoding_big5 FT_ENCODING_BIG5 -#define ft_encoding_wansung FT_ENCODING_WANSUNG -#define ft_encoding_johab FT_ENCODING_JOHAB - -#define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD -#define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT -#define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM -#define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_CharMapRec */ - /* */ - /* <Description> */ - /* The base charmap structure. */ - /* */ - /* <Fields> */ - /* face :: A handle to the parent face object. */ - /* */ - /* encoding :: An @FT_Encoding tag identifying the charmap. Use */ - /* this with @FT_Select_Charmap. */ - /* */ - /* platform_id :: An ID number describing the platform for the */ - /* following encoding ID. This comes directly from */ - /* the TrueType specification and should be emulated */ - /* for other formats. */ - /* */ - /* encoding_id :: A platform specific encoding number. This also */ - /* comes from the TrueType specification and should be */ - /* emulated similarly. */ - /* */ - typedef struct FT_CharMapRec_ - { - FT_Face face; - FT_Encoding encoding; - FT_UShort platform_id; - FT_UShort encoding_id; - - } FT_CharMapRec; - - /*************************************************************************/ - /*************************************************************************/ - /* */ - /* B A S E O B J E C T C L A S S E S */ - /* */ - /*************************************************************************/ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Face_Internal */ - /* */ - /* <Description> */ - /* An opaque handle to an `FT_Face_InternalRec' structure, used to */ - /* model private data of a given @FT_Face object. */ - /* */ - /* This structure might change between releases of FreeType~2 and is */ - /* not generally available to client applications. */ - /* */ - typedef struct FT_Face_InternalRec_* FT_Face_Internal; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_FaceRec */ - /* */ - /* <Description> */ - /* FreeType root face class structure. A face object models a */ - /* typeface in a font file. */ - /* */ - /* <Fields> */ - /* num_faces :: The number of faces in the font file. Some */ - /* font formats can have multiple faces in */ - /* a font file. */ - /* */ - /* face_index :: The index of the face in the font file. It */ - /* is set to~0 if there is only one face in */ - /* the font file. */ - /* */ - /* face_flags :: A set of bit flags that give important */ - /* information about the face; see */ - /* @FT_FACE_FLAG_XXX for the details. */ - /* */ - /* style_flags :: A set of bit flags indicating the style of */ - /* the face; see @FT_STYLE_FLAG_XXX for the */ - /* details. */ - /* */ - /* num_glyphs :: The number of glyphs in the face. If the */ - /* face is scalable and has sbits (see */ - /* `num_fixed_sizes'), it is set to the number */ - /* of outline glyphs. */ - /* */ - /* For CID-keyed fonts, this value gives the */ - /* highest CID used in the font. */ - /* */ - /* family_name :: The face's family name. This is an ASCII */ - /* string, usually in English, which describes */ - /* the typeface's family (like `Times New */ - /* Roman', `Bodoni', `Garamond', etc). This */ - /* is a least common denominator used to list */ - /* fonts. Some formats (TrueType & OpenType) */ - /* provide localized and Unicode versions of */ - /* this string. Applications should use the */ - /* format specific interface to access them. */ - /* Can be NULL (e.g., in fonts embedded in a */ - /* PDF file). */ - /* */ - /* style_name :: The face's style name. This is an ASCII */ - /* string, usually in English, which describes */ - /* the typeface's style (like `Italic', */ - /* `Bold', `Condensed', etc). Not all font */ - /* formats provide a style name, so this field */ - /* is optional, and can be set to NULL. As */ - /* for `family_name', some formats provide */ - /* localized and Unicode versions of this */ - /* string. Applications should use the format */ - /* specific interface to access them. */ - /* */ - /* num_fixed_sizes :: The number of bitmap strikes in the face. */ - /* Even if the face is scalable, there might */ - /* still be bitmap strikes, which are called */ - /* `sbits' in that case. */ - /* */ - /* available_sizes :: An array of @FT_Bitmap_Size for all bitmap */ - /* strikes in the face. It is set to NULL if */ - /* there is no bitmap strike. */ - /* */ - /* num_charmaps :: The number of charmaps in the face. */ - /* */ - /* charmaps :: An array of the charmaps of the face. */ - /* */ - /* generic :: A field reserved for client uses. See the */ - /* @FT_Generic type description. */ - /* */ - /* bbox :: The font bounding box. Coordinates are */ - /* expressed in font units (see */ - /* `units_per_EM'). The box is large enough */ - /* to contain any glyph from the font. Thus, */ - /* `bbox.yMax' can be seen as the `maximum */ - /* ascender', and `bbox.yMin' as the `minimum */ - /* descender'. Only relevant for scalable */ - /* formats. */ - /* */ - /* Note that the bounding box might be off by */ - /* (at least) one pixel for hinted fonts. See */ - /* @FT_Size_Metrics for further discussion. */ - /* */ - /* units_per_EM :: The number of font units per EM square for */ - /* this face. This is typically 2048 for */ - /* TrueType fonts, and 1000 for Type~1 fonts. */ - /* Only relevant for scalable formats. */ - /* */ - /* ascender :: The typographic ascender of the face, */ - /* expressed in font units. For font formats */ - /* not having this information, it is set to */ - /* `bbox.yMax'. Only relevant for scalable */ - /* formats. */ - /* */ - /* descender :: The typographic descender of the face, */ - /* expressed in font units. For font formats */ - /* not having this information, it is set to */ - /* `bbox.yMin'. Note that this field is */ - /* usually negative. Only relevant for */ - /* scalable formats. */ - /* */ - /* height :: The height is the vertical distance */ - /* between two consecutive baselines, */ - /* expressed in font units. It is always */ - /* positive. Only relevant for scalable */ - /* formats. */ - /* */ - /* max_advance_width :: The maximum advance width, in font units, */ - /* for all glyphs in this face. This can be */ - /* used to make word wrapping computations */ - /* faster. Only relevant for scalable */ - /* formats. */ - /* */ - /* max_advance_height :: The maximum advance height, in font units, */ - /* for all glyphs in this face. This is only */ - /* relevant for vertical layouts, and is set */ - /* to `height' for fonts that do not provide */ - /* vertical metrics. Only relevant for */ - /* scalable formats. */ - /* */ - /* underline_position :: The position, in font units, of the */ - /* underline line for this face. It is the */ - /* center of the underlining stem. Only */ - /* relevant for scalable formats. */ - /* */ - /* underline_thickness :: The thickness, in font units, of the */ - /* underline for this face. Only relevant for */ - /* scalable formats. */ - /* */ - /* glyph :: The face's associated glyph slot(s). */ - /* */ - /* size :: The current active size for this face. */ - /* */ - /* charmap :: The current active charmap for this face. */ - /* */ - /* <Note> */ - /* Fields may be changed after a call to @FT_Attach_File or */ - /* @FT_Attach_Stream. */ - /* */ - typedef struct FT_FaceRec_ - { - FT_Long num_faces; - FT_Long face_index; - - FT_Long face_flags; - FT_Long style_flags; - - FT_Long num_glyphs; - - FT_String* family_name; - FT_String* style_name; - - FT_Int num_fixed_sizes; - FT_Bitmap_Size* available_sizes; - - FT_Int num_charmaps; - FT_CharMap* charmaps; - - FT_Generic generic; - - /*# The following member variables (down to `underline_thickness') */ - /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */ - /*# for bitmap fonts. */ - FT_BBox bbox; - - FT_UShort units_per_EM; - FT_Short ascender; - FT_Short descender; - FT_Short height; - - FT_Short max_advance_width; - FT_Short max_advance_height; - - FT_Short underline_position; - FT_Short underline_thickness; - - FT_GlyphSlot glyph; - FT_Size size; - FT_CharMap charmap; - - /*@private begin */ - - FT_Driver driver; - FT_Memory memory; - FT_Stream stream; - - FT_ListRec sizes_list; - - FT_Generic autohint; /* face-specific auto-hinter data */ - void* extensions; /* unused */ - - FT_Face_Internal internal; - - /*@private end */ - - } FT_FaceRec; - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_FACE_FLAG_XXX */ - /* */ - /* <Description> */ - /* A list of bit flags used in the `face_flags' field of the */ - /* @FT_FaceRec structure. They inform client applications of */ - /* properties of the corresponding face. */ - /* */ - /* <Values> */ - /* FT_FACE_FLAG_SCALABLE :: */ - /* Indicates that the face contains outline glyphs. This doesn't */ - /* prevent bitmap strikes, i.e., a face can have both this and */ - /* and @FT_FACE_FLAG_FIXED_SIZES set. */ - /* */ - /* FT_FACE_FLAG_FIXED_SIZES :: */ - /* Indicates that the face contains bitmap strikes. See also the */ - /* `num_fixed_sizes' and `available_sizes' fields of @FT_FaceRec. */ - /* */ - /* FT_FACE_FLAG_FIXED_WIDTH :: */ - /* Indicates that the face contains fixed-width characters (like */ - /* Courier, Lucido, MonoType, etc.). */ - /* */ - /* FT_FACE_FLAG_SFNT :: */ - /* Indicates that the face uses the `sfnt' storage scheme. For */ - /* now, this means TrueType and OpenType. */ - /* */ - /* FT_FACE_FLAG_HORIZONTAL :: */ - /* Indicates that the face contains horizontal glyph metrics. This */ - /* should be set for all common formats. */ - /* */ - /* FT_FACE_FLAG_VERTICAL :: */ - /* Indicates that the face contains vertical glyph metrics. This */ - /* is only available in some formats, not all of them. */ - /* */ - /* FT_FACE_FLAG_KERNING :: */ - /* Indicates that the face contains kerning information. If set, */ - /* the kerning distance can be retrieved through the function */ - /* @FT_Get_Kerning. Otherwise the function always return the */ - /* vector (0,0). Note that FreeType doesn't handle kerning data */ - /* from the `GPOS' table (as present in some OpenType fonts). */ - /* */ - /* FT_FACE_FLAG_FAST_GLYPHS :: */ - /* THIS FLAG IS DEPRECATED. DO NOT USE OR TEST IT. */ - /* */ - /* FT_FACE_FLAG_MULTIPLE_MASTERS :: */ - /* Indicates that the font contains multiple masters and is capable */ - /* of interpolating between them. See the multiple-masters */ - /* specific API for details. */ - /* */ - /* FT_FACE_FLAG_GLYPH_NAMES :: */ - /* Indicates that the font contains glyph names that can be */ - /* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */ - /* fonts contain broken glyph name tables. Use the function */ - /* @FT_Has_PS_Glyph_Names when needed. */ - /* */ - /* FT_FACE_FLAG_EXTERNAL_STREAM :: */ - /* Used internally by FreeType to indicate that a face's stream was */ - /* provided by the client application and should not be destroyed */ - /* when @FT_Done_Face is called. Don't read or test this flag. */ - /* */ - /* FT_FACE_FLAG_HINTER :: */ - /* Set if the font driver has a hinting machine of its own. For */ - /* example, with TrueType fonts, it makes sense to use data from */ - /* the SFNT `gasp' table only if the native TrueType hinting engine */ - /* (with the bytecode interpreter) is available and active. */ - /* */ - /* FT_FACE_FLAG_CID_KEYED :: */ - /* Set if the font is CID-keyed. In that case, the font is not */ - /* accessed by glyph indices but by CID values. For subsetted */ - /* CID-keyed fonts this has the consequence that not all index */ - /* values are a valid argument to FT_Load_Glyph. Only the CID */ - /* values for which corresponding glyphs in the subsetted font */ - /* exist make FT_Load_Glyph return successfully; in all other cases */ - /* you get an `FT_Err_Invalid_Argument' error. */ - /* */ - /* Note that CID-keyed fonts which are in an SFNT wrapper don't */ - /* have this flag set since the glyphs are accessed in the normal */ - /* way (using contiguous indices); the `CID-ness' isn't visible to */ - /* the application. */ - /* */ - /* FT_FACE_FLAG_TRICKY :: */ - /* Set if the font is `tricky', this is, it always needs the */ - /* font format's native hinting engine to get a reasonable result. */ - /* A typical example is the Chinese font `mingli.ttf' which uses */ - /* TrueType bytecode instructions to move and scale all of its */ - /* subglyphs. */ - /* */ - /* It is not possible to autohint such fonts using */ - /* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */ - /* @FT_LOAD_NO_HINTING. You have to set both @FT_LOAD_NO_HINTING */ - /* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */ - /* probably never want this except for demonstration purposes. */ - /* */ - /* Currently, there are about a dozen TrueType fonts in the list of */ - /* tricky fonts; they are hard-coded in file `ttobjs.c'. */ - /* */ -#define FT_FACE_FLAG_SCALABLE ( 1L << 0 ) -#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 ) -#define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 ) -#define FT_FACE_FLAG_SFNT ( 1L << 3 ) -#define FT_FACE_FLAG_HORIZONTAL ( 1L << 4 ) -#define FT_FACE_FLAG_VERTICAL ( 1L << 5 ) -#define FT_FACE_FLAG_KERNING ( 1L << 6 ) -#define FT_FACE_FLAG_FAST_GLYPHS ( 1L << 7 ) -#define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 ) -#define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 ) -#define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 ) -#define FT_FACE_FLAG_HINTER ( 1L << 11 ) -#define FT_FACE_FLAG_CID_KEYED ( 1L << 12 ) -#define FT_FACE_FLAG_TRICKY ( 1L << 13 ) - - /************************************************************************* - * - * @macro: - * FT_HAS_HORIZONTAL( face ) - * - * @description: - * A macro that returns true whenever a face object contains - * horizontal metrics (this is true for all font formats though). - * - * @also: - * @FT_HAS_VERTICAL can be used to check for vertical metrics. - * - */ -#define FT_HAS_HORIZONTAL( face ) \ - ( face->face_flags & FT_FACE_FLAG_HORIZONTAL ) - - /************************************************************************* - * - * @macro: - * FT_HAS_VERTICAL( face ) - * - * @description: - * A macro that returns true whenever a face object contains vertical - * metrics. - * - */ -#define FT_HAS_VERTICAL( face ) \ - ( face->face_flags & FT_FACE_FLAG_VERTICAL ) - - /************************************************************************* - * - * @macro: - * FT_HAS_KERNING( face ) - * - * @description: - * A macro that returns true whenever a face object contains kerning - * data that can be accessed with @FT_Get_Kerning. - * - */ -#define FT_HAS_KERNING( face ) \ - ( face->face_flags & FT_FACE_FLAG_KERNING ) - - /************************************************************************* - * - * @macro: - * FT_IS_SCALABLE( face ) - * - * @description: - * A macro that returns true whenever a face object contains a scalable - * font face (true for TrueType, Type~1, Type~42, CID, OpenType/CFF, - * and PFR font formats. - * - */ -#define FT_IS_SCALABLE( face ) \ - ( face->face_flags & FT_FACE_FLAG_SCALABLE ) - - /************************************************************************* - * - * @macro: - * FT_IS_SFNT( face ) - * - * @description: - * A macro that returns true whenever a face object contains a font - * whose format is based on the SFNT storage scheme. This usually - * means: TrueType fonts, OpenType fonts, as well as SFNT-based embedded - * bitmap fonts. - * - * If this macro is true, all functions defined in @FT_SFNT_NAMES_H and - * @FT_TRUETYPE_TABLES_H are available. - * - */ -#define FT_IS_SFNT( face ) \ - ( face->face_flags & FT_FACE_FLAG_SFNT ) - - /************************************************************************* - * - * @macro: - * FT_IS_FIXED_WIDTH( face ) - * - * @description: - * A macro that returns true whenever a face object contains a font face - * that contains fixed-width (or `monospace', `fixed-pitch', etc.) - * glyphs. - * - */ -#define FT_IS_FIXED_WIDTH( face ) \ - ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH ) - - /************************************************************************* - * - * @macro: - * FT_HAS_FIXED_SIZES( face ) - * - * @description: - * A macro that returns true whenever a face object contains some - * embedded bitmaps. See the `available_sizes' field of the - * @FT_FaceRec structure. - * - */ -#define FT_HAS_FIXED_SIZES( face ) \ - ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES ) - - /************************************************************************* - * - * @macro: - * FT_HAS_FAST_GLYPHS( face ) - * - * @description: - * Deprecated. - * - */ -#define FT_HAS_FAST_GLYPHS( face ) 0 - - /************************************************************************* - * - * @macro: - * FT_HAS_GLYPH_NAMES( face ) - * - * @description: - * A macro that returns true whenever a face object contains some glyph - * names that can be accessed through @FT_Get_Glyph_Name. - * - */ -#define FT_HAS_GLYPH_NAMES( face ) \ - ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) - - /************************************************************************* - * - * @macro: - * FT_HAS_MULTIPLE_MASTERS( face ) - * - * @description: - * A macro that returns true whenever a face object contains some - * multiple masters. The functions provided by @FT_MULTIPLE_MASTERS_H - * are then available to choose the exact design you want. - * - */ -#define FT_HAS_MULTIPLE_MASTERS( face ) \ - ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS ) - - /************************************************************************* - * - * @macro: - * FT_IS_CID_KEYED( face ) - * - * @description: - * A macro that returns true whenever a face object contains a CID-keyed - * font. See the discussion of @FT_FACE_FLAG_CID_KEYED for more - * details. - * - * If this macro is true, all functions defined in @FT_CID_H are - * available. - * - */ -#define FT_IS_CID_KEYED( face ) \ - ( face->face_flags & FT_FACE_FLAG_CID_KEYED ) - - /************************************************************************* - * - * @macro: - * FT_IS_TRICKY( face ) - * - * @description: - * A macro that returns true whenever a face represents a `tricky' font. - * See the discussion of @FT_FACE_FLAG_TRICKY for more details. - * - */ -#define FT_IS_TRICKY( face ) \ - ( face->face_flags & FT_FACE_FLAG_TRICKY ) - - /*************************************************************************/ - /* */ - /* <Const> */ - /* FT_STYLE_FLAG_XXX */ - /* */ - /* <Description> */ - /* A list of bit-flags used to indicate the style of a given face. */ - /* These are used in the `style_flags' field of @FT_FaceRec. */ - /* */ - /* <Values> */ - /* FT_STYLE_FLAG_ITALIC :: */ - /* Indicates that a given face style is italic or oblique. */ - /* */ - /* FT_STYLE_FLAG_BOLD :: */ - /* Indicates that a given face is bold. */ - /* */ - /* <Note> */ - /* The style information as provided by FreeType is very basic. More */ - /* details are beyond the scope and should be done on a higher level */ - /* (for example, by analyzing various fields of the `OS/2' table in */ - /* SFNT based fonts). */ - /* */ -#define FT_STYLE_FLAG_ITALIC ( 1 << 0 ) -#define FT_STYLE_FLAG_BOLD ( 1 << 1 ) - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Size_Internal */ - /* */ - /* <Description> */ - /* An opaque handle to an `FT_Size_InternalRec' structure, used to */ - /* model private data of a given @FT_Size object. */ - /* */ - typedef struct FT_Size_InternalRec_* FT_Size_Internal; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Size_Metrics */ - /* */ - /* <Description> */ - /* The size metrics structure gives the metrics of a size object. */ - /* */ - /* <Fields> */ - /* x_ppem :: The width of the scaled EM square in pixels, hence */ - /* the term `ppem' (pixels per EM). It is also */ - /* referred to as `nominal width'. */ - /* */ - /* y_ppem :: The height of the scaled EM square in pixels, */ - /* hence the term `ppem' (pixels per EM). It is also */ - /* referred to as `nominal height'. */ - /* */ - /* x_scale :: A 16.16 fractional scaling value used to convert */ - /* horizontal metrics from font units to 26.6 */ - /* fractional pixels. Only relevant for scalable */ - /* font formats. */ - /* */ - /* y_scale :: A 16.16 fractional scaling value used to convert */ - /* vertical metrics from font units to 26.6 */ - /* fractional pixels. Only relevant for scalable */ - /* font formats. */ - /* */ - /* ascender :: The ascender in 26.6 fractional pixels. See */ - /* @FT_FaceRec for the details. */ - /* */ - /* descender :: The descender in 26.6 fractional pixels. See */ - /* @FT_FaceRec for the details. */ - /* */ - /* height :: The height in 26.6 fractional pixels. See */ - /* @FT_FaceRec for the details. */ - /* */ - /* max_advance :: The maximum advance width in 26.6 fractional */ - /* pixels. See @FT_FaceRec for the details. */ - /* */ - /* <Note> */ - /* The scaling values, if relevant, are determined first during a */ - /* size changing operation. The remaining fields are then set by the */ - /* driver. For scalable formats, they are usually set to scaled */ - /* values of the corresponding fields in @FT_FaceRec. */ - /* */ - /* Note that due to glyph hinting, these values might not be exact */ - /* for certain fonts. Thus they must be treated as unreliable */ - /* with an error margin of at least one pixel! */ - /* */ - /* Indeed, the only way to get the exact metrics is to render _all_ */ - /* glyphs. As this would be a definite performance hit, it is up to */ - /* client applications to perform such computations. */ - /* */ - /* The FT_Size_Metrics structure is valid for bitmap fonts also. */ - /* */ - typedef struct FT_Size_Metrics_ - { - FT_UShort x_ppem; /* horizontal pixels per EM */ - FT_UShort y_ppem; /* vertical pixels per EM */ - - FT_Fixed x_scale; /* scaling values used to convert font */ - FT_Fixed y_scale; /* units to 26.6 fractional pixels */ - - FT_Pos ascender; /* ascender in 26.6 frac. pixels */ - FT_Pos descender; /* descender in 26.6 frac. pixels */ - FT_Pos height; /* text height in 26.6 frac. pixels */ - FT_Pos max_advance; /* max horizontal advance, in 26.6 pixels */ - - } FT_Size_Metrics; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_SizeRec */ - /* */ - /* <Description> */ - /* FreeType root size class structure. A size object models a face */ - /* object at a given size. */ - /* */ - /* <Fields> */ - /* face :: Handle to the parent face object. */ - /* */ - /* generic :: A typeless pointer, which is unused by the FreeType */ - /* library or any of its drivers. It can be used by */ - /* client applications to link their own data to each size */ - /* object. */ - /* */ - /* metrics :: Metrics for this size object. This field is read-only. */ - /* */ - typedef struct FT_SizeRec_ - { - FT_Face face; /* parent face object */ - FT_Generic generic; /* generic pointer for client uses */ - FT_Size_Metrics metrics; /* size metrics */ - FT_Size_Internal internal; - - } FT_SizeRec; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_SubGlyph */ - /* */ - /* <Description> */ - /* The subglyph structure is an internal object used to describe */ - /* subglyphs (for example, in the case of composites). */ - /* */ - /* <Note> */ - /* The subglyph implementation is not part of the high-level API, */ - /* hence the forward structure declaration. */ - /* */ - /* You can however retrieve subglyph information with */ - /* @FT_Get_SubGlyph_Info. */ - /* */ - typedef struct FT_SubGlyphRec_* FT_SubGlyph; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Slot_Internal */ - /* */ - /* <Description> */ - /* An opaque handle to an `FT_Slot_InternalRec' structure, used to */ - /* model private data of a given @FT_GlyphSlot object. */ - /* */ - typedef struct FT_Slot_InternalRec_* FT_Slot_Internal; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_GlyphSlotRec */ - /* */ - /* <Description> */ - /* FreeType root glyph slot class structure. A glyph slot is a */ - /* container where individual glyphs can be loaded, be they in */ - /* outline or bitmap format. */ - /* */ - /* <Fields> */ - /* library :: A handle to the FreeType library instance */ - /* this slot belongs to. */ - /* */ - /* face :: A handle to the parent face object. */ - /* */ - /* next :: In some cases (like some font tools), several */ - /* glyph slots per face object can be a good */ - /* thing. As this is rare, the glyph slots are */ - /* listed through a direct, single-linked list */ - /* using its `next' field. */ - /* */ - /* generic :: A typeless pointer which is unused by the */ - /* FreeType library or any of its drivers. It */ - /* can be used by client applications to link */ - /* their own data to each glyph slot object. */ - /* */ - /* metrics :: The metrics of the last loaded glyph in the */ - /* slot. The returned values depend on the last */ - /* load flags (see the @FT_Load_Glyph API */ - /* function) and can be expressed either in 26.6 */ - /* fractional pixels or font units. */ - /* */ - /* Note that even when the glyph image is */ - /* transformed, the metrics are not. */ - /* */ - /* linearHoriAdvance :: The advance width of the unhinted glyph. */ - /* Its value is expressed in 16.16 fractional */ - /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */ - /* when loading the glyph. This field can be */ - /* important to perform correct WYSIWYG layout. */ - /* Only relevant for outline glyphs. */ - /* */ - /* linearVertAdvance :: The advance height of the unhinted glyph. */ - /* Its value is expressed in 16.16 fractional */ - /* pixels, unless @FT_LOAD_LINEAR_DESIGN is set */ - /* when loading the glyph. This field can be */ - /* important to perform correct WYSIWYG layout. */ - /* Only relevant for outline glyphs. */ - /* */ - /* advance :: This shorthand is, depending on */ - /* @FT_LOAD_IGNORE_TRANSFORM, the transformed */ - /* advance width for the glyph (in 26.6 */ - /* fractional pixel format). As specified with */ - /* @FT_LOAD_VERTICAL_LAYOUT, it uses either the */ - /* `horiAdvance' or the `vertAdvance' value of */ - /* `metrics' field. */ - /* */ - /* format :: This field indicates the format of the image */ - /* contained in the glyph slot. Typically */ - /* @FT_GLYPH_FORMAT_BITMAP, */ - /* @FT_GLYPH_FORMAT_OUTLINE, or */ - /* @FT_GLYPH_FORMAT_COMPOSITE, but others are */ - /* possible. */ - /* */ - /* bitmap :: This field is used as a bitmap descriptor */ - /* when the slot format is */ - /* @FT_GLYPH_FORMAT_BITMAP. Note that the */ - /* address and content of the bitmap buffer can */ - /* change between calls of @FT_Load_Glyph and a */ - /* few other functions. */ - /* */ - /* bitmap_left :: This is the bitmap's left bearing expressed */ - /* in integer pixels. Of course, this is only */ - /* valid if the format is */ - /* @FT_GLYPH_FORMAT_BITMAP. */ - /* */ - /* bitmap_top :: This is the bitmap's top bearing expressed in */ - /* integer pixels. Remember that this is the */ - /* distance from the baseline to the top-most */ - /* glyph scanline, upwards y~coordinates being */ - /* *positive*. */ - /* */ - /* outline :: The outline descriptor for the current glyph */ - /* image if its format is */ - /* @FT_GLYPH_FORMAT_OUTLINE. Once a glyph is */ - /* loaded, `outline' can be transformed, */ - /* distorted, embolded, etc. However, it must */ - /* not be freed. */ - /* */ - /* num_subglyphs :: The number of subglyphs in a composite glyph. */ - /* This field is only valid for the composite */ - /* glyph format that should normally only be */ - /* loaded with the @FT_LOAD_NO_RECURSE flag. */ - /* For now this is internal to FreeType. */ - /* */ - /* subglyphs :: An array of subglyph descriptors for */ - /* composite glyphs. There are `num_subglyphs' */ - /* elements in there. Currently internal to */ - /* FreeType. */ - /* */ - /* control_data :: Certain font drivers can also return the */ - /* control data for a given glyph image (e.g. */ - /* TrueType bytecode, Type~1 charstrings, etc.). */ - /* This field is a pointer to such data. */ - /* */ - /* control_len :: This is the length in bytes of the control */ - /* data. */ - /* */ - /* other :: Really wicked formats can use this pointer to */ - /* present their own glyph image to client */ - /* applications. Note that the application */ - /* needs to know about the image format. */ - /* */ - /* lsb_delta :: The difference between hinted and unhinted */ - /* left side bearing while autohinting is */ - /* active. Zero otherwise. */ - /* */ - /* rsb_delta :: The difference between hinted and unhinted */ - /* right side bearing while autohinting is */ - /* active. Zero otherwise. */ - /* */ - /* <Note> */ - /* If @FT_Load_Glyph is called with default flags (see */ - /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */ - /* its native format (e.g., an outline glyph for TrueType and Type~1 */ - /* formats). */ - /* */ - /* This image can later be converted into a bitmap by calling */ - /* @FT_Render_Glyph. This function finds the current renderer for */ - /* the native image's format, then invokes it. */ - /* */ - /* The renderer is in charge of transforming the native image through */ - /* the slot's face transformation fields, then converting it into a */ - /* bitmap that is returned in `slot->bitmap'. */ - /* */ - /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */ - /* to specify the position of the bitmap relative to the current pen */ - /* position (e.g., coordinates (0,0) on the baseline). Of course, */ - /* `slot->format' is also changed to @FT_GLYPH_FORMAT_BITMAP. */ - /* */ - /* <Note> */ - /* Here a small pseudo code fragment which shows how to use */ - /* `lsb_delta' and `rsb_delta': */ - /* */ - /* { */ - /* FT_Pos origin_x = 0; */ - /* FT_Pos prev_rsb_delta = 0; */ - /* */ - /* */ - /* for all glyphs do */ - /* <compute kern between current and previous glyph and add it to */ - /* `origin_x'> */ - /* */ - /* <load glyph with `FT_Load_Glyph'> */ - /* */ - /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */ - /* origin_x -= 64; */ - /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */ - /* origin_x += 64; */ - /* */ - /* prev_rsb_delta = face->glyph->rsb_delta; */ - /* */ - /* <save glyph image, or render glyph, or ...> */ - /* */ - /* origin_x += face->glyph->advance.x; */ - /* endfor */ - /* } */ - /* */ - typedef struct FT_GlyphSlotRec_ - { - FT_Library library; - FT_Face face; - FT_GlyphSlot next; - FT_UInt reserved; /* retained for binary compatibility */ - FT_Generic generic; - - FT_Glyph_Metrics metrics; - FT_Fixed linearHoriAdvance; - FT_Fixed linearVertAdvance; - FT_Vector advance; - - FT_Glyph_Format format; - - FT_Bitmap bitmap; - FT_Int bitmap_left; - FT_Int bitmap_top; - - FT_Outline outline; - - FT_UInt num_subglyphs; - FT_SubGlyph subglyphs; - - void* control_data; - long control_len; - - FT_Pos lsb_delta; - FT_Pos rsb_delta; - - void* other; - - FT_Slot_Internal internal; - - } FT_GlyphSlotRec; - - /*************************************************************************/ - /*************************************************************************/ - /* */ - /* F U N C T I O N S */ - /* */ - /*************************************************************************/ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Init_FreeType */ - /* */ - /* <Description> */ - /* Initialize a new FreeType library object. The set of modules */ - /* that are registered by this function is determined at build time. */ - /* */ - /* <Output> */ - /* alibrary :: A handle to a new library object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* In case you want to provide your own memory allocating routines, */ - /* use @FT_New_Library instead, followed by a call to */ - /* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module). */ - /* */ - /* For multi-threading applications each thread should have its own */ - /* FT_Library object. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Init_FreeType( FT_Library *alibrary ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Done_FreeType */ - /* */ - /* <Description> */ - /* Destroy a given FreeType library object and all of its children, */ - /* including resources, drivers, faces, sizes, etc. */ - /* */ - /* <Input> */ - /* library :: A handle to the target library object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Done_FreeType( FT_Library library ); - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_OPEN_XXX */ - /* */ - /* <Description> */ - /* A list of bit-field constants used within the `flags' field of the */ - /* @FT_Open_Args structure. */ - /* */ - /* <Values> */ - /* FT_OPEN_MEMORY :: This is a memory-based stream. */ - /* */ - /* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */ - /* */ - /* FT_OPEN_PATHNAME :: Create a new input stream from a C~path */ - /* name. */ - /* */ - /* FT_OPEN_DRIVER :: Use the `driver' field. */ - /* */ - /* FT_OPEN_PARAMS :: Use the `num_params' and `params' fields. */ - /* */ - /* ft_open_memory :: Deprecated; use @FT_OPEN_MEMORY instead. */ - /* */ - /* ft_open_stream :: Deprecated; use @FT_OPEN_STREAM instead. */ - /* */ - /* ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead. */ - /* */ - /* ft_open_driver :: Deprecated; use @FT_OPEN_DRIVER instead. */ - /* */ - /* ft_open_params :: Deprecated; use @FT_OPEN_PARAMS instead. */ - /* */ - /* <Note> */ - /* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */ - /* flags are mutually exclusive. */ - /* */ -#define FT_OPEN_MEMORY 0x1 -#define FT_OPEN_STREAM 0x2 -#define FT_OPEN_PATHNAME 0x4 -#define FT_OPEN_DRIVER 0x8 -#define FT_OPEN_PARAMS 0x10 - -#define ft_open_memory FT_OPEN_MEMORY /* deprecated */ -#define ft_open_stream FT_OPEN_STREAM /* deprecated */ -#define ft_open_pathname FT_OPEN_PATHNAME /* deprecated */ -#define ft_open_driver FT_OPEN_DRIVER /* deprecated */ -#define ft_open_params FT_OPEN_PARAMS /* deprecated */ - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Parameter */ - /* */ - /* <Description> */ - /* A simple structure used to pass more or less generic parameters to */ - /* @FT_Open_Face. */ - /* */ - /* <Fields> */ - /* tag :: A four-byte identification tag. */ - /* */ - /* data :: A pointer to the parameter data. */ - /* */ - /* <Note> */ - /* The ID and function of parameters are driver-specific. See the */ - /* various FT_PARAM_TAG_XXX flags for more information. */ - /* */ - typedef struct FT_Parameter_ - { - FT_ULong tag; - FT_Pointer data; - - } FT_Parameter; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Open_Args */ - /* */ - /* <Description> */ - /* A structure used to indicate how to open a new font file or */ - /* stream. A pointer to such a structure can be used as a parameter */ - /* for the functions @FT_Open_Face and @FT_Attach_Stream. */ - /* */ - /* <Fields> */ - /* flags :: A set of bit flags indicating how to use the */ - /* structure. */ - /* */ - /* memory_base :: The first byte of the file in memory. */ - /* */ - /* memory_size :: The size in bytes of the file in memory. */ - /* */ - /* pathname :: A pointer to an 8-bit file pathname. */ - /* */ - /* stream :: A handle to a source stream object. */ - /* */ - /* driver :: This field is exclusively used by @FT_Open_Face; */ - /* it simply specifies the font driver to use to open */ - /* the face. If set to~0, FreeType tries to load the */ - /* face with each one of the drivers in its list. */ - /* */ - /* num_params :: The number of extra parameters. */ - /* */ - /* params :: Extra parameters passed to the font driver when */ - /* opening a new face. */ - /* */ - /* <Note> */ - /* The stream type is determined by the contents of `flags' which */ - /* are tested in the following order by @FT_Open_Face: */ - /* */ - /* If the `FT_OPEN_MEMORY' bit is set, assume that this is a */ - /* memory file of `memory_size' bytes, located at `memory_address'. */ - /* The data are are not copied, and the client is responsible for */ - /* releasing and destroying them _after_ the corresponding call to */ - /* @FT_Done_Face. */ - /* */ - /* Otherwise, if the `FT_OPEN_STREAM' bit is set, assume that a */ - /* custom input stream `stream' is used. */ - /* */ - /* Otherwise, if the `FT_OPEN_PATHNAME' bit is set, assume that this */ - /* is a normal file and use `pathname' to open it. */ - /* */ - /* If the `FT_OPEN_DRIVER' bit is set, @FT_Open_Face only tries to */ - /* open the file with the driver whose handler is in `driver'. */ - /* */ - /* If the `FT_OPEN_PARAMS' bit is set, the parameters given by */ - /* `num_params' and `params' is used. They are ignored otherwise. */ - /* */ - /* Ideally, both the `pathname' and `params' fields should be tagged */ - /* as `const'; this is missing for API backwards compatibility. In */ - /* other words, applications should treat them as read-only. */ - /* */ - typedef struct FT_Open_Args_ - { - FT_UInt flags; - const FT_Byte* memory_base; - FT_Long memory_size; - FT_String* pathname; - FT_Stream stream; - FT_Module driver; - FT_Int num_params; - FT_Parameter* params; - - } FT_Open_Args; - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_New_Face */ - /* */ - /* <Description> */ - /* This function calls @FT_Open_Face to open a font by its pathname. */ - /* */ - /* <InOut> */ - /* library :: A handle to the library resource. */ - /* */ - /* <Input> */ - /* pathname :: A path to the font file. */ - /* */ - /* face_index :: The index of the face within the font. The first */ - /* face has index~0. */ - /* */ - /* <Output> */ - /* aface :: A handle to a new face object. If `face_index' is */ - /* greater than or equal to zero, it must be non-NULL. */ - /* See @FT_Open_Face for more details. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_New_Face( FT_Library library, - const char* filepathname, - FT_Long face_index, - FT_Face *aface ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_New_Memory_Face */ - /* */ - /* <Description> */ - /* This function calls @FT_Open_Face to open a font which has been */ - /* loaded into memory. */ - /* */ - /* <InOut> */ - /* library :: A handle to the library resource. */ - /* */ - /* <Input> */ - /* file_base :: A pointer to the beginning of the font data. */ - /* */ - /* file_size :: The size of the memory chunk used by the font data. */ - /* */ - /* face_index :: The index of the face within the font. The first */ - /* face has index~0. */ - /* */ - /* <Output> */ - /* aface :: A handle to a new face object. If `face_index' is */ - /* greater than or equal to zero, it must be non-NULL. */ - /* See @FT_Open_Face for more details. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* You must not deallocate the memory before calling @FT_Done_Face. */ - /* */ - FT_EXPORT( FT_Error ) - FT_New_Memory_Face( FT_Library library, - const FT_Byte* file_base, - FT_Long file_size, - FT_Long face_index, - FT_Face *aface ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Open_Face */ - /* */ - /* <Description> */ - /* Create a face object from a given resource described by */ - /* @FT_Open_Args. */ - /* */ - /* <InOut> */ - /* library :: A handle to the library resource. */ - /* */ - /* <Input> */ - /* args :: A pointer to an `FT_Open_Args' structure which must */ - /* be filled by the caller. */ - /* */ - /* face_index :: The index of the face within the font. The first */ - /* face has index~0. */ - /* */ - /* <Output> */ - /* aface :: A handle to a new face object. If `face_index' is */ - /* greater than or equal to zero, it must be non-NULL. */ - /* See note below. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* Unlike FreeType 1.x, this function automatically creates a glyph */ - /* slot for the face object which can be accessed directly through */ - /* `face->glyph'. */ - /* */ - /* FT_Open_Face can be used to quickly check whether the font */ - /* format of a given font resource is supported by FreeType. If the */ - /* `face_index' field is negative, the function's return value is~0 */ - /* if the font format is recognized, or non-zero otherwise; */ - /* the function returns a more or less empty face handle in `*aface' */ - /* (if `aface' isn't NULL). The only useful field in this special */ - /* case is `face->num_faces' which gives the number of faces within */ - /* the font file. After examination, the returned @FT_Face structure */ - /* should be deallocated with a call to @FT_Done_Face. */ - /* */ - /* Each new face object created with this function also owns a */ - /* default @FT_Size object, accessible as `face->size'. */ - /* */ - /* One @FT_Library instance can have multiple face objects, this is, */ - /* @FT_Open_Face and its siblings can be called multiple times using */ - /* the same `library' argument. */ - /* */ - /* See the discussion of reference counters in the description of */ - /* @FT_Reference_Face. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Open_Face( FT_Library library, - const FT_Open_Args* args, - FT_Long face_index, - FT_Face *aface ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Attach_File */ - /* */ - /* <Description> */ - /* This function calls @FT_Attach_Stream to attach a file. */ - /* */ - /* <InOut> */ - /* face :: The target face object. */ - /* */ - /* <Input> */ - /* filepathname :: The pathname. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Attach_File( FT_Face face, - const char* filepathname ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Attach_Stream */ - /* */ - /* <Description> */ - /* `Attach' data to a face object. Normally, this is used to read */ - /* additional information for the face object. For example, you can */ - /* attach an AFM file that comes with a Type~1 font to get the */ - /* kerning values and other metrics. */ - /* */ - /* <InOut> */ - /* face :: The target face object. */ - /* */ - /* <Input> */ - /* parameters :: A pointer to @FT_Open_Args which must be filled by */ - /* the caller. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* The meaning of the `attach' (i.e., what really happens when the */ - /* new file is read) is not fixed by FreeType itself. It really */ - /* depends on the font format (and thus the font driver). */ - /* */ - /* Client applications are expected to know what they are doing */ - /* when invoking this function. Most drivers simply do not implement */ - /* file attachments. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Attach_Stream( FT_Face face, - FT_Open_Args* parameters ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Reference_Face */ - /* */ - /* <Description> */ - /* A counter gets initialized to~1 at the time an @FT_Face structure */ - /* is created. This function increments the counter. @FT_Done_Face */ - /* then only destroys a face if the counter is~1, otherwise it simply */ - /* decrements the counter. */ - /* */ - /* This function helps in managing life-cycles of structures which */ - /* reference @FT_Face objects. */ - /* */ - /* <Input> */ - /* face :: A handle to a target face object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Since> */ - /* 2.4.2 */ - /* */ - FT_EXPORT( FT_Error ) - FT_Reference_Face( FT_Face face ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Done_Face */ - /* */ - /* <Description> */ - /* Discard a given face object, as well as all of its child slots and */ - /* sizes. */ - /* */ - /* <Input> */ - /* face :: A handle to a target face object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* See the discussion of reference counters in the description of */ - /* @FT_Reference_Face. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Done_Face( FT_Face face ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Select_Size */ - /* */ - /* <Description> */ - /* Select a bitmap strike. */ - /* */ - /* <InOut> */ - /* face :: A handle to a target face object. */ - /* */ - /* <Input> */ - /* strike_index :: The index of the bitmap strike in the */ - /* `available_sizes' field of @FT_FaceRec structure. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Select_Size( FT_Face face, - FT_Int strike_index ); - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_Size_Request_Type */ - /* */ - /* <Description> */ - /* An enumeration type that lists the supported size request types. */ - /* */ - /* <Values> */ - /* FT_SIZE_REQUEST_TYPE_NOMINAL :: */ - /* The nominal size. The `units_per_EM' field of @FT_FaceRec is */ - /* used to determine both scaling values. */ - /* */ - /* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */ - /* The real dimension. The sum of the the `ascender' and (minus */ - /* of) the `descender' fields of @FT_FaceRec are used to determine */ - /* both scaling values. */ - /* */ - /* FT_SIZE_REQUEST_TYPE_BBOX :: */ - /* The font bounding box. The width and height of the `bbox' field */ - /* of @FT_FaceRec are used to determine the horizontal and vertical */ - /* scaling value, respectively. */ - /* */ - /* FT_SIZE_REQUEST_TYPE_CELL :: */ - /* The `max_advance_width' field of @FT_FaceRec is used to */ - /* determine the horizontal scaling value; the vertical scaling */ - /* value is determined the same way as */ - /* @FT_SIZE_REQUEST_TYPE_REAL_DIM does. Finally, both scaling */ - /* values are set to the smaller one. This type is useful if you */ - /* want to specify the font size for, say, a window of a given */ - /* dimension and 80x24 cells. */ - /* */ - /* FT_SIZE_REQUEST_TYPE_SCALES :: */ - /* Specify the scaling values directly. */ - /* */ - /* <Note> */ - /* The above descriptions only apply to scalable formats. For bitmap */ - /* formats, the behaviour is up to the driver. */ - /* */ - /* See the note section of @FT_Size_Metrics if you wonder how size */ - /* requesting relates to scaling values. */ - /* */ - typedef enum FT_Size_Request_Type_ - { - FT_SIZE_REQUEST_TYPE_NOMINAL, - FT_SIZE_REQUEST_TYPE_REAL_DIM, - FT_SIZE_REQUEST_TYPE_BBOX, - FT_SIZE_REQUEST_TYPE_CELL, - FT_SIZE_REQUEST_TYPE_SCALES, - - FT_SIZE_REQUEST_TYPE_MAX - - } FT_Size_Request_Type; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Size_RequestRec */ - /* */ - /* <Description> */ - /* A structure used to model a size request. */ - /* */ - /* <Fields> */ - /* type :: See @FT_Size_Request_Type. */ - /* */ - /* width :: The desired width. */ - /* */ - /* height :: The desired height. */ - /* */ - /* horiResolution :: The horizontal resolution. If set to zero, */ - /* `width' is treated as a 26.6 fractional pixel */ - /* value. */ - /* */ - /* vertResolution :: The vertical resolution. If set to zero, */ - /* `height' is treated as a 26.6 fractional pixel */ - /* value. */ - /* */ - /* <Note> */ - /* If `width' is zero, then the horizontal scaling value is set equal */ - /* to the vertical scaling value, and vice versa. */ - /* */ - typedef struct FT_Size_RequestRec_ - { - FT_Size_Request_Type type; - FT_Long width; - FT_Long height; - FT_UInt horiResolution; - FT_UInt vertResolution; - - } FT_Size_RequestRec; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_Size_Request */ - /* */ - /* <Description> */ - /* A handle to a size request structure. */ - /* */ - typedef struct FT_Size_RequestRec_ *FT_Size_Request; - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Request_Size */ - /* */ - /* <Description> */ - /* Resize the scale of the active @FT_Size object in a face. */ - /* */ - /* <InOut> */ - /* face :: A handle to a target face object. */ - /* */ - /* <Input> */ - /* req :: A pointer to a @FT_Size_RequestRec. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* Although drivers may select the bitmap strike matching the */ - /* request, you should not rely on this if you intend to select a */ - /* particular bitmap strike. Use @FT_Select_Size instead in that */ - /* case. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Request_Size( FT_Face face, - FT_Size_Request req ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Set_Char_Size */ - /* */ - /* <Description> */ - /* This function calls @FT_Request_Size to request the nominal size */ - /* (in points). */ - /* */ - /* <InOut> */ - /* face :: A handle to a target face object. */ - /* */ - /* <Input> */ - /* char_width :: The nominal width, in 26.6 fractional points. */ - /* */ - /* char_height :: The nominal height, in 26.6 fractional points. */ - /* */ - /* horz_resolution :: The horizontal resolution in dpi. */ - /* */ - /* vert_resolution :: The vertical resolution in dpi. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* If either the character width or height is zero, it is set equal */ - /* to the other value. */ - /* */ - /* If either the horizontal or vertical resolution is zero, it is set */ - /* equal to the other value. */ - /* */ - /* A character width or height smaller than 1pt is set to 1pt; if */ - /* both resolution values are zero, they are set to 72dpi. */ - /* */ - /* Don't use this function if you are using the FreeType cache API. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Set_Char_Size( FT_Face face, - FT_F26Dot6 char_width, - FT_F26Dot6 char_height, - FT_UInt horz_resolution, - FT_UInt vert_resolution ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Set_Pixel_Sizes */ - /* */ - /* <Description> */ - /* This function calls @FT_Request_Size to request the nominal size */ - /* (in pixels). */ - /* */ - /* <InOut> */ - /* face :: A handle to the target face object. */ - /* */ - /* <Input> */ - /* pixel_width :: The nominal width, in pixels. */ - /* */ - /* pixel_height :: The nominal height, in pixels. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Set_Pixel_Sizes( FT_Face face, - FT_UInt pixel_width, - FT_UInt pixel_height ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Load_Glyph */ - /* */ - /* <Description> */ - /* A function used to load a single glyph into the glyph slot of a */ - /* face object. */ - /* */ - /* <InOut> */ - /* face :: A handle to the target face object where the glyph */ - /* is loaded. */ - /* */ - /* <Input> */ - /* glyph_index :: The index of the glyph in the font file. For */ - /* CID-keyed fonts (either in PS or in CFF format) */ - /* this argument specifies the CID value. */ - /* */ - /* load_flags :: A flag indicating what to load for this glyph. The */ - /* @FT_LOAD_XXX constants can be used to control the */ - /* glyph loading process (e.g., whether the outline */ - /* should be scaled, whether to load bitmaps or not, */ - /* whether to hint the outline, etc). */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* The loaded glyph may be transformed. See @FT_Set_Transform for */ - /* the details. */ - /* */ - /* For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument' is */ - /* returned for invalid CID values (this is, for CID values which */ - /* don't have a corresponding glyph in the font). See the discussion */ - /* of the @FT_FACE_FLAG_CID_KEYED flag for more details. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Load_Glyph( FT_Face face, - FT_UInt glyph_index, - FT_Int32 load_flags ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Load_Char */ - /* */ - /* <Description> */ - /* A function used to load a single glyph into the glyph slot of a */ - /* face object, according to its character code. */ - /* */ - /* <InOut> */ - /* face :: A handle to a target face object where the glyph */ - /* is loaded. */ - /* */ - /* <Input> */ - /* char_code :: The glyph's character code, according to the */ - /* current charmap used in the face. */ - /* */ - /* load_flags :: A flag indicating what to load for this glyph. The */ - /* @FT_LOAD_XXX constants can be used to control the */ - /* glyph loading process (e.g., whether the outline */ - /* should be scaled, whether to load bitmaps or not, */ - /* whether to hint the outline, etc). */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* This function simply calls @FT_Get_Char_Index and @FT_Load_Glyph. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Load_Char( FT_Face face, - FT_ULong char_code, - FT_Int32 load_flags ); - - /************************************************************************* - * - * @enum: - * FT_LOAD_XXX - * - * @description: - * A list of bit-field constants used with @FT_Load_Glyph to indicate - * what kind of operations to perform during glyph loading. - * - * @values: - * FT_LOAD_DEFAULT :: - * Corresponding to~0, this value is used as the default glyph load - * operation. In this case, the following happens: - * - * 1. FreeType looks for a bitmap for the glyph corresponding to the - * face's current size. If one is found, the function returns. - * The bitmap data can be accessed from the glyph slot (see note - * below). - * - * 2. If no embedded bitmap is searched or found, FreeType looks for a - * scalable outline. If one is found, it is loaded from the font - * file, scaled to device pixels, then `hinted' to the pixel grid - * in order to optimize it. The outline data can be accessed from - * the glyph slot (see note below). - * - * Note that by default, the glyph loader doesn't render outlines into - * bitmaps. The following flags are used to modify this default - * behaviour to more specific and useful cases. - * - * FT_LOAD_NO_SCALE :: - * Don't scale the outline glyph loaded, but keep it in font units. - * - * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and - * unsets @FT_LOAD_RENDER. - * - * FT_LOAD_NO_HINTING :: - * Disable hinting. This generally generates `blurrier' bitmap glyph - * when the glyph is rendered in any of the anti-aliased modes. See - * also the note below. - * - * This flag is implied by @FT_LOAD_NO_SCALE. - * - * FT_LOAD_RENDER :: - * Call @FT_Render_Glyph after the glyph is loaded. By default, the - * glyph is rendered in @FT_RENDER_MODE_NORMAL mode. This can be - * overridden by @FT_LOAD_TARGET_XXX or @FT_LOAD_MONOCHROME. - * - * This flag is unset by @FT_LOAD_NO_SCALE. - * - * FT_LOAD_NO_BITMAP :: - * Ignore bitmap strikes when loading. Bitmap-only fonts ignore this - * flag. - * - * @FT_LOAD_NO_SCALE always sets this flag. - * - * FT_LOAD_VERTICAL_LAYOUT :: - * Load the glyph for vertical text layout. _Don't_ use it as it is - * problematic currently. - * - * FT_LOAD_FORCE_AUTOHINT :: - * Indicates that the auto-hinter is preferred over the font's native - * hinter. See also the note below. - * - * FT_LOAD_CROP_BITMAP :: - * Indicates that the font driver should crop the loaded bitmap glyph - * (i.e., remove all space around its black bits). Not all drivers - * implement this. - * - * FT_LOAD_PEDANTIC :: - * Indicates that the font driver should perform pedantic verifications - * during glyph loading. This is mostly used to detect broken glyphs - * in fonts. By default, FreeType tries to handle broken fonts also. - * - * In particular, errors from the TrueType bytecode engine are not - * passed to the application if this flag is not set; this might - * result in partially hinted or distorted glyphs in case a glyph's - * bytecode is buggy. - * - * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH :: - * Ignored. Deprecated. - * - * FT_LOAD_NO_RECURSE :: - * This flag is only used internally. It merely indicates that the - * font driver should not load composite glyphs recursively. Instead, - * it should set the `num_subglyph' and `subglyphs' values of the - * glyph slot accordingly, and set `glyph->format' to - * @FT_GLYPH_FORMAT_COMPOSITE. - * - * The description of sub-glyphs is not available to client - * applications for now. - * - * This flag implies @FT_LOAD_NO_SCALE and @FT_LOAD_IGNORE_TRANSFORM. - * - * FT_LOAD_IGNORE_TRANSFORM :: - * Indicates that the transform matrix set by @FT_Set_Transform should - * be ignored. - * - * FT_LOAD_MONOCHROME :: - * This flag is used with @FT_LOAD_RENDER to indicate that you want to - * render an outline glyph to a 1-bit monochrome bitmap glyph, with - * 8~pixels packed into each byte of the bitmap data. - * - * Note that this has no effect on the hinting algorithm used. You - * should rather use @FT_LOAD_TARGET_MONO so that the - * monochrome-optimized hinting algorithm is used. - * - * FT_LOAD_LINEAR_DESIGN :: - * Indicates that the `linearHoriAdvance' and `linearVertAdvance' - * fields of @FT_GlyphSlotRec should be kept in font units. See - * @FT_GlyphSlotRec for details. - * - * FT_LOAD_NO_AUTOHINT :: - * Disable auto-hinter. See also the note below. - * - * @note: - * By default, hinting is enabled and the font's native hinter (see - * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can - * disable hinting by setting @FT_LOAD_NO_HINTING or change the - * precedence by setting @FT_LOAD_FORCE_AUTOHINT. You can also set - * @FT_LOAD_NO_AUTOHINT in case you don't want the auto-hinter to be - * used at all. - * - * See the description of @FT_FACE_FLAG_TRICKY for a special exception - * (affecting only a handful of Asian fonts). - * - * Besides deciding which hinter to use, you can also decide which - * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details. - * - */ -#define FT_LOAD_DEFAULT 0x0 -#define FT_LOAD_NO_SCALE ( 1L << 0 ) -#define FT_LOAD_NO_HINTING ( 1L << 1 ) -#define FT_LOAD_RENDER ( 1L << 2 ) -#define FT_LOAD_NO_BITMAP ( 1L << 3 ) -#define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 ) -#define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 ) -#define FT_LOAD_CROP_BITMAP ( 1L << 6 ) -#define FT_LOAD_PEDANTIC ( 1L << 7 ) -#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 ) -#define FT_LOAD_NO_RECURSE ( 1L << 10 ) -#define FT_LOAD_IGNORE_TRANSFORM ( 1L << 11 ) -#define FT_LOAD_MONOCHROME ( 1L << 12 ) -#define FT_LOAD_LINEAR_DESIGN ( 1L << 13 ) -#define FT_LOAD_NO_AUTOHINT ( 1L << 15 ) - - /* */ - - /* used internally only by certain font drivers! */ -#define FT_LOAD_ADVANCE_ONLY ( 1L << 8 ) -#define FT_LOAD_SBITS_ONLY ( 1L << 14 ) - - /************************************************************************** - * - * @enum: - * FT_LOAD_TARGET_XXX - * - * @description: - * A list of values that are used to select a specific hinting algorithm - * to use by the hinter. You should OR one of these values to your - * `load_flags' when calling @FT_Load_Glyph. - * - * Note that font's native hinters may ignore the hinting algorithm you - * have specified (e.g., the TrueType bytecode interpreter). You can set - * @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used. - * - * Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it - * always implies @FT_LOAD_FORCE_AUTOHINT. - * - * @values: - * FT_LOAD_TARGET_NORMAL :: - * This corresponds to the default hinting algorithm, optimized for - * standard gray-level rendering. For monochrome output, use - * @FT_LOAD_TARGET_MONO instead. - * - * FT_LOAD_TARGET_LIGHT :: - * A lighter hinting algorithm for non-monochrome modes. Many - * generated glyphs are more fuzzy but better resemble its original - * shape. A bit like rendering on Mac OS~X. - * - * As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT. - * - * FT_LOAD_TARGET_MONO :: - * Strong hinting algorithm that should only be used for monochrome - * output. The result is probably unpleasant if the glyph is rendered - * in non-monochrome modes. - * - * FT_LOAD_TARGET_LCD :: - * A variant of @FT_LOAD_TARGET_NORMAL optimized for horizontally - * decimated LCD displays. - * - * FT_LOAD_TARGET_LCD_V :: - * A variant of @FT_LOAD_TARGET_NORMAL optimized for vertically - * decimated LCD displays. - * - * @note: - * You should use only _one_ of the FT_LOAD_TARGET_XXX values in your - * `load_flags'. They can't be ORed. - * - * If @FT_LOAD_RENDER is also set, the glyph is rendered in the - * corresponding mode (i.e., the mode which matches the used algorithm - * best). An exeption is FT_LOAD_TARGET_MONO since it implies - * @FT_LOAD_MONOCHROME. - * - * You can use a hinting algorithm that doesn't correspond to the same - * rendering mode. As an example, it is possible to use the `light' - * hinting algorithm and have the results rendered in horizontal LCD - * pixel mode, with code like - * - * { - * FT_Load_Glyph( face, glyph_index, - * load_flags | FT_LOAD_TARGET_LIGHT ); - * - * FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD ); - * } - * - */ -#define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 ) - -#define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL ) -#define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT ) -#define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO ) -#define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD ) -#define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V ) - - /************************************************************************** - * - * @macro: - * FT_LOAD_TARGET_MODE - * - * @description: - * Return the @FT_Render_Mode corresponding to a given - * @FT_LOAD_TARGET_XXX value. - * - */ -#define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) ) - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Set_Transform */ - /* */ - /* <Description> */ - /* A function used to set the transformation that is applied to glyph */ - /* images when they are loaded into a glyph slot through */ - /* @FT_Load_Glyph. */ - /* */ - /* <InOut> */ - /* face :: A handle to the source face object. */ - /* */ - /* <Input> */ - /* matrix :: A pointer to the transformation's 2x2 matrix. Use~0 for */ - /* the identity matrix. */ - /* delta :: A pointer to the translation vector. Use~0 for the null */ - /* vector. */ - /* */ - /* <Note> */ - /* The transformation is only applied to scalable image formats after */ - /* the glyph has been loaded. It means that hinting is unaltered by */ - /* the transformation and is performed on the character size given in */ - /* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */ - /* */ - /* Note that this also transforms the `face.glyph.advance' field, but */ - /* *not* the values in `face.glyph.metrics'. */ - /* */ - FT_EXPORT( void ) - FT_Set_Transform( FT_Face face, - FT_Matrix* matrix, - FT_Vector* delta ); - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_Render_Mode */ - /* */ - /* <Description> */ - /* An enumeration type that lists the render modes supported by */ - /* FreeType~2. Each mode corresponds to a specific type of scanline */ - /* conversion performed on the outline. */ - /* */ - /* For bitmap fonts and embedded bitmaps the `bitmap->pixel_mode' */ - /* field in the @FT_GlyphSlotRec structure gives the format of the */ - /* returned bitmap. */ - /* */ - /* All modes except @FT_RENDER_MODE_MONO use 256 levels of opacity. */ - /* */ - /* <Values> */ - /* FT_RENDER_MODE_NORMAL :: */ - /* This is the default render mode; it corresponds to 8-bit */ - /* anti-aliased bitmaps. */ - /* */ - /* FT_RENDER_MODE_LIGHT :: */ - /* This is equivalent to @FT_RENDER_MODE_NORMAL. It is only */ - /* defined as a separate value because render modes are also used */ - /* indirectly to define hinting algorithm selectors. See */ - /* @FT_LOAD_TARGET_XXX for details. */ - /* */ - /* FT_RENDER_MODE_MONO :: */ - /* This mode corresponds to 1-bit bitmaps (with 2~levels of */ - /* opacity). */ - /* */ - /* FT_RENDER_MODE_LCD :: */ - /* This mode corresponds to horizontal RGB and BGR sub-pixel */ - /* displays like LCD screens. It produces 8-bit bitmaps that are */ - /* 3~times the width of the original glyph outline in pixels, and */ - /* which use the @FT_PIXEL_MODE_LCD mode. */ - /* */ - /* FT_RENDER_MODE_LCD_V :: */ - /* This mode corresponds to vertical RGB and BGR sub-pixel displays */ - /* (like PDA screens, rotated LCD displays, etc.). It produces */ - /* 8-bit bitmaps that are 3~times the height of the original */ - /* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */ - /* */ - /* <Note> */ - /* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph can be */ - /* filtered to reduce color-fringes by using @FT_Library_SetLcdFilter */ - /* (not active in the default builds). It is up to the caller to */ - /* either call @FT_Library_SetLcdFilter (if available) or do the */ - /* filtering itself. */ - /* */ - /* The selected render mode only affects vector glyphs of a font. */ - /* Embedded bitmaps often have a different pixel mode like */ - /* @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform */ - /* them into 8-bit pixmaps. */ - /* */ - typedef enum FT_Render_Mode_ - { - FT_RENDER_MODE_NORMAL = 0, - FT_RENDER_MODE_LIGHT, - FT_RENDER_MODE_MONO, - FT_RENDER_MODE_LCD, - FT_RENDER_MODE_LCD_V, - - FT_RENDER_MODE_MAX - - } FT_Render_Mode; - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* ft_render_mode_xxx */ - /* */ - /* <Description> */ - /* These constants are deprecated. Use the corresponding */ - /* @FT_Render_Mode values instead. */ - /* */ - /* <Values> */ - /* ft_render_mode_normal :: see @FT_RENDER_MODE_NORMAL */ - /* ft_render_mode_mono :: see @FT_RENDER_MODE_MONO */ - /* */ -#define ft_render_mode_normal FT_RENDER_MODE_NORMAL -#define ft_render_mode_mono FT_RENDER_MODE_MONO - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Render_Glyph */ - /* */ - /* <Description> */ - /* Convert a given glyph image to a bitmap. It does so by inspecting */ - /* the glyph image format, finding the relevant renderer, and */ - /* invoking it. */ - /* */ - /* <InOut> */ - /* slot :: A handle to the glyph slot containing the image to */ - /* convert. */ - /* */ - /* <Input> */ - /* render_mode :: This is the render mode used to render the glyph */ - /* image into a bitmap. See @FT_Render_Mode for a */ - /* list of possible values. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Render_Glyph( FT_GlyphSlot slot, - FT_Render_Mode render_mode ); - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_Kerning_Mode */ - /* */ - /* <Description> */ - /* An enumeration used to specify which kerning values to return in */ - /* @FT_Get_Kerning. */ - /* */ - /* <Values> */ - /* FT_KERNING_DEFAULT :: Return scaled and grid-fitted kerning */ - /* distances (value is~0). */ - /* */ - /* FT_KERNING_UNFITTED :: Return scaled but un-grid-fitted kerning */ - /* distances. */ - /* */ - /* FT_KERNING_UNSCALED :: Return the kerning vector in original font */ - /* units. */ - /* */ - typedef enum FT_Kerning_Mode_ - { - FT_KERNING_DEFAULT = 0, - FT_KERNING_UNFITTED, - FT_KERNING_UNSCALED - - } FT_Kerning_Mode; - - /*************************************************************************/ - /* */ - /* <Const> */ - /* ft_kerning_default */ - /* */ - /* <Description> */ - /* This constant is deprecated. Please use @FT_KERNING_DEFAULT */ - /* instead. */ - /* */ -#define ft_kerning_default FT_KERNING_DEFAULT - - /*************************************************************************/ - /* */ - /* <Const> */ - /* ft_kerning_unfitted */ - /* */ - /* <Description> */ - /* This constant is deprecated. Please use @FT_KERNING_UNFITTED */ - /* instead. */ - /* */ -#define ft_kerning_unfitted FT_KERNING_UNFITTED - - /*************************************************************************/ - /* */ - /* <Const> */ - /* ft_kerning_unscaled */ - /* */ - /* <Description> */ - /* This constant is deprecated. Please use @FT_KERNING_UNSCALED */ - /* instead. */ - /* */ -#define ft_kerning_unscaled FT_KERNING_UNSCALED - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Kerning */ - /* */ - /* <Description> */ - /* Return the kerning vector between two glyphs of a same face. */ - /* */ - /* <Input> */ - /* face :: A handle to a source face object. */ - /* */ - /* left_glyph :: The index of the left glyph in the kern pair. */ - /* */ - /* right_glyph :: The index of the right glyph in the kern pair. */ - /* */ - /* kern_mode :: See @FT_Kerning_Mode for more information. */ - /* Determines the scale and dimension of the returned */ - /* kerning vector. */ - /* */ - /* <Output> */ - /* akerning :: The kerning vector. This is either in font units */ - /* or in pixels (26.6 format) for scalable formats, */ - /* and in pixels for fixed-sizes formats. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* Only horizontal layouts (left-to-right & right-to-left) are */ - /* supported by this method. Other layouts, or more sophisticated */ - /* kernings, are out of the scope of this API function -- they can be */ - /* implemented through format-specific interfaces. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Get_Kerning( FT_Face face, - FT_UInt left_glyph, - FT_UInt right_glyph, - FT_UInt kern_mode, - FT_Vector *akerning ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Track_Kerning */ - /* */ - /* <Description> */ - /* Return the track kerning for a given face object at a given size. */ - /* */ - /* <Input> */ - /* face :: A handle to a source face object. */ - /* */ - /* point_size :: The point size in 16.16 fractional points. */ - /* */ - /* degree :: The degree of tightness. Increasingly negative */ - /* values represent tighter track kerning, while */ - /* increasingly positive values represent looser track */ - /* kerning. Value zero means no track kerning. */ - /* */ - /* <Output> */ - /* akerning :: The kerning in 16.16 fractional points, to be */ - /* uniformly applied between all glyphs. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* Currently, only the Type~1 font driver supports track kerning, */ - /* using data from AFM files (if attached with @FT_Attach_File or */ - /* @FT_Attach_Stream). */ - /* */ - /* Only very few AFM files come with track kerning data; please refer */ - /* to the Adobe's AFM specification for more details. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Get_Track_Kerning( FT_Face face, - FT_Fixed point_size, - FT_Int degree, - FT_Fixed* akerning ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Glyph_Name */ - /* */ - /* <Description> */ - /* Retrieve the ASCII name of a given glyph in a face. This only */ - /* works for those faces where @FT_HAS_GLYPH_NAMES(face) returns~1. */ - /* */ - /* <Input> */ - /* face :: A handle to a source face object. */ - /* */ - /* glyph_index :: The glyph index. */ - /* */ - /* buffer_max :: The maximum number of bytes available in the */ - /* buffer. */ - /* */ - /* <Output> */ - /* buffer :: A pointer to a target buffer where the name is */ - /* copied to. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* An error is returned if the face doesn't provide glyph names or if */ - /* the glyph index is invalid. In all cases of failure, the first */ - /* byte of `buffer' is set to~0 to indicate an empty name. */ - /* */ - /* The glyph name is truncated to fit within the buffer if it is too */ - /* long. The returned string is always zero-terminated. */ - /* */ - /* Be aware that FreeType reorders glyph indices internally so that */ - /* glyph index~0 always corresponds to the `missing glyph' (called */ - /* `.notdef'). */ - /* */ - /* This function is not compiled within the library if the config */ - /* macro `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is defined in */ - /* `include/freetype/config/ftoptions.h'. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Get_Glyph_Name( FT_Face face, - FT_UInt glyph_index, - FT_Pointer buffer, - FT_UInt buffer_max ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Postscript_Name */ - /* */ - /* <Description> */ - /* Retrieve the ASCII PostScript name of a given face, if available. */ - /* This only works with PostScript and TrueType fonts. */ - /* */ - /* <Input> */ - /* face :: A handle to the source face object. */ - /* */ - /* <Return> */ - /* A pointer to the face's PostScript name. NULL if unavailable. */ - /* */ - /* <Note> */ - /* The returned pointer is owned by the face and is destroyed with */ - /* it. */ - /* */ - FT_EXPORT( const char* ) - FT_Get_Postscript_Name( FT_Face face ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Select_Charmap */ - /* */ - /* <Description> */ - /* Select a given charmap by its encoding tag (as listed in */ - /* `freetype.h'). */ - /* */ - /* <InOut> */ - /* face :: A handle to the source face object. */ - /* */ - /* <Input> */ - /* encoding :: A handle to the selected encoding. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* This function returns an error if no charmap in the face */ - /* corresponds to the encoding queried here. */ - /* */ - /* Because many fonts contain more than a single cmap for Unicode */ - /* encoding, this function has some special code to select the one */ - /* which covers Unicode best (`best' in the sense that a UCS-4 cmap */ - /* is preferred to a UCS-2 cmap). It is thus preferable to */ - /* @FT_Set_Charmap in this case. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Select_Charmap( FT_Face face, - FT_Encoding encoding ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Set_Charmap */ - /* */ - /* <Description> */ - /* Select a given charmap for character code to glyph index mapping. */ - /* */ - /* <InOut> */ - /* face :: A handle to the source face object. */ - /* */ - /* <Input> */ - /* charmap :: A handle to the selected charmap. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* This function returns an error if the charmap is not part of */ - /* the face (i.e., if it is not listed in the `face->charmaps' */ - /* table). */ - /* */ - /* It also fails if a type~14 charmap is selected. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Set_Charmap( FT_Face face, - FT_CharMap charmap ); - - /************************************************************************* - * - * @function: - * FT_Get_Charmap_Index - * - * @description: - * Retrieve index of a given charmap. - * - * @input: - * charmap :: - * A handle to a charmap. - * - * @return: - * The index into the array of character maps within the face to which - * `charmap' belongs. If an error occurs, -1 is returned. - * - */ - FT_EXPORT( FT_Int ) - FT_Get_Charmap_Index( FT_CharMap charmap ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Char_Index */ - /* */ - /* <Description> */ - /* Return the glyph index of a given character code. This function */ - /* uses a charmap object to do the mapping. */ - /* */ - /* <Input> */ - /* face :: A handle to the source face object. */ - /* */ - /* charcode :: The character code. */ - /* */ - /* <Return> */ - /* The glyph index. 0~means `undefined character code'. */ - /* */ - /* <Note> */ - /* If you use FreeType to manipulate the contents of font files */ - /* directly, be aware that the glyph index returned by this function */ - /* doesn't always correspond to the internal indices used within */ - /* the file. This is done to ensure that value~0 always corresponds */ - /* to the `missing glyph'. */ - /* */ - FT_EXPORT( FT_UInt ) - FT_Get_Char_Index( FT_Face face, - FT_ULong charcode ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_First_Char */ - /* */ - /* <Description> */ - /* This function is used to return the first character code in the */ - /* current charmap of a given face. It also returns the */ - /* corresponding glyph index. */ - /* */ - /* <Input> */ - /* face :: A handle to the source face object. */ - /* */ - /* <Output> */ - /* agindex :: Glyph index of first character code. 0~if charmap is */ - /* empty. */ - /* */ - /* <Return> */ - /* The charmap's first character code. */ - /* */ - /* <Note> */ - /* You should use this function with @FT_Get_Next_Char to be able to */ - /* parse all character codes available in a given charmap. The code */ - /* should look like this: */ - /* */ - /* { */ - /* FT_ULong charcode; */ - /* FT_UInt gindex; */ - /* */ - /* */ - /* charcode = FT_Get_First_Char( face, &gindex ); */ - /* while ( gindex != 0 ) */ - /* { */ - /* ... do something with (charcode,gindex) pair ... */ - /* */ - /* charcode = FT_Get_Next_Char( face, charcode, &gindex ); */ - /* } */ - /* } */ - /* */ - /* Note that `*agindex' is set to~0 if the charmap is empty. The */ - /* result itself can be~0 in two cases: if the charmap is empty or */ - /* if the value~0 is the first valid character code. */ - /* */ - FT_EXPORT( FT_ULong ) - FT_Get_First_Char( FT_Face face, - FT_UInt *agindex ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Next_Char */ - /* */ - /* <Description> */ - /* This function is used to return the next character code in the */ - /* current charmap of a given face following the value `char_code', */ - /* as well as the corresponding glyph index. */ - /* */ - /* <Input> */ - /* face :: A handle to the source face object. */ - /* char_code :: The starting character code. */ - /* */ - /* <Output> */ - /* agindex :: Glyph index of next character code. 0~if charmap */ - /* is empty. */ - /* */ - /* <Return> */ - /* The charmap's next character code. */ - /* */ - /* <Note> */ - /* You should use this function with @FT_Get_First_Char to walk */ - /* over all character codes available in a given charmap. See the */ - /* note for this function for a simple code example. */ - /* */ - /* Note that `*agindex' is set to~0 when there are no more codes in */ - /* the charmap. */ - /* */ - FT_EXPORT( FT_ULong ) - FT_Get_Next_Char( FT_Face face, - FT_ULong char_code, - FT_UInt *agindex ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Name_Index */ - /* */ - /* <Description> */ - /* Return the glyph index of a given glyph name. This function uses */ - /* driver specific objects to do the translation. */ - /* */ - /* <Input> */ - /* face :: A handle to the source face object. */ - /* */ - /* glyph_name :: The glyph name. */ - /* */ - /* <Return> */ - /* The glyph index. 0~means `undefined character code'. */ - /* */ - FT_EXPORT( FT_UInt ) - FT_Get_Name_Index( FT_Face face, - FT_String* glyph_name ); - - /************************************************************************* - * - * @macro: - * FT_SUBGLYPH_FLAG_XXX - * - * @description: - * A list of constants used to describe subglyphs. Please refer to the - * TrueType specification for the meaning of the various flags. - * - * @values: - * FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS :: - * FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES :: - * FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID :: - * FT_SUBGLYPH_FLAG_SCALE :: - * FT_SUBGLYPH_FLAG_XY_SCALE :: - * FT_SUBGLYPH_FLAG_2X2 :: - * FT_SUBGLYPH_FLAG_USE_MY_METRICS :: - * - */ -#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1 -#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2 -#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4 -#define FT_SUBGLYPH_FLAG_SCALE 8 -#define FT_SUBGLYPH_FLAG_XY_SCALE 0x40 -#define FT_SUBGLYPH_FLAG_2X2 0x80 -#define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200 - - /************************************************************************* - * - * @func: - * FT_Get_SubGlyph_Info - * - * @description: - * Retrieve a description of a given subglyph. Only use it if - * `glyph->format' is @FT_GLYPH_FORMAT_COMPOSITE; an error is - * returned otherwise. - * - * @input: - * glyph :: - * The source glyph slot. - * - * sub_index :: - * The index of the subglyph. Must be less than - * `glyph->num_subglyphs'. - * - * @output: - * p_index :: - * The glyph index of the subglyph. - * - * p_flags :: - * The subglyph flags, see @FT_SUBGLYPH_FLAG_XXX. - * - * p_arg1 :: - * The subglyph's first argument (if any). - * - * p_arg2 :: - * The subglyph's second argument (if any). - * - * p_transform :: - * The subglyph transformation (if any). - * - * @return: - * FreeType error code. 0~means success. - * - * @note: - * The values of `*p_arg1', `*p_arg2', and `*p_transform' must be - * interpreted depending on the flags returned in `*p_flags'. See the - * TrueType specification for details. - * - */ - FT_EXPORT( FT_Error ) - FT_Get_SubGlyph_Info( FT_GlyphSlot glyph, - FT_UInt sub_index, - FT_Int *p_index, - FT_UInt *p_flags, - FT_Int *p_arg1, - FT_Int *p_arg2, - FT_Matrix *p_transform ); - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_FSTYPE_XXX */ - /* */ - /* <Description> */ - /* A list of bit flags used in the `fsType' field of the OS/2 table */ - /* in a TrueType or OpenType font and the `FSType' entry in a */ - /* PostScript font. These bit flags are returned by */ - /* @FT_Get_FSType_Flags; they inform client applications of embedding */ - /* and subsetting restrictions associated with a font. */ - /* */ - /* See http://www.adobe.com/devnet/acrobat/pdfs/FontPolicies.pdf for */ - /* more details. */ - /* */ - /* <Values> */ - /* FT_FSTYPE_INSTALLABLE_EMBEDDING :: */ - /* Fonts with no fsType bit set may be embedded and permanently */ - /* installed on the remote system by an application. */ - /* */ - /* FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING :: */ - /* Fonts that have only this bit set must not be modified, embedded */ - /* or exchanged in any manner without first obtaining permission of */ - /* the font software copyright owner. */ - /* */ - /* FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING :: */ - /* If this bit is set, the font may be embedded and temporarily */ - /* loaded on the remote system. Documents containing Preview & */ - /* Print fonts must be opened `read-only'; no edits can be applied */ - /* to the document. */ - /* */ - /* FT_FSTYPE_EDITABLE_EMBEDDING :: */ - /* If this bit is set, the font may be embedded but must only be */ - /* installed temporarily on other systems. In contrast to Preview */ - /* & Print fonts, documents containing editable fonts may be opened */ - /* for reading, editing is permitted, and changes may be saved. */ - /* */ - /* FT_FSTYPE_NO_SUBSETTING :: */ - /* If this bit is set, the font may not be subsetted prior to */ - /* embedding. */ - /* */ - /* FT_FSTYPE_BITMAP_EMBEDDING_ONLY :: */ - /* If this bit is set, only bitmaps contained in the font may be */ - /* embedded; no outline data may be embedded. If there are no */ - /* bitmaps available in the font, then the font is unembeddable. */ - /* */ - /* <Note> */ - /* While the fsType flags can indicate that a font may be embedded, a */ - /* license with the font vendor may be separately required to use the */ - /* font in this way. */ - /* */ -#define FT_FSTYPE_INSTALLABLE_EMBEDDING 0x0000 -#define FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING 0x0002 -#define FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING 0x0004 -#define FT_FSTYPE_EDITABLE_EMBEDDING 0x0008 -#define FT_FSTYPE_NO_SUBSETTING 0x0100 -#define FT_FSTYPE_BITMAP_EMBEDDING_ONLY 0x0200 - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_FSType_Flags */ - /* */ - /* <Description> */ - /* Return the fsType flags for a font. */ - /* */ - /* <Input> */ - /* face :: A handle to the source face object. */ - /* */ - /* <Return> */ - /* The fsType flags, @FT_FSTYPE_XXX. */ - /* */ - /* <Note> */ - /* Use this function rather than directly reading the `fs_type' field */ - /* in the @PS_FontInfoRec structure which is only guaranteed to */ - /* return the correct results for Type~1 fonts. */ - /* */ - /* <Since> */ - /* 2.3.8 */ - /* */ - FT_EXPORT( FT_UShort ) - FT_Get_FSType_Flags( FT_Face face ); - - /*************************************************************************/ - /* */ - /* <Section> */ - /* glyph_variants */ - /* */ - /* <Title> */ - /* Glyph Variants */ - /* */ - /* <Abstract> */ - /* The FreeType~2 interface to Unicode Ideographic Variation */ - /* Sequences (IVS), using the SFNT cmap format~14. */ - /* */ - /* <Description> */ - /* Many CJK characters have variant forms. They are a sort of grey */ - /* area somewhere between being totally irrelevant and semantically */ - /* distinct; for this reason, the Unicode consortium decided to */ - /* introduce Ideographic Variation Sequences (IVS), consisting of a */ - /* Unicode base character and one of 240 variant selectors */ - /* (U+E0100-U+E01EF), instead of further extending the already huge */ - /* code range for CJK characters. */ - /* */ - /* An IVS is registered and unique; for further details please refer */ - /* to Unicode Technical Report #37, the Ideographic Variation */ - /* Database. To date (October 2007), the character with the most */ - /* variants is U+908A, having 8~such IVS. */ - /* */ - /* Adobe and MS decided to support IVS with a new cmap subtable */ - /* (format~14). It is an odd subtable because it is not a mapping of */ - /* input code points to glyphs, but contains lists of all variants */ - /* supported by the font. */ - /* */ - /* A variant may be either `default' or `non-default'. A default */ - /* variant is the one you will get for that code point if you look it */ - /* up in the standard Unicode cmap. A non-default variant is a */ - /* different glyph. */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Face_GetCharVariantIndex */ - /* */ - /* <Description> */ - /* Return the glyph index of a given character code as modified by */ - /* the variation selector. */ - /* */ - /* <Input> */ - /* face :: */ - /* A handle to the source face object. */ - /* */ - /* charcode :: */ - /* The character code point in Unicode. */ - /* */ - /* variantSelector :: */ - /* The Unicode code point of the variation selector. */ - /* */ - /* <Return> */ - /* The glyph index. 0~means either `undefined character code', or */ - /* `undefined selector code', or `no variation selector cmap */ - /* subtable', or `current CharMap is not Unicode'. */ - /* */ - /* <Note> */ - /* If you use FreeType to manipulate the contents of font files */ - /* directly, be aware that the glyph index returned by this function */ - /* doesn't always correspond to the internal indices used within */ - /* the file. This is done to ensure that value~0 always corresponds */ - /* to the `missing glyph'. */ - /* */ - /* This function is only meaningful if */ - /* a) the font has a variation selector cmap sub table, */ - /* and */ - /* b) the current charmap has a Unicode encoding. */ - /* */ - /* <Since> */ - /* 2.3.6 */ - /* */ - FT_EXPORT( FT_UInt ) - FT_Face_GetCharVariantIndex( FT_Face face, - FT_ULong charcode, - FT_ULong variantSelector ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Face_GetCharVariantIsDefault */ - /* */ - /* <Description> */ - /* Check whether this variant of this Unicode character is the one to */ - /* be found in the `cmap'. */ - /* */ - /* <Input> */ - /* face :: */ - /* A handle to the source face object. */ - /* */ - /* charcode :: */ - /* The character codepoint in Unicode. */ - /* */ - /* variantSelector :: */ - /* The Unicode codepoint of the variation selector. */ - /* */ - /* <Return> */ - /* 1~if found in the standard (Unicode) cmap, 0~if found in the */ - /* variation selector cmap, or -1 if it is not a variant. */ - /* */ - /* <Note> */ - /* This function is only meaningful if the font has a variation */ - /* selector cmap subtable. */ - /* */ - /* <Since> */ - /* 2.3.6 */ - /* */ - FT_EXPORT( FT_Int ) - FT_Face_GetCharVariantIsDefault( FT_Face face, - FT_ULong charcode, - FT_ULong variantSelector ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Face_GetVariantSelectors */ - /* */ - /* <Description> */ - /* Return a zero-terminated list of Unicode variant selectors found */ - /* in the font. */ - /* */ - /* <Input> */ - /* face :: */ - /* A handle to the source face object. */ - /* */ - /* <Return> */ - /* A pointer to an array of selector code points, or NULL if there is */ - /* no valid variant selector cmap subtable. */ - /* */ - /* <Note> */ - /* The last item in the array is~0; the array is owned by the */ - /* @FT_Face object but can be overwritten or released on the next */ - /* call to a FreeType function. */ - /* */ - /* <Since> */ - /* 2.3.6 */ - /* */ - FT_EXPORT( FT_UInt32* ) - FT_Face_GetVariantSelectors( FT_Face face ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Face_GetVariantsOfChar */ - /* */ - /* <Description> */ - /* Return a zero-terminated list of Unicode variant selectors found */ - /* for the specified character code. */ - /* */ - /* <Input> */ - /* face :: */ - /* A handle to the source face object. */ - /* */ - /* charcode :: */ - /* The character codepoint in Unicode. */ - /* */ - /* <Return> */ - /* A pointer to an array of variant selector code points which are */ - /* active for the given character, or NULL if the corresponding list */ - /* is empty. */ - /* */ - /* <Note> */ - /* The last item in the array is~0; the array is owned by the */ - /* @FT_Face object but can be overwritten or released on the next */ - /* call to a FreeType function. */ - /* */ - /* <Since> */ - /* 2.3.6 */ - /* */ - FT_EXPORT( FT_UInt32* ) - FT_Face_GetVariantsOfChar( FT_Face face, - FT_ULong charcode ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Face_GetCharsOfVariant */ - /* */ - /* <Description> */ - /* Return a zero-terminated list of Unicode character codes found for */ - /* the specified variant selector. */ - /* */ - /* <Input> */ - /* face :: */ - /* A handle to the source face object. */ - /* */ - /* variantSelector :: */ - /* The variant selector code point in Unicode. */ - /* */ - /* <Return> */ - /* A list of all the code points which are specified by this selector */ - /* (both default and non-default codes are returned) or NULL if there */ - /* is no valid cmap or the variant selector is invalid. */ - /* */ - /* <Note> */ - /* The last item in the array is~0; the array is owned by the */ - /* @FT_Face object but can be overwritten or released on the next */ - /* call to a FreeType function. */ - /* */ - /* <Since> */ - /* 2.3.6 */ - /* */ - FT_EXPORT( FT_UInt32* ) - FT_Face_GetCharsOfVariant( FT_Face face, - FT_ULong variantSelector ); - - /*************************************************************************/ - /* */ - /* <Section> */ - /* computations */ - /* */ - /* <Title> */ - /* Computations */ - /* */ - /* <Abstract> */ - /* Crunching fixed numbers and vectors. */ - /* */ - /* <Description> */ - /* This section contains various functions used to perform */ - /* computations on 16.16 fixed-float numbers or 2d vectors. */ - /* */ - /* <Order> */ - /* FT_MulDiv */ - /* FT_MulFix */ - /* FT_DivFix */ - /* FT_RoundFix */ - /* FT_CeilFix */ - /* FT_FloorFix */ - /* FT_Vector_Transform */ - /* FT_Matrix_Multiply */ - /* FT_Matrix_Invert */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_MulDiv */ - /* */ - /* <Description> */ - /* A very simple function used to perform the computation `(a*b)/c' */ - /* with maximum accuracy (it uses a 64-bit intermediate integer */ - /* whenever necessary). */ - /* */ - /* This function isn't necessarily as fast as some processor specific */ - /* operations, but is at least completely portable. */ - /* */ - /* <Input> */ - /* a :: The first multiplier. */ - /* b :: The second multiplier. */ - /* c :: The divisor. */ - /* */ - /* <Return> */ - /* The result of `(a*b)/c'. This function never traps when trying to */ - /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */ - /* on the signs of `a' and `b'. */ - /* */ - FT_EXPORT( FT_Long ) - FT_MulDiv( FT_Long a, - FT_Long b, - FT_Long c ); - - /* */ - - /* The following #if 0 ... #endif is for the documentation formatter, */ - /* hiding the internal `FT_MULFIX_INLINED' macro. */ - -#if 0 - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_MulFix */ - /* */ - /* <Description> */ - /* A very simple function used to perform the computation */ - /* `(a*b)/0x10000' with maximum accuracy. Most of the time this is */ - /* used to multiply a given value by a 16.16 fixed float factor. */ - /* */ - /* <Input> */ - /* a :: The first multiplier. */ - /* b :: The second multiplier. Use a 16.16 factor here whenever */ - /* possible (see note below). */ - /* */ - /* <Return> */ - /* The result of `(a*b)/0x10000'. */ - /* */ - /* <Note> */ - /* This function has been optimized for the case where the absolute */ - /* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */ - /* As this happens mainly when scaling from notional units to */ - /* fractional pixels in FreeType, it resulted in noticeable speed */ - /* improvements between versions 2.x and 1.x. */ - /* */ - /* As a conclusion, always try to place a 16.16 factor as the */ - /* _second_ argument of this function; this can make a great */ - /* difference. */ - /* */ - FT_EXPORT( FT_Long ) - FT_MulFix( FT_Long a, - FT_Long b ); - - /* */ -#endif - -#ifdef FT_MULFIX_INLINED -#define FT_MulFix( a, b ) FT_MULFIX_INLINED( a, b ) -#else - FT_EXPORT( FT_Long ) - FT_MulFix( FT_Long a, - FT_Long b ); -#endif - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_DivFix */ - /* */ - /* <Description> */ - /* A very simple function used to perform the computation */ - /* `(a*0x10000)/b' with maximum accuracy. Most of the time, this is */ - /* used to divide a given value by a 16.16 fixed float factor. */ - /* */ - /* <Input> */ - /* a :: The first multiplier. */ - /* b :: The second multiplier. Use a 16.16 factor here whenever */ - /* possible (see note below). */ - /* */ - /* <Return> */ - /* The result of `(a*0x10000)/b'. */ - /* */ - /* <Note> */ - /* The optimization for FT_DivFix() is simple: If (a~<<~16) fits in */ - /* 32~bits, then the division is computed directly. Otherwise, we */ - /* use a specialized version of @FT_MulDiv. */ - /* */ - FT_EXPORT( FT_Long ) - FT_DivFix( FT_Long a, - FT_Long b ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_RoundFix */ - /* */ - /* <Description> */ - /* A very simple function used to round a 16.16 fixed number. */ - /* */ - /* <Input> */ - /* a :: The number to be rounded. */ - /* */ - /* <Return> */ - /* The result of `(a + 0x8000) & -0x10000'. */ - /* */ - FT_EXPORT( FT_Fixed ) - FT_RoundFix( FT_Fixed a ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_CeilFix */ - /* */ - /* <Description> */ - /* A very simple function used to compute the ceiling function of a */ - /* 16.16 fixed number. */ - /* */ - /* <Input> */ - /* a :: The number for which the ceiling function is to be computed. */ - /* */ - /* <Return> */ - /* The result of `(a + 0x10000 - 1) & -0x10000'. */ - /* */ - FT_EXPORT( FT_Fixed ) - FT_CeilFix( FT_Fixed a ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_FloorFix */ - /* */ - /* <Description> */ - /* A very simple function used to compute the floor function of a */ - /* 16.16 fixed number. */ - /* */ - /* <Input> */ - /* a :: The number for which the floor function is to be computed. */ - /* */ - /* <Return> */ - /* The result of `a & -0x10000'. */ - /* */ - FT_EXPORT( FT_Fixed ) - FT_FloorFix( FT_Fixed a ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Vector_Transform */ - /* */ - /* <Description> */ - /* Transform a single vector through a 2x2 matrix. */ - /* */ - /* <InOut> */ - /* vector :: The target vector to transform. */ - /* */ - /* <Input> */ - /* matrix :: A pointer to the source 2x2 matrix. */ - /* */ - /* <Note> */ - /* The result is undefined if either `vector' or `matrix' is invalid. */ - /* */ - FT_EXPORT( void ) - FT_Vector_Transform( FT_Vector* vec, - const FT_Matrix* matrix ); - - /*************************************************************************/ - /* */ - /* <Section> */ - /* version */ - /* */ - /* <Title> */ - /* FreeType Version */ - /* */ - /* <Abstract> */ - /* Functions and macros related to FreeType versions. */ - /* */ - /* <Description> */ - /* Note that those functions and macros are of limited use because */ - /* even a new release of FreeType with only documentation changes */ - /* increases the version number. */ - /* */ - /*************************************************************************/ - - /************************************************************************* - * - * @enum: - * FREETYPE_XXX - * - * @description: - * These three macros identify the FreeType source code version. - * Use @FT_Library_Version to access them at runtime. - * - * @values: - * FREETYPE_MAJOR :: The major version number. - * FREETYPE_MINOR :: The minor version number. - * FREETYPE_PATCH :: The patch level. - * - * @note: - * The version number of FreeType if built as a dynamic link library - * with the `libtool' package is _not_ controlled by these three - * macros. - * - */ -#define FREETYPE_MAJOR 2 -#define FREETYPE_MINOR 4 -#define FREETYPE_PATCH 9 - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Library_Version */ - /* */ - /* <Description> */ - /* Return the version of the FreeType library being used. This is */ - /* useful when dynamically linking to the library, since one cannot */ - /* use the macros @FREETYPE_MAJOR, @FREETYPE_MINOR, and */ - /* @FREETYPE_PATCH. */ - /* */ - /* <Input> */ - /* library :: A source library handle. */ - /* */ - /* <Output> */ - /* amajor :: The major version number. */ - /* */ - /* aminor :: The minor version number. */ - /* */ - /* apatch :: The patch version number. */ - /* */ - /* <Note> */ - /* The reason why this function takes a `library' argument is because */ - /* certain programs implement library initialization in a custom way */ - /* that doesn't use @FT_Init_FreeType. */ - /* */ - /* In such cases, the library version might not be available before */ - /* the library object has been created. */ - /* */ - FT_EXPORT( void ) - FT_Library_Version( FT_Library library, - FT_Int *amajor, - FT_Int *aminor, - FT_Int *apatch ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Face_CheckTrueTypePatents */ - /* */ - /* <Description> */ - /* Parse all bytecode instructions of a TrueType font file to check */ - /* whether any of the patented opcodes are used. This is only useful */ - /* if you want to be able to use the unpatented hinter with */ - /* fonts that do *not* use these opcodes. */ - /* */ - /* Note that this function parses *all* glyph instructions in the */ - /* font file, which may be slow. */ - /* */ - /* <Input> */ - /* face :: A face handle. */ - /* */ - /* <Return> */ - /* 1~if this is a TrueType font that uses one of the patented */ - /* opcodes, 0~otherwise. */ - /* */ - /* <Note> */ - /* Since May 2010, TrueType hinting is no longer patented. */ - /* */ - /* <Since> */ - /* 2.3.5 */ - /* */ - FT_EXPORT( FT_Bool ) - FT_Face_CheckTrueTypePatents( FT_Face face ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Face_SetUnpatentedHinting */ - /* */ - /* <Description> */ - /* Enable or disable the unpatented hinter for a given face. */ - /* Only enable it if you have determined that the face doesn't */ - /* use any patented opcodes (see @FT_Face_CheckTrueTypePatents). */ - /* */ - /* <Input> */ - /* face :: A face handle. */ - /* */ - /* value :: New boolean setting. */ - /* */ - /* <Return> */ - /* The old setting value. This will always be false if this is not */ - /* an SFNT font, or if the unpatented hinter is not compiled in this */ - /* instance of the library. */ - /* */ - /* <Note> */ - /* Since May 2010, TrueType hinting is no longer patented. */ - /* */ - /* <Since> */ - /* 2.3.5 */ - /* */ - FT_EXPORT( FT_Bool ) - FT_Face_SetUnpatentedHinting( FT_Face face, - FT_Bool value ); - - /* */ - -FT_END_HEADER - -#endif /* __FREETYPE_H__ */ - -/* END */ - -/*** End of inlined file: freetype.h ***/ - -/* - * These headers are normally included manually but we add them - * here for completeness. - * - */ - -/*** Start of inlined file: ftgasp.h ***/ -/* */ -/* ftgasp.h */ -/* */ -/* Access of TrueType's `gasp' table (specification). */ -/* */ -/* Copyright 2007, 2008, 2011 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - -#ifndef _FT_GASP_H_ -#define _FT_GASP_H_ - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - - /*************************************************************************** - * - * @section: - * gasp_table - * - * @title: - * Gasp Table - * - * @abstract: - * Retrieving TrueType `gasp' table entries. - * - * @description: - * The function @FT_Get_Gasp can be used to query a TrueType or OpenType - * font for specific entries in its `gasp' table, if any. This is - * mainly useful when implementing native TrueType hinting with the - * bytecode interpreter to duplicate the Windows text rendering results. - */ - - /************************************************************************* - * - * @enum: - * FT_GASP_XXX - * - * @description: - * A list of values and/or bit-flags returned by the @FT_Get_Gasp - * function. - * - * @values: - * FT_GASP_NO_TABLE :: - * This special value means that there is no GASP table in this face. - * It is up to the client to decide what to do. - * - * FT_GASP_DO_GRIDFIT :: - * Grid-fitting and hinting should be performed at the specified ppem. - * This *really* means TrueType bytecode interpretation. If this bit - * is not set, no hinting gets applied. - * - * FT_GASP_DO_GRAY :: - * Anti-aliased rendering should be performed at the specified ppem. - * If not set, do monochrome rendering. - * - * FT_GASP_SYMMETRIC_SMOOTHING :: - * If set, smoothing along multiple axes must be used with ClearType. - * - * FT_GASP_SYMMETRIC_GRIDFIT :: - * Grid-fitting must be used with ClearType's symmetric smoothing. - * - * @note: - * The bit-flags `FT_GASP_DO_GRIDFIT' and `FT_GASP_DO_GRAY' are to be - * used for standard font rasterization only. Independently of that, - * `FT_GASP_SYMMETRIC_SMOOTHING' and `FT_GASP_SYMMETRIC_GRIDFIT' are to - * be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT' and - * `FT_GASP_DO_GRAY' are consequently ignored). - * - * `ClearType' is Microsoft's implementation of LCD rendering, partly - * protected by patents. - * - * @since: - * 2.3.0 - */ -#define FT_GASP_NO_TABLE -1 -#define FT_GASP_DO_GRIDFIT 0x01 -#define FT_GASP_DO_GRAY 0x02 -#define FT_GASP_SYMMETRIC_SMOOTHING 0x08 -#define FT_GASP_SYMMETRIC_GRIDFIT 0x10 - - /************************************************************************* - * - * @func: - * FT_Get_Gasp - * - * @description: - * Read the `gasp' table from a TrueType or OpenType font file and - * return the entry corresponding to a given character pixel size. - * - * @input: - * face :: The source face handle. - * ppem :: The vertical character pixel size. - * - * @return: - * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no - * `gasp' table in the face. - * - * @since: - * 2.3.0 - */ - FT_EXPORT( FT_Int ) - FT_Get_Gasp( FT_Face face, - FT_UInt ppem ); - -/* */ - -#endif /* _FT_GASP_H_ */ - -/* END */ - -/*** End of inlined file: ftgasp.h ***/ - - - -/*** Start of inlined file: ftglyph.h ***/ -/* */ -/* ftglyph.h */ -/* */ -/* FreeType convenience functions to handle glyphs (specification). */ -/* */ -/* Copyright 1996-2003, 2006, 2008, 2009, 2011 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - /*************************************************************************/ - /* */ - /* This file contains the definition of several convenience functions */ - /* that can be used by client applications to easily retrieve glyph */ - /* bitmaps and outlines from a given face. */ - /* */ - /* These functions should be optional if you are writing a font server */ - /* or text layout engine on top of FreeType. However, they are pretty */ - /* handy for many other simple uses of the library. */ - /* */ - /*************************************************************************/ - -#ifndef __FTGLYPH_H__ -#define __FTGLYPH_H__ - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - -FT_BEGIN_HEADER - - /*************************************************************************/ - /* */ - /* <Section> */ - /* glyph_management */ - /* */ - /* <Title> */ - /* Glyph Management */ - /* */ - /* <Abstract> */ - /* Generic interface to manage individual glyph data. */ - /* */ - /* <Description> */ - /* This section contains definitions used to manage glyph data */ - /* through generic FT_Glyph objects. Each of them can contain a */ - /* bitmap, a vector outline, or even images in other formats. */ - /* */ - /*************************************************************************/ - - /* forward declaration to a private type */ - typedef struct FT_Glyph_Class_ FT_Glyph_Class; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_Glyph */ - /* */ - /* <Description> */ - /* Handle to an object used to model generic glyph images. It is a */ - /* pointer to the @FT_GlyphRec structure and can contain a glyph */ - /* bitmap or pointer. */ - /* */ - /* <Note> */ - /* Glyph objects are not owned by the library. You must thus release */ - /* them manually (through @FT_Done_Glyph) _before_ calling */ - /* @FT_Done_FreeType. */ - /* */ - typedef struct FT_GlyphRec_* FT_Glyph; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_GlyphRec */ - /* */ - /* <Description> */ - /* The root glyph structure contains a given glyph image plus its */ - /* advance width in 16.16 fixed float format. */ - /* */ - /* <Fields> */ - /* library :: A handle to the FreeType library object. */ - /* */ - /* clazz :: A pointer to the glyph's class. Private. */ - /* */ - /* format :: The format of the glyph's image. */ - /* */ - /* advance :: A 16.16 vector that gives the glyph's advance width. */ - /* */ - typedef struct FT_GlyphRec_ - { - FT_Library library; - const FT_Glyph_Class* clazz; - FT_Glyph_Format format; - FT_Vector advance; - - } FT_GlyphRec; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_BitmapGlyph */ - /* */ - /* <Description> */ - /* A handle to an object used to model a bitmap glyph image. This is */ - /* a sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec. */ - /* */ - typedef struct FT_BitmapGlyphRec_* FT_BitmapGlyph; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_BitmapGlyphRec */ - /* */ - /* <Description> */ - /* A structure used for bitmap glyph images. This really is a */ - /* `sub-class' of @FT_GlyphRec. */ - /* */ - /* <Fields> */ - /* root :: The root @FT_Glyph fields. */ - /* */ - /* left :: The left-side bearing, i.e., the horizontal distance */ - /* from the current pen position to the left border of the */ - /* glyph bitmap. */ - /* */ - /* top :: The top-side bearing, i.e., the vertical distance from */ - /* the current pen position to the top border of the glyph */ - /* bitmap. This distance is positive for upwards~y! */ - /* */ - /* bitmap :: A descriptor for the bitmap. */ - /* */ - /* <Note> */ - /* You can typecast an @FT_Glyph to @FT_BitmapGlyph if you have */ - /* `glyph->format == FT_GLYPH_FORMAT_BITMAP'. This lets you access */ - /* the bitmap's contents easily. */ - /* */ - /* The corresponding pixel buffer is always owned by @FT_BitmapGlyph */ - /* and is thus created and destroyed with it. */ - /* */ - typedef struct FT_BitmapGlyphRec_ - { - FT_GlyphRec root; - FT_Int left; - FT_Int top; - FT_Bitmap bitmap; - - } FT_BitmapGlyphRec; - - /*************************************************************************/ - /* */ - /* <Type> */ - /* FT_OutlineGlyph */ - /* */ - /* <Description> */ - /* A handle to an object used to model an outline glyph image. This */ - /* is a sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec. */ - /* */ - typedef struct FT_OutlineGlyphRec_* FT_OutlineGlyph; - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* FT_OutlineGlyphRec */ - /* */ - /* <Description> */ - /* A structure used for outline (vectorial) glyph images. This */ - /* really is a `sub-class' of @FT_GlyphRec. */ - /* */ - /* <Fields> */ - /* root :: The root @FT_Glyph fields. */ - /* */ - /* outline :: A descriptor for the outline. */ - /* */ - /* <Note> */ - /* You can typecast an @FT_Glyph to @FT_OutlineGlyph if you have */ - /* `glyph->format == FT_GLYPH_FORMAT_OUTLINE'. This lets you access */ - /* the outline's content easily. */ - /* */ - /* As the outline is extracted from a glyph slot, its coordinates are */ - /* expressed normally in 26.6 pixels, unless the flag */ - /* @FT_LOAD_NO_SCALE was used in @FT_Load_Glyph() or @FT_Load_Char(). */ - /* */ - /* The outline's tables are always owned by the object and are */ - /* destroyed with it. */ - /* */ - typedef struct FT_OutlineGlyphRec_ - { - FT_GlyphRec root; - FT_Outline outline; - - } FT_OutlineGlyphRec; - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Get_Glyph */ - /* */ - /* <Description> */ - /* A function used to extract a glyph image from a slot. Note that */ - /* the created @FT_Glyph object must be released with @FT_Done_Glyph. */ - /* */ - /* <Input> */ - /* slot :: A handle to the source glyph slot. */ - /* */ - /* <Output> */ - /* aglyph :: A handle to the glyph object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Get_Glyph( FT_GlyphSlot slot, - FT_Glyph *aglyph ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Glyph_Copy */ - /* */ - /* <Description> */ - /* A function used to copy a glyph image. Note that the created */ - /* @FT_Glyph object must be released with @FT_Done_Glyph. */ - /* */ - /* <Input> */ - /* source :: A handle to the source glyph object. */ - /* */ - /* <Output> */ - /* target :: A handle to the target glyph object. 0~in case of */ - /* error. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Glyph_Copy( FT_Glyph source, - FT_Glyph *target ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Glyph_Transform */ - /* */ - /* <Description> */ - /* Transform a glyph image if its format is scalable. */ - /* */ - /* <InOut> */ - /* glyph :: A handle to the target glyph object. */ - /* */ - /* <Input> */ - /* matrix :: A pointer to a 2x2 matrix to apply. */ - /* */ - /* delta :: A pointer to a 2d vector to apply. Coordinates are */ - /* expressed in 1/64th of a pixel. */ - /* */ - /* <Return> */ - /* FreeType error code (if not 0, the glyph format is not scalable). */ - /* */ - /* <Note> */ - /* The 2x2 transformation matrix is also applied to the glyph's */ - /* advance vector. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Glyph_Transform( FT_Glyph glyph, - FT_Matrix* matrix, - FT_Vector* delta ); - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* FT_Glyph_BBox_Mode */ - /* */ - /* <Description> */ - /* The mode how the values of @FT_Glyph_Get_CBox are returned. */ - /* */ - /* <Values> */ - /* FT_GLYPH_BBOX_UNSCALED :: */ - /* Return unscaled font units. */ - /* */ - /* FT_GLYPH_BBOX_SUBPIXELS :: */ - /* Return unfitted 26.6 coordinates. */ - /* */ - /* FT_GLYPH_BBOX_GRIDFIT :: */ - /* Return grid-fitted 26.6 coordinates. */ - /* */ - /* FT_GLYPH_BBOX_TRUNCATE :: */ - /* Return coordinates in integer pixels. */ - /* */ - /* FT_GLYPH_BBOX_PIXELS :: */ - /* Return grid-fitted pixel coordinates. */ - /* */ - typedef enum FT_Glyph_BBox_Mode_ - { - FT_GLYPH_BBOX_UNSCALED = 0, - FT_GLYPH_BBOX_SUBPIXELS = 0, - FT_GLYPH_BBOX_GRIDFIT = 1, - FT_GLYPH_BBOX_TRUNCATE = 2, - FT_GLYPH_BBOX_PIXELS = 3 - - } FT_Glyph_BBox_Mode; - - /*************************************************************************/ - /* */ - /* <Enum> */ - /* ft_glyph_bbox_xxx */ - /* */ - /* <Description> */ - /* These constants are deprecated. Use the corresponding */ - /* @FT_Glyph_BBox_Mode values instead. */ - /* */ - /* <Values> */ - /* ft_glyph_bbox_unscaled :: See @FT_GLYPH_BBOX_UNSCALED. */ - /* ft_glyph_bbox_subpixels :: See @FT_GLYPH_BBOX_SUBPIXELS. */ - /* ft_glyph_bbox_gridfit :: See @FT_GLYPH_BBOX_GRIDFIT. */ - /* ft_glyph_bbox_truncate :: See @FT_GLYPH_BBOX_TRUNCATE. */ - /* ft_glyph_bbox_pixels :: See @FT_GLYPH_BBOX_PIXELS. */ - /* */ -#define ft_glyph_bbox_unscaled FT_GLYPH_BBOX_UNSCALED -#define ft_glyph_bbox_subpixels FT_GLYPH_BBOX_SUBPIXELS -#define ft_glyph_bbox_gridfit FT_GLYPH_BBOX_GRIDFIT -#define ft_glyph_bbox_truncate FT_GLYPH_BBOX_TRUNCATE -#define ft_glyph_bbox_pixels FT_GLYPH_BBOX_PIXELS - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Glyph_Get_CBox */ - /* */ - /* <Description> */ - /* Return a glyph's `control box'. The control box encloses all the */ - /* outline's points, including Bézier control points. Though it */ - /* coincides with the exact bounding box for most glyphs, it can be */ - /* slightly larger in some situations (like when rotating an outline */ - /* which contains Bézier outside arcs). */ - /* */ - /* Computing the control box is very fast, while getting the bounding */ - /* box can take much more time as it needs to walk over all segments */ - /* and arcs in the outline. To get the latter, you can use the */ - /* `ftbbox' component which is dedicated to this single task. */ - /* */ - /* <Input> */ - /* glyph :: A handle to the source glyph object. */ - /* */ - /* mode :: The mode which indicates how to interpret the returned */ - /* bounding box values. */ - /* */ - /* <Output> */ - /* acbox :: The glyph coordinate bounding box. Coordinates are */ - /* expressed in 1/64th of pixels if it is grid-fitted. */ - /* */ - /* <Note> */ - /* Coordinates are relative to the glyph origin, using the y~upwards */ - /* convention. */ - /* */ - /* If the glyph has been loaded with @FT_LOAD_NO_SCALE, `bbox_mode' */ - /* must be set to @FT_GLYPH_BBOX_UNSCALED to get unscaled font */ - /* units in 26.6 pixel format. The value @FT_GLYPH_BBOX_SUBPIXELS */ - /* is another name for this constant. */ - /* */ - /* If the font is tricky and the glyph has been loaded with */ - /* @FT_LOAD_NO_SCALE, the resulting CBox is meaningless. To get */ - /* reasonable values for the CBox it is necessary to load the glyph */ - /* at a large ppem value (so that the hinting instructions can */ - /* properly shift and scale the subglyphs), then extracting the CBox */ - /* which can be eventually converted back to font units. */ - /* */ - /* Note that the maximum coordinates are exclusive, which means that */ - /* one can compute the width and height of the glyph image (be it in */ - /* integer or 26.6 pixels) as: */ - /* */ - /* { */ - /* width = bbox.xMax - bbox.xMin; */ - /* height = bbox.yMax - bbox.yMin; */ - /* } */ - /* */ - /* Note also that for 26.6 coordinates, if `bbox_mode' is set to */ - /* @FT_GLYPH_BBOX_GRIDFIT, the coordinates will also be grid-fitted, */ - /* which corresponds to: */ - /* */ - /* { */ - /* bbox.xMin = FLOOR(bbox.xMin); */ - /* bbox.yMin = FLOOR(bbox.yMin); */ - /* bbox.xMax = CEILING(bbox.xMax); */ - /* bbox.yMax = CEILING(bbox.yMax); */ - /* } */ - /* */ - /* To get the bbox in pixel coordinates, set `bbox_mode' to */ - /* @FT_GLYPH_BBOX_TRUNCATE. */ - /* */ - /* To get the bbox in grid-fitted pixel coordinates, set `bbox_mode' */ - /* to @FT_GLYPH_BBOX_PIXELS. */ - /* */ - FT_EXPORT( void ) - FT_Glyph_Get_CBox( FT_Glyph glyph, - FT_UInt bbox_mode, - FT_BBox *acbox ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Glyph_To_Bitmap */ - /* */ - /* <Description> */ - /* Convert a given glyph object to a bitmap glyph object. */ - /* */ - /* <InOut> */ - /* the_glyph :: A pointer to a handle to the target glyph. */ - /* */ - /* <Input> */ - /* render_mode :: An enumeration that describes how the data is */ - /* rendered. */ - /* */ - /* origin :: A pointer to a vector used to translate the glyph */ - /* image before rendering. Can be~0 (if no */ - /* translation). The origin is expressed in */ - /* 26.6 pixels. */ - /* */ - /* destroy :: A boolean that indicates that the original glyph */ - /* image should be destroyed by this function. It is */ - /* never destroyed in case of error. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* This function does nothing if the glyph format isn't scalable. */ - /* */ - /* The glyph image is translated with the `origin' vector before */ - /* rendering. */ - /* */ - /* The first parameter is a pointer to an @FT_Glyph handle, that will */ - /* be _replaced_ by this function (with newly allocated data). */ - /* Typically, you would use (omitting error handling): */ - /* */ - /* */ - /* { */ - /* FT_Glyph glyph; */ - /* FT_BitmapGlyph glyph_bitmap; */ - /* */ - /* */ - /* // load glyph */ - /* error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAUT ); */ - /* */ - /* // extract glyph image */ - /* error = FT_Get_Glyph( face->glyph, &glyph ); */ - /* */ - /* // convert to a bitmap (default render mode + destroying old) */ - /* if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) */ - /* { */ - /* error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL, */ - /* 0, 1 ); */ - /* if ( error ) // `glyph' unchanged */ - /* ... */ - /* } */ - /* */ - /* // access bitmap content by typecasting */ - /* glyph_bitmap = (FT_BitmapGlyph)glyph; */ - /* */ - /* // do funny stuff with it, like blitting/drawing */ - /* ... */ - /* */ - /* // discard glyph image (bitmap or not) */ - /* FT_Done_Glyph( glyph ); */ - /* } */ - /* */ - /* */ - /* Here another example, again without error handling: */ - /* */ - /* */ - /* { */ - /* FT_Glyph glyphs[MAX_GLYPHS] */ - /* */ - /* */ - /* ... */ - /* */ - /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */ - /* error = FT_Load_Glyph( face, idx, FT_LOAD_DEFAULT ) || */ - /* FT_Get_Glyph ( face->glyph, &glyph[idx] ); */ - /* */ - /* ... */ - /* */ - /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */ - /* { */ - /* FT_Glyph bitmap = glyphs[idx]; */ - /* */ - /* */ - /* ... */ - /* */ - /* // after this call, `bitmap' no longer points into */ - /* // the `glyphs' array (and the old value isn't destroyed) */ - /* FT_Glyph_To_Bitmap( &bitmap, FT_RENDER_MODE_MONO, 0, 0 ); */ - /* */ - /* ... */ - /* */ - /* FT_Done_Glyph( bitmap ); */ - /* } */ - /* */ - /* ... */ - /* */ - /* for ( idx = 0; i < MAX_GLYPHS; i++ ) */ - /* FT_Done_Glyph( glyphs[idx] ); */ - /* } */ - /* */ - FT_EXPORT( FT_Error ) - FT_Glyph_To_Bitmap( FT_Glyph* the_glyph, - FT_Render_Mode render_mode, - FT_Vector* origin, - FT_Bool destroy ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Done_Glyph */ - /* */ - /* <Description> */ - /* Destroy a given glyph. */ - /* */ - /* <Input> */ - /* glyph :: A handle to the target glyph object. */ - /* */ - FT_EXPORT( void ) - FT_Done_Glyph( FT_Glyph glyph ); - - /* */ - - /* other helpful functions */ - - /*************************************************************************/ - /* */ - /* <Section> */ - /* computations */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Matrix_Multiply */ - /* */ - /* <Description> */ - /* Perform the matrix operation `b = a*b'. */ - /* */ - /* <Input> */ - /* a :: A pointer to matrix `a'. */ - /* */ - /* <InOut> */ - /* b :: A pointer to matrix `b'. */ - /* */ - /* <Note> */ - /* The result is undefined if either `a' or `b' is zero. */ - /* */ - FT_EXPORT( void ) - FT_Matrix_Multiply( const FT_Matrix* a, - FT_Matrix* b ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Matrix_Invert */ - /* */ - /* <Description> */ - /* Invert a 2x2 matrix. Return an error if it can't be inverted. */ - /* */ - /* <InOut> */ - /* matrix :: A pointer to the target matrix. Remains untouched in */ - /* case of error. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Matrix_Invert( FT_Matrix* matrix ); - - /* */ - -FT_END_HEADER - -#endif /* __FTGLYPH_H__ */ - -/* END */ - -/* Local Variables: */ -/* coding: utf-8 */ -/* End: */ - -/*** End of inlined file: ftglyph.h ***/ - - -/*** Start of inlined file: ftoutln.h ***/ -/* */ -/* ftoutln.h */ -/* */ -/* Support for the FT_Outline type used to store glyph shapes of */ -/* most scalable font formats (specification). */ -/* */ -/* Copyright 1996-2003, 2005-2012 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - -#ifndef __FTOUTLN_H__ -#define __FTOUTLN_H__ - -#ifdef FREETYPE_H -#error "freetype.h of FreeType 1 has been loaded!" -#error "Please fix the directory search order for header files" -#error "so that freetype.h of FreeType 2 is found first." -#endif - -FT_BEGIN_HEADER - - /*************************************************************************/ - /* */ - /* <Section> */ - /* outline_processing */ - /* */ - /* <Title> */ - /* Outline Processing */ - /* */ - /* <Abstract> */ - /* Functions to create, transform, and render vectorial glyph images. */ - /* */ - /* <Description> */ - /* This section contains routines used to create and destroy scalable */ - /* glyph images known as `outlines'. These can also be measured, */ - /* transformed, and converted into bitmaps and pixmaps. */ - /* */ - /* <Order> */ - /* FT_Outline */ - /* FT_OUTLINE_FLAGS */ - /* FT_Outline_New */ - /* FT_Outline_Done */ - /* FT_Outline_Copy */ - /* FT_Outline_Translate */ - /* FT_Outline_Transform */ - /* FT_Outline_Embolden */ - /* FT_Outline_Reverse */ - /* FT_Outline_Check */ - /* */ - /* FT_Outline_Get_CBox */ - /* FT_Outline_Get_BBox */ - /* */ - /* FT_Outline_Get_Bitmap */ - /* FT_Outline_Render */ - /* */ - /* FT_Outline_Decompose */ - /* FT_Outline_Funcs */ - /* FT_Outline_MoveTo_Func */ - /* FT_Outline_LineTo_Func */ - /* FT_Outline_ConicTo_Func */ - /* FT_Outline_CubicTo_Func */ - /* */ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Decompose */ - /* */ - /* <Description> */ - /* Walk over an outline's structure to decompose it into individual */ - /* segments and Bézier arcs. This function also emits `move to' */ - /* operations to indicate the start of new contours in the outline. */ - /* */ - /* <Input> */ - /* outline :: A pointer to the source target. */ - /* */ - /* func_interface :: A table of `emitters', i.e., function pointers */ - /* called during decomposition to indicate path */ - /* operations. */ - /* */ - /* <InOut> */ - /* user :: A typeless pointer which is passed to each */ - /* emitter during the decomposition. It can be */ - /* used to store the state during the */ - /* decomposition. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_Decompose( FT_Outline* outline, - const FT_Outline_Funcs* func_interface, - void* user ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_New */ - /* */ - /* <Description> */ - /* Create a new outline of a given size. */ - /* */ - /* <Input> */ - /* library :: A handle to the library object from where the */ - /* outline is allocated. Note however that the new */ - /* outline will *not* necessarily be *freed*, when */ - /* destroying the library, by @FT_Done_FreeType. */ - /* */ - /* numPoints :: The maximum number of points within the outline. */ - /* */ - /* numContours :: The maximum number of contours within the outline. */ - /* */ - /* <Output> */ - /* anoutline :: A handle to the new outline. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* The reason why this function takes a `library' parameter is simply */ - /* to use the library's memory allocator. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_New( FT_Library library, - FT_UInt numPoints, - FT_Int numContours, - FT_Outline *anoutline ); - - FT_EXPORT( FT_Error ) - FT_Outline_New_Internal( FT_Memory memory, - FT_UInt numPoints, - FT_Int numContours, - FT_Outline *anoutline ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Done */ - /* */ - /* <Description> */ - /* Destroy an outline created with @FT_Outline_New. */ - /* */ - /* <Input> */ - /* library :: A handle of the library object used to allocate the */ - /* outline. */ - /* */ - /* outline :: A pointer to the outline object to be discarded. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* If the outline's `owner' field is not set, only the outline */ - /* descriptor will be released. */ - /* */ - /* The reason why this function takes an `library' parameter is */ - /* simply to use ft_mem_free(). */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_Done( FT_Library library, - FT_Outline* outline ); - - FT_EXPORT( FT_Error ) - FT_Outline_Done_Internal( FT_Memory memory, - FT_Outline* outline ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Check */ - /* */ - /* <Description> */ - /* Check the contents of an outline descriptor. */ - /* */ - /* <Input> */ - /* outline :: A handle to a source outline. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_Check( FT_Outline* outline ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Get_CBox */ - /* */ - /* <Description> */ - /* Return an outline's `control box'. The control box encloses all */ - /* the outline's points, including Bézier control points. Though it */ - /* coincides with the exact bounding box for most glyphs, it can be */ - /* slightly larger in some situations (like when rotating an outline */ - /* which contains Bézier outside arcs). */ - /* */ - /* Computing the control box is very fast, while getting the bounding */ - /* box can take much more time as it needs to walk over all segments */ - /* and arcs in the outline. To get the latter, you can use the */ - /* `ftbbox' component which is dedicated to this single task. */ - /* */ - /* <Input> */ - /* outline :: A pointer to the source outline descriptor. */ - /* */ - /* <Output> */ - /* acbox :: The outline's control box. */ - /* */ - /* <Note> */ - /* See @FT_Glyph_Get_CBox for a discussion of tricky fonts. */ - /* */ - FT_EXPORT( void ) - FT_Outline_Get_CBox( const FT_Outline* outline, - FT_BBox *acbox ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Translate */ - /* */ - /* <Description> */ - /* Apply a simple translation to the points of an outline. */ - /* */ - /* <InOut> */ - /* outline :: A pointer to the target outline descriptor. */ - /* */ - /* <Input> */ - /* xOffset :: The horizontal offset. */ - /* */ - /* yOffset :: The vertical offset. */ - /* */ - FT_EXPORT( void ) - FT_Outline_Translate( const FT_Outline* outline, - FT_Pos xOffset, - FT_Pos yOffset ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Copy */ - /* */ - /* <Description> */ - /* Copy an outline into another one. Both objects must have the */ - /* same sizes (number of points & number of contours) when this */ - /* function is called. */ - /* */ - /* <Input> */ - /* source :: A handle to the source outline. */ - /* */ - /* <Output> */ - /* target :: A handle to the target outline. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_Copy( const FT_Outline* source, - FT_Outline *target ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Transform */ - /* */ - /* <Description> */ - /* Apply a simple 2x2 matrix to all of an outline's points. Useful */ - /* for applying rotations, slanting, flipping, etc. */ - /* */ - /* <InOut> */ - /* outline :: A pointer to the target outline descriptor. */ - /* */ - /* <Input> */ - /* matrix :: A pointer to the transformation matrix. */ - /* */ - /* <Note> */ - /* You can use @FT_Outline_Translate if you need to translate the */ - /* outline's points. */ - /* */ - FT_EXPORT( void ) - FT_Outline_Transform( const FT_Outline* outline, - const FT_Matrix* matrix ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Embolden */ - /* */ - /* <Description> */ - /* Embolden an outline. The new outline will be at most 4~times */ - /* `strength' pixels wider and higher. You may think of the left and */ - /* bottom borders as unchanged. */ - /* */ - /* Negative `strength' values to reduce the outline thickness are */ - /* possible also. */ - /* */ - /* <InOut> */ - /* outline :: A handle to the target outline. */ - /* */ - /* <Input> */ - /* strength :: How strong the glyph is emboldened. Expressed in */ - /* 26.6 pixel format. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* The used algorithm to increase or decrease the thickness of the */ - /* glyph doesn't change the number of points; this means that certain */ - /* situations like acute angles or intersections are sometimes */ - /* handled incorrectly. */ - /* */ - /* If you need `better' metrics values you should call */ - /* @FT_Outline_Get_CBox or @FT_Outline_Get_BBox. */ - /* */ - /* Example call: */ - /* */ - /* { */ - /* FT_Load_Glyph( face, index, FT_LOAD_DEFAULT ); */ - /* if ( face->slot->format == FT_GLYPH_FORMAT_OUTLINE ) */ - /* FT_Outline_Embolden( &face->slot->outline, strength ); */ - /* } */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_Embolden( FT_Outline* outline, - FT_Pos strength ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Reverse */ - /* */ - /* <Description> */ - /* Reverse the drawing direction of an outline. This is used to */ - /* ensure consistent fill conventions for mirrored glyphs. */ - /* */ - /* <InOut> */ - /* outline :: A pointer to the target outline descriptor. */ - /* */ - /* <Note> */ - /* This function toggles the bit flag @FT_OUTLINE_REVERSE_FILL in */ - /* the outline's `flags' field. */ - /* */ - /* It shouldn't be used by a normal client application, unless it */ - /* knows what it is doing. */ - /* */ - FT_EXPORT( void ) - FT_Outline_Reverse( FT_Outline* outline ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Get_Bitmap */ - /* */ - /* <Description> */ - /* Render an outline within a bitmap. The outline's image is simply */ - /* OR-ed to the target bitmap. */ - /* */ - /* <Input> */ - /* library :: A handle to a FreeType library object. */ - /* */ - /* outline :: A pointer to the source outline descriptor. */ - /* */ - /* <InOut> */ - /* abitmap :: A pointer to the target bitmap descriptor. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* This function does NOT CREATE the bitmap, it only renders an */ - /* outline image within the one you pass to it! Consequently, the */ - /* various fields in `abitmap' should be set accordingly. */ - /* */ - /* It will use the raster corresponding to the default glyph format. */ - /* */ - /* The value of the `num_grays' field in `abitmap' is ignored. If */ - /* you select the gray-level rasterizer, and you want less than 256 */ - /* gray levels, you have to use @FT_Outline_Render directly. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_Get_Bitmap( FT_Library library, - FT_Outline* outline, - const FT_Bitmap *abitmap ); - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Outline_Render */ - /* */ - /* <Description> */ - /* Render an outline within a bitmap using the current scan-convert. */ - /* This function uses an @FT_Raster_Params structure as an argument, */ - /* allowing advanced features like direct composition, translucency, */ - /* etc. */ - /* */ - /* <Input> */ - /* library :: A handle to a FreeType library object. */ - /* */ - /* outline :: A pointer to the source outline descriptor. */ - /* */ - /* <InOut> */ - /* params :: A pointer to an @FT_Raster_Params structure used to */ - /* describe the rendering operation. */ - /* */ - /* <Return> */ - /* FreeType error code. 0~means success. */ - /* */ - /* <Note> */ - /* You should know what you are doing and how @FT_Raster_Params works */ - /* to use this function. */ - /* */ - /* The field `params.source' will be set to `outline' before the scan */ - /* converter is called, which means that the value you give to it is */ - /* actually ignored. */ - /* */ - /* The gray-level rasterizer always uses 256 gray levels. If you */ - /* want less gray levels, you have to provide your own span callback. */ - /* See the @FT_RASTER_FLAG_DIRECT value of the `flags' field in the */ - /* @FT_Raster_Params structure for more details. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_Render( FT_Library library, - FT_Outline* outline, - FT_Raster_Params* params ); - - /************************************************************************** - * - * @enum: - * FT_Orientation - * - * @description: - * A list of values used to describe an outline's contour orientation. - * - * The TrueType and PostScript specifications use different conventions - * to determine whether outline contours should be filled or unfilled. - * - * @values: - * FT_ORIENTATION_TRUETYPE :: - * According to the TrueType specification, clockwise contours must - * be filled, and counter-clockwise ones must be unfilled. - * - * FT_ORIENTATION_POSTSCRIPT :: - * According to the PostScript specification, counter-clockwise contours - * must be filled, and clockwise ones must be unfilled. - * - * FT_ORIENTATION_FILL_RIGHT :: - * This is identical to @FT_ORIENTATION_TRUETYPE, but is used to - * remember that in TrueType, everything that is to the right of - * the drawing direction of a contour must be filled. - * - * FT_ORIENTATION_FILL_LEFT :: - * This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to - * remember that in PostScript, everything that is to the left of - * the drawing direction of a contour must be filled. - * - * FT_ORIENTATION_NONE :: - * The orientation cannot be determined. That is, different parts of - * the glyph have different orientation. - * - */ - typedef enum FT_Orientation_ - { - FT_ORIENTATION_TRUETYPE = 0, - FT_ORIENTATION_POSTSCRIPT = 1, - FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE, - FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT, - FT_ORIENTATION_NONE - - } FT_Orientation; - - /************************************************************************** - * - * @function: - * FT_Outline_Get_Orientation - * - * @description: - * This function analyzes a glyph outline and tries to compute its - * fill orientation (see @FT_Orientation). This is done by computing - * the direction of each global horizontal and/or vertical extrema - * within the outline. - * - * Note that this will return @FT_ORIENTATION_TRUETYPE for empty - * outlines. - * - * @input: - * outline :: - * A handle to the source outline. - * - * @return: - * The orientation. - * - */ - FT_EXPORT( FT_Orientation ) - FT_Outline_Get_Orientation( FT_Outline* outline ); - - /* */ - -FT_END_HEADER - -#endif /* __FTOUTLN_H__ */ - -/* END */ - -/* Local Variables: */ -/* coding: utf-8 */ -/* End: */ - -/*** End of inlined file: ftoutln.h ***/ - -#ifdef _MSC_VER -#pragma pop_macro("_CRT_SECURE_NO_WARNINGS") -#endif - diff --git a/InForm/InForm.bi b/InForm/InForm.bi index 7fe078c..ae524ed 100644 --- a/InForm/InForm.bi +++ b/InForm/InForm.bi @@ -1,253 +1,235 @@ 'InForm - GUI library for QB64 'Fellippe Heitor, 2016-2019 - fellippe@qb64.org - @fellippeheitor ' +DECLARE CUSTOMTYPE LIBRARY + FUNCTION __UI_GetPID ALIAS getpid () + SUB __UI_MemCopy ALIAS memcpy (BYVAL dest AS _OFFSET, BYVAL source AS _OFFSET, BYVAL bytes AS LONG) +END DECLARE -Declare Library - Function __UI_GetPID Alias getpid () -End Declare - -Declare CustomType Library - Sub __UI_MemCopy Alias memcpy (ByVal dest As _Offset, Byval source As _Offset, Byval bytes As Long) -End Declare - -Declare Library "./InForm/falcon" - Sub uprint_extra (ByVal x&, Byval y&, Byval chars%&, Byval length%&, Byval kern&, Byval do_render&, txt_width&, Byval charpos%&, charcount&, Byval colour~&, Byval max_width&) - Function uprint (ByVal x&, Byval y&, chars$, Byval txt_len&, Byval colour~&, Byval max_width&) - Function uprintwidth (chars$, Byval txt_len&, Byval max_width&) - Function uheight& () - Function falcon_uspacing& Alias uspacing () - Function uascension& () -End Declare - -$If WIN Then - Declare Library - Function __UI_MB& Alias MessageBox (ByVal ignore&, message$, title$, Byval type&) - Function GetSystemMetrics& (ByVal WhichMetric&) - End Declare - - Const __UI_SM_SWAPBUTTON = 23 -$Else - DECLARE LIBRARY "" - FUNCTION __UI_MB& ALIAS MessageBox (BYVAL ignore&, message$, title$, BYVAL type&) +$IF WIN THEN + DECLARE LIBRARY + FUNCTION GetSystemMetrics& (BYVAL WhichMetric&) END DECLARE -$End If -$ScreenHide -_ControlChr Off + CONST __UI_SM_SWAPBUTTON = 23 +$END IF -Type __UI_ControlTYPE - ID As Long - ParentID As Long - PreviousParentID As Long - ContextMenuID As Long - Type As Integer - Name As String * 40 - ParentName As String * 40 - SubMenu As _Byte - MenuPanelID As Long - SourceControl As Long - Top As Integer - Left As Integer - Width As Integer - Height As Integer - Canvas As Long - HelperCanvas As Long - TransparentColor As _Unsigned Long - Stretch As _Byte - PreviousStretch As _Byte - Font As Integer - PreviousFont As Integer - BackColor As _Unsigned Long - ForeColor As _Unsigned Long - SelectedForeColor As _Unsigned Long - SelectedBackColor As _Unsigned Long - BackStyle As _Byte - HasBorder As _Byte - BorderSize As Integer - Padding As Integer - Encoding As Long - Align As _Byte - PrevAlign As _Byte - VAlign As _Byte - PrevVAlign As _Byte - BorderColor As _Unsigned Long - Value As _Float - PreviousValue As _Float - Min As _Float - PrevMin As _Float - Max As _Float - PrevMax As _Float - Interval As _Float - PrevInterval As _Float - MinInterval As _Float - PrevMinInterval As _Float - HotKey As Integer - HotKeyOffset As Integer - HotKeyPosition As Integer - ShowPercentage As _Byte - AutoScroll As _Byte - AutoSize As _Byte - InputViewStart As Long - PreviousInputViewStart As Long - LastVisibleItem As Integer - ItemHeight As Integer - HasVScrollbar As _Byte - VScrollbarButton2Top As Integer - HoveringVScrollbarButton As _Byte - ThumbHeight As Integer - ThumbTop As Integer - VScrollbarRatio As Single - Cursor As Long - PasswordField As _Byte - PrevCursor As Long - FieldArea As Long - PreviousFieldArea As Long - TextIsSelected As _Byte - BypassSelectOnFocus As _Byte - Multiline As _Byte - NumericOnly As _Byte - FirstVisibleLine As Long - PrevFirstVisibleLine As Long - CurrentLine As Long - PrevCurrentLine As Long - VisibleCursor As Long - PrevVisibleCursor As Long - ControlIsSelected As _Byte - LeftOffsetFromFirstSelected As Integer - TopOffsetFromFirstSelected As Integer - SelectionLength As Long - SelectionStart As Long - WordWrap As _Byte - CanResize As _Byte - CanHaveFocus As _Byte - Disabled As _Byte - Hidden As _Byte - PreviouslyHidden As _Byte - CenteredWindow As _Byte - ControlState As _Byte - ChildrenRedrawn As _Byte - FocusState As Long - LastChange As Single - Redraw As _Byte - BulletStyle As _Byte - MenuItemGroup As Integer - KeyCombo As Long - BoundTo As Long - BoundProperty As Long -End Type +$SCREENHIDE +_CONTROLCHR OFF -Type __UI_Types - Name As String * 16 - Count As Long - TurnsInto As Integer - DefaultHeight As Integer - MinimumHeight As Integer - DefaultWidth As Integer - MinimumWidth As Integer - RestrictResize As _Byte -End Type +TYPE __UI_ControlTYPE + ID AS LONG + ParentID AS LONG + PreviousParentID AS LONG + ContextMenuID AS LONG + Type AS INTEGER + Name AS STRING * 40 + ParentName AS STRING * 40 + SubMenu AS _BYTE + MenuPanelID AS LONG + SourceControl AS LONG + Top AS INTEGER + Left AS INTEGER + Width AS INTEGER + Height AS INTEGER + Canvas AS LONG + HelperCanvas AS LONG + TransparentColor AS _UNSIGNED LONG + Stretch AS _BYTE + PreviousStretch AS _BYTE + Font AS INTEGER + PreviousFont AS INTEGER + BackColor AS _UNSIGNED LONG + ForeColor AS _UNSIGNED LONG + SelectedForeColor AS _UNSIGNED LONG + SelectedBackColor AS _UNSIGNED LONG + BackStyle AS _BYTE + HasBorder AS _BYTE + BorderSize AS INTEGER + Padding AS INTEGER + Encoding AS LONG + Align AS _BYTE + PrevAlign AS _BYTE + VAlign AS _BYTE + PrevVAlign AS _BYTE + BorderColor AS _UNSIGNED LONG + Value AS _FLOAT + PreviousValue AS _FLOAT + Min AS _FLOAT + PrevMin AS _FLOAT + Max AS _FLOAT + PrevMax AS _FLOAT + Interval AS _FLOAT + PrevInterval AS _FLOAT + MinInterval AS _FLOAT + PrevMinInterval AS _FLOAT + HotKey AS INTEGER + HotKeyOffset AS INTEGER + HotKeyPosition AS INTEGER + ShowPercentage AS _BYTE + AutoScroll AS _BYTE + AutoSize AS _BYTE + InputViewStart AS LONG + PreviousInputViewStart AS LONG + LastVisibleItem AS INTEGER + ItemHeight AS INTEGER + HasVScrollbar AS _BYTE + VScrollbarButton2Top AS INTEGER + HoveringVScrollbarButton AS _BYTE + ThumbHeight AS INTEGER + ThumbTop AS INTEGER + VScrollbarRatio AS SINGLE + Cursor AS LONG + PasswordField AS _BYTE + PrevCursor AS LONG + FieldArea AS LONG + PreviousFieldArea AS LONG + TextIsSelected AS _BYTE + BypassSelectOnFocus AS _BYTE + Multiline AS _BYTE + NumericOnly AS _BYTE + FirstVisibleLine AS LONG + PrevFirstVisibleLine AS LONG + CurrentLine AS LONG + PrevCurrentLine AS LONG + VisibleCursor AS LONG + PrevVisibleCursor AS LONG + ControlIsSelected AS _BYTE + LeftOffsetFromFirstSelected AS INTEGER + TopOffsetFromFirstSelected AS INTEGER + SelectionLength AS LONG + SelectionStart AS LONG + WordWrap AS _BYTE + CanResize AS _BYTE + CanHaveFocus AS _BYTE + Disabled AS _BYTE + Hidden AS _BYTE + PreviouslyHidden AS _BYTE + CenteredWindow AS _BYTE + ControlState AS _BYTE + ChildrenRedrawn AS _BYTE + FocusState AS LONG + LastChange AS SINGLE + Redraw AS _BYTE + BulletStyle AS _BYTE + MenuItemGroup AS INTEGER + KeyCombo AS LONG + BoundTo AS LONG + BoundProperty AS LONG +END TYPE -Type __UI_ThemeImagesType - FileName As String * 32 - Handle As Long -End Type +TYPE __UI_Types + Name AS STRING * 16 + Count AS LONG + TurnsInto AS INTEGER + DefaultHeight AS INTEGER + MinimumHeight AS INTEGER + DefaultWidth AS INTEGER + MinimumWidth AS INTEGER + RestrictResize AS _BYTE +END TYPE -Type __UI_WordWrapHistoryType - StringSlot As Long - Width As Integer - LongestLine As Integer - Font As Long - TotalLines As Integer -End Type +TYPE __UI_ThemeImagesType + FileName AS STRING * 32 + Handle AS LONG +END TYPE -Type __UI_KeyCombos - Combo As String * 14 ' "CTRL+SHIFT+F12" - FriendlyCombo As String * 14 ' "Ctrl+Shift+F12" - ControlID As Long -End Type +TYPE __UI_WordWrapHistoryType + StringSlot AS LONG + Width AS INTEGER + LongestLine AS INTEGER + Font AS LONG + TotalLines AS INTEGER +END TYPE -ReDim Shared Caption(0 To 100) As String -ReDim Shared __UI_TempCaptions(0 To 100) As String -ReDim Shared Text(0 To 100) As String -ReDim Shared __UI_TempTexts(0 To 100) As String -ReDim Shared Mask(0 To 100) As String -ReDim Shared __UI_TempMask(0 To 100) As String -ReDim Shared ToolTip(0 To 100) As String -ReDim Shared __UI_TempTips(0 To 100) As String -ReDim Shared Control(0 To 100) As __UI_ControlTYPE -ReDim Shared ControlDrawOrder(0) As Long -ReDim Shared __UI_ThemeImages(0 To 100) As __UI_ThemeImagesType -ReDim Shared __UI_WordWrapHistoryTexts(0 To 100) As String -ReDim Shared __UI_WordWrapHistoryResults(0 To 100) As String -ReDim Shared __UI_WordWrapHistory(0 To 100) As __UI_WordWrapHistoryType -ReDim Shared __UI_ThisLineChars(0) As Long, __UI_FocusedTextBoxChars(0) As Long -ReDim Shared __UI_ActiveMenu(0 To 100) As Long, __UI_ParentMenu(0 To 100) As Long -ReDim Shared __UI_KeyCombo(0 To 100) As __UI_KeyCombos +TYPE __UI_KeyCombos + Combo AS STRING * 14 ' "CTRL+SHIFT+F12" + FriendlyCombo AS STRING * 14 ' "Ctrl+Shift+F12" + ControlID AS LONG +END TYPE -Dim Shared __UI_TotalKeyCombos As Long, __UI_BypassKeyCombos As _Byte -Dim Shared table1252$(0 To 255), table437$(0 To 255) -Dim Shared __UI_MouseLeft As Integer, __UI_MouseTop As Integer -Dim Shared __UI_MouseWheel As Integer, __UI_MouseButtonsSwap As _Byte -Dim Shared __UI_PrevMouseLeft As Integer, __UI_PrevMouseTop As Integer -Dim Shared __UI_MouseButton1 As _Byte, __UI_MouseButton2 As _Byte -Dim Shared __UI_MouseIsDown As _Byte, __UI_MouseDownOnID As Long -Dim Shared __UI_Mouse2IsDown As _Byte, __UI_Mouse2DownOnID As Long -Dim Shared __UI_PreviousMouseDownOnID As Long -Dim Shared __UI_KeyIsDown As _Byte, __UI_KeyDownOnID As Long -Dim Shared __UI_ShiftIsDown As _Byte, __UI_CtrlIsDown As _Byte -Dim Shared __UI_AltIsDown As _Byte, __UI_ShowHotKeys As _Byte, __UI_AltCombo$ -Dim Shared __UI_LastMouseClick As Single, __UI_MouseDownOnScrollbar As Single -Dim Shared __UI_DragX As Integer, __UI_DragY As Integer -Dim Shared __UI_DefaultButtonID As Long -Dim Shared __UI_KeyHit As Long, __UI_KeepFocus As _Byte -Dim Shared __UI_Focus As Long, __UI_PreviousFocus As Long, __UI_KeyboardFocus As _Byte -Dim Shared __UI_HoveringID As Long, __UI_LastHoveringID As Long, __UI_BelowHoveringID As Long -Dim Shared __UI_IsDragging As _Byte, __UI_DraggingID As Long -Dim Shared __UI_IsResizing As _Byte, __UI_ResizingID As Long -Dim Shared __UI_ResizeHandleHover As _Byte -Dim Shared __UI_IsSelectingText As _Byte, __UI_IsSelectingTextOnID As Long -Dim Shared __UI_SelectedText As String, __UI_SelectionLength As Long -Dim Shared __UI_StateHasChanged As _Byte -Dim Shared __UI_DraggingThumb As _Byte, __UI_ThumbDragTop As Integer -Dim Shared __UI_DraggingThumbOnID As Long -Dim Shared __UI_HasInput As _Byte, __UI_ProcessInputTimer As Single -Dim Shared __UI_UnloadSignal As _Byte, __UI_HasResized As _Byte -Dim Shared __UI_ExitTriggered As _Byte -Dim Shared __UI_Loaded As _Byte -Dim Shared __UI_EventsTimer As Integer, __UI_RefreshTimer As Integer -Dim Shared __UI_ActiveDropdownList As Long, __UI_ParentDropdownList As Long -Dim Shared __UI_TotalActiveMenus As Long, __UI_ActiveMenuIsContextMenu As _Byte -Dim Shared __UI_SubMenuDelay As Single, __UI_HoveringSubMenu As _Byte -Dim Shared __UI_TopMenuBarItem As Long -Dim Shared __UI_ActiveTipID As Long, __UI_TipTimer As Single, __UI_PreviousTipID As Long -Dim Shared __UI_ActiveTipTop As Integer, __UI_ActiveTipLeft As Integer -Dim Shared __UI_FormID As Long, __UI_HasMenuBar As Long -Dim Shared __UI_ScrollbarWidth As Integer, __UI_ScrollbarButtonHeight As Integer -Dim Shared __UI_MenuBarOffset As Integer, __UI_MenuItemOffset As Integer -Dim Shared __UI_NewMenuBarTextLeft As Integer, __UI_DefaultCaptionIndent As Integer -Dim Shared __UI_ForceRedraw As _Byte, __UI_AutoRefresh As _Byte -Dim Shared __UI_CurrentTitle As String -Dim Shared __UI_DesignMode As _Byte, __UI_FirstSelectedID As Long -Dim Shared __UI_WaitMessage As String, __UI_TotalSelectedControls As Long -Dim Shared __UI_WaitMessageHandle As Long, __UI_EditorMode As _Byte -Dim Shared __UI_LastRenderedLineWidth As Long, __UI_LastRenderedCharCount As Long -Dim Shared __UI_SelectionRectangleTop As Integer, __UI_SelectionRectangleLeft As Integer -Dim Shared __UI_SelectionRectangle As _Byte -Dim Shared __UI_CantShowContextMenu As _Byte, __UI_ShowPositionAndSize As _Byte -Dim Shared __UI_ShowInvisibleControls As _Byte, __UI_Snapped As _Byte -Dim Shared __UI_SnappedByProximityX As _Byte, __UI_SnappedByProximityY As _Byte -Dim Shared __UI_SnappedX As Integer, __UI_SnappedY As Integer -Dim Shared __UI_SnappedXID As Long, __UI_SnappedYID As Long -Dim Shared __UI_SnapLines As _Byte, __UI_SnapDistance As Integer, __UI_SnapDistanceFromForm As Integer -Dim Shared __UI_FrameRate As Single, __UI_Font8Offset As Integer, __UI_Font16Offset As Integer -Dim Shared __UI_ClipboardCheck$, __UI_MenuBarOffsetV As Integer -Dim Shared __UI_KeepScreenHidden As _Byte, __UI_MaxBorderSize As Integer -Dim Shared __UI_InternalContextMenus As Long, __UI_DidClick As _Byte -Dim Shared __UI_ContextMenuSourceID As Long -Dim Shared __UI_FKey(1 To 12) As Long +REDIM SHARED Caption(0 TO 100) AS STRING +REDIM SHARED __UI_TempCaptions(0 TO 100) AS STRING +REDIM SHARED Text(0 TO 100) AS STRING +REDIM SHARED __UI_TempTexts(0 TO 100) AS STRING +REDIM SHARED Mask(0 TO 100) AS STRING +REDIM SHARED __UI_TempMask(0 TO 100) AS STRING +REDIM SHARED ToolTip(0 TO 100) AS STRING +REDIM SHARED __UI_TempTips(0 TO 100) AS STRING +REDIM SHARED Control(0 TO 100) AS __UI_ControlTYPE +REDIM SHARED ControlDrawOrder(0) AS LONG +REDIM SHARED __UI_ThemeImages(0 TO 100) AS __UI_ThemeImagesType +REDIM SHARED __UI_WordWrapHistoryTexts(0 TO 100) AS STRING +REDIM SHARED __UI_WordWrapHistoryResults(0 TO 100) AS STRING +REDIM SHARED __UI_WordWrapHistory(0 TO 100) AS __UI_WordWrapHistoryType +REDIM SHARED __UI_ThisLineChars(0) AS LONG, __UI_FocusedTextBoxChars(0) AS LONG +REDIM SHARED __UI_ActiveMenu(0 TO 100) AS LONG, __UI_ParentMenu(0 TO 100) AS LONG +REDIM SHARED __UI_KeyCombo(0 TO 100) AS __UI_KeyCombos + +DIM SHARED __UI_TotalKeyCombos AS LONG, __UI_BypassKeyCombos AS _BYTE +DIM SHARED table1252$(0 TO 255), table437$(0 TO 255) +DIM SHARED __UI_MouseLeft AS INTEGER, __UI_MouseTop AS INTEGER +DIM SHARED __UI_MouseWheel AS INTEGER, __UI_MouseButtonsSwap AS _BYTE +DIM SHARED __UI_PrevMouseLeft AS INTEGER, __UI_PrevMouseTop AS INTEGER +DIM SHARED __UI_MouseButton1 AS _BYTE, __UI_MouseButton2 AS _BYTE +DIM SHARED __UI_MouseIsDown AS _BYTE, __UI_MouseDownOnID AS LONG +DIM SHARED __UI_Mouse2IsDown AS _BYTE, __UI_Mouse2DownOnID AS LONG +DIM SHARED __UI_PreviousMouseDownOnID AS LONG +DIM SHARED __UI_KeyIsDown AS _BYTE, __UI_KeyDownOnID AS LONG +DIM SHARED __UI_ShiftIsDown AS _BYTE, __UI_CtrlIsDown AS _BYTE +DIM SHARED __UI_AltIsDown AS _BYTE, __UI_ShowHotKeys AS _BYTE, __UI_AltCombo$ +DIM SHARED __UI_LastMouseClick AS SINGLE, __UI_MouseDownOnScrollbar AS SINGLE +DIM SHARED __UI_DragX AS INTEGER, __UI_DragY AS INTEGER +DIM SHARED __UI_DefaultButtonID AS LONG +DIM SHARED __UI_KeyHit AS LONG, __UI_KeepFocus AS _BYTE +DIM SHARED __UI_Focus AS LONG, __UI_PreviousFocus AS LONG, __UI_KeyboardFocus AS _BYTE +DIM SHARED __UI_HoveringID AS LONG, __UI_LastHoveringID AS LONG, __UI_BelowHoveringID AS LONG +DIM SHARED __UI_IsDragging AS _BYTE, __UI_DraggingID AS LONG +DIM SHARED __UI_IsResizing AS _BYTE, __UI_ResizingID AS LONG +DIM SHARED __UI_ResizeHandleHover AS _BYTE +DIM SHARED __UI_IsSelectingText AS _BYTE, __UI_IsSelectingTextOnID AS LONG +DIM SHARED __UI_SelectedText AS STRING, __UI_SelectionLength AS LONG +DIM SHARED __UI_StateHasChanged AS _BYTE +DIM SHARED __UI_DraggingThumb AS _BYTE, __UI_ThumbDragTop AS INTEGER +DIM SHARED __UI_DraggingThumbOnID AS LONG +DIM SHARED __UI_HasInput AS _BYTE, __UI_ProcessInputTimer AS SINGLE +DIM SHARED __UI_UnloadSignal AS _BYTE, __UI_HasResized AS _BYTE +DIM SHARED __UI_ExitTriggered AS _BYTE +DIM SHARED __UI_Loaded AS _BYTE +DIM SHARED __UI_EventsTimer AS INTEGER, __UI_RefreshTimer AS INTEGER +DIM SHARED __UI_ActiveDropdownList AS LONG, __UI_ParentDropdownList AS LONG +DIM SHARED __UI_TotalActiveMenus AS LONG, __UI_ActiveMenuIsContextMenu AS _BYTE +DIM SHARED __UI_SubMenuDelay AS SINGLE, __UI_HoveringSubMenu AS _BYTE +DIM SHARED __UI_TopMenuBarItem AS LONG +DIM SHARED __UI_ActiveTipID AS LONG, __UI_TipTimer AS SINGLE, __UI_PreviousTipID AS LONG +DIM SHARED __UI_ActiveTipTop AS INTEGER, __UI_ActiveTipLeft AS INTEGER +DIM SHARED __UI_FormID AS LONG, __UI_HasMenuBar AS LONG +DIM SHARED __UI_ScrollbarWidth AS INTEGER, __UI_ScrollbarButtonHeight AS INTEGER +DIM SHARED __UI_MenuBarOffset AS INTEGER, __UI_MenuItemOffset AS INTEGER +DIM SHARED __UI_NewMenuBarTextLeft AS INTEGER, __UI_DefaultCaptionIndent AS INTEGER +DIM SHARED __UI_ForceRedraw AS _BYTE, __UI_AutoRefresh AS _BYTE +DIM SHARED __UI_CurrentTitle AS STRING +DIM SHARED __UI_DesignMode AS _BYTE, __UI_FirstSelectedID AS LONG +DIM SHARED __UI_WaitMessage AS STRING, __UI_TotalSelectedControls AS LONG +DIM SHARED __UI_WaitMessageHandle AS LONG, __UI_EditorMode AS _BYTE +DIM SHARED __UI_LastRenderedCharCount AS LONG +DIM SHARED __UI_SelectionRectangleTop AS INTEGER, __UI_SelectionRectangleLeft AS INTEGER +DIM SHARED __UI_SelectionRectangle AS _BYTE +DIM SHARED __UI_CantShowContextMenu AS _BYTE, __UI_ShowPositionAndSize AS _BYTE +DIM SHARED __UI_ShowInvisibleControls AS _BYTE, __UI_Snapped AS _BYTE +DIM SHARED __UI_SnappedByProximityX AS _BYTE, __UI_SnappedByProximityY AS _BYTE +DIM SHARED __UI_SnappedX AS INTEGER, __UI_SnappedY AS INTEGER +DIM SHARED __UI_SnappedXID AS LONG, __UI_SnappedYID AS LONG +DIM SHARED __UI_SnapLines AS _BYTE, __UI_SnapDistance AS INTEGER, __UI_SnapDistanceFromForm AS INTEGER +DIM SHARED __UI_FrameRate AS SINGLE, __UI_Font8Offset AS INTEGER, __UI_Font16Offset AS INTEGER +DIM SHARED __UI_ClipboardCheck$, __UI_MenuBarOffsetV AS INTEGER +DIM SHARED __UI_KeepScreenHidden AS _BYTE, __UI_MaxBorderSize AS INTEGER +DIM SHARED __UI_InternalContextMenus AS LONG, __UI_DidClick AS _BYTE +DIM SHARED __UI_ContextMenuSourceID AS LONG +DIM SHARED __UI_FKey(1 TO 12) AS LONG 'Control types: ----------------------------------------------- -Dim Shared __UI_Type(0 To 18) As __UI_Types +DIM SHARED __UI_Type(0 TO 18) AS __UI_Types __UI_Type(__UI_Type_Form).Name = "Form" __UI_Type(__UI_Type_Frame).Name = "Frame" @@ -325,7 +307,8 @@ __UI_Type(__UI_Type_ToggleSwitch).RestrictResize = __UI_CantResize __UI_RestoreFKeys -CONST True = -1, False = 0 +CONST False = 0, True = Not False + '$INCLUDE:'InFormVersion.bas' __UI_SubMenuDelay = .4 __UI_SnapDistance = 5 @@ -347,6 +330,7 @@ DO LOOP SYSTEM + __UI_ErrorHandler: RESUME NEXT diff --git a/InForm/InForm.ui b/InForm/InForm.ui index 2264f7d..e940fde 100644 --- a/InForm/InForm.ui +++ b/InForm/InForm.ui @@ -42,40 +42,6 @@ FUNCTION __UI_NumericWithBounds%%: __UI_NumericWithBounds%% = 2: END FUNCTION FUNCTION __UI_CheckMark%%: __UI_CheckMark%% = 0: END FUNCTION FUNCTION __UI_Bullet%%: __UI_Bullet%% = 1: END FUNCTION - -'Messagebox constants -FUNCTION MsgBox_OkOnly%%: MsgBox_OkOnly%% = 0: END FUNCTION -FUNCTION MsgBox_OkCancel%%: MsgBox_OkCancel%% = 1: END FUNCTION -FUNCTION MsgBox_AbortRetryIgnore%%: MsgBox_AbortRetryIgnore%% = 2: END FUNCTION -FUNCTION MsgBox_YesNoCancel%%: MsgBox_YesNoCancel%% = 3: END FUNCTION -FUNCTION MsgBox_YesNo%%: MsgBox_YesNo%% = 4: END FUNCTION -FUNCTION MsgBox_RetryCancel%%: MsgBox_RetryCancel%% = 5: END FUNCTION -FUNCTION MsgBox_CancelTryagainContinue%%: MsgBox_CancelTryagainContinue%% = 6: END FUNCTION - -FUNCTION MsgBox_Critical%: MsgBox_Critical% = 16: END FUNCTION -FUNCTION MsgBox_Question%: MsgBox_Question% = 32: END FUNCTION -FUNCTION MsgBox_Exclamation%: MsgBox_Exclamation% = 48: END FUNCTION -FUNCTION MsgBox_Information%: MsgBox_Information% = 64: END FUNCTION - -FUNCTION MsgBox_DefaultButton1%: MsgBox_DefaultButton1% = 0: END FUNCTION -FUNCTION MsgBox_DefaultButton2%: MsgBox_DefaultButton2% = 256: END FUNCTION -FUNCTION MsgBox_DefaultButton3%: MsgBox_DefaultButton3% = 512: END FUNCTION -FUNCTION MsgBox_Defaultbutton4%: MsgBox_Defaultbutton4% = 768: END FUNCTION - -FUNCTION MsgBox_AppModal%%: MsgBox_AppModal%% = 0: END FUNCTION -FUNCTION MsgBox_SystemModal%: MsgBox_SystemModal% = 4096: END FUNCTION -FUNCTION MsgBox_SetForeground&: MsgBox_SetForeground& = 65536: END FUNCTION - -FUNCTION MsgBox_Ok%%: MsgBox_Ok%% = 1: END FUNCTION -FUNCTION MsgBox_Cancel%%: MsgBox_Cancel%% = 2: END FUNCTION -FUNCTION MsgBox_Abort%%: MsgBox_Abort%% = 3: END FUNCTION -FUNCTION MsgBox_Retry%%: MsgBox_Retry%% = 4: END FUNCTION -FUNCTION MsgBox_Ignore%%: MsgBox_Ignore%% = 5: END FUNCTION -FUNCTION MsgBox_Yes%%: MsgBox_Yes%% = 6: END FUNCTION -FUNCTION MsgBox_No%%: MsgBox_No%% = 7: END FUNCTION -FUNCTION MsgBox_Tryagain%%: MsgBox_Tryagain%% = 10: END FUNCTION -FUNCTION MsgBox_Continue%%: MsgBox_Continue%% = 11: END FUNCTION - 'General constants FUNCTION __UI_ToolTipTimeOut!: __UI_ToolTipTimeOut! = .8: END FUNCTION FUNCTION __UI_CantResizeV%%: __UI_CantResizeV%% = 1: END FUNCTION @@ -83,8 +49,9 @@ FUNCTION __UI_CantResizeH%%: __UI_CantResizeH%% = 2: END FUNCTION FUNCTION __UI_CantResize%%: __UI_CantResize%% = 3: END FUNCTION '--------------------------------------------------------------------------------- +' a740g: Check if this has the expected behavior 'cause _UFONTHEIGHT actually returns the true font height for built-in fonts FUNCTION uspacing& - uspacing& = uheight + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + uspacing& = _UFONTHEIGHT + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) END FUNCTION '--------------------------------------------------------------------------------- @@ -717,7 +684,7 @@ SUB __UI_ProcessInput IF __UI_HasMenuBar = True THEN 'Add menubar div to main form's canvas _FONT Control(__UI_FormID).Font - __UI_MenuBarOffsetV = falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 2 + __UI_MenuBarOffsetV = _ulinespacing + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 2 LINE (0, __UI_MenuBarOffsetV - 1)-STEP(Control(__UI_FormID).Width - 1, 0), Darken(Control(__UI_FormID).BackColor, 80) LINE (0, __UI_MenuBarOffsetV)-STEP(Control(__UI_FormID).Width - 1, 0), Darken(Control(__UI_FormID).BackColor, 120) __UI_RefreshMenuBar @@ -795,9 +762,9 @@ SUB __UI_UpdateDisplay CLS IF __UI_HasMenuBar THEN _FONT Control(__UI_FormID).Font - __UI_MenuBarOffsetV = falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 2 - LINE (0, falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 1)-STEP(Control(__UI_FormID).Width - 1, 0), Darken(Control(__UI_FormID).BackColor, 80) - LINE (0, falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 2)-STEP(Control(__UI_FormID).Width - 1, 0), Darken(Control(__UI_FormID).BackColor, 120) + __UI_MenuBarOffsetV = _ulinespacing + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 2 + LINE (0, _ulinespacing + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 1)-STEP(Control(__UI_FormID).Width - 1, 0), Darken(Control(__UI_FormID).BackColor, 80) + LINE (0, _ulinespacing + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 2)-STEP(Control(__UI_FormID).Width - 1, 0), Darken(Control(__UI_FormID).BackColor, 120) ELSE __UI_MenuBarOffsetV = 0 END IF @@ -834,7 +801,7 @@ SUB __UI_UpdateDisplay _PRINTMODE _KEEPBACKGROUND COLOR _RGBA32(0, 0, 0, 150) _PRINTSTRING (Control(i).Left + 1, Control(i).Top + 1), RTRIM$(Control(i).Name) - _PRINTSTRING (Control(i).Left + 1, Control(i).Top + 1 + falcon_uspacing&), "(hidden)" + _PRINTSTRING (Control(i).Left + 1, Control(i).Top + 1 + _ulinespacing), "(hidden)" GOTO BypassDisplay ELSEIF Control(i).Hidden = True THEN GOTO BypassDisplay @@ -1282,7 +1249,7 @@ SUB __UI_UpdateDisplay COLOR __UI_DefaultColor(__UI_Type_Form, 1) IF TotalLines = 1 THEN - __UI_PrintString _WIDTH \ 2 - __UI_PrintWidth(TempCaption$) \ 2 - 1.75, _HEIGHT \ 2 - uheight& \ 2 - 1.75, TempCaption$ + __UI_PrintString _WIDTH \ 2 - __UI_PrintWidth(TempCaption$) \ 2 - 1.75, _HEIGHT \ 2 - _ufontheight \ 2 - 1.75, TempCaption$ ELSE DO WHILE LEN(TempCaption$) ThisLine% = ThisLine% + 1 @@ -1438,7 +1405,6 @@ SUB __UI_EventDispatcher STATIC __UI_JustOpenedMenu AS _BYTE STATIC OriginalDragX AS INTEGER, OriginalDragY AS INTEGER STATIC OriginalResizeRightSide AS INTEGER, OriginalResizeBottom AS INTEGER - STATIC PrevResizeSnapX AS INTEGER, PrevResizeSnapY AS INTEGER DIM i AS LONG, j AS LONG, ThisItem%, TempParent AS LONG DIM ContainerOffsetLeft AS INTEGER, ContainerOffsetTop AS INTEGER @@ -2097,7 +2063,7 @@ SUB __UI_EventDispatcher ThisLineLen = LEN(ThisLine$) 'Print the text offscreen just to fill the right variables - __UI_PrintString _WIDTH + 10, _HEIGHT + 10, ThisLine$ + __UI_CharPos ThisLine$ 'New cursor position: FOR i = 1 TO __UI_LastRenderedCharCount @@ -2161,7 +2127,7 @@ SUB __UI_EventDispatcher __UI_FillSelectedText 0, 0 'Print the text offscreen just to fill the right variables - __UI_PrintString _WIDTH + 10, _HEIGHT + 10, Text(__UI_Focus) + __UI_CharPos Text(__UI_Focus) 'Single-line textbox click FOR i = 1 TO __UI_LastRenderedCharCount @@ -2261,7 +2227,7 @@ SUB __UI_EventDispatcher _FONT (Control(__UI_IsSelectingTextOnID).Font) IF NOT Control(__UI_IsSelectingTextOnID).Multiline THEN 'Print the text offscreen just to fill the right variables - __UI_PrintString _WIDTH + 10, _HEIGHT + 10, Text(__UI_Focus) + __UI_CharPos Text(__UI_Focus) IF NOT WholeWordSelection THEN 'Single line selection, char by char @@ -2318,7 +2284,7 @@ SUB __UI_EventDispatcher IF Control(__UI_IsSelectingTextOnID).CurrentLine = 0 THEN Control(__UI_IsSelectingTextOnID).CurrentLine = 1 ThisLine$ = __UI_GetTextBoxLine(__UI_IsSelectingTextOnID, Control(__UI_IsSelectingTextOnID).CurrentLine, ThisLineStart) ThisLineLen = LEN(ThisLine$) - __UI_PrintString _WIDTH + 10, _HEIGHT + 10, ThisLine$ + __UI_CharPos ThisLine$ ' print the text offscreen just to fill the right variables 'New cursor position: FOR i = 1 TO __UI_LastRenderedCharCount @@ -4761,7 +4727,7 @@ SUB __UI_AdjustNewMenuBarTopHeight (NextSlot AS LONG) END IF IF Control(__UI_FormID).Font THEN _FONT Control(__UI_FormID).Font - Control(NextSlot).Height = falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + Control(NextSlot).Height = _ulinespacing + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 Control(NextSlot).Top = 0 IF TempCanvas <> 0 THEN @@ -4778,9 +4744,9 @@ SUB __UI_AdjustNewMenuBarTopHeight (NextSlot AS LONG) COLOR Control(__UI_FormID).ForeColor, Control(__UI_FormID).BackColor CLS IF Control(__UI_FormID).Font THEN _FONT Control(__UI_FormID).Font - __UI_MenuBarOffsetV = falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 2 - LINE (0, falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 1)-STEP(Control(__UI_FormID).Width - 1, 0), Darken(Control(__UI_FormID).BackColor, 80) - LINE (0, falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 2)-STEP(Control(__UI_FormID).Width - 1, 0), Darken(Control(__UI_FormID).BackColor, 120) + __UI_MenuBarOffsetV = _ulinespacing + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 2 + LINE (0, _ulinespacing + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 1)-STEP(Control(__UI_FormID).Width - 1, 0), Darken(Control(__UI_FormID).BackColor, 80) + LINE (0, _ulinespacing + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 2)-STEP(Control(__UI_FormID).Width - 1, 0), Darken(Control(__UI_FormID).BackColor, 120) _DEST 0 END IF END SUB @@ -5699,6 +5665,7 @@ SUB __UI_ListBoxSearchItem (This AS __UI_ControlTYPE) END SUB '--------------------------------------------------------------------------------- + SUB __UI_PrintString(Left AS INTEGER, Top AS INTEGER, Text$) DIM Utf$ @@ -5712,14 +5679,42 @@ SUB __UI_PrintString(Left AS INTEGER, Top AS INTEGER, Text$) END IF END IF + DIM PM AS LONG: PM = _PRINTMODE + _PRINTMODE _KEEPBACKGROUND + + _UPRINTSTRING (Left, Top), Utf$, , 8 + + SELECT CASE PM + CASE 1 + _PRINTMODE _KEEPBACKGROUND + CASE 2 + _PRINTMODE _ONLYBACKGROUND + CASE 3 + _PRINTMODE _FILLBACKGROUND + END SELECT +END SUB + +SUB __UI_CharPos(Text$) + DIM Utf$ + + IF LEFT$(Text$, 1) = CHR$(7) AND (_FONT = 8 OR _FONT = 16) THEN + Utf$ = Text$ + ELSE + IF Control(__UI_FormID).Encoding = 1252 THEN + Utf$ = FromCP1252$(Text$) + ELSE 'Default to 437 + Utf$ = FromCP437$(Text$) + END IF + END IF + REDIM __UI_ThisLineChars(0 TO LEN(Utf$)) AS LONG - uprint_extra Left, Top, _OFFSET(Utf$), LEN(Utf$), True, True, __UI_LastRenderedLineWidth, _OFFSET(__UI_ThisLineChars()), __UI_LastRenderedCharCount, _DEFAULTCOLOR, 0 + __UI_LastRenderedCharCount = _UCHARPOS(Utf$, __UI_ThisLineChars(), 8) REDIM _PRESERVE __UI_ThisLineChars(__UI_LastRenderedCharCount) AS LONG END SUB '--------------------------------------------------------------------------------- FUNCTION __UI_PrintWidth&(Text$) - __UI_PrintWidth& = uprintwidth(Text$, LEN(Text$), 0) + __UI_PrintWidth& = _UPRINTWIDTH(Text$, 8) END FUNCTION '--------------------------------------------------------------------------------- @@ -5868,23 +5863,6 @@ FUNCTION __UI_WordWrap$ (PassedText AS STRING, Width AS INTEGER, LongestLine AS END IF END FUNCTION -'--------------------------------------------------------------------------------- -FUNCTION MessageBox& (Message$, Title$, Setup AS LONG) - _DELAY .1 'So the interface can redraw before the messagebox kicks in - - IF Title$ = "" THEN Title$ = __UI_CurrentTitle - - $IF WIN THEN - MessageBox& = __UI_MB(0, Replace(Message$, "\n", CHR$(10), False, 0) + CHR$(0), Title$ + CHR$(0), Setup + MsgBox_SystemModal + MsgBox_SetForeground) - $ELSE - IF (Setup AND 4) THEN - MessageBox& = __UI_MB(0, Replace(Message$, "\n", CHR$(10), False, 0) + CHR$(0), Title$ + CHR$(0), 4) - ELSE - MessageBox& = __UI_MB(0, Replace(Message$, "\n", CHR$(10), False, 0) + CHR$(0), Title$ + CHR$(0), 0) - END IF - $END IF -END FUNCTION - '--------------------------------------------------------------------------------- FUNCTION __UI_MAP! (value!, minRange!, maxRange!, newMinRange!, newMaxRange!) __UI_MAP! = ((value! - minRange!) / (maxRange! - minRange!)) * (newMaxRange! - newMinRange!) + newMinRange! @@ -5996,7 +5974,7 @@ SUB __UI_ActivateMenu (This AS __UI_ControlTYPE, SelectFirstItem AS _BYTE) IF This.Type = __UI_Type_MenuBar THEN Control(__UI_ActiveMenu(__UI_TotalActiveMenus)).Left = This.Left - Control(__UI_ActiveMenu(__UI_TotalActiveMenus)).Top = falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 3 + Control(__UI_ActiveMenu(__UI_TotalActiveMenus)).Top = _ulinespacing + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 3 __UI_TopMenuBarItem = This.ID ELSEIF This.Type = __UI_Type_MenuItem THEN Control(__UI_ActiveMenu(__UI_TotalActiveMenus)).Left = Control(This.MenuPanelID).Left + Control(This.MenuPanelID).Width - __UI_MenuItemOffset / 4 @@ -6013,8 +5991,8 @@ SUB __UI_ActivateMenu (This AS __UI_ControlTYPE, SelectFirstItem AS _BYTE) END IF 'Calculate panel's width and position the menu items - ItemHeight = falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 3 - Control(__UI_ActiveMenu(__UI_TotalActiveMenus)).Height = (((_FONT = 8) * -1) * 3 + falcon_uspacing&) / 4 + ItemHeight = _ulinespacing + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 3 + Control(__UI_ActiveMenu(__UI_TotalActiveMenus)).Height = (((_FONT = 8) * -1) * 3 + _ulinespacing) / 4 Control(__UI_ActiveMenu(__UI_TotalActiveMenus)).Width = 0 CurrentGroup = 1 ComboSpacing = 0 @@ -6053,7 +6031,7 @@ SUB __UI_ActivateMenu (This AS __UI_ControlTYPE, SelectFirstItem AS _BYTE) END IF NEXT - Control(__UI_ActiveMenu(__UI_TotalActiveMenus)).Height = Control(__UI_ActiveMenu(__UI_TotalActiveMenus)).Height + (((((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + falcon_uspacing&) / 4) + Control(__UI_ActiveMenu(__UI_TotalActiveMenus)).Height = Control(__UI_ActiveMenu(__UI_TotalActiveMenus)).Height + (((((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + _ulinespacing) / 4) IF Control(__UI_ActiveMenu(__UI_TotalActiveMenus)).Width = 0 THEN Control(__UI_ActiveMenu(__UI_TotalActiveMenus)).Width = Control(__UI_FormID).Width / 4 @@ -6956,11 +6934,11 @@ SUB __UI_DrawButton (This AS __UI_ControlTYPE, ControlState AS _BYTE) ELSE COLOR Darken(Control(__UI_FormID).BackColor, 80) END IF - __UI_PrintString (IconWidth / 2) + (This.Width \ 2 - __UI_PrintWidth&(TempCaption$) \ 2), ((This.Height \ 2) - uheight& \ 2), TempCaption$ + __UI_PrintString (IconWidth / 2) + (This.Width \ 2 - __UI_PrintWidth&(TempCaption$) \ 2), ((This.Height \ 2) - _ufontheight \ 2), TempCaption$ 'Hot key: IF (This.HotKey > 0 AND (__UI_ShowHotKeys AND NOT This.Disabled)) OR (This.HotKey > 0 AND __UI_DesignMode) THEN - LINE ((This.Width \ 2 - __UI_PrintWidth&(TempCaption$) \ 2) + This.HotKeyOffset, ((This.Height \ 2) + uheight& \ 2))-STEP(__UI_PrintWidth&(CHR$(This.HotKey)) - 1, 0), This.ForeColor + LINE ((This.Width \ 2 - __UI_PrintWidth&(TempCaption$) \ 2) + This.HotKeyOffset, ((This.Height \ 2) + _ufontheight \ 2))-STEP(__UI_PrintWidth&(CHR$(This.HotKey)) - 1, 0), This.ForeColor END IF 'Focus outline: @@ -7689,8 +7667,10 @@ SUB __UI_DrawTextBox (This AS __UI_ControlTYPE, ControlState) IF ((__UI_Focus = This.ID) OR (This.ID = __UI_PreviousFocus AND __UI_ParentMenu(__UI_TotalActiveMenus) = This.ContextMenuID)) AND NOT This.Disabled THEN IF LEN(Text(This.ID)) THEN __UI_PrintString CaptionIndent - This.InputViewStart, ((This.Height \ 2) - uspacing& \ 2), ThisTempText$ + __UI_CharPos ThisTempText$ ELSE __UI_PrintString CaptionIndent, ((This.Height \ 2) - uspacing& \ 2), TempCaption$ + __UI_CharPos TempCaption$ END IF IF This.TextIsSelected THEN @@ -8350,7 +8330,7 @@ SUB __UI_DrawFrame (This AS __UI_ControlTYPE) 'Hot key: IF (This.HotKey > 0 AND (__UI_ShowHotKeys AND NOT This.Disabled)) OR (This.HotKey > 0 AND __UI_DesignMode) THEN Temp& = __UI_PrintWidth(CHR$(This.HotKey)) - LINE (CaptionLeft + Temp& + This.HotKeyOffset, uheight&)-STEP(Temp& - 1, 0), This.ForeColor + LINE (CaptionLeft + Temp& + This.HotKeyOffset, _ufontheight)-STEP(Temp& - 1, 0), This.ForeColor END IF END IF END IF @@ -8414,11 +8394,11 @@ SUB __UI_DrawMenuBar (This AS __UI_ControlTYPE, ControlState AS _BYTE) COLOR Darken(Control(__UI_FormID).BackColor, 80) END IF - __UI_PrintString __UI_MenuBarOffset, ((This.Height \ 2) - (falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset)) \ 2), TempCaption$ + __UI_PrintString __UI_MenuBarOffset, ((This.Height \ 2) - (_ulinespacing + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset)) \ 2), TempCaption$ IF This.HotKey > 0 AND (__UI_AltIsDown OR Control(__UI_Focus).Type = __UI_Type_MenuBar OR __UI_DesignMode) THEN 'Has "hot-key" Temp& = __UI_PrintWidth(CHR$(This.HotKey)) - LINE (__UI_MenuBarOffset + This.HotKeyOffset, ((This.Height \ 2) + (falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset)) \ 2) - 1)-STEP(Temp& - 1, 0), _DEFAULTCOLOR + LINE (__UI_MenuBarOffset + This.HotKeyOffset, ((This.Height \ 2) + (_ulinespacing + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset)) \ 2) - 1)-STEP(Temp& - 1, 0), _DEFAULTCOLOR END IF IF __UI_DesignMode THEN @@ -8427,8 +8407,8 @@ SUB __UI_DrawMenuBar (This AS __UI_ControlTYPE, ControlState AS _BYTE) _DEST Control(__UI_FormID).Canvas COLOR Darken(Control(__UI_FormID).BackColor, 80) _FONT (This.Font) - LINE (__UI_NewMenuBarTextLeft + __UI_MenuBarOffset, ((This.Height \ 2) - (falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset)) \ 2))-STEP(__UI_PrintWidth("Add new"),(falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset))), Control(__UI_FormID).BackColor, BF - __UI_PrintString __UI_NewMenuBarTextLeft + __UI_MenuBarOffset, ((This.Height \ 2) - (falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset)) \ 2), "Add new" + LINE (__UI_NewMenuBarTextLeft + __UI_MenuBarOffset, ((This.Height \ 2) - (_ulinespacing + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset)) \ 2))-STEP(__UI_PrintWidth("Add new"),(_ulinespacing + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset))), Control(__UI_FormID).BackColor, BF + __UI_PrintString __UI_NewMenuBarTextLeft + __UI_MenuBarOffset, ((This.Height \ 2) - (_ulinespacing + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset)) \ 2), "Add new" END IF END IF '--- @@ -8516,9 +8496,9 @@ SUB __UI_DrawMenuPanel (This AS __UI_ControlTYPE, Parent AS LONG) CheckMarkIndex = 3 END IF - __UI_PrintString Control(i).Left + __UI_MenuItemOffset, Control(i).Top + Control(i).Height \ 2 - uheight& \ 2, TempCaption$ + __UI_PrintString Control(i).Left + __UI_MenuItemOffset, Control(i).Top + Control(i).Height \ 2 - _ufontheight \ 2, TempCaption$ IF Control(i).KeyCombo > 0 THEN - __UI_PrintString Control(i).Left + This.Width - __UI_MenuItemOffset - __UI_PrintWidth(RTRIM$(__UI_KeyCombo(Control(i).KeyCombo).FriendlyCombo)), Control(i).Top + Control(i).Height \ 2 - uheight& \ 2, RTRIM$(__UI_KeyCombo(Control(i).KeyCombo).FriendlyCombo) + __UI_PrintString Control(i).Left + This.Width - __UI_MenuItemOffset - __UI_PrintWidth(RTRIM$(__UI_KeyCombo(Control(i).KeyCombo).FriendlyCombo)), Control(i).Top + Control(i).Height \ 2 - _ufontheight \ 2, RTRIM$(__UI_KeyCombo(Control(i).KeyCombo).FriendlyCombo) END IF IF Control(i).SubMenu THEN @@ -8528,13 +8508,13 @@ SUB __UI_DrawMenuPanel (This AS __UI_ControlTYPE, Parent AS LONG) IF Control(i).HotKey > 0 THEN 'Has "hot-key" Temp& = __UI_PrintWidth(CHR$(Control(i).HotKey)) - LINE (Control(i).Left + __UI_MenuItemOffset + Control(i).HotKeyOffset, Control(i).Top + Control(i).Height \ 2 + uheight& \ 2 - 1)-STEP(Temp& - 1, 0), _DEFAULTCOLOR + LINE (Control(i).Left + __UI_MenuItemOffset + Control(i).HotKeyOffset, Control(i).Top + Control(i).Height \ 2 + _ufontheight \ 2 - 1)-STEP(Temp& - 1, 0), _DEFAULTCOLOR END IF IF Control(i).Value = True THEN 'Checked menu item IF Control(i).BulletStyle = __UI_Bullet%% THEN - __UI_PrintString __UI_MenuItemOffset \ 2 - __UI_PrintWidth(CHR$(7)) \ 2, Control(i).Top + Control(i).Height \ 2 - uheight \ 2, CHR$(7) + __UI_PrintString __UI_MenuItemOffset \ 2 - __UI_PrintWidth(CHR$(7)) \ 2, Control(i).Top + Control(i).Height \ 2 - _ufontheight \ 2, CHR$(7) ELSE _PUTIMAGE (__UI_MenuItemOffset \ 2 - CheckMarkWidth \ 2, Control(i).Top + Control(i).Height \ 2 - CheckMarkHeight \ 2), ControlImage, , (0, CheckMarkIndex * CheckMarkHeight - CheckMarkHeight)-STEP(6, 6) END IF @@ -8578,7 +8558,7 @@ SUB __UI_DrawMenuPanel (This AS __UI_ControlTYPE, Parent AS LONG) IF __UI_DesignMode AND LEFT$(This.Name, 5) <> "__UI_" THEN COLOR Darken(Control(__UI_FormID).BackColor, 80) - __UI_PrintString __UI_MenuItemOffset, This.Height - (uheight& + 6), "Add new" + __UI_PrintString __UI_MenuItemOffset, This.Height - (_ufontheight + 6), "Add new" END IF '--- @@ -8714,3 +8694,4 @@ SUB __UI_ShadowBox (bX AS INTEGER, bY AS INTEGER, bW AS INTEGER, bH AS INTEGER, LINE (bX, bY)-STEP(bW, bH), C, BF END SUB + diff --git a/InForm/InFormVersion.bas b/InForm/InFormVersion.bas index 0d0529f..5e5c6d7 100644 --- a/InForm/InFormVersion.bas +++ b/InForm/InFormVersion.bas @@ -1,5 +1,10 @@ 'Starting with v1.0, __UI_VersionNumber is actually the current build. -Const __UI_Version = "v1.4" -Const __UI_VersionNumber = 21 -Const __UI_VersionIsBeta = 0 -Const __UI_CopyrightSpan = "2016-2021" + +$IF INFORMVERSION_BAS = UNDEFINED THEN + $LET INFORMVERSION_BAS = TRUE + CONST __UI_Version = "v1.5" + CONST __UI_VersionNumber = 0 + CONST __UI_VersionIsBeta = 1 + CONST __UI_CopyrightSpan = "2016-2023" +$END IF + diff --git a/InForm/UiEditor.bas b/InForm/UiEditor.bas index 660a345..6cf1cc6 100644 --- a/InForm/UiEditor.bas +++ b/InForm/UiEditor.bas @@ -1,322 +1,326 @@ OPTION _EXPLICIT OPTION _EXPLICITARRAY +$UNSTABLE:HTTP -$ExeIcon:'.\resources\InForm.ico' +$EXEICON:'.\resources\InForm.ico' 'Controls: -------------------------------------------------------------------- 'Main form -Dim Shared UiEditor As Long -Dim Shared StatusBar As Long +DIM SHARED UiEditor AS LONG +DIM SHARED StatusBar AS LONG 'Menus -Dim Shared FileMenu As Long, EditMenu As Long, ViewMenu As Long -Dim Shared InsertMenu As Long, AlignMenu As Long, OptionsMenu As Long -Dim Shared HelpMenu As Long, FontSwitchMenu As Long +DIM SHARED FileMenu AS LONG, EditMenu AS LONG, ViewMenu AS LONG +DIM SHARED InsertMenu AS LONG, AlignMenu AS LONG, OptionsMenu AS LONG +DIM SHARED HelpMenu AS LONG, FontSwitchMenu AS LONG 'Frames -Dim Shared Toolbox As Long, ColorMixer As Long -Dim Shared OpenFrame As Long, ZOrdering As Long -Dim Shared ControlProperties As Long, ControlToggles As Long -Dim Shared SetControlBinding As Long +DIM SHARED Toolbox AS LONG, ColorMixer AS LONG +DIM SHARED OpenFrame AS LONG, ZOrdering AS LONG +DIM SHARED ControlProperties AS LONG, ControlToggles AS LONG +DIM SHARED SetControlBinding AS LONG 'Menu items -Dim Shared FileMenuNew As Long, FileMenuOpen As Long -Dim Shared FileMenuSave As Long, FileMenuSaveAs As Long -Dim Shared FileMenuExit As Long +DIM SHARED FileMenuNew AS LONG, FileMenuOpen AS LONG +DIM SHARED FileMenuSave AS LONG, FileMenuSaveAs AS LONG +DIM SHARED FileMenuExit AS LONG -Dim Shared FileMenuRecent As Long -Dim Shared FileMenuRecent1 As Long -Dim Shared FileMenuRecent2 As Long -Dim Shared FileMenuRecent3 As Long -Dim Shared FileMenuRecent4 As Long -Dim Shared FileMenuRecent5 As Long -Dim Shared FileMenuRecent6 As Long -Dim Shared FileMenuRecent7 As Long -Dim Shared FileMenuRecent8 As Long -Dim Shared FileMenuRecent9 As Long +DIM SHARED FileMenuRecent AS LONG +DIM SHARED FileMenuRecent1 AS LONG +DIM SHARED FileMenuRecent2 AS LONG +DIM SHARED FileMenuRecent3 AS LONG +DIM SHARED FileMenuRecent4 AS LONG +DIM SHARED FileMenuRecent5 AS LONG +DIM SHARED FileMenuRecent6 AS LONG +DIM SHARED FileMenuRecent7 AS LONG +DIM SHARED FileMenuRecent8 AS LONG +DIM SHARED FileMenuRecent9 AS LONG -Dim Shared EditMenuUndo As Long, EditMenuRedo As Long, EditMenuCut As Long -Dim Shared EditMenuCopy As Long, EditMenuPaste As Long -Dim Shared EditMenuDelete As Long, EditMenuSelectAll As Long -Dim Shared EditMenuCP437 As Long, EditMenuCP1252 As Long -Dim Shared EditMenuConvertType As Long, EditMenuSetDefaultButton As Long -Dim Shared EditMenuRestoreDimensions As Long, EditMenuBindControls As Long -Dim Shared EditMenuAllowMinMax As Long, EditMenuZOrdering As Long +DIM SHARED EditMenuUndo AS LONG, EditMenuRedo AS LONG, EditMenuCut AS LONG +DIM SHARED EditMenuCopy AS LONG, EditMenuPaste AS LONG +DIM SHARED EditMenuDelete AS LONG, EditMenuSelectAll AS LONG +DIM SHARED EditMenuCP437 AS LONG, EditMenuCP1252 AS LONG +DIM SHARED EditMenuConvertType AS LONG, EditMenuSetDefaultButton AS LONG +DIM SHARED EditMenuRestoreDimensions AS LONG, EditMenuBindControls AS LONG +DIM SHARED EditMenuAllowMinMax AS LONG, EditMenuZOrdering AS LONG -Dim Shared ViewMenuPreviewDetach As Long -Dim Shared ViewMenuShowPositionAndSize As Long -Dim Shared ViewMenuShowInvisibleControls As Long -Dim Shared ViewMenuPreview As Long, ViewMenuLoadedFonts As Long +DIM SHARED ViewMenuPreviewDetach AS LONG +DIM SHARED ViewMenuShowPositionAndSize AS LONG +DIM SHARED ViewMenuShowInvisibleControls AS LONG +DIM SHARED ViewMenuPreview AS LONG, ViewMenuLoadedFonts AS LONG -Dim Shared InsertMenuMenuBar As Long, InsertMenuContextMenu As Long -Dim Shared InsertMenuMenuItem As Long +DIM SHARED InsertMenuMenuBar AS LONG, InsertMenuContextMenu AS LONG +DIM SHARED InsertMenuMenuItem AS LONG -Dim Shared OptionsMenuSnapLines As Long -Dim Shared AlignMenuAlignLeft As Long -Dim Shared AlignMenuAlignRight As Long -Dim Shared AlignMenuAlignTops As Long -Dim Shared AlignMenuAlignBottoms As Long -Dim Shared AlignMenuAlignCentersV As Long -Dim Shared AlignMenuAlignCentersH As Long -Dim Shared AlignMenuAlignCenterV As Long -Dim Shared AlignMenuAlignCenterH As Long -Dim Shared AlignMenuDistributeV As Long -Dim Shared AlignMenuDistributeH As Long +DIM SHARED OptionsMenuSnapLines AS LONG +DIM SHARED AlignMenuAlignLeft AS LONG +DIM SHARED AlignMenuAlignRight AS LONG +DIM SHARED AlignMenuAlignTops AS LONG +DIM SHARED AlignMenuAlignBottoms AS LONG +DIM SHARED AlignMenuAlignCentersV AS LONG +DIM SHARED AlignMenuAlignCentersH AS LONG +DIM SHARED AlignMenuAlignCenterV AS LONG +DIM SHARED AlignMenuAlignCenterH AS LONG +DIM SHARED AlignMenuDistributeV AS LONG +DIM SHARED AlignMenuDistributeH AS LONG -Dim Shared OptionsMenuAutoName As Long, OptionsMenuSwapButtons As Long +DIM SHARED OptionsMenuAutoName AS LONG, OptionsMenuSwapButtons AS LONG -Dim Shared HelpMenuHelp As Long, HelpMenuAbout As Long +DIM SHARED HelpMenuHelp AS LONG, HelpMenuAbout AS LONG -Dim Shared FontSwitchMenuSwitch As Long +DIM SHARED FontSwitchMenuSwitch AS LONG 'Toolbox buttons -Dim Shared AddButton As Long, AddLabel As Long -Dim Shared AddTextBox As Long, AddNumericBox As Long -Dim Shared AddCheckBox As Long, AddRadioButton As Long -Dim Shared AddListBox As Long, AddDropdownList As Long -Dim Shared AddTrackBar As Long, AddProgressBar As Long -Dim Shared AddPictureBox As Long, AddFrame As Long -Dim Shared AddToggleSwitch As Long +DIM SHARED AddButton AS LONG, AddLabel AS LONG +DIM SHARED AddTextBox AS LONG, AddNumericBox AS LONG +DIM SHARED AddCheckBox AS LONG, AddRadioButton AS LONG +DIM SHARED AddListBox AS LONG, AddDropdownList AS LONG +DIM SHARED AddTrackBar AS LONG, AddProgressBar AS LONG +DIM SHARED AddPictureBox AS LONG, AddFrame AS LONG +DIM SHARED AddToggleSwitch AS LONG 'Control toggles -Dim Shared Stretch As Long, HasBorder As Long -Dim Shared ShowPercentage As Long, PasswordMaskCB As Long -Dim Shared WordWrap As Long, CanHaveFocus As Long -Dim Shared Disabled As Long, Transparent As Long -Dim Shared Hidden As Long, CenteredWindow As Long -Dim Shared Resizable As Long, AutoScroll As Long -Dim Shared AutoSize As Long, SizeTB As Long -Dim Shared HideTicks As Long, AutoPlayGif As Long -Dim Shared AddGifExtensionToggle As Long +DIM SHARED Stretch AS LONG, HasBorder AS LONG +DIM SHARED ShowPercentage AS LONG, PasswordMaskCB AS LONG +DIM SHARED WordWrap AS LONG, CanHaveFocus AS LONG +DIM SHARED Disabled AS LONG, Transparent AS LONG +DIM SHARED Hidden AS LONG, CenteredWindow AS LONG +DIM SHARED Resizable AS LONG, AutoScroll AS LONG +DIM SHARED AutoSize AS LONG, SizeTB AS LONG +DIM SHARED HideTicks AS LONG, AutoPlayGif AS LONG +DIM SHARED AddGifExtensionToggle AS LONG 'Open/Save dialog -Dim Shared DialogBG As Long, FileNameLB As Long -Dim Shared FileNameTextBox As Long, PathLB As Long -Dim Shared FilesLB As Long, FileList As Long -Dim Shared PathsLB As Long, DirList As Long -Dim Shared OpenBT As Long, SaveBT As Long, CancelBT As Long -Dim Shared ShowOnlyFrmbinFilesCB As Long, SaveFrmOnlyCB As Long +DIM SHARED DialogBG AS LONG, FileNameLB AS LONG +DIM SHARED FileNameTextBox AS LONG, PathLB AS LONG +DIM SHARED FilesLB AS LONG, FileList AS LONG +DIM SHARED PathsLB AS LONG, DirList AS LONG +DIM SHARED OpenBT AS LONG, SaveBT AS LONG, CancelBT AS LONG +DIM SHARED ShowOnlyFrmbinFilesCB AS LONG, SaveFrmOnlyCB AS LONG 'Z-ordering dialog -Dim Shared ControlList As Long, UpBT As Long -Dim Shared DownBT As Long, CloseZOrderingBT As Long +DIM SHARED ControlList AS LONG, UpBT AS LONG +DIM SHARED DownBT AS LONG, CloseZOrderingBT AS LONG 'Set binding dialog -Dim Shared SourceControlLB As Long -Dim Shared SourceControlNameLB As Long -Dim Shared TargetControlLB As Long -Dim Shared TargetControlNameLB As Long +DIM SHARED SourceControlLB AS LONG +DIM SHARED SourceControlNameLB AS LONG +DIM SHARED TargetControlLB AS LONG +DIM SHARED TargetControlNameLB AS LONG 'DIM SHARED SwapBT AS LONG -Dim Shared SourcePropertyLB As Long -Dim Shared SourcePropertyList As Long -Dim Shared TargetPropertyLB As Long -Dim Shared TargetPropertyList As Long -Dim Shared BindBT As Long -Dim Shared CancelBindBT As Long +DIM SHARED SourcePropertyLB AS LONG +DIM SHARED SourcePropertyList AS LONG +DIM SHARED TargetPropertyLB AS LONG +DIM SHARED TargetPropertyList AS LONG +DIM SHARED BindBT AS LONG +DIM SHARED CancelBindBT AS LONG 'Properties -Dim Shared TextAlignLB As Long, AlignOptions As Long -Dim Shared VerticalAlignLB As Long, VAlignOptions As Long -Dim Shared ColorPropertiesList As Long, ColorPreview As Long -Dim Shared Red As Long, RedValue As Long -Dim Shared Green As Long, GreenValue As Long -Dim Shared Blue As Long, BlueValue As Long -Dim Shared NameLB As Long, CaptionLB As Long -Dim Shared TextLB As Long, TopLB As Long -Dim Shared LeftLB As Long, WidthLB As Long -Dim Shared HeightLB As Long, FontLB As Long -Dim Shared TooltipLB As Long, ValueLB As Long -Dim Shared MinLB As Long, MaxLB As Long -Dim Shared IntervalLB As Long, MinIntervalLB As Long -Dim Shared PaddingLeftrightLB As Long, NameTB As Long -Dim Shared CaptionTB As Long, TextTB As Long -Dim Shared TopTB As Long, LeftTB As Long -Dim Shared WidthTB As Long, HeightTB As Long -Dim Shared FontTB As Long, TooltipTB As Long -Dim Shared ValueTB As Long, MinTB As Long -Dim Shared MaxTB As Long, IntervalTB As Long -Dim Shared MinIntervalTB As Long, PaddingTB As Long -Dim Shared MaskTB As Long, MaskLB As Long -Dim Shared BulletOptions As Long, BulletOptionsLB As Long -Dim Shared BooleanLB As Long, BooleanOptions As Long -Dim Shared FontListLB As Long, FontList As Long, FontSizeList -Dim Shared PasteListBT As Long, ContextMenuLB As Long -Dim Shared ContextMenuControlsList As Long -Dim Shared KeyboardComboLB As Long, KeyboardComboBT As Long +DIM SHARED TextAlignLB AS LONG, AlignOptions AS LONG +DIM SHARED VerticalAlignLB AS LONG, VAlignOptions AS LONG +DIM SHARED ColorPropertiesList AS LONG, ColorPreview AS LONG +DIM SHARED Red AS LONG, RedValue AS LONG +DIM SHARED Green AS LONG, GreenValue AS LONG +DIM SHARED Blue AS LONG, BlueValue AS LONG +DIM SHARED NameLB AS LONG, CaptionLB AS LONG +DIM SHARED TextLB AS LONG, TopLB AS LONG +DIM SHARED LeftLB AS LONG, WidthLB AS LONG +DIM SHARED HeightLB AS LONG, FontLB AS LONG +DIM SHARED TooltipLB AS LONG, ValueLB AS LONG +DIM SHARED MinLB AS LONG, MaxLB AS LONG +DIM SHARED IntervalLB AS LONG, MinIntervalLB AS LONG +DIM SHARED PaddingLeftrightLB AS LONG, NameTB AS LONG +DIM SHARED CaptionTB AS LONG, TextTB AS LONG +DIM SHARED TopTB AS LONG, LeftTB AS LONG +DIM SHARED WidthTB AS LONG, HeightTB AS LONG +DIM SHARED FontTB AS LONG, TooltipTB AS LONG +DIM SHARED ValueTB AS LONG, MinTB AS LONG +DIM SHARED MaxTB AS LONG, IntervalTB AS LONG +DIM SHARED MinIntervalTB AS LONG, PaddingTB AS LONG +DIM SHARED MaskTB AS LONG, MaskLB AS LONG +DIM SHARED BulletOptions AS LONG, BulletOptionsLB AS LONG +DIM SHARED BooleanLB AS LONG, BooleanOptions AS LONG +DIM SHARED FontListLB AS LONG, FontList AS LONG, FontSizeList +DIM SHARED PasteListBT AS LONG, ContextMenuLB AS LONG +DIM SHARED ContextMenuControlsList AS LONG +DIM SHARED KeyboardComboLB AS LONG, KeyboardComboBT AS LONG '------------------------------------------------------------------------------ 'Other shared variables: -Dim Shared UiPreviewPID As Long, TotalSelected As Long, FirstSelected As Long -Dim Shared PreviewFormID As Long, PreviewSelectionRectangle As Integer -Dim Shared PreviewAttached As _Byte, AutoNameControls As _Byte -Dim Shared LastKeyPress As Double -Dim Shared UiEditorTitle$, Edited As _Byte, ZOrderingDialogOpen As _Byte -Dim Shared OpenDialogOpen As _Byte -Dim Shared PropertySent As _Byte, RevertEdit As _Byte, OldColor As _Unsigned Long -Dim Shared ColorPreviewWord$, BlinkStatusBar As Single, StatusBarBackColor As _Unsigned Long -Dim Shared InstanceHost As Long, InstanceClient As Long -Dim Shared HostPort As String, Host As Long, Client As Long -Dim Shared Stream$, FormDataReceived As _Byte, LastFormData$ -Dim Shared prevScreenX As Integer, prevScreenY As Integer -Dim Shared UndoPointer As Integer, TotalUndoImages As Integer -Dim Shared totalBytesSent As _Unsigned _Integer64 -Dim Shared RecentMenuItem(1 To 9) As Long, RecentListBuilt As _Byte -Dim Shared LoadedWithGifExtension As _Byte, AddGifExtension As _Byte -Dim Shared TotalGifLoaded As Long, SetBindingDialogOpen As _Byte -Dim Shared InitialControlSet As String +DIM SHARED UiPreviewPID AS LONG, TotalSelected AS LONG, FirstSelected AS LONG +DIM SHARED PreviewFormID AS LONG, PreviewSelectionRectangle AS INTEGER +DIM SHARED PreviewAttached AS _BYTE, AutoNameControls AS _BYTE +DIM SHARED LastKeyPress AS DOUBLE +DIM SHARED UiEditorTitle$, Edited AS _BYTE, ZOrderingDialogOpen AS _BYTE +DIM SHARED OpenDialogOpen AS _BYTE +DIM SHARED PropertySent AS _BYTE, RevertEdit AS _BYTE, OldColor AS _UNSIGNED LONG +DIM SHARED ColorPreviewWord$, BlinkStatusBar AS SINGLE, StatusBarBackColor AS _UNSIGNED LONG +DIM SHARED InstanceHost AS LONG, InstanceClient AS LONG +DIM SHARED HostPort AS STRING, Host AS LONG, Client AS LONG +DIM SHARED Stream$, FormDataReceived AS _BYTE, LastFormData$ +DIM SHARED prevScreenX AS INTEGER, prevScreenY AS INTEGER +DIM SHARED UndoPointer AS INTEGER, TotalUndoImages AS INTEGER +DIM SHARED totalBytesSent AS _UNSIGNED _INTEGER64 +DIM SHARED RecentMenuItem(1 TO 9) AS LONG, RecentListBuilt AS _BYTE +DIM SHARED LoadedWithGifExtension AS _BYTE, AddGifExtension AS _BYTE +DIM SHARED TotalGifLoaded AS LONG, SetBindingDialogOpen AS _BYTE +DIM SHARED InitialControlSet AS STRING DIM SHARED Answer AS LONG -Type newInputBox - ID As Long - LabelID As Long - Signal As Integer - LastEdited As Single - DataType As Integer - Sent As _Byte -End Type +TYPE newInputBox + ID AS LONG + LabelID AS LONG + Signal AS INTEGER + LastEdited AS SINGLE + DataType AS INTEGER + Sent AS _BYTE +END TYPE -Const DT_Text = 1 -Const DT_Integer = 2 -Const DT_Float = 3 +CONST DT_Text = 1 +CONST DT_Integer = 2 +CONST DT_Float = 3 -ReDim Shared PreviewCaptions(0) As String -ReDim Shared PreviewTexts(0) As String -ReDim Shared PreviewMasks(0) As String -ReDim Shared PreviewTips(0) As String -ReDim Shared PreviewFonts(0) As String -ReDim Shared PreviewActualFonts(0) As String -ReDim Shared PreviewControls(0) As __UI_ControlTYPE -ReDim Shared PreviewParentIDS(0) As String -ReDim Shared PreviewContextMenu(0) As String -ReDim Shared PreviewBoundTo(0) As String -ReDim Shared PreviewBoundProperty(0) As String -ReDim Shared PreviewKeyCombos(0) As String -ReDim Shared PreviewAnimatedGif(0) As _Byte -ReDim Shared PreviewAutoPlayGif(0) As _Byte -ReDim Shared zOrderIDs(0) As Long -ReDim Shared InputBox(1 To 100) As newInputBox -ReDim Shared Toggles(1 To 100) As Long -ReDim Shared InputBoxText(1 To 100) As String -Dim Shared PreviewDefaultButtonID As Long +REDIM SHARED PreviewCaptions(0) AS STRING +REDIM SHARED PreviewTexts(0) AS STRING +REDIM SHARED PreviewMasks(0) AS STRING +REDIM SHARED PreviewTips(0) AS STRING +REDIM SHARED PreviewFonts(0) AS STRING +REDIM SHARED PreviewActualFonts(0) AS STRING +REDIM SHARED PreviewControls(0) AS __UI_ControlTYPE +REDIM SHARED PreviewParentIDS(0) AS STRING +REDIM SHARED PreviewContextMenu(0) AS STRING +REDIM SHARED PreviewBoundTo(0) AS STRING +REDIM SHARED PreviewBoundProperty(0) AS STRING +REDIM SHARED PreviewKeyCombos(0) AS STRING +REDIM SHARED PreviewAnimatedGif(0) AS _BYTE +REDIM SHARED PreviewAutoPlayGif(0) AS _BYTE +REDIM SHARED zOrderIDs(0) AS LONG +REDIM SHARED InputBox(1 TO 100) AS newInputBox +REDIM SHARED Toggles(1 TO 100) AS LONG +REDIM SHARED InputBoxText(1 TO 100) AS STRING +DIM SHARED PreviewDefaultButtonID AS LONG -Dim Shared HasFontList As _Byte, ShowFontList As _Byte -Dim Shared AttemptToShowFontList As _Byte, BypassShowFontList As _Byte -Dim Shared TotalFontsFound As Long -ReDim Shared FontFile(0) As String +DIM SHARED HasFontList AS _BYTE, ShowFontList AS _BYTE +DIM SHARED AttemptToShowFontList AS _BYTE, BypassShowFontList AS _BYTE +DIM SHARED TotalFontsFound AS LONG +REDIM SHARED FontFile(0) AS STRING -DIM SHARED AS STRING QB64_EXE, QB64_DISPLAY +CONST QB64_DISPLAY = "QB64-PE" +DIM SHARED AS STRING QB64_EXE_PATH -$If WIN Then - Const PathSep$ = "\" - IF _FILEEXISTS(".." + PathSep$ + "qb64pe.exe") THEN - QB64_EXE = "qb64pe.exe" - QB64_DISPLAY = "QB64/PE" - ELSEIF _FILEEXISTS(".." + PathSep$ + "qb64.exe") THEN - QB64_EXE = "qb64.exe" - QB64_DISPLAY = "QB64" +$IF WIN THEN + CONST PathSep$ = "\" + CONST QB64_EXE_NAME = "qb64pe.exe" +$ELSE + CONST PathSep$ = "/" + CONST QB64_EXE_NAME = "qb64pe" +$END IF + +UiEditorTitle$ = "InForm Designer" + +' Get the location of QB64-PE +' First look in obvious places +IF _FILEEXISTS("." + PathSep$ + QB64_EXE_NAME) THEN + QB64_EXE_PATH = "." + PathSep$ + QB64_EXE_NAME +ELSEIF _FILEEXISTS(".." + PathSep$ + QB64_EXE_NAME) THEN + QB64_EXE_PATH = ".." + PathSep$ + QB64_EXE_NAME +ELSEIF _FILEEXISTS(".." + PathSep$ + "QB64pe" + PathSep$ + QB64_EXE_NAME) THEN + QB64_EXE_PATH = ".." + PathSep$ + "QB64pe" + PathSep$ + QB64_EXE_NAME +ELSEIF _FILEEXISTS(".." + PathSep$ + "qb64pe" + PathSep$ + QB64_EXE_NAME) THEN + QB64_EXE_PATH = ".." + PathSep$ + "qb64pe" + PathSep$ + QB64_EXE_NAME +ELSE + QB64_EXE_PATH = _SELECTFOLDERDIALOG$("Select QB64-PE directory:") + IF _FILEEXISTS(QB64_EXE_PATH + PathSep$ + QB64_EXE_NAME) THEN + QB64_EXE_PATH = QB64_EXE_PATH + PathSep$ + QB64_EXE_NAME ELSE - Answer = MessageBox("InForm aborted - Neither qb64pe.exe or qb64.exe executable found.", "", MsgBox_Ok + MsgBox_Critical) + _MESSAGEBOX UiEditorTitle$, QB64_DISPLAY + " executable not found.", "error" SYSTEM 1 END IF -$Else - CONST PathSep$ = "/" - IF _FILEEXISTS(".." + PathSep$ + "qb64pe") THEN - QB64_EXE = "qb64pe" - QB64_DISPLAY = "QB64/PE" - ELSEIF _FILEEXISTS(".." + PathSep$ + "qb64") THEN - QB64_EXE = "qb64" - QB64_DISPLAY = "QB64" - ELSE - Answer = MessageBox("InForm aborted - Neither qb64pe or qb64 executable found.", "", MsgBox_Ok + MsgBox_Critical) - SYSTEM 1 - END IF -$End If +END IF -Dim Shared CurrentPath$, ThisFileName$ +DIM SHARED CurrentPath$, ThisFileName$ 'CheckPreviewTimer = _FREETIMER 'ON TIMER(CheckPreviewTimer, .003) CheckPreview -UiEditorTitle$ = "InForm Designer" +$IF WIN THEN + DECLARE DYNAMIC LIBRARY "kernel32" + FUNCTION OpenProcess& (BYVAL dwDesiredAccess AS LONG, BYVAL bInheritHandle AS LONG, BYVAL dwProcessId AS LONG) + FUNCTION CloseHandle& (BYVAL hObject AS LONG) + FUNCTION GetExitCodeProcess& (BYVAL hProcess AS LONG, lpExitCode AS LONG) + END DECLARE -$If WIN Then - Declare Dynamic Library "kernel32" - Function OpenProcess& (ByVal dwDesiredAccess As Long, Byval bInheritHandle As Long, Byval dwProcessId As Long) - Function CloseHandle& (ByVal hObject As Long) - Function GetExitCodeProcess& (ByVal hProcess As Long, lpExitCode As Long) - End Declare - - Declare Dynamic Library "user32" - Function SetForegroundWindow& (ByVal hWnd As Long) - End Declare + DECLARE DYNAMIC LIBRARY "user32" + FUNCTION SetForegroundWindow& (BYVAL hWnd AS LONG) + END DECLARE ''Registry routines taken from the Wiki: http://www.qb64.org/wiki/Windows_Libraries#Registered_Fonts ''Code courtesy of Michael Calkins ''winreg.h - Const HKEY_CLASSES_ROOT = &H80000000~& - Const HKEY_CURRENT_USER = &H80000001~& - Const HKEY_LOCAL_MACHINE = &H80000002~& - Const HKEY_USERS = &H80000003~& - Const HKEY_PERFORMANCE_DATA = &H80000004~& - Const HKEY_CURRENT_CONFIG = &H80000005~& - Const HKEY_DYN_DATA = &H80000006~& - Const REG_OPTION_VOLATILE = 1 - Const REG_OPTION_NON_VOLATILE = 0 - Const REG_CREATED_NEW_KEY = 1 - Const REG_OPENED_EXISTING_KEY = 2 + CONST HKEY_CLASSES_ROOT = &H80000000~& + CONST HKEY_CURRENT_USER = &H80000001~& + CONST HKEY_LOCAL_MACHINE = &H80000002~& + CONST HKEY_USERS = &H80000003~& + CONST HKEY_PERFORMANCE_DATA = &H80000004~& + CONST HKEY_CURRENT_CONFIG = &H80000005~& + CONST HKEY_DYN_DATA = &H80000006~& + CONST REG_OPTION_VOLATILE = 1 + CONST REG_OPTION_NON_VOLATILE = 0 + CONST REG_CREATED_NEW_KEY = 1 + CONST REG_OPENED_EXISTING_KEY = 2 ''http://msdn.microsoft.com/en-us/library/ms724884(v=VS.85).aspx - Const REG_NONE = 0 - Const REG_SZ = 1 - Const REG_EXPAND_SZ = 2 - Const REG_BINARY = 3 - Const REG_DWORD_LITTLE_ENDIAN = 4 - Const REG_DWORD = 4 - Const REG_DWORD_BIG_ENDIAN = 5 - Const REG_LINK = 6 - Const REG_MULTI_SZ = 7 - Const REG_RESOURCE_LIST = 8 - Const REG_FULL_RESOURCE_DESCRIPTOR = 9 - Const REG_RESOURCE_REQUIREMENTS_LIST = 10 - Const REG_QWORD_LITTLE_ENDIAN = 11 - Const REG_QWORD = 11 - Const REG_NOTIFY_CHANGE_NAME = 1 - Const REG_NOTIFY_CHANGE_ATTRIBUTES = 2 - Const REG_NOTIFY_CHANGE_LAST_SET = 4 - Const REG_NOTIFY_CHANGE_SECURITY = 8 + CONST REG_NONE = 0 + CONST REG_SZ = 1 + CONST REG_EXPAND_SZ = 2 + CONST REG_BINARY = 3 + CONST REG_DWORD_LITTLE_ENDIAN = 4 + CONST REG_DWORD = 4 + CONST REG_DWORD_BIG_ENDIAN = 5 + CONST REG_LINK = 6 + CONST REG_MULTI_SZ = 7 + CONST REG_RESOURCE_LIST = 8 + CONST REG_FULL_RESOURCE_DESCRIPTOR = 9 + CONST REG_RESOURCE_REQUIREMENTS_LIST = 10 + CONST REG_QWORD_LITTLE_ENDIAN = 11 + CONST REG_QWORD = 11 + CONST REG_NOTIFY_CHANGE_NAME = 1 + CONST REG_NOTIFY_CHANGE_ATTRIBUTES = 2 + CONST REG_NOTIFY_CHANGE_LAST_SET = 4 + CONST REG_NOTIFY_CHANGE_SECURITY = 8 ''http://msdn.microsoft.com/en-us/library/ms724878(v=VS.85).aspx - Const KEY_ALL_ACCESS = &HF003F& - Const KEY_CREATE_LINK = &H0020& - Const KEY_CREATE_SUB_KEY = &H0004& - Const KEY_ENUMERATE_SUB_KEYS = &H0008& - Const KEY_EXECUTE = &H20019& - Const KEY_NOTIFY = &H0010& - Const KEY_QUERY_VALUE = &H0001& - Const KEY_READ = &H20019& - Const KEY_SET_VALUE = &H0002& - Const KEY_WOW64_32KEY = &H0200& - Const KEY_WOW64_64KEY = &H0100& - Const KEY_WRITE = &H20006& + CONST KEY_ALL_ACCESS = &HF003F& + CONST KEY_CREATE_LINK = &H0020& + CONST KEY_CREATE_SUB_KEY = &H0004& + CONST KEY_ENUMERATE_SUB_KEYS = &H0008& + CONST KEY_EXECUTE = &H20019& + CONST KEY_NOTIFY = &H0010& + CONST KEY_QUERY_VALUE = &H0001& + CONST KEY_READ = &H20019& + CONST KEY_SET_VALUE = &H0002& + CONST KEY_WOW64_32KEY = &H0200& + CONST KEY_WOW64_64KEY = &H0100& + CONST KEY_WRITE = &H20006& ''winerror.h ''http://msdn.microsoft.com/en-us/library/ms681382(v=VS.85).aspx - Const ERROR_SUCCESS = 0 - Const ERROR_FILE_NOT_FOUND = &H2& - Const ERROR_INVALID_HANDLE = &H6& - Const ERROR_MORE_DATA = &HEA& - Const ERROR_NO_MORE_ITEMS = &H103& + CONST ERROR_SUCCESS = 0 + CONST ERROR_FILE_NOT_FOUND = &H2& + CONST ERROR_INVALID_HANDLE = &H6& + CONST ERROR_MORE_DATA = &HEA& + CONST ERROR_NO_MORE_ITEMS = &H103& - Declare Dynamic Library "advapi32" - Function RegOpenKeyExA& (ByVal hKey As _Offset, Byval lpSubKey As _Offset, Byval ulOptions As _Unsigned Long, Byval samDesired As _Unsigned Long, Byval phkResult As _Offset) - Function RegCloseKey& (ByVal hKey As _Offset) - Function RegEnumValueA& (ByVal hKey As _Offset, Byval dwIndex As _Unsigned Long, Byval lpValueName As _Offset, Byval lpcchValueName As _Offset, Byval lpReserved As _Offset, Byval lpType As _Offset, Byval lpData As _Offset, Byval lpcbData As _Offset) - End Declare -$Else + DECLARE DYNAMIC LIBRARY "advapi32" + FUNCTION RegOpenKeyExA& (BYVAL hKey AS _OFFSET, BYVAL lpSubKey AS _OFFSET, BYVAL ulOptions AS _UNSIGNED LONG, BYVAL samDesired AS _UNSIGNED LONG, BYVAL phkResult AS _OFFSET) + FUNCTION RegCloseKey& (BYVAL hKey AS _OFFSET) + FUNCTION RegEnumValueA& (BYVAL hKey AS _OFFSET, BYVAL dwIndex AS _UNSIGNED LONG, BYVAL lpValueName AS _OFFSET, BYVAL lpcchValueName AS _OFFSET, BYVAL lpReserved AS _OFFSET, BYVAL lpType AS _OFFSET, BYVAL lpData AS _OFFSET, BYVAL lpcbData AS _OFFSET) + END DECLARE +$ELSE DECLARE LIBRARY FUNCTION PROCESS_CLOSED& ALIAS kill (BYVAL pid AS INTEGER, BYVAL signal AS INTEGER) END DECLARE -$End If +$END IF '$include:'ini.bi' '$include:'InForm.bi' @@ -326,178 +330,174 @@ $End If '$include:'extensions/download.bas' 'Event procedures: --------------------------------------------------------------- -Sub __UI_Click (id As Long) - Dim Answer As _Byte, Dummy As Long, b$ - Static LastClick#, LastClickedID As Long +SUB __UI_Click (id AS LONG) + DIM Answer AS _BYTE, Dummy AS LONG, b$ + STATIC LastClick#, LastClickedID AS LONG SendSignal -8 - Select EveryCase id - Case AlignMenuAlignLeft: Dummy = 201 - Case AlignMenuAlignRight: Dummy = 202 - Case AlignMenuAlignTops: Dummy = 203 - Case AlignMenuAlignBottoms: Dummy = 204 - Case AlignMenuAlignCentersV: Dummy = 205 - Case AlignMenuAlignCentersH: Dummy = 206 - Case AlignMenuAlignCenterV: Dummy = 207 - Case AlignMenuAlignCenterH: Dummy = 208 - Case AlignMenuDistributeV: Dummy = 209 - Case AlignMenuDistributeH: Dummy = 210 + SELECT EVERYCASE id + CASE AlignMenuAlignLeft: Dummy = 201 + CASE AlignMenuAlignRight: Dummy = 202 + CASE AlignMenuAlignTops: Dummy = 203 + CASE AlignMenuAlignBottoms: Dummy = 204 + CASE AlignMenuAlignCentersV: Dummy = 205 + CASE AlignMenuAlignCentersH: Dummy = 206 + CASE AlignMenuAlignCenterV: Dummy = 207 + CASE AlignMenuAlignCenterH: Dummy = 208 + CASE AlignMenuDistributeV: Dummy = 209 + CASE AlignMenuDistributeH: Dummy = 210 CASE AlignMenuAlignLeft, AlignMenuAlignRight, AlignMenuAlignTops, _ AlignMenuAlignBottoms, AlignMenuAlignCentersV, AlignMenuAlignCentersH, _ AlignMenuAlignCenterV, AlignMenuAlignCenterH, AlignMenuDistributeV, _ AlignMenuDistributeH b$ = MKI$(0) SendData b$, Dummy - Case OptionsMenuAutoName - AutoNameControls = Not AutoNameControls + CASE OptionsMenuAutoName + AutoNameControls = NOT AutoNameControls Control(id).Value = AutoNameControls SaveSettings - Case EditMenuConvertType + CASE EditMenuConvertType b$ = MKI$(0) SendData b$, 225 - Case EditMenuSetDefaultButton + CASE EditMenuSetDefaultButton SendSignal -6 - Case EditMenuRestoreDimensions + CASE EditMenuRestoreDimensions SendSignal -7 - Case OptionsMenuSwapButtons - __UI_MouseButtonsSwap = Not __UI_MouseButtonsSwap + CASE OptionsMenuSwapButtons + __UI_MouseButtonsSwap = NOT __UI_MouseButtonsSwap Control(id).Value = __UI_MouseButtonsSwap SaveSettings - Case OptionsMenuSnapLines - __UI_SnapLines = Not __UI_SnapLines + CASE OptionsMenuSnapLines + __UI_SnapLines = NOT __UI_SnapLines Control(id).Value = __UI_SnapLines SaveSettings - Case InsertMenuMenuBar + CASE InsertMenuMenuBar b$ = "NEWCONTROL>" + MKI$(__UI_Type_MenuBar) + "<END>" Send Client, b$ - Case InsertMenuMenuItem + CASE InsertMenuMenuItem b$ = "NEWCONTROL>" + MKI$(__UI_Type_MenuItem) + "<END>" Send Client, b$ - Case InsertMenuContextMenu + CASE InsertMenuContextMenu b$ = "NEWCONTROL>" + MKI$(__UI_Type_ContextMenu) + "<END>" Send Client, b$ - Case ViewMenuPreviewDetach - PreviewAttached = Not PreviewAttached + CASE ViewMenuPreviewDetach + PreviewAttached = NOT PreviewAttached Control(id).Value = PreviewAttached SaveSettings - Case AddButton: Dummy = __UI_Type_Button - Case AddLabel: Dummy = __UI_Type_Label - Case AddTextBox: Dummy = __UI_Type_TextBox - Case AddCheckBox: Dummy = __UI_Type_CheckBox - Case AddRadioButton: Dummy = __UI_Type_RadioButton - Case AddListBox: Dummy = __UI_Type_ListBox - Case AddDropdownList: Dummy = __UI_Type_DropdownList - Case AddTrackBar: Dummy = __UI_Type_TrackBar - Case AddProgressBar: Dummy = __UI_Type_ProgressBar - Case AddPictureBox: Dummy = __UI_Type_PictureBox - Case AddFrame: Dummy = __UI_Type_Frame - Case AddToggleSwitch: Dummy = __UI_Type_ToggleSwitch + CASE AddButton: Dummy = __UI_Type_Button + CASE AddLabel: Dummy = __UI_Type_Label + CASE AddTextBox: Dummy = __UI_Type_TextBox + CASE AddCheckBox: Dummy = __UI_Type_CheckBox + CASE AddRadioButton: Dummy = __UI_Type_RadioButton + CASE AddListBox: Dummy = __UI_Type_ListBox + CASE AddDropdownList: Dummy = __UI_Type_DropdownList + CASE AddTrackBar: Dummy = __UI_Type_TrackBar + CASE AddProgressBar: Dummy = __UI_Type_ProgressBar + CASE AddPictureBox: Dummy = __UI_Type_PictureBox + CASE AddFrame: Dummy = __UI_Type_Frame + CASE AddToggleSwitch: Dummy = __UI_Type_ToggleSwitch CASE AddButton, AddLabel, AddTextBox, AddCheckBox, _ AddRadioButton, AddListBox, AddDropdownList, _ AddTrackBar, AddProgressBar, AddPictureBox, AddFrame, _ AddToggleSwitch b$ = "NEWCONTROL>" + MKI$(Dummy) + "<END>" Send Client, b$ - Case AddNumericBox + CASE AddNumericBox b$ = MKI$(0) SendData b$, 222 - Case Stretch + CASE Stretch b$ = MKI$(Control(id).Value) SendData b$, 14 - Case HasBorder + CASE HasBorder b$ = MKI$(Control(id).Value) SendData b$, 15 - Case Transparent + CASE Transparent b$ = MKI$(Control(Transparent).Value) SendData b$, 28 - Case ShowPercentage + CASE ShowPercentage b$ = MKI$(Control(id).Value) SendData b$, 16 - Case WordWrap + CASE WordWrap b$ = MKI$(Control(id).Value) SendData b$, 17 'Also: disable autosize - If Control(id).Value Then + IF Control(id).Value THEN b$ = MKI$(0) SendData b$, 39 - End If - Case CanHaveFocus + END IF + CASE CanHaveFocus b$ = MKI$(Control(id).Value) SendData b$, 18 - Case ColorPreview - _Clipboard$ = ColorPreviewWord$ - Case Disabled + CASE ColorPreview + _CLIPBOARD$ = ColorPreviewWord$ + CASE Disabled b$ = MKI$(Control(id).Value) SendData b$, 19 - Case Hidden + CASE Hidden b$ = MKI$(Control(id).Value) SendData b$, 20 - Case CenteredWindow + CASE CenteredWindow b$ = MKI$(Control(id).Value) SendData b$, 21 - Case Resizable + CASE Resizable b$ = MKI$(Control(id).Value) SendData b$, 29 - Case PasswordMaskCB + CASE PasswordMaskCB b$ = MKI$(Control(id).Value) SendData b$, 33 - Case AutoScroll + CASE AutoScroll b$ = MKI$(Control(id).Value) SendData b$, 38 - Case AutoSize + CASE AutoSize b$ = MKI$(Control(id).Value) SendData b$, 39 - Case HideTicks + CASE HideTicks b$ = MKI$(Control(id).Value) SendData b$, 42 - Case AutoPlayGif + CASE AutoPlayGif b$ = MKI$(Control(id).Value) SendData b$, 44 - Case AddGifExtensionToggle - If Control(AddGifExtensionToggle).Value = False And TotalGifLoaded > 0 Then - Answer = MessageBox("Removing the GIF extension will load the existing animations as static frames. Proceed?", "", MsgBox_YesNo + MsgBox_Question) - If Answer = MsgBox_No Then + CASE AddGifExtensionToggle + IF Control(AddGifExtensionToggle).Value = False AND TotalGifLoaded > 0 THEN + Answer = _MESSAGEBOX(UiEditorTitle$, "Removing the GIF extension will load the existing animations as static frames. Proceed?", "yesno", "question", 0) + IF Answer = 0 THEN Control(AddGifExtensionToggle).Value = True - Else + ELSE b$ = "PAUSEALLGIF>" + "<END>" Send Client, b$ - End If - End If - Case ViewMenuPreview - $If WIN Then - Shell _DontWait ".\UiEditorPreview.exe " + HostPort - $Else - SHELL _DONTWAIT "./UiEditorPreview " + HostPort - $End If - Case ViewMenuLoadedFonts - Dim Temp$ - Temp$ = "These fonts are currently in use in your form:" + Chr$(10) - For Dummy = 1 To UBound(PreviewFonts) - If Len(PreviewFonts(Dummy)) Then - Temp$ = Temp$ + Chr$(10) + END IF + END IF + CASE ViewMenuPreview + $IF WIN THEN + SHELL _DONTWAIT ".\InForm\UiEditorPreview.exe " + HostPort + $ELSE + SHELL _DONTWAIT "./InForm/UiEditorPreview " + HostPort + $END IF + CASE ViewMenuLoadedFonts + DIM Temp$ + Temp$ = "These fonts are currently in use in your form:" + CHR$(10) + FOR Dummy = 1 TO UBOUND(PreviewFonts) + IF LEN(PreviewFonts(Dummy)) THEN + Temp$ = Temp$ + CHR$(10) Temp$ = Temp$ + PreviewFonts(Dummy) - End If - Next - If Len(Temp$) Then - Answer = MessageBox(Temp$, "Loaded fonts", MsgBox_OkOnly + MsgBox_Information) - Else - Answer = MessageBox("There are no fonts loaded.", "", MsgBox_OkOnly + MsgBox_Critical) - End If - Case FileMenuNew - If Edited Then - $If WIN Then - Answer = MessageBox("Save the current form?", "", MsgBox_YesNoCancel + MsgBox_Question) - $Else - Answer = MessageBox("Save the current form?", "", MsgBox_YesNo + MsgBox_Question) - $End If - If Answer = MsgBox_Cancel Then - Exit Sub - ElseIf Answer = MsgBox_Yes Then + END IF + NEXT + IF LEN(Temp$) THEN + _MESSAGEBOX UiEditorTitle$ + " - Loaded fonts", Temp$, "info" + ELSE + _MESSAGEBOX UiEditorTitle$, "There are no fonts loaded.", "error" + END IF + CASE FileMenuNew + IF Edited THEN + Answer = _MESSAGEBOX(UiEditorTitle$, "Save the current form?", "yesnocancle", "question", 1) + IF Answer = 0 THEN + EXIT SUB + ELSEIF Answer = 1 THEN SaveForm False, False - End If - End If + END IF + END IF __UI_Focus = 0 LastFormData$ = "" @@ -509,17 +509,17 @@ Sub __UI_Click (id As Long) LoadedWithGifExtension = False Edited = False SendSignal -5 - Case FileMenuSave - If Len(ThisFileName$) Then + CASE FileMenuSave + IF LEN(ThisFileName$) THEN SaveForm True, False - Else - GoTo SaveAs - End If - Case FileMenuSaveAs + ELSE + GOTO SaveAs + END IF + CASE FileMenuSaveAs SaveAs: 'Refresh the file list control's contents - Dim TotalFiles% - If CurrentPath$ = "" Then CurrentPath$ = _StartDir$ + DIM TotalFiles% + IF CurrentPath$ = "" THEN CurrentPath$ = _STARTDIR$ Text(FileList) = idezfilelist$(CurrentPath$, Control(ShowOnlyFrmbinFilesCB).Value + 1, 1, TotalFiles%) Control(FileList).Max = TotalFiles% Control(FileList).LastVisibleItem = 0 'Reset it so it's recalculated @@ -535,27 +535,27 @@ Sub __UI_Click (id As Long) OpenDialogOpen = True Caption(StatusBar) = "Specify the name under which to save the current form..." __UI_Focus = FileNameTextBox - If Len(ThisFileName$) Then + IF LEN(ThisFileName$) THEN Text(FileNameTextBox) = ThisFileName$ - Else + ELSE Text(FileNameTextBox) = "" - End If - If Len(Text(FileNameTextBox)) Then + END IF + IF LEN(Text(FileNameTextBox)) THEN Control(FileNameTextBox).SelectionStart = 0 - Control(FileNameTextBox).Cursor = Len(Text(FileNameTextBox)) + Control(FileNameTextBox).Cursor = LEN(Text(FileNameTextBox)) Control(FileNameTextBox).TextIsSelected = True - End If + END IF __UI_ForceRedraw = True - Case SaveBT + CASE SaveBT SaveFile: - If OpenDialogOpen Then - Dim FileToOpen$, FreeFileNum As Integer + IF OpenDialogOpen THEN + DIM FileToOpen$, FreeFileNum AS INTEGER FileToOpen$ = CurrentPath$ + PathSep$ + Text(FileNameTextBox) - ThisFileName$ = LTrim$(RTrim$(Text(FileNameTextBox))) - If ThisFileName$ = "" Then Exit Sub - If UCase$(Right$(ThisFileName$, 4)) <> ".FRM" Then + ThisFileName$ = LTRIM$(RTRIM$(Text(FileNameTextBox))) + IF ThisFileName$ = "" THEN EXIT SUB + IF UCASE$(RIGHT$(ThisFileName$, 4)) <> ".FRM" THEN ThisFileName$ = ThisFileName$ + ".frm" - End If + END IF Control(DialogBG).Left = -600: Control(DialogBG).Top = -600 Control(OpenFrame).Left = -600: Control(OpenFrame).Top = -600 Control(FileList).FirstVisibleLine = 1 @@ -570,166 +570,154 @@ Sub __UI_Click (id As Long) Caption(StatusBar) = "Ready." __UI_Focus = 0 SaveForm True, Control(SaveFrmOnlyCB).Value - End If - Case HelpMenuAbout - Dim isBeta$ - If __UI_VersionIsBeta Then isBeta$ = " Beta Version" Else isBeta$ = "" - Answer = MessageBox("InForm GUI for QB64 - Created by Fellippe Heitor (2016-2021)\n\n" + UiEditorTitle$ + " " + __UI_Version + " (build" + Str$(__UI_VersionNumber) + isBeta$ + ")\nby George McGinn (gbytes58@gmail.com)\n Samuel Gomes\n\nGitHub: https://github.com/a740g/InForm\n\nContact: gbytes58@gmail.com", "About", MsgBox_OkOnly + MsgBox_Information) - Case HelpMenuHelp - Answer = MessageBox("Design a form and export the resulting code to generate an event-driven QB64 program.", "What's all this?", MsgBox_OkOnly + MsgBox_Information) - Case FileMenuExit - If Edited Then - $If WIN Then - Answer = MessageBox("Save the current form before leaving?", "", MsgBox_YesNoCancel + MsgBox_Question) - $Else - Answer = MessageBox("Save the current form before leaving?", "", MsgBox_YesNo + MsgBox_Question) - $End If - If Answer = MsgBox_Cancel Then - Exit Sub - ElseIf Answer = MsgBox_Yes Then + END IF + CASE HelpMenuAbout + DIM isBeta$ + IF __UI_VersionIsBeta THEN isBeta$ = " Beta Version" ELSE isBeta$ = "" + _MESSAGEBOX "About " + UiEditorTitle$, "InForm GUI for QB64-PE - Created by Fellippe Heitor (2016-2021)\n\n" + UiEditorTitle$ + " " + __UI_Version + " (build" + STR$(__UI_VersionNumber) + isBeta$ + ")\nby George McGinn (gbytes58@gmail.com)\n Samuel Gomes\n\nGitHub: https://github.com/a740g/InForm-PE", "info" + CASE HelpMenuHelp + _MESSAGEBOX UiEditorTitle$ + " What's all this?", "Design a form and export the resulting code to generate an event-driven QB64-PE program.", "info" + CASE FileMenuExit + IF Edited THEN + Answer = _MESSAGEBOX(UiEditorTitle$, "Save the current form before leaving?", "yesnocancel", "question", 1) + IF Answer = 0 THEN + EXIT SUB + ELSEIF Answer = 1 THEN SaveForm False, False - End If - End If - $IF WIN THEN - IF _FileExists("..\UiEditorPreview.frmbin") THEN Kill "..\UiEditorPreview.frmbin" - $ELSE - IF _FileExists("UiEditorPreview.frmbin") Then Kill "UiEditorPreview.frmbin" - $END IF - System - Case EditMenuZOrdering + END IF + END IF + IF _FILEEXISTS("InForm/UiEditorPreview.frmbin") THEN KILL "InForm/UiEditorPreview.frmbin" + SYSTEM + CASE EditMenuZOrdering 'Fill the list: Caption(StatusBar) = "Editing z-ordering/tab ordering" - Dim j As Long, i As Long - Static Moving As _Byte - ReDim _Preserve zOrderIDs(1 To UBound(PreviewControls)) As Long + DIM j AS LONG, i AS LONG + STATIC Moving AS _BYTE + REDIM _PRESERVE zOrderIDs(1 TO UBOUND(PreviewControls)) AS LONG ReloadZList: ResetList ControlList - For i = 1 To UBound(PreviewControls) - Select Case PreviewControls(i).Type - Case 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 18 + FOR i = 1 TO UBOUND(PreviewControls) + SELECT CASE PreviewControls(i).Type + CASE 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 18 j = j + 1 zOrderIDs(j) = i - AddItem ControlList, __UI_Type(PreviewControls(i).Type).Name + RTrim$(PreviewControls(i).Name) - End Select - Next - If Moving Then Return + AddItem ControlList, __UI_Type(PreviewControls(i).Type).Name + RTRIM$(PreviewControls(i).Name) + END SELECT + NEXT + IF Moving THEN RETURN Control(DialogBG).Left = 0: Control(DialogBG).Top = 0 Control(ZOrdering).Left = 18: Control(ZOrdering).Top = 40 __UI_Focus = ControlList ZOrderingDialogOpen = True - Case EditMenuBindControls + CASE EditMenuBindControls 'Get controls' names and bound properties - Dim CurrentSource$ + DIM CurrentSource$ j = 0 - For i = 1 To UBound(PreviewControls) - If PreviewControls(i).ControlIsSelected Then + FOR i = 1 TO UBOUND(PreviewControls) + IF PreviewControls(i).ControlIsSelected THEN j = j + 1 - If j = 1 Then - Caption(SourceControlNameLB) = RTrim$(PreviewControls(i).Name) + IF j = 1 THEN + Caption(SourceControlNameLB) = RTRIM$(PreviewControls(i).Name) CurrentSource$ = PreviewBoundTo(i) - If Len(PreviewBoundProperty(i)) = 0 Then + IF LEN(PreviewBoundProperty(i)) = 0 THEN Dummy = SelectItem(SourcePropertyList, "Value") - Else + ELSE Dummy = SelectItem(SourcePropertyList, PreviewBoundProperty(i)) - End If - End If - If j = 2 Then - Caption(TargetControlNameLB) = RTrim$(PreviewControls(i).Name) - If Len(PreviewBoundProperty(i)) = 0 Then + END IF + END IF + IF j = 2 THEN + Caption(TargetControlNameLB) = RTRIM$(PreviewControls(i).Name) + IF LEN(PreviewBoundProperty(i)) = 0 THEN Dummy = SelectItem(TargetPropertyList, "Value") - Else + ELSE Dummy = SelectItem(TargetPropertyList, PreviewBoundProperty(i)) - End If - Exit For - End If - End If - Next + END IF + EXIT FOR + END IF + END IF + NEXT - If CurrentSource$ = Caption(TargetControlNameLB) Then + IF CurrentSource$ = Caption(TargetControlNameLB) THEN Caption(BindBT) = "Rebind" Caption(CancelBindBT) = "Unbind" - Else + ELSE Caption(BindBT) = "Bind" Caption(CancelBindBT) = "Cancel" - End If + END IF Caption(StatusBar) = "Defining control bindings" Control(DialogBG).Left = 0: Control(DialogBG).Top = 0 Control(SetControlBinding).Left = 83: Control(SetControlBinding).Top = 169 __UI_Focus = SourcePropertyList SetBindingDialogOpen = True - 'CASE SwapBT + 'CASE SwapBT ' SWAP Caption(SourceControlNameLB), Caption(TargetControlNameLB) ' SWAP Control(SourcePropertyList).Value, Control(TargetPropertyList).Value - Case BindBT + CASE BindBT Control(DialogBG).Left = -600: Control(DialogBG).Top = -600 Control(SetControlBinding).Left = -600: Control(SetControlBinding).Top = -600 SetBindingDialogOpen = False b$ = "BINDCONTROLS>" - b$ = b$ + MKL$(Len(Caption(SourceControlNameLB))) + Caption(SourceControlNameLB) - b$ = b$ + MKL$(Len(Caption(TargetControlNameLB))) + Caption(TargetControlNameLB) - b$ = b$ + MKL$(Len(GetItem(SourcePropertyList, Control(SourcePropertyList).Value))) + b$ = b$ + MKL$(LEN(Caption(SourceControlNameLB))) + Caption(SourceControlNameLB) + b$ = b$ + MKL$(LEN(Caption(TargetControlNameLB))) + Caption(TargetControlNameLB) + b$ = b$ + MKL$(LEN(GetItem(SourcePropertyList, Control(SourcePropertyList).Value))) b$ = b$ + GetItem(SourcePropertyList, Control(SourcePropertyList).Value) - b$ = b$ + MKL$(Len(GetItem(TargetPropertyList, Control(TargetPropertyList).Value))) + b$ = b$ + MKL$(LEN(GetItem(TargetPropertyList, Control(TargetPropertyList).Value))) b$ = b$ + GetItem(TargetPropertyList, Control(TargetPropertyList).Value) b$ = b$ + "<END>" Send Client, b$ - Case CancelBindBT + CASE CancelBindBT Control(DialogBG).Left = -600: Control(DialogBG).Top = -600 Control(SetControlBinding).Left = -600: Control(SetControlBinding).Top = -600 SetBindingDialogOpen = False - If Caption(CancelBindBT) = "Unbind" Then + IF Caption(CancelBindBT) = "Unbind" THEN b$ = "UNBINDCONTROLS>" b$ = b$ + Caption(SourceControlNameLB) b$ = b$ + "<END>" Send Client, b$ - End If - Case CloseZOrderingBT + END IF + CASE CloseZOrderingBT Caption(StatusBar) = "Ready." Control(DialogBG).Left = -600: Control(DialogBG).Top = -600 Control(ZOrdering).Left = -600: Control(ZOrdering).Top = -600 __UI_Focus = 0 ZOrderingDialogOpen = False - Case UpBT - Dim PrevListValue As Long + CASE UpBT + DIM PrevListValue AS LONG PrevListValue = Control(ControlList).Value b$ = MKL$(zOrderIDs(Control(ControlList).Value)) + MKL$(zOrderIDs(Control(ControlList).Value - 1)) SendData b$, 211 - _Delay .1 - Moving = True: GoSub ReloadZList + _DELAY .1 + Moving = True: GOSUB ReloadZList Moving = False Control(ControlList).Value = PrevListValue - 1 __UI_Focus = ControlList __UI_ValueChanged ControlList - Case DownBT + CASE DownBT PrevListValue = Control(ControlList).Value b$ = MKL$(zOrderIDs(Control(ControlList).Value)) + MKL$(zOrderIDs(Control(ControlList).Value + 1)) SendData b$, 212 - _Delay .1 - Moving = True: GoSub ReloadZList + _DELAY .1 + Moving = True: GOSUB ReloadZList Moving = False Control(ControlList).Value = PrevListValue + 1 __UI_Focus = ControlList __UI_ValueChanged ControlList - Case FileMenuOpen - If Edited Then - $If WIN Then - Answer = MessageBox("Save the current form?", "", MsgBox_YesNoCancel + MsgBox_Question) - $Else - Answer = MessageBox("Save the current form?", "", MsgBox_YesNo + MsgBox_Question) - $End If - If Answer = MsgBox_Cancel Then - Exit Sub - ElseIf Answer = MsgBox_Yes Then + CASE FileMenuOpen + IF Edited THEN + Answer = _MESSAGEBOX(UiEditorTitle$, "Save the current form?", "yesnocancle", "question", 1) + IF Answer = 0 THEN + EXIT SUB + ELSEIF Answer = 1 THEN SaveForm False, False - End If - End If + END IF + END IF 'Hide the preview SendSignal -2 'Refresh the file list control's contents - If CurrentPath$ = "" Then CurrentPath$ = _StartDir$ + IF CurrentPath$ = "" THEN CurrentPath$ = _STARTDIR$ Text(FileList) = idezfilelist$(CurrentPath$, Control(ShowOnlyFrmbinFilesCB).Value + 1, 1, TotalFiles%) Control(FileList).Max = TotalFiles% Control(FileList).LastVisibleItem = 0 'Reset it so it's recalculated @@ -744,13 +732,13 @@ Sub __UI_Click (id As Long) OpenDialogOpen = True Caption(StatusBar) = "Select a form file to load..." __UI_Focus = FileNameTextBox - If Len(Text(FileNameTextBox)) > 0 Then + IF LEN(Text(FileNameTextBox)) > 0 THEN Control(FileNameTextBox).SelectionStart = 0 - Control(FileNameTextBox).Cursor = Len(Text(FileNameTextBox)) + Control(FileNameTextBox).Cursor = LEN(Text(FileNameTextBox)) Control(FileNameTextBox).TextIsSelected = True - End If + END IF __UI_ForceRedraw = True - Case CancelBT + CASE CancelBT Text(FileNameTextBox) = "" Control(DialogBG).Left = -600: Control(DialogBG).Top = -600 Control(OpenFrame).Left = -600: Control(OpenFrame).Top = -600 @@ -764,66 +752,62 @@ Sub __UI_Click (id As Long) CASE FileMenuRecent1, FileMenuRecent2, FileMenuRecent3, _ FileMenuRecent4, FileMenuRecent5, FileMenuRecent6, _ FileMenuRecent7, FileMenuRecent8, FileMenuRecent9 - Dim RecentToOpen$ + DIM RecentToOpen$ RecentToOpen$ = ToolTip(id) - If _FileExists(RecentToOpen$) Then - If InStr(RecentToOpen$, "/") > 0 Or InStr(RecentToOpen$, "\") > 0 Then - For i = Len(RecentToOpen$) To 1 Step -1 - If Asc(RecentToOpen$, i) = 92 Or Asc(RecentToOpen$, i) = 47 Then - CurrentPath$ = Left$(RecentToOpen$, i - 1) - RecentToOpen$ = Mid$(RecentToOpen$, i + 1) - Exit For - End If - Next - End If + IF _FILEEXISTS(RecentToOpen$) THEN + IF INSTR(RecentToOpen$, "/") > 0 OR INSTR(RecentToOpen$, "\") > 0 THEN + FOR i = LEN(RecentToOpen$) TO 1 STEP -1 + IF ASC(RecentToOpen$, i) = 92 OR ASC(RecentToOpen$, i) = 47 THEN + CurrentPath$ = LEFT$(RecentToOpen$, i - 1) + RecentToOpen$ = MID$(RecentToOpen$, i + 1) + EXIT FOR + END IF + NEXT + END IF - If Edited Then - $If WIN Then - Answer = MessageBox("Save the current form?", "", MsgBox_YesNoCancel + MsgBox_Question) - $Else - Answer = MessageBox("Save the current form?", "", MsgBox_YesNo + MsgBox_Question) - $End If - If Answer = MsgBox_Cancel Then - Exit Sub - ElseIf Answer = MsgBox_Yes Then + IF Edited THEN + Answer = _MESSAGEBOX(UiEditorTitle$, "Save the current form?", "yesnocancle", "question", 1) + IF Answer = 0 THEN + EXIT SUB + ELSEIF Answer = 1 THEN SaveForm False, False - End If - End If + END IF + END IF Text(FileNameTextBox) = RecentToOpen$ OpenDialogOpen = True __UI_Click OpenBT - Else - Answer = MessageBox("File not found.", "", MsgBox_OkOnly + MsgBox_Critical) + ELSE + _MESSAGEBOX UiEditorTitle$, "File not found.", "error" RemoveFromRecentList RecentToOpen$ - End If - Case OpenBT + END IF + CASE OpenBT OpenFile: - If OpenDialogOpen Then + IF OpenDialogOpen THEN FileToOpen$ = CurrentPath$ + PathSep$ + Text(FileNameTextBox) - If _FileExists(FileToOpen$) Then + IF _FILEEXISTS(FileToOpen$) THEN LoadedWithGifExtension = False - If _FileExists(Left$(FileToOpen$, Len(FileToOpen$) - 4) + ".bas") Then - FreeFileNum = FreeFile - Open Left$(FileToOpen$, Len(FileToOpen$) - 4) + ".bas" For Binary As #FreeFileNum - b$ = Space$(LOF(FreeFileNum)) - Get #FreeFileNum, 1, b$ - Close #FreeFileNum - If InStr(b$, Chr$(10) + "'$INCLUDE:'InForm\extensions\gifplay.bm'") > 0 Then + IF _FILEEXISTS(LEFT$(FileToOpen$, LEN(FileToOpen$) - 4) + ".bas") THEN + FreeFileNum = FREEFILE + OPEN LEFT$(FileToOpen$, LEN(FileToOpen$) - 4) + ".bas" FOR BINARY AS #FreeFileNum + b$ = SPACE$(LOF(FreeFileNum)) + GET #FreeFileNum, 1, b$ + CLOSE #FreeFileNum + IF INSTR(b$, CHR$(10) + "'$INCLUDE:'InForm\extensions\gifplay.bm'") > 0 THEN LoadedWithGifExtension = True - End If - End If + END IF + END IF AddToRecentList FileToOpen$ ThisFileName$ = Text(FileNameTextBox) 'Send open command - If LoadedWithGifExtension = False Then + IF LoadedWithGifExtension = False THEN LoadedWithGifExtension = 1 'Set to 1 to check whether a loaded file already had the gif extension Control(AddGifExtensionToggle).Value = False - Else + ELSE Control(AddGifExtensionToggle).Value = True - End If + END IF AddGifExtension = False b$ = "OPENFILE>" + FileToOpen$ + "<END>" Send Client, b$ @@ -848,36 +832,36 @@ Sub __UI_Click (id As Long) Stream$ = "" FormDataReceived = False InitialControlSet = "" - Else - Answer = MessageBox("File not found.", "", MsgBox_OkOnly + MsgBox_Critical) + ELSE + _MESSAGEBOX UiEditorTitle$, "File not found.", "error" Control(FileList).Value = 0 - End If - End If - Case FileList + END IF + END IF + CASE FileList Text(FileNameTextBox) = GetItem(FileList, Control(FileList).Value) Control(DirList).Value = 0 - If Control(FileList).HoveringVScrollbarButton = 0 And LastClickedID = id And Timer - LastClick# < .3 Then 'Double click - If Len(Text(FileNameTextBox)) > 0 Then - If Caption(OpenFrame) = "Open" Then - GoTo OpenFile - Else - GoTo SaveFile - End If - End If - End If - Case DirList + IF Control(FileList).HoveringVScrollbarButton = 0 AND LastClickedID = id AND TIMER - LastClick# < .3 THEN 'Double click + IF LEN(Text(FileNameTextBox)) > 0 THEN + IF Caption(OpenFrame) = "Open" THEN + GOTO OpenFile + ELSE + GOTO SaveFile + END IF + END IF + END IF + CASE DirList Text(FileNameTextBox) = GetItem(DirList, Control(DirList).Value) Control(FileList).Value = 0 - If LastClickedID = id And Timer - LastClick# < .3 Then 'Double click + IF LastClickedID = id AND TIMER - LastClick# < .3 THEN 'Double click CurrentPath$ = idezchangepath(CurrentPath$, Text(FileNameTextBox)) Caption(PathLB) = "Path: " + CurrentPath$ Text(DirList) = idezpathlist$(CurrentPath$, TotalFiles%) Control(DirList).Max = TotalFiles% Control(DirList).LastVisibleItem = 0 'Reset it so it's recalculated Control(DirList).Value = 0 - GoTo ReloadList - End If - Case ShowOnlyFrmbinFilesCB + GOTO ReloadList + END IF + CASE ShowOnlyFrmbinFilesCB ReloadList: Text(FileList) = idezfilelist$(CurrentPath$, Control(ShowOnlyFrmbinFilesCB).Value + 1, 1, TotalFiles%) Control(FileList).Max = TotalFiles% @@ -885,829 +869,825 @@ Sub __UI_Click (id As Long) Control(FileList).InputViewStart = 1 Control(FileList).Value = 0 Control(FileList).LastVisibleItem = 0 'Reset it so it's recalculated - Case EditMenuUndo + CASE EditMenuUndo SendSignal 214 - Case EditMenuRedo + CASE EditMenuRedo SendSignal 215 - Case EditMenuCopy + CASE EditMenuCopy b$ = MKI$(0) SendData b$, 217 - Case EditMenuPaste + CASE EditMenuPaste b$ = MKI$(0) SendData b$, 218 - Case EditMenuCut + CASE EditMenuCut b$ = MKI$(0) SendData b$, 219 - Case EditMenuDelete + CASE EditMenuDelete b$ = MKI$(0) SendData b$, 220 - Case EditMenuSelectAll + CASE EditMenuSelectAll b$ = MKI$(0) SendData b$, 221 - Case EditMenuAllowMinMax + CASE EditMenuAllowMinMax b$ = MKI$(0) SendData b$, 223 - Case EditMenuCP437 + CASE EditMenuCP437 b$ = MKL$(437) SendData b$, 34 'Encoding - Case EditMenuCP1252 + CASE EditMenuCP1252 b$ = MKL$(1252) SendData b$, 34 'Encoding - Case ViewMenuShowPositionAndSize - __UI_ShowPositionAndSize = Not __UI_ShowPositionAndSize + CASE ViewMenuShowPositionAndSize + __UI_ShowPositionAndSize = NOT __UI_ShowPositionAndSize Control(id).Value = __UI_ShowPositionAndSize SaveSettings - Case ViewMenuShowInvisibleControls - __UI_ShowInvisibleControls = Not __UI_ShowInvisibleControls + CASE ViewMenuShowInvisibleControls + __UI_ShowInvisibleControls = NOT __UI_ShowInvisibleControls Control(id).Value = __UI_ShowInvisibleControls SaveSettings - Case FontSwitchMenuSwitch, FontLB, FontListLB - AttemptToShowFontList = (ShowFontList = False Or BypassShowFontList = True) - ShowFontList = Not ShowFontList - If id <> FontSwitchMenuSwitch Then __UI_MouseEnter FontLB + CASE FontSwitchMenuSwitch, FontLB, FontListLB + AttemptToShowFontList = (ShowFontList = False OR BypassShowFontList = True) + ShowFontList = NOT ShowFontList + IF id <> FontSwitchMenuSwitch THEN __UI_MouseEnter FontLB SaveSettings __UI_ForceRedraw = True - Case PasteListBT - Dim Clip$ - Clip$ = _Clipboard$ - Clip$ = Replace$(Clip$, Chr$(13) + Chr$(10), Chr$(10), 0, 0) - Clip$ = Replace$(Clip$, Chr$(10), "\n", 0, 0) + CASE PasteListBT + DIM Clip$ + Clip$ = _CLIPBOARD$ + Clip$ = Replace$(Clip$, CHR$(13) + CHR$(10), CHR$(10), 0, 0) + Clip$ = Replace$(Clip$, CHR$(10), "\n", 0, 0) - If PreviewControls(FirstSelected).Type = __UI_Type_ListBox Or PreviewControls(FirstSelected).Type = __UI_Type_DropdownList Then + IF PreviewControls(FirstSelected).Type = __UI_Type_ListBox OR PreviewControls(FirstSelected).Type = __UI_Type_DropdownList THEN Dummy = TextTB - ElseIf (PreviewControls(FirstSelected).Type = __UI_Type_Label And PreviewControls(FirstSelected).WordWrap = True) Then + ELSEIF (PreviewControls(FirstSelected).Type = __UI_Type_Label AND PreviewControls(FirstSelected).WordWrap = True) THEN Dummy = CaptionTB - End If + END IF Text(Dummy) = Clip$ __UI_Focus = Dummy - Control(Dummy).Cursor = Len(Text(Dummy)) + Control(Dummy).Cursor = LEN(Text(Dummy)) Control(Dummy).TextIsSelected = False - Case KeyboardComboBT + CASE KeyboardComboBT __UI_BypassKeyCombos = True - Caption(KeyboardComboBT) = Chr$(7) + " hit a key combo... (ESC to clear)" + Caption(KeyboardComboBT) = CHR$(7) + " hit a key combo... (ESC to clear)" ToolTip(KeyboardComboBT) = "Press a key combination to assign to the selected control" - End Select + END SELECT LastClickedID = id - LastClick# = Timer - If Caption(StatusBar) = "" Then Caption(StatusBar) = "Ready." -End Sub + LastClick# = TIMER + IF Caption(StatusBar) = "" THEN Caption(StatusBar) = "Ready." +END SUB -Sub __UI_MouseEnter (id As Long) - Select Case id - Case FileMenuNew +SUB __UI_MouseEnter (id AS LONG) + SELECT CASE id + CASE FileMenuNew Caption(StatusBar) = "Creates a new project." - Case FileMenuOpen + CASE FileMenuOpen Caption(StatusBar) = "Loads an existing project from disk." - Case FileMenuExit + CASE FileMenuExit Caption(StatusBar) = "Exits the editor." - Case FileMenuSave + CASE FileMenuSave Caption(StatusBar) = "Saves the current project to disk." - Case FileMenuSaveAs + CASE FileMenuSaveAs Caption(StatusBar) = "Saves a copy of the current project to disk." - Case EditMenuUndo + CASE EditMenuUndo Caption(StatusBar) = "Undoes the last edit." - Case EditMenuRedo + CASE EditMenuRedo Caption(StatusBar) = "Redoes the last undone edit." - Case EditMenuCut + CASE EditMenuCut Caption(StatusBar) = "Removes the selected controls and copies them to the Clipboard." - Case EditMenuCopy + CASE EditMenuCopy Caption(StatusBar) = "Copies the selected controls to the Clipboard." - Case EditMenuPaste + CASE EditMenuPaste Caption(StatusBar) = "Inserts controls previously cut or copied from the Clipboard." - Case EditMenuDelete + CASE EditMenuDelete Caption(StatusBar) = "Removes the selected controls." - Case EditMenuSelectAll + CASE EditMenuSelectAll Caption(StatusBar) = "Selects all controls." - Case EditMenuCP437 + CASE EditMenuCP437 Caption(StatusBar) = "Applies code page 437 to the current form." - Case EditMenuCP1252 + CASE EditMenuCP1252 Caption(StatusBar) = "Applies code page 1252 to the current form." - Case EditMenuConvertType + CASE EditMenuConvertType Caption(StatusBar) = "Converts this control's type into another similar in functionality." - Case EditMenuSetDefaultButton + CASE EditMenuSetDefaultButton Caption(StatusBar) = "Makes the currently selected button the default button." - Case EditMenuRestoreDimensions + CASE EditMenuRestoreDimensions Caption(StatusBar) = "Makes this control have the same dimensions as the loaded image." - Case EditMenuAllowMinMax + CASE EditMenuAllowMinMax Caption(StatusBar) = "Enables and validates the .Min and .Max properties for NumericTextBox controls." - Case EditMenuZOrdering + CASE EditMenuZOrdering Caption(StatusBar) = "Allows you to change tab-order/z-ordering of controls." - Case ViewMenuPreviewDetach + CASE ViewMenuPreviewDetach Caption(StatusBar) = "Toggles whether the preview form will be moved with the editor." - Case ViewMenuShowPositionAndSize + CASE ViewMenuShowPositionAndSize Caption(StatusBar) = "Toggles whether size and position indicators will be shown in the preview." - Case ViewMenuShowInvisibleControls + CASE ViewMenuShowInvisibleControls Caption(StatusBar) = "Show or hide invisible controls and binding indicators in the preview dialog." - Case ViewMenuPreview + CASE ViewMenuPreview Caption(StatusBar) = "Launches the preview window in case it's been closed accidentaly." - Case ViewMenuLoadedFonts + CASE ViewMenuLoadedFonts Caption(StatusBar) = "Shows a list of all fonts in use in the current form." - Case InsertMenuMenuBar + CASE InsertMenuMenuBar Caption(StatusBar) = "Inserts a new MenuBar control." - Case InsertMenuMenuItem + CASE InsertMenuMenuItem Caption(StatusBar) = "Inserts a new MenuItem control in the currently selected menu panel." - Case OptionsMenuSnapLines + CASE OptionsMenuSnapLines Caption(StatusBar) = "Toggles whether controls edges are automatically snapped to others." - Case OptionsMenuAutoName + CASE OptionsMenuAutoName Caption(StatusBar) = "Automatically sets control names based on caption and type" - Case OptionsMenuSwapButtons + CASE OptionsMenuSwapButtons Caption(StatusBar) = "Toggles left/right mouse buttons." - Case FontLB, FontListLB + CASE FontLB, FontListLB Control(FontLB).BackColor = Darken(__UI_DefaultColor(__UI_Type_Form, 2), 90) Control(FontListLB).BackColor = Darken(__UI_DefaultColor(__UI_Type_Form, 2), 90) Caption(FontLB) = "Font (toggle)" Caption(FontListLB) = "Font (toggle)" - Case Else - If Control(id).Type = __UI_Type_MenuItem Or Control(id).Type = __UI_Type_MenuBar Then + CASE ELSE + IF Control(id).Type = __UI_Type_MenuItem OR Control(id).Type = __UI_Type_MenuBar THEN Caption(StatusBar) = "" - End If - End Select -End Sub + END IF + END SELECT +END SUB -Sub __UI_MouseLeave (id As Long) - Select Case id - Case FontLB, FontListLB +SUB __UI_MouseLeave (id AS LONG) + SELECT CASE id + CASE FontLB, FontListLB Control(FontLB).BackColor = __UI_DefaultColor(__UI_Type_Form, 2) Control(FontListLB).BackColor = __UI_DefaultColor(__UI_Type_Form, 2) Caption(FontLB) = "Font" Caption(FontListLB) = "Font" - End Select -End Sub + END SELECT +END SUB -Sub __UI_FocusIn (id As Long) - Select Case id - Case NameTB, CaptionTB, TextTB, MaskTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, ValueTB, MinTB, MaxTB, IntervalTB, PaddingTB, MinIntervalTB, SizeTB - Dim ThisInputBox As Long +SUB __UI_FocusIn (id AS LONG) + SELECT CASE id + CASE NameTB, CaptionTB, TextTB, MaskTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, ValueTB, MinTB, MaxTB, IntervalTB, PaddingTB, MinIntervalTB, SizeTB + DIM ThisInputBox AS LONG ThisInputBox = GetInputBoxFromID(id) InputBoxText(ThisInputBox) = Text(id) InputBox(ThisInputBox).Sent = False Caption(StatusBar) = "Editing property" - Case FileNameTextBox - If OpenDialogOpen = False Then __UI_Focus = AddButton - Case ControlList - If OpenDialogOpen Then __UI_Focus = FileNameTextBox - Case BlueValue - If OpenDialogOpen Then __UI_Focus = CancelBT - Case CloseZOrderingBT - If ZOrderingDialogOpen = False Then __UI_Focus = BlueValue - Case AddButton - If ZOrderingDialogOpen Then __UI_Focus = ControlList - Case CancelBT - If ZOrderingDialogOpen Then __UI_Focus = CloseZOrderingBT - Case KeyboardComboBT + CASE FileNameTextBox + IF OpenDialogOpen = False THEN __UI_Focus = AddButton + CASE ControlList + IF OpenDialogOpen THEN __UI_Focus = FileNameTextBox + CASE BlueValue + IF OpenDialogOpen THEN __UI_Focus = CancelBT + CASE CloseZOrderingBT + IF ZOrderingDialogOpen = False THEN __UI_Focus = BlueValue + CASE AddButton + IF ZOrderingDialogOpen THEN __UI_Focus = ControlList + CASE CancelBT + IF ZOrderingDialogOpen THEN __UI_Focus = CloseZOrderingBT + CASE KeyboardComboBT __UI_BypassKeyCombos = True - Caption(KeyboardComboBT) = Chr$(7) + " hit a key combo... (ESC to clear)" + Caption(KeyboardComboBT) = CHR$(7) + " hit a key combo... (ESC to clear)" ToolTip(KeyboardComboBT) = "Press a key combination to assign to the selected control" - End Select -End Sub + END SELECT +END SUB -Sub __UI_FocusOut (id As Long) - Select Case id - Case NameTB, CaptionTB, TextTB, MaskTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, ValueTB, MinTB, MaxTB, IntervalTB, PaddingTB, MinIntervalTB, SizeTB +SUB __UI_FocusOut (id AS LONG) + SELECT CASE id + CASE NameTB, CaptionTB, TextTB, MaskTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, ValueTB, MinTB, MaxTB, IntervalTB, PaddingTB, MinIntervalTB, SizeTB ConfirmEdits id - Case KeyboardComboBT + CASE KeyboardComboBT __UI_BypassKeyCombos = False Caption(KeyboardComboBT) = "Click to assign" - End Select -End Sub + END SELECT +END SUB -Sub __UI_MouseDown (id As Long) - Select Case id - Case Red, Green, Blue +SUB __UI_MouseDown (id AS LONG) + SELECT CASE id + CASE Red, Green, Blue Caption(StatusBar) = "Color picker active. Release to apply the new values..." - Select Case Control(ColorPropertiesList).Value - Case 1 + SELECT CASE Control(ColorPropertiesList).Value + CASE 1 OldColor = PreviewControls(FirstSelected).ForeColor - If OldColor = 0 Then OldColor = PreviewControls(PreviewFormID).ForeColor - If OldColor = 0 Then OldColor = __UI_DefaultColor(__UI_Type_Form, 1) - Case 2 + IF OldColor = 0 THEN OldColor = PreviewControls(PreviewFormID).ForeColor + IF OldColor = 0 THEN OldColor = __UI_DefaultColor(__UI_Type_Form, 1) + CASE 2 OldColor = PreviewControls(FirstSelected).BackColor - If OldColor = 0 Then OldColor = PreviewControls(PreviewFormID).BackColor - If OldColor = 0 Then OldColor = __UI_DefaultColor(__UI_Type_Form, 2) - Case 3 + IF OldColor = 0 THEN OldColor = PreviewControls(PreviewFormID).BackColor + IF OldColor = 0 THEN OldColor = __UI_DefaultColor(__UI_Type_Form, 2) + CASE 3 OldColor = PreviewControls(FirstSelected).SelectedForeColor - If OldColor = 0 Then OldColor = PreviewControls(PreviewFormID).SelectedForeColor - If OldColor = 0 Then OldColor = __UI_DefaultColor(__UI_Type_Form, 3) - Case 4 + IF OldColor = 0 THEN OldColor = PreviewControls(PreviewFormID).SelectedForeColor + IF OldColor = 0 THEN OldColor = __UI_DefaultColor(__UI_Type_Form, 3) + CASE 4 OldColor = PreviewControls(FirstSelected).SelectedBackColor - If OldColor = 0 Then OldColor = PreviewControls(PreviewFormID).SelectedBackColor - If OldColor = 0 Then OldColor = __UI_DefaultColor(__UI_Type_Form, 4) - Case 5 + IF OldColor = 0 THEN OldColor = PreviewControls(PreviewFormID).SelectedBackColor + IF OldColor = 0 THEN OldColor = __UI_DefaultColor(__UI_Type_Form, 4) + CASE 5 OldColor = PreviewControls(FirstSelected).BorderColor - If OldColor = 0 Then OldColor = PreviewControls(PreviewFormID).BorderColor - If OldColor = 0 Then OldColor = __UI_DefaultColor(__UI_Type_Form, 5) - End Select - End Select -End Sub + IF OldColor = 0 THEN OldColor = PreviewControls(PreviewFormID).BorderColor + IF OldColor = 0 THEN OldColor = __UI_DefaultColor(__UI_Type_Form, 5) + END SELECT + END SELECT +END SUB -Sub __UI_MouseUp (id As Long) - Select Case id - Case Red, Green, Blue +SUB __UI_MouseUp (id AS LONG) + SELECT CASE id + CASE Red, Green, Blue 'Compose a new color and send it to the preview SendNewRGB Caption(StatusBar) = "Color changed." - End Select -End Sub + END SELECT +END SUB -Sub AddToRecentList (FileName$) - Dim i As Long, j As Long, b$ +SUB AddToRecentList (FileName$) + DIM i AS LONG, j AS LONG, b$ 'Check if this FileName$ is already in the list; if so, delete it. - For i = 1 To 9 - b$ = ReadSetting("InForm.ini", "Recent Projects", Str$(i)) - If b$ = FileName$ Then - For j = i + 1 To 9 - b$ = ReadSetting("InForm.ini", "Recent Projects", Str$(j)) - WriteSetting "InForm.ini", "Recent Projects", Str$(j - 1), b$ - Next - Exit For - End If - Next + FOR i = 1 TO 9 + b$ = ReadSetting("InForm/InForm.ini", "Recent Projects", STR$(i)) + IF b$ = FileName$ THEN + FOR j = i + 1 TO 9 + b$ = ReadSetting("InForm/InForm.ini", "Recent Projects", STR$(j)) + WriteSetting "InForm/InForm.ini", "Recent Projects", STR$(j - 1), b$ + NEXT + EXIT FOR + END IF + NEXT 'Make room for FileName$ by shifting existing list by one; '1 is the most recent, 9 is the oldest; - For i = 8 To 1 Step -1 - b$ = ReadSetting("InForm.ini", "Recent Projects", Str$(i)) - WriteSetting "InForm.ini", "Recent Projects", Str$(i + 1), b$ - Next + FOR i = 8 TO 1 STEP -1 + b$ = ReadSetting("InForm/InForm.ini", "Recent Projects", STR$(i)) + WriteSetting "InForm/InForm.ini", "Recent Projects", STR$(i + 1), b$ + NEXT - WriteSetting "InForm.ini", "Recent Projects", "1", FileName$ + WriteSetting "InForm/InForm.ini", "Recent Projects", "1", FileName$ RecentListBuilt = False -End Sub +END SUB -Sub RemoveFromRecentList (FileName$) - Dim i As Long, j As Long, b$ +SUB RemoveFromRecentList (FileName$) + DIM i AS LONG, j AS LONG, b$ 'Check if this FileName$ is already in the list; if so, delete it. - For i = 1 To 9 - b$ = ReadSetting("InForm.ini", "Recent Projects", Str$(i)) - If b$ = FileName$ Then - For j = i + 1 To 9 - b$ = ReadSetting("InForm.ini", "Recent Projects", Str$(j)) - WriteSetting "InForm.ini", "Recent Projects", Str$(j - 1), b$ - Next - WriteSetting "InForm.ini", "Recent Projects", "9", "" - Exit For - End If - Next + FOR i = 1 TO 9 + b$ = ReadSetting("InForm/InForm.ini", "Recent Projects", STR$(i)) + IF b$ = FileName$ THEN + FOR j = i + 1 TO 9 + b$ = ReadSetting("InForm/InForm.ini", "Recent Projects", STR$(j)) + WriteSetting "InForm/InForm.ini", "Recent Projects", STR$(j - 1), b$ + NEXT + WriteSetting "InForm/InForm.ini", "Recent Projects", "9", "" + EXIT FOR + END IF + NEXT RecentListBuilt = False -End Sub +END SUB -Sub SendNewRGB - Dim b$, NewColor As _Unsigned Long +SUB SendNewRGB + DIM b$, NewColor AS _UNSIGNED LONG NewColor = _RGB32(Control(Red).Value, Control(Green).Value, Control(Blue).Value) - b$ = _MK$(_Unsigned Long, NewColor) + b$ = _MK$(_UNSIGNED LONG, NewColor) SendData b$, Control(ColorPropertiesList).Value + 22 -End Sub +END SUB -Function PropertyFullySelected%% (id As Long) +FUNCTION PropertyFullySelected%% (id AS LONG) PropertyFullySelected%% = Control(id).TextIsSelected AND _ Control(id).SelectionStart = 0 AND _ Control(id).Cursor = LEN(Text(id)) -End Function +END FUNCTION -Sub SelectPropertyFully (id As Long) +SUB SelectPropertyFully (id AS LONG) Control(id).TextIsSelected = True Control(id).SelectionStart = 0 - Control(id).Cursor = Len(Text(id)) -End Sub + Control(id).Cursor = LEN(Text(id)) +END SUB -Sub SelectFontInList (FontSetup$) - Dim i As Long, thisFile$, thisSize% +SUB SelectFontInList (FontSetup$) + DIM i AS LONG, thisFile$, thisSize% - If FontSetup$ = "" Then Exit Sub + IF FontSetup$ = "" THEN EXIT SUB - thisFile$ = UCase$(Left$(FontSetup$, InStr(FontSetup$, ",") - 1)) - thisSize% = Val(Mid$(FontSetup$, InStr(FontSetup$, ",") + 1)) + thisFile$ = UCASE$(LEFT$(FontSetup$, INSTR(FontSetup$, ",") - 1)) + thisSize% = VAL(MID$(FontSetup$, INSTR(FontSetup$, ",") + 1)) ResetList FontSizeList - For i = 8 To 120 - AddItem FontSizeList, LTrim$(Str$(i)) - Next - i = SelectItem(FontSizeList, LTrim$(Str$(thisSize%))) + FOR i = 8 TO 120 + AddItem FontSizeList, LTRIM$(STR$(i)) + NEXT + i = SelectItem(FontSizeList, LTRIM$(STR$(thisSize%))) - If Len(thisFile$) > 0 Then - For i = 1 To UBound(FontFile) - If UCase$(Right$(FontFile(i), Len(thisFile$))) = thisFile$ Then + IF LEN(thisFile$) > 0 THEN + FOR i = 1 TO UBOUND(FontFile) + IF UCASE$(RIGHT$(FontFile(i), LEN(thisFile$))) = thisFile$ THEN Control(FontList).Value = i BypassShowFontList = False AttemptToShowFontList = False - Exit Sub - End If - Next - Else - If thisSize% > 8 Then thisSize% = 16 Else thisSize% = 8 + EXIT SUB + END IF + NEXT + ELSE + IF thisSize% > 8 THEN thisSize% = 16 ELSE thisSize% = 8 ResetList FontSizeList AddItem FontSizeList, "8" AddItem FontSizeList, "16" - i = SelectItem(FontSizeList, LTrim$(Str$(thisSize%))) + i = SelectItem(FontSizeList, LTRIM$(STR$(thisSize%))) Control(FontList).Value = 1 'Built-in VGA font BypassShowFontList = False AttemptToShowFontList = False - Exit Sub - End If + EXIT SUB + END IF 'If this line is reached, the currently open form 'uses a non-system font. In that case we must 'disable the list. BypassShowFontList = True - If AttemptToShowFontList Then + IF AttemptToShowFontList THEN AttemptToShowFontList = False - i = MessageBox("The current font isn't a system font.\nReset this control to the built-in font?", "", MsgBox_YesNo + MsgBox_Question) - If i = MsgBox_Yes Then + i = _MESSAGEBOX(UiEditorTitle$, "The current font isn't a system font.\nReset this control to the built-in font?", "yesno", "question", 1) + IF i = 1 THEN thisFile$ = ",16" - thisFile$ = MKL$(Len(thisFile$)) + thisFile$ + thisFile$ = MKL$(LEN(thisFile$)) + thisFile$ SendData thisFile$, 8 BypassShowFontList = False ShowFontList = True - End If - End If -End Sub + END IF + END IF +END SUB -Sub LoseFocus - If __UI_TotalActiveMenus > 0 Then __UI_CloseAllMenus - If __UI_ActiveDropdownList > 0 Then __UI_DestroyControl Control(__UI_ActiveDropdownList) - If __UI_Focus > 0 Then __UI_FocusOut __UI_Focus +SUB LoseFocus + IF __UI_TotalActiveMenus > 0 THEN __UI_CloseAllMenus + IF __UI_ActiveDropdownList > 0 THEN __UI_DestroyControl Control(__UI_ActiveDropdownList) + IF __UI_Focus > 0 THEN __UI_FocusOut __UI_Focus __UI_Focus = 0 __UI_ForceRedraw = True -End Sub +END SUB -Sub __UI_BeforeUpdateDisplay - Dim b$ - Dim i As Long, j As Long, Answer As _Byte - Dim incomingData$, Signal$ - Dim thisData$, thisCommand$ - Static OriginalImageWidth As Integer, OriginalImageHeight As Integer - Static PrevFirstSelected As Long, PreviewHasMenuActive As Integer - Static ThisControlTurnsInto As Integer - Static LastChange As Single +SUB __UI_BeforeUpdateDisplay + DIM b$ + DIM i AS LONG, j AS LONG, Answer AS _BYTE + DIM incomingData$, Signal$ + DIM thisData$, thisCommand$ + STATIC OriginalImageWidth AS INTEGER, OriginalImageHeight AS INTEGER + STATIC PrevFirstSelected AS LONG, PreviewHasMenuActive AS INTEGER + STATIC ThisControlTurnsInto AS INTEGER + STATIC LastChange AS SINGLE - If Timer - BlinkStatusBar < 1 Then - If Timer - LastChange > .2 Then - If Control(StatusBar).BackColor = StatusBarBackColor Then + IF TIMER - BlinkStatusBar < 1 THEN + IF TIMER - LastChange > .2 THEN + IF Control(StatusBar).BackColor = StatusBarBackColor THEN Control(StatusBar).BackColor = _RGB32(222, 194, 127) - Else + ELSE Control(StatusBar).BackColor = StatusBarBackColor - End If + END IF Control(StatusBar).Redraw = True - LastChange = Timer - End If - Else + LastChange = TIMER + END IF + ELSE Control(StatusBar).BackColor = StatusBarBackColor Control(StatusBar).Redraw = True - End If + END IF - If __UI_BypassKeyCombos Then + IF __UI_BypassKeyCombos THEN 'Blink KeyCombo button - If Timer - LastChange > .4 Then - If Control(KeyboardComboBT).ForeColor = __UI_DefaultColor(__UI_Type_Button, 1) Then + IF TIMER - LastChange > .4 THEN + IF Control(KeyboardComboBT).ForeColor = __UI_DefaultColor(__UI_Type_Button, 1) THEN Control(KeyboardComboBT).ForeColor = _RGB32(255, 0, 0) - Else + ELSE Control(KeyboardComboBT).ForeColor = __UI_DefaultColor(__UI_Type_Button, 1) - End If + END IF Control(KeyboardComboBT).Redraw = True - LastChange = Timer - End If - Else + LastChange = TIMER + END IF + ELSE Control(KeyboardComboBT).ForeColor = __UI_DefaultColor(__UI_Type_Button, 1) Control(KeyboardComboBT).Redraw = True - End If + END IF - If OpenDialogOpen Then - If Len(RTrim$(LTrim$(Text(FileNameTextBox)))) = 0 Then + IF OpenDialogOpen THEN + IF LEN(RTRIM$(LTRIM$(Text(FileNameTextBox)))) = 0 THEN Control(OpenBT).Disabled = True Control(SaveBT).Disabled = True - Else + ELSE Control(OpenBT).Disabled = False Control(SaveBT).Disabled = False - End If - End If + END IF + END IF - If RecentListBuilt = False Then + IF RecentListBuilt = False THEN 'Build list of recent projects RecentListBuilt = True - For i = 1 To 9 - b$ = ReadSetting("InForm.ini", "Recent Projects", Str$(i)) - If Len(b$) Then + FOR i = 1 TO 9 + b$ = ReadSetting("InForm/InForm.ini", "Recent Projects", STR$(i)) + IF LEN(b$) THEN ToolTip(RecentMenuItem(i)) = b$ - If InStr(b$, PathSep$) > 0 Then - For j = Len(b$) To 1 Step -1 - If Mid$(b$, j, 1) = PathSep$ Then - SetCaption RecentMenuItem(i), "&" + LTrim$(Str$(i)) + " " + Mid$(b$, j + 1) - Exit For - End If - Next - Else - SetCaption RecentMenuItem(i), "&" + LTrim$(Str$(i)) + " " + b$ - End If + IF INSTR(b$, PathSep$) > 0 THEN + FOR j = LEN(b$) TO 1 STEP -1 + IF MID$(b$, j, 1) = PathSep$ THEN + SetCaption RecentMenuItem(i), "&" + LTRIM$(STR$(i)) + " " + MID$(b$, j + 1) + EXIT FOR + END IF + NEXT + ELSE + SetCaption RecentMenuItem(i), "&" + LTRIM$(STR$(i)) + " " + b$ + END IF Control(RecentMenuItem(i)).Disabled = False Control(RecentMenuItem(i)).Hidden = False - Else - If i = 1 Then + ELSE + IF i = 1 THEN SetCaption RecentMenuItem(i), "No recent projects" ToolTip(RecentMenuItem(i)) = "" Control(RecentMenuItem(i)).Disabled = True - Else + ELSE Control(RecentMenuItem(i)).Hidden = True - End If - End If - Next - End If + END IF + END IF + NEXT + END IF - If __UI_Focus = 0 Then - If Caption(StatusBar) = "" Then Caption(StatusBar) = "Ready." - End If + IF __UI_Focus = 0 THEN + IF Caption(StatusBar) = "" THEN Caption(StatusBar) = "Ready." + END IF IF __UI_MouseDownOnID = Red OR __UI_MouseDownOnID = Green OR __UI_MouseDownOnID = Blue OR _ __UI_PreviousMouseDownOnID = Red OR __UI_PreviousMouseDownOnID = Green OR __UI_PreviousMouseDownOnID = Blue THEN - Select Case __UI_MouseDownOnID + __UI_PreviousMouseDownOnID - Case Red - Text(RedValue) = LTrim$(Str$(Fix(Control(Red).Value))) - Case Green - Text(GreenValue) = LTrim$(Str$(Fix(Control(Green).Value))) - Case Blue - Text(BlueValue) = LTrim$(Str$(Fix(Control(Blue).Value))) - End Select + SELECT CASE __UI_MouseDownOnID + __UI_PreviousMouseDownOnID + CASE Red + Text(RedValue) = LTRIM$(STR$(FIX(Control(Red).Value))) + CASE Green + Text(GreenValue) = LTRIM$(STR$(FIX(Control(Green).Value))) + CASE Blue + Text(BlueValue) = LTRIM$(STR$(FIX(Control(Blue).Value))) + END SELECT 'Compose a new color and preview it - Dim NewColor As _Unsigned Long + DIM NewColor AS _UNSIGNED LONG NewColor = _RGB32(Control(Red).Value, Control(Green).Value, Control(Blue).Value) QuickColorPreview NewColor - End If + END IF 'Check if another instance was launched and is passing 'parameters: - Static BringToFront As _Byte, InstanceStream$ - If InstanceClient Then - If BringToFront = False Then - $If WIN Then - i = SetForegroundWindow&(_WindowHandle) - $End If + STATIC BringToFront AS _BYTE, InstanceStream$ + IF InstanceClient THEN + IF BringToFront = False THEN + $IF WIN THEN + i = SetForegroundWindow&(_WINDOWHANDLE) + $END IF BringToFront = True - End If + END IF - Get #InstanceClient, , incomingData$ + GET #InstanceClient, , incomingData$ InstanceStream$ = InstanceStream$ + incomingData$ - If InStr(InstanceStream$, "<END>") Then - If Left$(InstanceStream$, 12) = "NEWINSTANCE>" Then - InstanceStream$ = Mid$(InstanceStream$, 13) - InstanceStream$ = Left$(InstanceStream$, InStr(InstanceStream$, "<END>") - 1) - If _FileExists(InstanceStream$) Then + IF INSTR(InstanceStream$, "<END>") THEN + IF LEFT$(InstanceStream$, 12) = "NEWINSTANCE>" THEN + InstanceStream$ = MID$(InstanceStream$, 13) + InstanceStream$ = LEFT$(InstanceStream$, INSTR(InstanceStream$, "<END>") - 1) + IF _FILEEXISTS(InstanceStream$) THEN LoadNewInstanceForm: - If InStr(InstanceStream$, "/") > 0 Or InStr(InstanceStream$, "\") > 0 Then - For i = Len(InstanceStream$) To 1 Step -1 - If Asc(InstanceStream$, i) = 92 Or Asc(InstanceStream$, i) = 47 Then - CurrentPath$ = Left$(InstanceStream$, i - 1) - InstanceStream$ = Mid$(InstanceStream$, i + 1) - Exit For - End If - Next - End If + IF INSTR(InstanceStream$, "/") > 0 OR INSTR(InstanceStream$, "\") > 0 THEN + FOR i = LEN(InstanceStream$) TO 1 STEP -1 + IF ASC(InstanceStream$, i) = 92 OR ASC(InstanceStream$, i) = 47 THEN + CurrentPath$ = LEFT$(InstanceStream$, i - 1) + InstanceStream$ = MID$(InstanceStream$, i + 1) + EXIT FOR + END IF + NEXT + END IF - If Edited Then - $If WIN Then - Answer = MessageBox("Save the current form?", "", MsgBox_YesNoCancel + MsgBox_Question) - $Else - Answer = MessageBox("Save the current form?", "", MsgBox_YesNo + MsgBox_Question) - $End If - If Answer = MsgBox_Cancel Then - Close InstanceClient + IF Edited THEN + Answer = _MESSAGEBOX(UiEditorTitle$, "Save the current form?", "yesnocancle", "question", 1) + IF Answer = 0 THEN + CLOSE InstanceClient InstanceClient = 0 - Exit Sub - ElseIf Answer = MsgBox_Yes Then + EXIT SUB + ELSEIF Answer = 1 THEN SaveForm False, False - End If - End If + END IF + END IF Text(FileNameTextBox) = InstanceStream$ OpenDialogOpen = True __UI_Click OpenBT - End If - End If - Close InstanceClient + END IF + END IF + CLOSE InstanceClient InstanceClient = 0 - End If - Else - InstanceClient = _OpenConnection(InstanceHost) + END IF + ELSE + InstanceClient = _OPENCONNECTION(InstanceHost) BringToFront = False InstanceStream$ = "" - End If + END IF 'Check if a form file was dropped onto the Editor for loading - For i = 1 To _TotalDroppedFiles - If _FileExists(_DroppedFile(i)) Then - InstanceStream$ = _DroppedFile(i) - _FinishDrop - GoTo LoadNewInstanceForm - End If - Next + FOR i = 1 TO _TOTALDROPPEDFILES + IF _FILEEXISTS(_DROPPEDFILE(i)) THEN + InstanceStream$ = _DROPPEDFILE(i) + _FINISHDROP + GOTO LoadNewInstanceForm + END IF + NEXT CheckPreview - Get #Client, , incomingData$ + GET #Client, , incomingData$ Stream$ = Stream$ + incomingData$ 'STATIC bytesIn~&&, refreshes~& 'refreshes~& = refreshes~& + 1 'bytesIn~&& = bytesIn~&& + LEN(incomingData$) 'Caption(StatusBar) = "Received:" + STR$(bytesIn~&&) + " bytes | Sent:" + STR$(totalBytesSent) + " bytes" - $If WIN Then - If PreviewAttached Then - If prevScreenX <> _ScreenX Or prevScreenY <> _ScreenY Then - prevScreenX = _ScreenX - prevScreenY = _ScreenY - b$ = "WINDOWPOSITION>" + MKI$(_ScreenX) + MKI$(_ScreenY) + "<END>" + $IF WIN THEN + IF PreviewAttached THEN + IF prevScreenX <> _SCREENX OR prevScreenY <> _SCREENY THEN + prevScreenX = _SCREENX + prevScreenY = _SCREENY + b$ = "WINDOWPOSITION>" + MKI$(_SCREENX) + MKI$(_SCREENY) + "<END>" Send Client, b$ - End If - Else - If prevScreenX <> -32001 Or prevScreenY <> -32001 Then + END IF + ELSE + IF prevScreenX <> -32001 OR prevScreenY <> -32001 THEN prevScreenX = -32001 prevScreenY = -32001 b$ = "WINDOWPOSITION>" + MKI$(-32001) + MKI$(-32001) + "<END>" Send Client, b$ - End If - End If - $Else + END IF + END IF + $ELSE IF PreviewAttached = True THEN PreviewAttached = False SaveSettings END IF Control(ViewMenuPreviewDetach).Disabled = True Control(ViewMenuPreviewDetach).Value = False - $End If + $END IF - Static prevAutoName As _Byte, prevMouseSwap As _Byte - Static prevShowPos As _Byte, prevSnapLines As _Byte - Static prevShowInvisible As _Byte, SignalsFirstSent As _Byte + STATIC prevAutoName AS _BYTE, prevMouseSwap AS _BYTE + STATIC prevShowPos AS _BYTE, prevSnapLines AS _BYTE + STATIC prevShowInvisible AS _BYTE, SignalsFirstSent AS _BYTE - If prevAutoName <> AutoNameControls Or SignalsFirstSent = False Then + IF prevAutoName <> AutoNameControls OR SignalsFirstSent = False THEN prevAutoName = AutoNameControls b$ = "AUTONAME>" + MKI$(AutoNameControls) + "<END>" Send Client, b$ - End If + END IF - If prevMouseSwap <> __UI_MouseButtonsSwap Or SignalsFirstSent = False Then + IF prevMouseSwap <> __UI_MouseButtonsSwap OR SignalsFirstSent = False THEN prevMouseSwap = __UI_MouseButtonsSwap b$ = "MOUSESWAP>" + MKI$(__UI_MouseButtonsSwap) + "<END>" Send Client, b$ - End If + END IF - If prevShowPos <> __UI_ShowPositionAndSize Or SignalsFirstSent = False Then + IF prevShowPos <> __UI_ShowPositionAndSize OR SignalsFirstSent = False THEN prevShowPos = __UI_ShowPositionAndSize b$ = "SHOWPOSSIZE>" + MKI$(__UI_ShowPositionAndSize) + "<END>" Send Client, b$ - End If + END IF - If prevShowInvisible <> __UI_ShowInvisibleControls Or SignalsFirstSent = False Then + IF prevShowInvisible <> __UI_ShowInvisibleControls OR SignalsFirstSent = False THEN prevShowInvisible = __UI_ShowInvisibleControls b$ = "SHOWINVISIBLECONTROLS>" + MKI$(__UI_ShowInvisibleControls) + "<END>" Send Client, b$ - End If + END IF - If prevSnapLines <> __UI_SnapLines Or SignalsFirstSent = False Then + IF prevSnapLines <> __UI_SnapLines OR SignalsFirstSent = False THEN prevSnapLines = __UI_SnapLines b$ = "SNAPLINES>" + MKI$(__UI_SnapLines) + "<END>" Send Client, b$ - End If + END IF SignalsFirstSent = True - Do While InStr(Stream$, "<END>") > 0 - thisData$ = Left$(Stream$, InStr(Stream$, "<END>") - 1) - Stream$ = Mid$(Stream$, InStr(Stream$, "<END>") + 5) - thisCommand$ = Left$(thisData$, InStr(thisData$, ">") - 1) - thisData$ = Mid$(thisData$, Len(thisCommand$) + 2) - Select Case UCase$(thisCommand$) - Case "TOTALSELECTEDCONTROLS" + DO WHILE INSTR(Stream$, "<END>") > 0 + thisData$ = LEFT$(Stream$, INSTR(Stream$, "<END>") - 1) + Stream$ = MID$(Stream$, INSTR(Stream$, "<END>") + 5) + thisCommand$ = LEFT$(thisData$, INSTR(thisData$, ">") - 1) + thisData$ = MID$(thisData$, LEN(thisCommand$) + 2) + SELECT CASE UCASE$(thisCommand$) + CASE "TOTALSELECTEDCONTROLS" TotalSelected = CVL(thisData$) - If SetBindingDialogOpen Then + IF SetBindingDialogOpen THEN Caption(CancelBindBT) = "Cancel" __UI_Click CancelBindBT - End If - Case "FORMID" + END IF + CASE "FORMID" PreviewFormID = CVL(thisData$) - Case "FIRSTSELECTED" + CASE "FIRSTSELECTED" FirstSelected = CVL(thisData$) - If SetBindingDialogOpen Then + IF SetBindingDialogOpen THEN Caption(CancelBindBT) = "Cancel" __UI_Click CancelBindBT - End If - Case "DEFAULTBUTTONID" + END IF + CASE "DEFAULTBUTTONID" PreviewDefaultButtonID = CVL(thisData$) - Case "SHOWINVISIBLECONTROLS" + CASE "SHOWINVISIBLECONTROLS" __UI_ShowInvisibleControls = CVI(thisData$) Control(ViewMenuShowInvisibleControls).Value = __UI_ShowInvisibleControls - Case "CONTROLRENAMED" - If Len(InitialControlSet) Then - Dim insertionPoint As Long, endPoint - insertionPoint = InStr(InitialControlSet, Chr$(10) + Left$(thisData$, InStr(thisData$, Chr$(10)))) - If insertionPoint Then - endPoint = InStr(insertionPoint + 1, InitialControlSet, Chr$(10)) - InitialControlSet = Left$(InitialControlSet, endPoint - 1) + Chr$(11) + Mid$(thisData$, InStr(thisData$, Chr$(10)) + 1) + Mid$(InitialControlSet, endPoint) - Else + CASE "CONTROLRENAMED" + IF LEN(InitialControlSet) THEN + DIM insertionPoint AS LONG, endPoint + insertionPoint = INSTR(InitialControlSet, CHR$(10) + LEFT$(thisData$, INSTR(thisData$, CHR$(10)))) + IF insertionPoint THEN + endPoint = INSTR(insertionPoint + 1, InitialControlSet, CHR$(10)) + InitialControlSet = LEFT$(InitialControlSet, endPoint - 1) + CHR$(11) + MID$(thisData$, INSTR(thisData$, CHR$(10)) + 1) + MID$(InitialControlSet, endPoint) + ELSE 'not found... maybe renamed previously in this session? - insertionPoint = InStr(InitialControlSet, Chr$(11) + Left$(thisData$, InStr(thisData$, Chr$(10)) - 1) + Chr$(10)) - If insertionPoint Then - insertionPoint = InStr(insertionPoint, InitialControlSet, Chr$(11)) - endPoint = InStr(insertionPoint + 1, InitialControlSet, Chr$(10)) - InitialControlSet = Left$(InitialControlSet, insertionPoint) + Mid$(thisData$, InStr(thisData$, Chr$(10)) + 1) + Mid$(InitialControlSet, endPoint) - End If - End If - End If - Case "SHOWBINDCONTROLDIALOG" + insertionPoint = INSTR(InitialControlSet, CHR$(11) + LEFT$(thisData$, INSTR(thisData$, CHR$(10)) - 1) + CHR$(10)) + IF insertionPoint THEN + insertionPoint = INSTR(insertionPoint, InitialControlSet, CHR$(11)) + endPoint = INSTR(insertionPoint + 1, InitialControlSet, CHR$(10)) + InitialControlSet = LEFT$(InitialControlSet, insertionPoint) + MID$(thisData$, INSTR(thisData$, CHR$(10)) + 1) + MID$(InitialControlSet, endPoint) + END IF + END IF + END IF + CASE "SHOWBINDCONTROLDIALOG" __UI_Click EditMenuBindControls - Case "ORIGINALIMAGEWIDTH" + CASE "ORIGINALIMAGEWIDTH" OriginalImageWidth = CVI(thisData$) - Case "ORIGINALIMAGEHEIGHT" + CASE "ORIGINALIMAGEHEIGHT" OriginalImageHeight = CVI(thisData$) - Case "TURNSINTO" + CASE "TURNSINTO" ThisControlTurnsInto = CVI(thisData$) - Case "SELECTIONRECTANGLE" + CASE "SELECTIONRECTANGLE" PreviewSelectionRectangle = CVI(thisData$) LoseFocus - Case "MENUPANELACTIVE" + CASE "MENUPANELACTIVE" PreviewHasMenuActive = CVI(thisData$) - Case "SIGNAL" + CASE "SIGNAL" Signal$ = Signal$ + thisData$ - Case "FORMDATA" + CASE "FORMDATA" LastFormData$ = thisData$ LoadPreview - If Not FormDataReceived Then + IF NOT FormDataReceived THEN FormDataReceived = True - Else + ELSE Edited = True - If __UI_Focus > 0 Then - If PropertySent Then PropertySent = False Else LoseFocus - End If - End If - Case "UNDOPOINTER" + IF __UI_Focus > 0 THEN + IF PropertySent THEN PropertySent = False ELSE LoseFocus + END IF + END IF + CASE "UNDOPOINTER" UndoPointer = CVI(thisData$) - Case "TOTALUNDOIMAGES" + CASE "TOTALUNDOIMAGES" TotalUndoImages = CVI(thisData$) - End Select - Loop + END SELECT + LOOP - If Not FormDataReceived Then Exit Sub + IF NOT FormDataReceived THEN EXIT SUB - If InitialControlSet = "" Then - InitialControlSet = Chr$(1) - For i = 1 To UBound(PreviewControls) - If PreviewControls(i).ID > 0 And PreviewControls(i).Type <> __UI_Type_Font And PreviewControls(i).Type <> __UI_Type_MenuPanel Then - InitialControlSet = InitialControlSet + Chr$(10) + RTrim$(PreviewControls(i).Name) + Chr$(10) - End If - Next - End If + IF InitialControlSet = "" THEN + InitialControlSet = CHR$(1) + FOR i = 1 TO UBOUND(PreviewControls) + IF PreviewControls(i).ID > 0 AND PreviewControls(i).Type <> __UI_Type_Font AND PreviewControls(i).Type <> __UI_Type_MenuPanel THEN + InitialControlSet = InitialControlSet + CHR$(10) + RTRIM$(PreviewControls(i).Name) + CHR$(10) + END IF + NEXT + END IF Control(EditMenuRestoreDimensions).Disabled = True SetCaption EditMenuRestoreDimensions, "Restore &image dimensions" - If TotalSelected = 1 And PreviewControls(FirstSelected).Type = __UI_Type_PictureBox And OriginalImageWidth > 0 And OriginalImageHeight > 0 Then + IF TotalSelected = 1 AND PreviewControls(FirstSelected).Type = __UI_Type_PictureBox AND OriginalImageWidth > 0 AND OriginalImageHeight > 0 THEN IF PreviewControls(FirstSelected).Height - (PreviewControls(FirstSelected).BorderSize * ABS(PreviewControls(FirstSelected).HasBorder)) <> OriginalImageHeight OR _ PreviewControls(FirstSelected).Width - (PreviewControls(FirstSelected).BorderSize * ABS(PreviewControls(FirstSelected).HasBorder)) <> OriginalImageWidth THEN Control(EditMenuRestoreDimensions).Disabled = False - SetCaption EditMenuRestoreDimensions, "Restore &image dimensions (" + LTrim$(Str$(OriginalImageWidth)) + "x" + LTrim$(Str$(OriginalImageHeight)) + ")" - End If - End If + SetCaption EditMenuRestoreDimensions, "Restore &image dimensions (" + LTRIM$(STR$(OriginalImageWidth)) + "x" + LTRIM$(STR$(OriginalImageHeight)) + ")" + END IF + END IF - If ThisControlTurnsInto > 0 Then + IF ThisControlTurnsInto > 0 THEN Control(EditMenuConvertType).Disabled = False - SetCaption EditMenuConvertType, "Co&nvert to " + RTrim$(__UI_Type(ThisControlTurnsInto).Name) - ElseIf ThisControlTurnsInto = -1 Then + SetCaption EditMenuConvertType, "Co&nvert to " + RTRIM$(__UI_Type(ThisControlTurnsInto).Name) + ELSEIF ThisControlTurnsInto = -1 THEN 'Offer to turn text to numeric-only TextBox Control(EditMenuConvertType).Disabled = False SetCaption EditMenuConvertType, "Co&nvert to NumericTextBox" - ElseIf ThisControlTurnsInto = -2 Then + ELSEIF ThisControlTurnsInto = -2 THEN 'Offer to turn numeric-only to text TextBox Control(EditMenuConvertType).Disabled = False SetCaption EditMenuConvertType, "Co&nvert to TextBox" - Else + ELSE Control(EditMenuConvertType).Disabled = True SetCaption EditMenuConvertType, "Co&nvert type" - End If + END IF - Do While Len(Signal$) + DO WHILE LEN(Signal$) 'signals -1 and -3 deprecated for now - b$ = Left$(Signal$, 2) - Signal$ = Mid$(Signal$, 3) - If CVI(b$) = -2 Then + b$ = LEFT$(Signal$, 2) + Signal$ = MID$(Signal$, 3) + IF CVI(b$) = -2 THEN 'User attempted to right-click a control but the preview 'form is smaller than the menu panel. In such case the "Align" 'menu is shown in the editor. - If ZOrderingDialogOpen Then __UI_Click CloseZOrderingBT + IF ZOrderingDialogOpen THEN __UI_Click CloseZOrderingBT __UI_ActivateMenu Control(AlignMenu), False __UI_ForceRedraw = True - ElseIf CVI(b$) = -4 Then + ELSEIF CVI(b$) = -4 THEN 'User attempted to load an icon file that couldn't be previewed - Answer = MessageBox("Icon couldn't be previewed. Make sure it's a valid icon file.", "", MsgBox_OkOnly + MsgBox_Exclamation) - ElseIf CVI(b$) = -5 Then + _MESSAGEBOX UiEditorTitle$, "Icon couldn't be previewed. Make sure it's a valid icon file.", "warning" + ELSEIF CVI(b$) = -5 THEN 'Context menu was successfully shown on the preview - If __UI_TotalActiveMenus > 0 Then __UI_CloseAllMenus + IF __UI_TotalActiveMenus > 0 THEN __UI_CloseAllMenus __UI_Focus = 0 __UI_ForceRedraw = True - ElseIf CVI(b$) = -6 Then + ELSEIF CVI(b$) = -6 THEN 'User attempted to load an invalid icon file - Answer = MessageBox("Only .ico files are accepted.", "", MsgBox_OkOnly + MsgBox_Exclamation) - ElseIf CVI(b$) = -7 Then + _MESSAGEBOX UiEditorTitle$, "Only .ico files are accepted.", "warning" + ELSEIF CVI(b$) = -7 THEN 'A new empty form has just been created or a file has just finished loading from disk Edited = False - ElseIf CVI(b$) = -9 Then + ELSEIF CVI(b$) = -9 THEN 'User attempted to close the preview form __UI_Click FileMenuNew - Exit Sub - End If - Loop + EXIT SUB + END IF + LOOP - If PrevFirstSelected <> FirstSelected Then + IF PrevFirstSelected <> FirstSelected THEN LoseFocus PrevFirstSelected = FirstSelected __UI_ForceRedraw = True - If ZOrderingDialogOpen And FirstSelected <> PreviewFormID Then - For j = 1 To UBound(zOrderIDs) - If zOrderIDs(j) = FirstSelected Then Control(ControlList).Value = j: __UI_ValueChanged ControlList: Exit For - Next - End If - End If + IF ZOrderingDialogOpen AND FirstSelected <> PreviewFormID THEN + FOR j = 1 TO UBOUND(zOrderIDs) + IF zOrderIDs(j) = FirstSelected THEN Control(ControlList).Value = j: __UI_ValueChanged ControlList: EXIT FOR + NEXT + END IF + END IF - If Len(ThisFileName$) Then + IF LEN(ThisFileName$) THEN Caption(__UI_FormID) = UiEditorTitle$ + " - " + ThisFileName$ - Else - If Len(RTrim$(__UI_TrimAt0$(PreviewControls(PreviewFormID).Name))) > 0 Then + ELSE + IF LEN(RTRIM$(__UI_TrimAt0$(PreviewControls(PreviewFormID).Name))) > 0 THEN Caption(__UI_FormID) = UiEditorTitle$ + " - Untitled.frm" - End If - End If + END IF + END IF - If Edited Then - If Right$(Caption(__UI_FormID), 1) <> "*" Then Caption(__UI_FormID) = Caption(__UI_FormID) + "*" - End If + IF Edited THEN + IF RIGHT$(Caption(__UI_FormID), 1) <> "*" THEN Caption(__UI_FormID) = Caption(__UI_FormID) + "*" + END IF 'Ctrl+Z? Ctrl+Y? Control(EditMenuUndo).Disabled = True Control(EditMenuRedo).Disabled = True - If UndoPointer > 0 Then Control(EditMenuUndo).Disabled = False - If UndoPointer < TotalUndoImages Then Control(EditMenuRedo).Disabled = False + IF UndoPointer > 0 THEN Control(EditMenuUndo).Disabled = False + IF UndoPointer < TotalUndoImages THEN Control(EditMenuRedo).Disabled = False - If (__UI_KeyHit = Asc("z") Or __UI_KeyHit = Asc("Z")) And __UI_CtrlIsDown Then + IF (__UI_KeyHit = ASC("z") OR __UI_KeyHit = ASC("Z")) AND __UI_CtrlIsDown THEN SendSignal 214 - ElseIf (__UI_KeyHit = Asc("y") Or __UI_KeyHit = Asc("Y")) And __UI_CtrlIsDown Then + ELSEIF (__UI_KeyHit = ASC("y") OR __UI_KeyHit = ASC("Y")) AND __UI_CtrlIsDown THEN SendSignal 215 - End If + END IF 'Make ZOrdering menu enabled/disabled according to control list Control(EditMenuZOrdering).Disabled = True - For i = 1 To UBound(PreviewControls) - Select Case PreviewControls(i).Type - Case 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 18 + FOR i = 1 TO UBOUND(PreviewControls) + SELECT CASE PreviewControls(i).Type + CASE 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 18 j = j + 1 - If j > 1 Then + IF j > 1 THEN Control(EditMenuZOrdering).Disabled = False - Exit For - End If - End Select - Next + EXIT FOR + END IF + END SELECT + NEXT Control(EditMenuCP1252).Value = False Control(EditMenuCP437).Value = False Control(FontSwitchMenuSwitch).Value = ShowFontList - If BypassShowFontList Then + IF BypassShowFontList THEN Control(FontSwitchMenuSwitch).Disabled = True - Else + ELSE Control(FontSwitchMenuSwitch).Disabled = False - End If - Select Case PreviewControls(PreviewFormID).Encoding - Case 0, 437 + END IF + SELECT CASE PreviewControls(PreviewFormID).Encoding + CASE 0, 437 Control(EditMenuCP437).Value = True - Case 1252 + CASE 1252 Control(EditMenuCP1252).Value = True - End Select + END SELECT - If PreviewHasMenuActive Then + IF PreviewHasMenuActive THEN Control(InsertMenuMenuItem).Disabled = False - Else + ELSE Control(InsertMenuMenuItem).Disabled = True - End If + END IF Control(EditMenuSetDefaultButton).Disabled = True Control(EditMenuSetDefaultButton).Value = False Control(EditMenuBindControls).Disabled = True Control(EditMenuAllowMinMax).Disabled = True Control(EditMenuAllowMinMax).Value = False - If InStr(LCase$(PreviewControls(PreviewFormID).Name), "form") = 0 Then + IF INSTR(LCASE$(PreviewControls(PreviewFormID).Name), "form") = 0 THEN Caption(ControlProperties) = "Control properties (Form):" - Else + ELSE Caption(ControlProperties) = "Control properties:" - End If + END IF Caption(AlignMenuAlignCenterV) = "Center Vertically (group)" Caption(AlignMenuAlignCenterH) = "Center Horizontally (group)-" Control(EditMenuPaste).Disabled = True - If Left$(_Clipboard$, Len(__UI_ClipboardCheck$)) = __UI_ClipboardCheck$ Then + IF LEFT$(_CLIPBOARD$, LEN(__UI_ClipboardCheck$)) = __UI_ClipboardCheck$ THEN Control(EditMenuPaste).Disabled = False - End If + END IF - If TotalSelected = 0 Then + IF TotalSelected = 0 THEN FirstSelected = PreviewFormID Control(EditMenuCut).Disabled = True @@ -1725,55 +1705,55 @@ Sub __UI_BeforeUpdateDisplay Control(AlignMenuDistributeV).Disabled = True Control(AlignMenuDistributeH).Disabled = True - ElseIf TotalSelected = 1 Then - If FirstSelected > 0 And FirstSelected <= UBound(PreviewControls) Then + ELSEIF TotalSelected = 1 THEN + IF FirstSelected > 0 AND FirstSelected <= UBOUND(PreviewControls) THEN Control(EditMenuCut).Disabled = False Control(EditMenuCopy).Disabled = False Control(EditMenuDelete).Disabled = False - If InStr(LCase$(PreviewControls(FirstSelected).Name), LCase$(RTrim$(__UI_Type(PreviewControls(FirstSelected).Type).Name))) = 0 Then - Caption(ControlProperties) = "Control properties (Type = " + RTrim$(__UI_Type(PreviewControls(FirstSelected).Type).Name) + "):" - Else + IF INSTR(LCASE$(PreviewControls(FirstSelected).Name), LCASE$(RTRIM$(__UI_Type(PreviewControls(FirstSelected).Type).Name))) = 0 THEN + Caption(ControlProperties) = "Control properties (Type = " + RTRIM$(__UI_Type(PreviewControls(FirstSelected).Type).Name) + "):" + ELSE Caption(ControlProperties) = "Control properties:" - End If + END IF Control(AlignMenuAlignLeft).Disabled = True Control(AlignMenuAlignRight).Disabled = True Control(AlignMenuAlignTops).Disabled = True Control(AlignMenuAlignBottoms).Disabled = True - If PreviewControls(FirstSelected).Type <> __UI_Type_MenuBar And PreviewControls(FirstSelected).Type <> __UI_Type_MenuItem Then + IF PreviewControls(FirstSelected).Type <> __UI_Type_MenuBar AND PreviewControls(FirstSelected).Type <> __UI_Type_MenuItem THEN Control(AlignMenuAlignCenterV).Disabled = False Control(AlignMenuAlignCenterH).Disabled = False Caption(AlignMenuAlignCenterV) = "Center Vertically" Caption(AlignMenuAlignCenterH) = "Center Horizontally-" - Else + ELSE Control(AlignMenuAlignCenterV).Disabled = True Control(AlignMenuAlignCenterH).Disabled = True - End If + END IF Control(AlignMenuAlignCentersV).Disabled = True Control(AlignMenuAlignCentersH).Disabled = True Control(AlignMenuDistributeV).Disabled = True Control(AlignMenuDistributeH).Disabled = True - If PreviewControls(FirstSelected).Type = __UI_Type_Button Then + IF PreviewControls(FirstSelected).Type = __UI_Type_Button THEN Control(EditMenuSetDefaultButton).Disabled = False - If PreviewDefaultButtonID <> FirstSelected Then + IF PreviewDefaultButtonID <> FirstSelected THEN Control(EditMenuSetDefaultButton).Value = False - Else + ELSE Control(EditMenuSetDefaultButton).Value = True - End If - ElseIf PreviewControls(FirstSelected).Type = __UI_Type_TextBox Then - If PreviewControls(FirstSelected).NumericOnly = True Then + END IF + ELSEIF PreviewControls(FirstSelected).Type = __UI_Type_TextBox THEN + IF PreviewControls(FirstSelected).NumericOnly = True THEN Control(EditMenuAllowMinMax).Disabled = False Control(EditMenuAllowMinMax).Value = False - If InStr(PreviewControls(FirstSelected).Name, "NumericTextBox") = 0 Then Caption(ControlProperties) = "Control properties (Type = NumericTextBox):" - ElseIf PreviewControls(FirstSelected).NumericOnly = __UI_NumericWithBounds Then + IF INSTR(PreviewControls(FirstSelected).Name, "NumericTextBox") = 0 THEN Caption(ControlProperties) = "Control properties (Type = NumericTextBox):" + ELSEIF PreviewControls(FirstSelected).NumericOnly = __UI_NumericWithBounds THEN Control(EditMenuAllowMinMax).Disabled = False Control(EditMenuAllowMinMax).Value = True - If InStr(PreviewControls(FirstSelected).Name, "NumericTextBox") = 0 Then Caption(ControlProperties) = "Control properties (Type = NumericTextBox):" - End If - End If - End If - ElseIf TotalSelected = 2 Then + IF INSTR(PreviewControls(FirstSelected).Name, "NumericTextBox") = 0 THEN Caption(ControlProperties) = "Control properties (Type = NumericTextBox):" + END IF + END IF + END IF + ELSEIF TotalSelected = 2 THEN Control(EditMenuBindControls).Disabled = False Caption(ControlProperties) = "Control properties: (multiple selection)" @@ -1792,7 +1772,7 @@ Sub __UI_BeforeUpdateDisplay Control(AlignMenuAlignCentersH).Disabled = False Control(AlignMenuDistributeV).Disabled = True Control(AlignMenuDistributeH).Disabled = True - Else + ELSE SetCaption ControlProperties, "Control properties: (multiple selection)" Control(EditMenuCut).Disabled = False @@ -1809,340 +1789,340 @@ Sub __UI_BeforeUpdateDisplay Control(AlignMenuAlignCentersH).Disabled = False Control(AlignMenuDistributeV).Disabled = False Control(AlignMenuDistributeH).Disabled = False - End If + END IF - If FirstSelected = 0 Then FirstSelected = PreviewFormID + IF FirstSelected = 0 THEN FirstSelected = PreviewFormID - For i = 1 To UBound(InputBox) + FOR i = 1 TO UBOUND(InputBox) Control(InputBox(i).ID).Disabled = False Control(InputBox(i).ID).Hidden = False Control(InputBox(i).LabelID).Hidden = False - If __UI_Focus = InputBox(i).ID Then + IF __UI_Focus = InputBox(i).ID THEN Control(InputBox(i).ID).Height = 22 Control(InputBox(i).ID).BorderColor = _RGB32(0, 0, 0) Control(InputBox(i).ID).BorderSize = 2 - Else + ELSE Control(InputBox(i).ID).Height = 23 Control(InputBox(i).ID).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) Control(InputBox(i).ID).BorderSize = 1 - End If - Next + END IF + NEXT Control(FontSizeList).Hidden = True - For i = 1 To UBound(Toggles) + FOR i = 1 TO UBOUND(Toggles) Control(Toggles(i)).Disabled = True Control(Toggles(i)).Hidden = False - Next + NEXT - Dim ShadeOfGreen As _Unsigned Long, ShadeOfRed As _Unsigned Long + DIM ShadeOfGreen AS _UNSIGNED LONG, ShadeOfRed AS _UNSIGNED LONG ShadeOfGreen = _RGB32(28, 150, 50) ShadeOfRed = _RGB32(233, 44, 0) - Const PropertyUpdateDelay = .1 + CONST PropertyUpdateDelay = .1 - If FirstSelected > 0 Then - Dim ThisInputBox As Long + IF FirstSelected > 0 THEN + DIM ThisInputBox AS LONG ThisInputBox = GetInputBoxFromID(__UI_Focus) - If __UI_Focus <> NameTB Or (__UI_Focus = NameTB And RevertEdit = True) Then - Text(NameTB) = RTrim$(PreviewControls(FirstSelected).Name) - If (__UI_Focus = NameTB And RevertEdit = True) Then RevertEdit = False: SelectPropertyFully __UI_Focus - ElseIf __UI_Focus = NameTB Then - If PropertyFullySelected(NameTB) Then - If Text(NameTB) = RTrim$(PreviewControls(FirstSelected).Name) Then + IF __UI_Focus <> NameTB OR (__UI_Focus = NameTB AND RevertEdit = True) THEN + Text(NameTB) = RTRIM$(PreviewControls(FirstSelected).Name) + IF (__UI_Focus = NameTB AND RevertEdit = True) THEN RevertEdit = False: SelectPropertyFully __UI_Focus + ELSEIF __UI_Focus = NameTB THEN + IF PropertyFullySelected(NameTB) THEN + IF Text(NameTB) = RTRIM$(PreviewControls(FirstSelected).Name) THEN Control(__UI_Focus).BorderColor = ShadeOfGreen - Else - If Timer - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay Then + ELSE + IF TIMER - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay THEN Control(__UI_Focus).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) - Else + ELSE Control(__UI_Focus).BorderColor = ShadeOfRed - End If - End If - End If - End If - If __UI_Focus <> CaptionTB Or (__UI_Focus = CaptionTB And RevertEdit = True) Then - Text(CaptionTB) = Replace(__UI_TrimAt0$(PreviewCaptions(FirstSelected)), Chr$(10), "\n", False, 0) - If (__UI_Focus = CaptionTB And RevertEdit = True) Then RevertEdit = False: SelectPropertyFully __UI_Focus - ElseIf __UI_Focus = CaptionTB Then - If PropertyFullySelected(CaptionTB) Then - If Text(CaptionTB) = Replace(__UI_TrimAt0$(PreviewCaptions(FirstSelected)), Chr$(10), "\n", False, 0) Then + END IF + END IF + END IF + END IF + IF __UI_Focus <> CaptionTB OR (__UI_Focus = CaptionTB AND RevertEdit = True) THEN + Text(CaptionTB) = Replace(__UI_TrimAt0$(PreviewCaptions(FirstSelected)), CHR$(10), "\n", False, 0) + IF (__UI_Focus = CaptionTB AND RevertEdit = True) THEN RevertEdit = False: SelectPropertyFully __UI_Focus + ELSEIF __UI_Focus = CaptionTB THEN + IF PropertyFullySelected(CaptionTB) THEN + IF Text(CaptionTB) = Replace(__UI_TrimAt0$(PreviewCaptions(FirstSelected)), CHR$(10), "\n", False, 0) THEN Control(__UI_Focus).BorderColor = ShadeOfGreen - Else - If Timer - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay Then + ELSE + IF TIMER - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay THEN Control(__UI_Focus).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) - Else + ELSE Control(__UI_Focus).BorderColor = ShadeOfRed - End If - End If - End If - End If - If __UI_Focus <> TextTB Or (__UI_Focus = TextTB And RevertEdit = True) Then - If PreviewControls(FirstSelected).Type = __UI_Type_ListBox Or PreviewControls(FirstSelected).Type = __UI_Type_DropdownList Then - Text(TextTB) = Replace(PreviewTexts(FirstSelected), Chr$(10), "\n", False, 0) - Else + END IF + END IF + END IF + END IF + IF __UI_Focus <> TextTB OR (__UI_Focus = TextTB AND RevertEdit = True) THEN + IF PreviewControls(FirstSelected).Type = __UI_Type_ListBox OR PreviewControls(FirstSelected).Type = __UI_Type_DropdownList THEN + Text(TextTB) = Replace(PreviewTexts(FirstSelected), CHR$(10), "\n", False, 0) + ELSE Text(TextTB) = PreviewTexts(FirstSelected) - If Len(PreviewMasks(FirstSelected)) > 0 And PreviewControls(FirstSelected).Type = __UI_Type_TextBox Then + IF LEN(PreviewMasks(FirstSelected)) > 0 AND PreviewControls(FirstSelected).Type = __UI_Type_TextBox THEN Mask(TextTB) = PreviewMasks(FirstSelected) - Else + ELSE Mask(TextTB) = "" - End If - End If - If (__UI_Focus = TextTB And RevertEdit = True) Then RevertEdit = False: SelectPropertyFully __UI_Focus - ElseIf __UI_Focus = TextTB Then + END IF + END IF + IF (__UI_Focus = TextTB AND RevertEdit = True) THEN RevertEdit = False: SelectPropertyFully __UI_Focus + ELSEIF __UI_Focus = TextTB THEN Control(TextTB).NumericOnly = PreviewControls(FirstSelected).NumericOnly - If PropertyFullySelected(TextTB) Then + IF PropertyFullySelected(TextTB) THEN IF ((PreviewControls(FirstSelected).Type = __UI_Type_ListBox OR PreviewControls(FirstSelected).Type = __UI_Type_DropdownList) AND Text(TextTB) = Replace(PreviewTexts(FirstSelected), CHR$(13), "\n", False, 0)) OR _ ((PreviewControls(FirstSelected).Type <> __UI_Type_ListBox AND PreviewControls(FirstSelected).Type <> __UI_Type_DropdownList) AND Text(TextTB) = PreviewTexts(FirstSelected)) THEN Control(__UI_Focus).BorderColor = ShadeOfGreen - Else - If Timer - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay Then + ELSE + IF TIMER - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay THEN Control(__UI_Focus).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) - Else + ELSE Control(__UI_Focus).BorderColor = ShadeOfRed - End If - End If - End If - End If - If __UI_Focus <> MaskTB Or (__UI_Focus = MaskTB And RevertEdit = True) Then + END IF + END IF + END IF + END IF + IF __UI_Focus <> MaskTB OR (__UI_Focus = MaskTB AND RevertEdit = True) THEN Text(MaskTB) = PreviewMasks(FirstSelected) - If (__UI_Focus = MaskTB And RevertEdit = True) Then RevertEdit = False: SelectPropertyFully __UI_Focus - ElseIf __UI_Focus = MaskTB Then - If PropertyFullySelected(MaskTB) Then - If Text(MaskTB) = PreviewMasks(FirstSelected) Then + IF (__UI_Focus = MaskTB AND RevertEdit = True) THEN RevertEdit = False: SelectPropertyFully __UI_Focus + ELSEIF __UI_Focus = MaskTB THEN + IF PropertyFullySelected(MaskTB) THEN + IF Text(MaskTB) = PreviewMasks(FirstSelected) THEN Control(__UI_Focus).BorderColor = ShadeOfGreen - Else - If Timer - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay Then + ELSE + IF TIMER - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay THEN Control(__UI_Focus).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) - Else + ELSE Control(__UI_Focus).BorderColor = ShadeOfRed - End If - End If - End If - End If - If __UI_Focus <> TopTB Or (__UI_Focus = TopTB And RevertEdit = True) Then - Text(TopTB) = LTrim$(Str$(PreviewControls(FirstSelected).Top)) - If (__UI_Focus = TopTB And RevertEdit = True) Then RevertEdit = False: SelectPropertyFully __UI_Focus - ElseIf __UI_Focus = TopTB Then - If PropertyFullySelected(TopTB) Then - If Text(TopTB) = LTrim$(Str$(PreviewControls(FirstSelected).Top)) Then + END IF + END IF + END IF + END IF + IF __UI_Focus <> TopTB OR (__UI_Focus = TopTB AND RevertEdit = True) THEN + Text(TopTB) = LTRIM$(STR$(PreviewControls(FirstSelected).Top)) + IF (__UI_Focus = TopTB AND RevertEdit = True) THEN RevertEdit = False: SelectPropertyFully __UI_Focus + ELSEIF __UI_Focus = TopTB THEN + IF PropertyFullySelected(TopTB) THEN + IF Text(TopTB) = LTRIM$(STR$(PreviewControls(FirstSelected).Top)) THEN Control(__UI_Focus).BorderColor = ShadeOfGreen - Else - If Timer - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay Then + ELSE + IF TIMER - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay THEN Control(__UI_Focus).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) - Else + ELSE Control(__UI_Focus).BorderColor = ShadeOfRed - End If - End If - End If - End If - If __UI_Focus <> LeftTB Or (__UI_Focus = LeftTB And RevertEdit = True) Then - Text(LeftTB) = LTrim$(Str$(PreviewControls(FirstSelected).Left)) - If (__UI_Focus = LeftTB And RevertEdit = True) Then RevertEdit = False: SelectPropertyFully __UI_Focus - ElseIf __UI_Focus = LeftTB Then - If PropertyFullySelected(LeftTB) Then - If Text(LeftTB) = LTrim$(Str$(PreviewControls(FirstSelected).Left)) Then + END IF + END IF + END IF + END IF + IF __UI_Focus <> LeftTB OR (__UI_Focus = LeftTB AND RevertEdit = True) THEN + Text(LeftTB) = LTRIM$(STR$(PreviewControls(FirstSelected).Left)) + IF (__UI_Focus = LeftTB AND RevertEdit = True) THEN RevertEdit = False: SelectPropertyFully __UI_Focus + ELSEIF __UI_Focus = LeftTB THEN + IF PropertyFullySelected(LeftTB) THEN + IF Text(LeftTB) = LTRIM$(STR$(PreviewControls(FirstSelected).Left)) THEN Control(__UI_Focus).BorderColor = ShadeOfGreen - Else - If Timer - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay Then + ELSE + IF TIMER - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay THEN Control(__UI_Focus).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) - Else + ELSE Control(__UI_Focus).BorderColor = ShadeOfRed - End If - End If - End If - End If - If __UI_Focus <> WidthTB Or (__UI_Focus = WidthTB And RevertEdit = True) Then - Text(WidthTB) = LTrim$(Str$(PreviewControls(FirstSelected).Width)) - If (__UI_Focus = WidthTB And RevertEdit = True) Then RevertEdit = False: SelectPropertyFully __UI_Focus - ElseIf __UI_Focus = WidthTB Then - If PropertyFullySelected(WidthTB) Then - If Text(WidthTB) = LTrim$(Str$(PreviewControls(FirstSelected).Width)) Then + END IF + END IF + END IF + END IF + IF __UI_Focus <> WidthTB OR (__UI_Focus = WidthTB AND RevertEdit = True) THEN + Text(WidthTB) = LTRIM$(STR$(PreviewControls(FirstSelected).Width)) + IF (__UI_Focus = WidthTB AND RevertEdit = True) THEN RevertEdit = False: SelectPropertyFully __UI_Focus + ELSEIF __UI_Focus = WidthTB THEN + IF PropertyFullySelected(WidthTB) THEN + IF Text(WidthTB) = LTRIM$(STR$(PreviewControls(FirstSelected).Width)) THEN Control(__UI_Focus).BorderColor = ShadeOfGreen - Else - If Timer - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay Then + ELSE + IF TIMER - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay THEN Control(__UI_Focus).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) - Else + ELSE Control(__UI_Focus).BorderColor = ShadeOfRed - End If - End If - End If - End If - If __UI_Focus <> HeightTB Or (__UI_Focus = HeightTB And RevertEdit = True) Then - Text(HeightTB) = LTrim$(Str$(PreviewControls(FirstSelected).Height)) - If (__UI_Focus = HeightTB And RevertEdit = True) Then RevertEdit = False: SelectPropertyFully __UI_Focus - ElseIf __UI_Focus = HeightTB Then - If PropertyFullySelected(HeightTB) Then - If Text(HeightTB) = LTrim$(Str$(PreviewControls(FirstSelected).Height)) Then + END IF + END IF + END IF + END IF + IF __UI_Focus <> HeightTB OR (__UI_Focus = HeightTB AND RevertEdit = True) THEN + Text(HeightTB) = LTRIM$(STR$(PreviewControls(FirstSelected).Height)) + IF (__UI_Focus = HeightTB AND RevertEdit = True) THEN RevertEdit = False: SelectPropertyFully __UI_Focus + ELSEIF __UI_Focus = HeightTB THEN + IF PropertyFullySelected(HeightTB) THEN + IF Text(HeightTB) = LTRIM$(STR$(PreviewControls(FirstSelected).Height)) THEN Control(__UI_Focus).BorderColor = ShadeOfGreen - Else - If Timer - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay Then + ELSE + IF TIMER - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay THEN Control(__UI_Focus).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) - Else + ELSE Control(__UI_Focus).BorderColor = ShadeOfRed - End If - End If - End If - End If - If __UI_Focus <> FontTB Or (__UI_Focus = FontTB And RevertEdit = True) Then - If Len(PreviewFonts(FirstSelected)) > 0 Then + END IF + END IF + END IF + END IF + IF __UI_Focus <> FontTB OR (__UI_Focus = FontTB AND RevertEdit = True) THEN + IF LEN(PreviewFonts(FirstSelected)) > 0 THEN Text(FontTB) = PreviewFonts(FirstSelected) - Else + ELSE Text(FontTB) = PreviewFonts(PreviewFormID) - End If - If (__UI_Focus = FontTB And RevertEdit = True) Then RevertEdit = False: SelectPropertyFully __UI_Focus - ElseIf __UI_Focus = FontTB Then - If PropertyFullySelected(FontTB) Then - If Text(FontTB) = PreviewFonts(FirstSelected) Or Text(FontTB) = PreviewFonts(PreviewFormID) Then + END IF + IF (__UI_Focus = FontTB AND RevertEdit = True) THEN RevertEdit = False: SelectPropertyFully __UI_Focus + ELSEIF __UI_Focus = FontTB THEN + IF PropertyFullySelected(FontTB) THEN + IF Text(FontTB) = PreviewFonts(FirstSelected) OR Text(FontTB) = PreviewFonts(PreviewFormID) THEN Control(__UI_Focus).BorderColor = ShadeOfGreen - Else - If Timer - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay Then + ELSE + IF TIMER - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay THEN Control(__UI_Focus).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) - Else + ELSE Control(__UI_Focus).BorderColor = ShadeOfRed - End If - End If - End If - End If - If Len(PreviewFonts(FirstSelected)) > 0 Then + END IF + END IF + END IF + END IF + IF LEN(PreviewFonts(FirstSelected)) > 0 THEN SelectFontInList PreviewActualFonts(FirstSelected) - Else + ELSE SelectFontInList PreviewActualFonts(PreviewFormID) - End If - If __UI_Focus <> TooltipTB Or (__UI_Focus = TooltipTB And RevertEdit = True) Then - Text(TooltipTB) = Replace(PreviewTips(FirstSelected), Chr$(10), "\n", False, 0) - If (__UI_Focus = TooltipTB And RevertEdit = True) Then RevertEdit = False: SelectPropertyFully __UI_Focus - ElseIf __UI_Focus = TooltipTB Then - If PropertyFullySelected(FontTB) Then - If Text(TooltipTB) = Replace(PreviewTips(FirstSelected), Chr$(10), "\n", False, 0) Then + END IF + IF __UI_Focus <> TooltipTB OR (__UI_Focus = TooltipTB AND RevertEdit = True) THEN + Text(TooltipTB) = Replace(PreviewTips(FirstSelected), CHR$(10), "\n", False, 0) + IF (__UI_Focus = TooltipTB AND RevertEdit = True) THEN RevertEdit = False: SelectPropertyFully __UI_Focus + ELSEIF __UI_Focus = TooltipTB THEN + IF PropertyFullySelected(FontTB) THEN + IF Text(TooltipTB) = Replace(PreviewTips(FirstSelected), CHR$(10), "\n", False, 0) THEN Control(__UI_Focus).BorderColor = ShadeOfGreen - Else - If Timer - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay Then + ELSE + IF TIMER - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay THEN Control(__UI_Focus).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) - Else + ELSE Control(__UI_Focus).BorderColor = ShadeOfRed - End If - End If - End If - End If - If __UI_Focus <> ValueTB Or (__UI_Focus = ValueTB And RevertEdit = True) Then - Text(ValueTB) = LTrim$(Str$(PreviewControls(FirstSelected).Value)) - If (__UI_Focus = ValueTB And RevertEdit = True) Then RevertEdit = False: SelectPropertyFully __UI_Focus - ElseIf __UI_Focus = ValueTB Then - If PropertyFullySelected(ValueTB) Then - If Text(ValueTB) = LTrim$(Str$(PreviewControls(FirstSelected).Value)) Then + END IF + END IF + END IF + END IF + IF __UI_Focus <> ValueTB OR (__UI_Focus = ValueTB AND RevertEdit = True) THEN + Text(ValueTB) = LTRIM$(STR$(PreviewControls(FirstSelected).Value)) + IF (__UI_Focus = ValueTB AND RevertEdit = True) THEN RevertEdit = False: SelectPropertyFully __UI_Focus + ELSEIF __UI_Focus = ValueTB THEN + IF PropertyFullySelected(ValueTB) THEN + IF Text(ValueTB) = LTRIM$(STR$(PreviewControls(FirstSelected).Value)) THEN Control(__UI_Focus).BorderColor = ShadeOfGreen - Else - If Timer - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay Then + ELSE + IF TIMER - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay THEN Control(__UI_Focus).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) - Else + ELSE Control(__UI_Focus).BorderColor = ShadeOfRed - End If - End If - End If - End If - If __UI_Focus <> MinTB Or (__UI_Focus = MinTB And RevertEdit = True) Then - Text(MinTB) = LTrim$(Str$(PreviewControls(FirstSelected).Min)) - If (__UI_Focus = MinTB And RevertEdit = True) Then RevertEdit = False: SelectPropertyFully __UI_Focus - ElseIf __UI_Focus = MinTB Then - If PropertyFullySelected(MinTB) Then - If Text(MinTB) = LTrim$(Str$(PreviewControls(FirstSelected).Min)) Then + END IF + END IF + END IF + END IF + IF __UI_Focus <> MinTB OR (__UI_Focus = MinTB AND RevertEdit = True) THEN + Text(MinTB) = LTRIM$(STR$(PreviewControls(FirstSelected).Min)) + IF (__UI_Focus = MinTB AND RevertEdit = True) THEN RevertEdit = False: SelectPropertyFully __UI_Focus + ELSEIF __UI_Focus = MinTB THEN + IF PropertyFullySelected(MinTB) THEN + IF Text(MinTB) = LTRIM$(STR$(PreviewControls(FirstSelected).Min)) THEN Control(__UI_Focus).BorderColor = ShadeOfGreen - Else - If Timer - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay Then + ELSE + IF TIMER - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay THEN Control(__UI_Focus).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) - Else + ELSE Control(__UI_Focus).BorderColor = ShadeOfRed - End If - End If - End If - End If - If __UI_Focus <> MaxTB Or (__UI_Focus = MaxTB And RevertEdit = True) Then - Text(MaxTB) = LTrim$(Str$(PreviewControls(FirstSelected).Max)) - If (__UI_Focus = MaxTB And RevertEdit = True) Then RevertEdit = False: SelectPropertyFully __UI_Focus - ElseIf __UI_Focus = MaxTB Then - If PropertyFullySelected(MaxTB) Then - If Text(MaxTB) = LTrim$(Str$(PreviewControls(FirstSelected).Max)) Then + END IF + END IF + END IF + END IF + IF __UI_Focus <> MaxTB OR (__UI_Focus = MaxTB AND RevertEdit = True) THEN + Text(MaxTB) = LTRIM$(STR$(PreviewControls(FirstSelected).Max)) + IF (__UI_Focus = MaxTB AND RevertEdit = True) THEN RevertEdit = False: SelectPropertyFully __UI_Focus + ELSEIF __UI_Focus = MaxTB THEN + IF PropertyFullySelected(MaxTB) THEN + IF Text(MaxTB) = LTRIM$(STR$(PreviewControls(FirstSelected).Max)) THEN Control(__UI_Focus).BorderColor = ShadeOfGreen - Else - If Timer - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay Then + ELSE + IF TIMER - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay THEN Control(__UI_Focus).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) - Else + ELSE Control(__UI_Focus).BorderColor = ShadeOfRed - End If - End If - End If - End If - If __UI_Focus <> IntervalTB Or (__UI_Focus = IntervalTB And RevertEdit = True) Then - Text(IntervalTB) = LTrim$(Str$(PreviewControls(FirstSelected).Interval)) - If (__UI_Focus = IntervalTB And RevertEdit = True) Then RevertEdit = False: SelectPropertyFully __UI_Focus - ElseIf __UI_Focus = IntervalTB Then - If PropertyFullySelected(IntervalTB) Then - If Text(IntervalTB) = LTrim$(Str$(PreviewControls(FirstSelected).Interval)) Then + END IF + END IF + END IF + END IF + IF __UI_Focus <> IntervalTB OR (__UI_Focus = IntervalTB AND RevertEdit = True) THEN + Text(IntervalTB) = LTRIM$(STR$(PreviewControls(FirstSelected).Interval)) + IF (__UI_Focus = IntervalTB AND RevertEdit = True) THEN RevertEdit = False: SelectPropertyFully __UI_Focus + ELSEIF __UI_Focus = IntervalTB THEN + IF PropertyFullySelected(IntervalTB) THEN + IF Text(IntervalTB) = LTRIM$(STR$(PreviewControls(FirstSelected).Interval)) THEN Control(__UI_Focus).BorderColor = ShadeOfGreen - Else - If Timer - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay Then + ELSE + IF TIMER - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay THEN Control(__UI_Focus).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) - Else + ELSE Control(__UI_Focus).BorderColor = ShadeOfRed - End If - End If - End If - End If - If __UI_Focus <> MinIntervalTB Or (__UI_Focus = MinIntervalTB And RevertEdit = True) Then - Text(MinIntervalTB) = LTrim$(Str$(PreviewControls(FirstSelected).MinInterval)) - ElseIf __UI_Focus = MinIntervalTB Then - If PropertyFullySelected(MinIntervalTB) Then - If Text(MinIntervalTB) = LTrim$(Str$(PreviewControls(FirstSelected).MinInterval)) Then + END IF + END IF + END IF + END IF + IF __UI_Focus <> MinIntervalTB OR (__UI_Focus = MinIntervalTB AND RevertEdit = True) THEN + Text(MinIntervalTB) = LTRIM$(STR$(PreviewControls(FirstSelected).MinInterval)) + ELSEIF __UI_Focus = MinIntervalTB THEN + IF PropertyFullySelected(MinIntervalTB) THEN + IF Text(MinIntervalTB) = LTRIM$(STR$(PreviewControls(FirstSelected).MinInterval)) THEN Control(__UI_Focus).BorderColor = ShadeOfGreen - Else - If Timer - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay Then + ELSE + IF TIMER - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay THEN Control(__UI_Focus).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) - Else + ELSE Control(__UI_Focus).BorderColor = ShadeOfRed - End If - End If - End If - End If - If __UI_Focus <> PaddingTB Or (__UI_Focus = PaddingTB And RevertEdit = True) Then - Text(PaddingTB) = LTrim$(Str$(PreviewControls(FirstSelected).Padding)) - If (__UI_Focus = PaddingTB And RevertEdit = True) Then RevertEdit = False: SelectPropertyFully __UI_Focus - ElseIf __UI_Focus = PaddingTB Then - If PropertyFullySelected(PaddingTB) Then - If Text(PaddingTB) = LTrim$(Str$(PreviewControls(FirstSelected).Padding)) Then + END IF + END IF + END IF + END IF + IF __UI_Focus <> PaddingTB OR (__UI_Focus = PaddingTB AND RevertEdit = True) THEN + Text(PaddingTB) = LTRIM$(STR$(PreviewControls(FirstSelected).Padding)) + IF (__UI_Focus = PaddingTB AND RevertEdit = True) THEN RevertEdit = False: SelectPropertyFully __UI_Focus + ELSEIF __UI_Focus = PaddingTB THEN + IF PropertyFullySelected(PaddingTB) THEN + IF Text(PaddingTB) = LTRIM$(STR$(PreviewControls(FirstSelected).Padding)) THEN Control(__UI_Focus).BorderColor = ShadeOfGreen - Else - If Timer - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay Then + ELSE + IF TIMER - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay THEN Control(__UI_Focus).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) - Else + ELSE Control(__UI_Focus).BorderColor = ShadeOfRed - End If - End If - End If - End If - If __UI_Focus <> SizeTB Or (__UI_Focus = SizeTB And RevertEdit = True) Then - Text(SizeTB) = LTrim$(Str$(PreviewControls(FirstSelected).BorderSize)) - If (__UI_Focus = SizeTB And RevertEdit = True) Then RevertEdit = False: SelectPropertyFully __UI_Focus - ElseIf __UI_Focus = SizeTB Then - If PropertyFullySelected(SizeTB) Then - If Text(SizeTB) = LTrim$(Str$(PreviewControls(FirstSelected).BorderSize)) Then + END IF + END IF + END IF + END IF + IF __UI_Focus <> SizeTB OR (__UI_Focus = SizeTB AND RevertEdit = True) THEN + Text(SizeTB) = LTRIM$(STR$(PreviewControls(FirstSelected).BorderSize)) + IF (__UI_Focus = SizeTB AND RevertEdit = True) THEN RevertEdit = False: SelectPropertyFully __UI_Focus + ELSEIF __UI_Focus = SizeTB THEN + IF PropertyFullySelected(SizeTB) THEN + IF Text(SizeTB) = LTRIM$(STR$(PreviewControls(FirstSelected).BorderSize)) THEN Control(__UI_Focus).BorderColor = ShadeOfGreen - Else - If Timer - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay Then + ELSE + IF TIMER - InputBox(ThisInputBox).LastEdited < PropertyUpdateDelay THEN Control(__UI_Focus).BorderColor = __UI_DefaultColor(__UI_Type_TextBox, 5) - Else + ELSE Control(__UI_Focus).BorderColor = ShadeOfRed - End If - End If - End If - End If - End If + END IF + END IF + END IF + END IF + END IF Control(TextTB).Max = 0 Control(TextTB).Min = 0 - If PreviewControls(FirstSelected).Type = __UI_Type_TextBox And __UI_Focus = TextTB Then + IF PreviewControls(FirstSelected).Type = __UI_Type_TextBox AND __UI_Focus = TextTB THEN Control(TextTB).Max = PreviewControls(FirstSelected).Max Control(TextTB).Min = PreviewControls(FirstSelected).Min - End If + END IF 'Update checkboxes: Control(Stretch).Value = PreviewControls(FirstSelected).Stretch @@ -2155,7 +2135,7 @@ Sub __UI_BeforeUpdateDisplay Control(Hidden).Value = PreviewControls(FirstSelected).Hidden Control(CenteredWindow).Value = PreviewControls(FirstSelected).CenteredWindow Control(PasswordMaskCB).Value = PreviewControls(FirstSelected).PasswordField - Control(BooleanOptions).Value = Abs(PreviewControls(FirstSelected).Value <> 0) + 1 + Control(BooleanOptions).Value = ABS(PreviewControls(FirstSelected).Value <> 0) + 1 Control(AlignOptions).Value = PreviewControls(FirstSelected).Align + 1 Control(VAlignOptions).Value = PreviewControls(FirstSelected).VAlign + 1 Control(BulletOptions).Value = PreviewControls(FirstSelected).BulletStyle + 1 @@ -2166,30 +2146,30 @@ Sub __UI_BeforeUpdateDisplay Control(HideTicks).Value = (PreviewControls(FirstSelected).Height = __UI_Type(__UI_Type_TrackBar).MinimumHeight) Control(AutoPlayGif).Value = PreviewAutoPlayGif(FirstSelected) - If Len(PreviewContextMenu(FirstSelected)) Then - Dim ItemFound As _Byte + IF LEN(PreviewContextMenu(FirstSelected)) THEN + DIM ItemFound AS _BYTE ItemFound = SelectItem(ContextMenuControlsList, PreviewContextMenu(FirstSelected)) - Else + ELSE Control(ContextMenuControlsList).Value = 1 - End If - If __UI_BypassKeyCombos = False Then - If TotalSelected = 1 And Len(PreviewKeyCombos(FirstSelected)) Then + END IF + IF __UI_BypassKeyCombos = False THEN + IF TotalSelected = 1 AND LEN(PreviewKeyCombos(FirstSelected)) THEN Caption(KeyboardComboBT) = PreviewKeyCombos(FirstSelected) - Else + ELSE Caption(KeyboardComboBT) = "Click to assign" - End If - End If + END IF + END IF - Static ShowInvalidValueWarning As _Byte - If Control(__UI_Focus).BorderColor = ShadeOfRed Then - If ShowInvalidValueWarning = False Then + STATIC ShowInvalidValueWarning AS _BYTE + IF Control(__UI_Focus).BorderColor = ShadeOfRed THEN + IF ShowInvalidValueWarning = False THEN ShowInvalidValueWarning = True Caption(StatusBar) = "Invalid value; ESC for previous or adjusted value" - BlinkStatusBar = Timer - End If - Else + BlinkStatusBar = TIMER + END IF + ELSE ShowInvalidValueWarning = False - End If + END IF 'Disable properties that don't apply Control(AlignOptions).Disabled = True @@ -2201,9 +2181,9 @@ Sub __UI_BeforeUpdateDisplay Caption(MaxLB) = "Max" Control(SizeTB).Disabled = True Control(SizeTB).Hidden = True - If TotalSelected > 0 Then - Select EveryCase PreviewControls(FirstSelected).Type - Case __UI_Type_ToggleSwitch + IF TotalSelected > 0 THEN + SELECT EVERYCASE PreviewControls(FirstSelected).Type + CASE __UI_Type_ToggleSwitch Control(CanHaveFocus).Disabled = False Control(Disabled).Disabled = False Control(Hidden).Disabled = False @@ -2218,519 +2198,514 @@ Sub __UI_BeforeUpdateDisplay Control(MinIntervalTB).Disabled = True Control(PaddingTB).Disabled = True Control(BulletOptions).Disabled = True - Case __UI_Type_MenuBar, __UI_Type_MenuItem + CASE __UI_Type_MenuBar, __UI_Type_MenuItem Control(Disabled).Disabled = False Control(Hidden).Disabled = False - Case __UI_Type_MenuBar + CASE __UI_Type_MenuBar 'Check if this is the last menu bar item so that Align options can be enabled - For i = UBound(PreviewControls) To 1 Step -1 - If PreviewControls(i).ID > 0 And PreviewControls(i).Type = __UI_Type_MenuBar Then - Exit For - End If - Next - If i = FirstSelected Then + FOR i = UBOUND(PreviewControls) TO 1 STEP -1 + IF PreviewControls(i).ID > 0 AND PreviewControls(i).Type = __UI_Type_MenuBar THEN + EXIT FOR + END IF + NEXT + IF i = FirstSelected THEN Control(AlignOptions).Disabled = False - End If + END IF - For i = 1 To UBound(InputBox) - Select Case InputBox(i).ID - Case NameTB, CaptionTB, TooltipTB, AlignOptions + FOR i = 1 TO UBOUND(InputBox) + SELECT CASE InputBox(i).ID + CASE NameTB, CaptionTB, TooltipTB, AlignOptions Control(InputBox(i).ID).Disabled = False - Case Else + CASE ELSE Control(InputBox(i).ID).Disabled = True - End Select - Next - Case __UI_Type_ContextMenu - For i = 1 To UBound(InputBox) - Select Case InputBox(i).ID - Case NameTB + END SELECT + NEXT + CASE __UI_Type_ContextMenu + FOR i = 1 TO UBOUND(InputBox) + SELECT CASE InputBox(i).ID + CASE NameTB Control(InputBox(i).ID).Disabled = False - Case Else + CASE ELSE Control(InputBox(i).ID).Disabled = True - End Select - Next - Case __UI_Type_MenuItem - For i = 1 To UBound(InputBox) - Select Case InputBox(i).ID - Case NameTB, CaptionTB, TextTB, TooltipTB, BulletOptions, BooleanOptions, KeyboardComboBT + END SELECT + NEXT + CASE __UI_Type_MenuItem + FOR i = 1 TO UBOUND(InputBox) + SELECT CASE InputBox(i).ID + CASE NameTB, CaptionTB, TextTB, TooltipTB, BulletOptions, BooleanOptions, KeyboardComboBT Control(InputBox(i).ID).Disabled = False - Case Else + CASE ELSE Control(InputBox(i).ID).Disabled = True - End Select - Next - Case __UI_Type_PictureBox + END SELECT + NEXT + CASE __UI_Type_PictureBox Caption(TextLB) = "Image file" Control(AlignOptions).Disabled = False Control(VAlignOptions).Disabled = False Control(Stretch).Disabled = False Control(Transparent).Disabled = False - If PreviewAnimatedGif(FirstSelected) Then + IF PreviewAnimatedGif(FirstSelected) THEN Control(AutoPlayGif).Disabled = False - End If - For i = 1 To UBound(InputBox) - Select Case InputBox(i).ID - Case NameTB, TextTB, TopTB, LeftTB, WidthTB, HeightTB, TooltipTB, AlignOptions, VAlignOptions + END IF + FOR i = 1 TO UBOUND(InputBox) + SELECT CASE InputBox(i).ID + CASE NameTB, TextTB, TopTB, LeftTB, WidthTB, HeightTB, TooltipTB, AlignOptions, VAlignOptions Control(InputBox(i).ID).Disabled = False - Case Else + CASE ELSE Control(InputBox(i).ID).Disabled = True - End Select - Next - Case __UI_Type_Label + END SELECT + NEXT + CASE __UI_Type_Label Control(Transparent).Disabled = False Control(AutoSize).Disabled = False - For i = 1 To UBound(InputBox) - Select Case InputBox(i).ID - Case NameTB, CaptionTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, PaddingTB, AlignOptions, VAlignOptions, FontList + FOR i = 1 TO UBOUND(InputBox) + SELECT CASE InputBox(i).ID + CASE NameTB, CaptionTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, PaddingTB, AlignOptions, VAlignOptions, FontList Control(InputBox(i).ID).Disabled = False - Case Else + CASE ELSE Control(InputBox(i).ID).Disabled = True - End Select - Next - Case __UI_Type_Frame + END SELECT + NEXT + CASE __UI_Type_Frame Control(Transparent).Disabled = True - For i = 1 To UBound(InputBox) - Select Case InputBox(i).ID - Case NameTB, CaptionTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, FontList + FOR i = 1 TO UBOUND(InputBox) + SELECT CASE InputBox(i).ID + CASE NameTB, CaptionTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, FontList Control(InputBox(i).ID).Disabled = False - Case Else + CASE ELSE Control(InputBox(i).ID).Disabled = True - End Select - Next - Case __UI_Type_TextBox - Static PreviousNumericState As _Byte + END SELECT + NEXT + CASE __UI_Type_TextBox + STATIC PreviousNumericState AS _BYTE Control(Transparent).Disabled = False Control(PasswordMaskCB).Disabled = (PreviewControls(FirstSelected).NumericOnly <> False) - If PreviousNumericState <> PreviewControls(FirstSelected).NumericOnly Then + IF PreviousNumericState <> PreviewControls(FirstSelected).NumericOnly THEN PreviousNumericState = PreviewControls(FirstSelected).NumericOnly __UI_ForceRedraw = True - End If - If PreviewControls(FirstSelected).NumericOnly = True Then - For i = 1 To UBound(InputBox) - Select Case InputBox(i).ID - Case ValueTB, MinTB, MaxTB, MaskTB, IntervalTB, PaddingTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions, KeyboardComboBT + END IF + IF PreviewControls(FirstSelected).NumericOnly = True THEN + FOR i = 1 TO UBOUND(InputBox) + SELECT CASE InputBox(i).ID + CASE ValueTB, MinTB, MaxTB, MaskTB, IntervalTB, PaddingTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions, KeyboardComboBT Control(InputBox(i).ID).Disabled = True - Case Else + CASE ELSE Control(InputBox(i).ID).Disabled = False - End Select - Next - ElseIf PreviewControls(FirstSelected).NumericOnly = __UI_NumericWithBounds Then - For i = 1 To UBound(InputBox) - Select Case InputBox(i).ID - Case ValueTB, MaskTB, IntervalTB, PaddingTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions, KeyboardComboBT + END SELECT + NEXT + ELSEIF PreviewControls(FirstSelected).NumericOnly = __UI_NumericWithBounds THEN + FOR i = 1 TO UBOUND(InputBox) + SELECT CASE InputBox(i).ID + CASE ValueTB, MaskTB, IntervalTB, PaddingTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions, KeyboardComboBT Control(InputBox(i).ID).Disabled = True - Case Else + CASE ELSE Control(InputBox(i).ID).Disabled = False - End Select - Next - Else + END SELECT + NEXT + ELSE Caption(MaxLB) = "Max length" - For i = 1 To UBound(InputBox) - Select Case InputBox(i).ID - Case ValueTB, MinTB, IntervalTB, PaddingTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions, KeyboardComboBT + FOR i = 1 TO UBOUND(InputBox) + SELECT CASE InputBox(i).ID + CASE ValueTB, MinTB, IntervalTB, PaddingTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions, KeyboardComboBT Control(InputBox(i).ID).Disabled = True - Case Else + CASE ELSE Control(InputBox(i).ID).Disabled = False - End Select - Next - End If - Case __UI_Type_Button, __UI_Type_MenuItem + END SELECT + NEXT + END IF + CASE __UI_Type_Button, __UI_Type_MenuItem Caption(TextLB) = "Image file" - Case __UI_Type_Button - For i = 1 To UBound(InputBox) - Select Case InputBox(i).ID - Case ValueTB, MinTB, MaxTB, IntervalTB, PaddingTB, MaskTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions + CASE __UI_Type_Button + FOR i = 1 TO UBOUND(InputBox) + SELECT CASE InputBox(i).ID + CASE ValueTB, MinTB, MaxTB, IntervalTB, PaddingTB, MaskTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions Control(InputBox(i).ID).Disabled = True - Case Else + CASE ELSE Control(InputBox(i).ID).Disabled = False - End Select - Next - Case __UI_Type_CheckBox, __UI_Type_RadioButton + END SELECT + NEXT + CASE __UI_Type_CheckBox, __UI_Type_RadioButton Control(Transparent).Disabled = False - For i = 1 To UBound(InputBox) - Select Case InputBox(i).ID - Case TextTB, MinTB, MaxTB, IntervalTB, PaddingTB, MaskTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, ValueTB + FOR i = 1 TO UBOUND(InputBox) + SELECT CASE InputBox(i).ID + CASE TextTB, MinTB, MaxTB, IntervalTB, PaddingTB, MaskTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, ValueTB Control(InputBox(i).ID).Disabled = True - Case Else + CASE ELSE Control(InputBox(i).ID).Disabled = False - End Select - Next - Case __UI_Type_ToggleSwitch + END SELECT + NEXT + CASE __UI_Type_ToggleSwitch Control(Transparent).Disabled = True - For i = 1 To UBound(InputBox) - Select Case InputBox(i).ID - Case WidthTB, HeightTB, TextTB, MinTB, MaxTB, IntervalTB, PaddingTB, MaskTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, ValueTB, FontTB, FontList + FOR i = 1 TO UBOUND(InputBox) + SELECT CASE InputBox(i).ID + CASE WidthTB, HeightTB, TextTB, MinTB, MaxTB, IntervalTB, PaddingTB, MaskTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, ValueTB, FontTB, FontList Control(InputBox(i).ID).Disabled = True - Case Else + CASE ELSE Control(InputBox(i).ID).Disabled = False - End Select - Next - Case __UI_Type_ProgressBar - For i = 1 To UBound(InputBox) - Select Case InputBox(i).ID - Case TextTB, IntervalTB, PaddingTB, MaskTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions, KeyboardComboBT + END SELECT + NEXT + CASE __UI_Type_ProgressBar + FOR i = 1 TO UBOUND(InputBox) + SELECT CASE InputBox(i).ID + CASE TextTB, IntervalTB, PaddingTB, MaskTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions, KeyboardComboBT Control(InputBox(i).ID).Disabled = True - Case Else + CASE ELSE Control(InputBox(i).ID).Disabled = False - End Select - Next - Case __UI_Type_TrackBar + END SELECT + NEXT + CASE __UI_Type_TrackBar Control(HideTicks).Disabled = False - For i = 1 To UBound(InputBox) - Select Case InputBox(i).ID - Case CaptionTB, TextTB, FontTB, PaddingTB, MaskTB, AlignOptions, VAlignOptions, BulletOptions, BooleanOptions, FontList, KeyboardComboBT + FOR i = 1 TO UBOUND(InputBox) + SELECT CASE InputBox(i).ID + CASE CaptionTB, TextTB, FontTB, PaddingTB, MaskTB, AlignOptions, VAlignOptions, BulletOptions, BooleanOptions, FontList, KeyboardComboBT Control(InputBox(i).ID).Disabled = True - Case Else + CASE ELSE Control(InputBox(i).ID).Disabled = False - End Select - Next - Case __UI_Type_ListBox, __UI_Type_DropdownList + END SELECT + NEXT + CASE __UI_Type_ListBox, __UI_Type_DropdownList Caption(TextLB) = "List items" Caption(ValueLB) = "Selected item" Control(Transparent).Disabled = False - For i = 1 To UBound(InputBox) - Select Case InputBox(i).ID - Case CaptionTB, MinTB, MaxTB, IntervalTB, PaddingTB, MaskTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions, KeyboardComboBT + FOR i = 1 TO UBOUND(InputBox) + SELECT CASE InputBox(i).ID + CASE CaptionTB, MinTB, MaxTB, IntervalTB, PaddingTB, MaskTB, AlignOptions, VAlignOptions, MinIntervalTB, BulletOptions, BooleanOptions, KeyboardComboBT Control(InputBox(i).ID).Disabled = True - Case Else + CASE ELSE Control(InputBox(i).ID).Disabled = False - End Select - Next - Case __UI_Type_ListBox + END SELECT + NEXT + CASE __UI_Type_ListBox Control(AutoScroll).Disabled = False - Case __UI_Type_Frame, __UI_Type_Label, __UI_Type_TextBox, __UI_Type_ListBox, __UI_Type_DropdownList, __UI_Type_PictureBox + CASE __UI_Type_Frame, __UI_Type_Label, __UI_Type_TextBox, __UI_Type_ListBox, __UI_Type_DropdownList, __UI_Type_PictureBox Control(HasBorder).Disabled = False - Case __UI_Type_ProgressBar + CASE __UI_Type_ProgressBar Control(ShowPercentage).Disabled = False - Case __UI_Type_Label + CASE __UI_Type_Label Control(WordWrap).Disabled = False - Case __UI_Type_Button, __UI_Type_CheckBox, __UI_Type_RadioButton, __UI_Type_TextBox, __UI_Type_ListBox, __UI_Type_DropdownList, __UI_Type_TrackBar + CASE __UI_Type_Button, __UI_Type_CheckBox, __UI_Type_RadioButton, __UI_Type_TextBox, __UI_Type_ListBox, __UI_Type_DropdownList, __UI_Type_TrackBar Control(CanHaveFocus).Disabled = False - Case __UI_Type_Button, __UI_Type_CheckBox, __UI_Type_RadioButton, __UI_Type_TextBox, __UI_Type_ListBox, __UI_Type_DropdownList, __UI_Type_TrackBar, __UI_Type_Label, __UI_Type_ProgressBar + CASE __UI_Type_Button, __UI_Type_CheckBox, __UI_Type_RadioButton, __UI_Type_TextBox, __UI_Type_ListBox, __UI_Type_DropdownList, __UI_Type_TrackBar, __UI_Type_Label, __UI_Type_ProgressBar Control(Disabled).Disabled = False - Case __UI_Type_Frame, __UI_Type_Button, __UI_Type_CheckBox, __UI_Type_RadioButton, __UI_Type_TextBox, __UI_Type_ListBox, __UI_Type_DropdownList, __UI_Type_TrackBar, __UI_Type_Label, __UI_Type_ProgressBar, __UI_Type_PictureBox + CASE __UI_Type_Frame, __UI_Type_Button, __UI_Type_CheckBox, __UI_Type_RadioButton, __UI_Type_TextBox, __UI_Type_ListBox, __UI_Type_DropdownList, __UI_Type_TrackBar, __UI_Type_Label, __UI_Type_ProgressBar, __UI_Type_PictureBox Control(Hidden).Disabled = False - Case __UI_Type_Label + CASE __UI_Type_Label Control(AlignOptions).Disabled = False Control(VAlignOptions).Disabled = False - End Select - Else + END SELECT + ELSE 'Properties relative to the form Control(CenteredWindow).Disabled = False Control(Resizable).Disabled = False Control(AddGifExtensionToggle).Disabled = False Caption(TextLB) = "Icon file" - For i = 1 To UBound(InputBox) - Select Case InputBox(i).ID - Case NameTB, CaptionTB, TextTB, WidthTB, HeightTB, FontTB, FontList + FOR i = 1 TO UBOUND(InputBox) + SELECT CASE InputBox(i).ID + CASE NameTB, CaptionTB, TextTB, WidthTB, HeightTB, FontTB, FontList Control(InputBox(i).ID).Disabled = False - Case Else + CASE ELSE Control(InputBox(i).ID).Disabled = True - End Select - Next - End If + END SELECT + NEXT + END IF - If TotalSelected > 1 Then Control(NameTB).Disabled = True + IF TotalSelected > 1 THEN Control(NameTB).Disabled = True - If HasFontList And (ShowFontList = True And BypassShowFontList = False) Then + IF HasFontList AND (ShowFontList = True AND BypassShowFontList = False) THEN Control(FontTB).Disabled = True - Else + ELSE Control(FontList).Disabled = True - End If + END IF IF PreviewControls(FirstSelected).Type = __UI_Type_ContextMenu OR _ PreviewControls(FirstSelected).Type = __UI_Type_MenuBar OR _ PreviewControls(FirstSelected).Type = __UI_Type_MenuItem THEN Control(ContextMenuControlsList).Disabled = True - Else + ELSE Control(ContextMenuControlsList).Disabled = False - End If + END IF - Dim LastTopForInputBox As Integer + DIM LastTopForInputBox AS INTEGER LastTopForInputBox = -12 - Const TopIncrementForInputBox = 22 - For i = 1 To UBound(InputBox) + CONST TopIncrementForInputBox = 22 + FOR i = 1 TO UBOUND(InputBox) 'Exception for SizeTB: - If InputBox(i).ID = SizeTB Then _Continue + IF InputBox(i).ID = SizeTB THEN _CONTINUE - If Control(InputBox(i).ID).Disabled Then + IF Control(InputBox(i).ID).Disabled THEN Control(InputBox(i).ID).Hidden = True Control(InputBox(i).LabelID).Hidden = True - Else + ELSE LastTopForInputBox = LastTopForInputBox + TopIncrementForInputBox Control(InputBox(i).ID).Top = LastTopForInputBox Control(InputBox(i).LabelID).Top = LastTopForInputBox - End If - Next + END IF + NEXT LastTopForInputBox = -12 - For i = 1 To UBound(Toggles) - If Control(Toggles(i)).Disabled Then + FOR i = 1 TO UBOUND(Toggles) + IF Control(Toggles(i)).Disabled THEN Control(Toggles(i)).Hidden = True - Else + ELSE LastTopForInputBox = LastTopForInputBox + TopIncrementForInputBox Control(Toggles(i)).Top = LastTopForInputBox - End If - Next + END IF + NEXT 'Custom cases - Control(AutoPlayGif).Disabled = Not Control(AddGifExtensionToggle).Value + Control(AutoPlayGif).Disabled = NOT Control(AddGifExtensionToggle).Value Control(AutoSize).Disabled = Control(WordWrap).Value - If Control(HasBorder).Value = True And PreviewControls(FirstSelected).Type <> __UI_Type_Frame Then + IF Control(HasBorder).Value = True AND PreviewControls(FirstSelected).Type <> __UI_Type_Frame THEN Control(SizeTB).Disabled = False Control(SizeTB).Hidden = False Control(SizeTB).Height = 22 Control(SizeTB).Top = Control(HasBorder).Top Caption(HasBorder) = "Has border Size" - End If + END IF Control(FontSizeList).Disabled = Control(FontList).Disabled Control(FontSizeList).Hidden = Control(FontList).Hidden Control(FontSizeList).Top = Control(FontList).Top Control(PasteListBT).Hidden = True - If PreviewControls(FirstSelected).Type = __UI_Type_ListBox Or PreviewControls(FirstSelected).Type = __UI_Type_DropdownList Then - If InStr(_Clipboard$, Chr$(10)) Then + IF PreviewControls(FirstSelected).Type = __UI_Type_ListBox OR PreviewControls(FirstSelected).Type = __UI_Type_DropdownList THEN + IF INSTR(_CLIPBOARD$, CHR$(10)) THEN Control(PasteListBT).Top = Control(TextTB).Top Control(PasteListBT).Hidden = False - End If - ElseIf (PreviewControls(FirstSelected).Type = __UI_Type_Label And PreviewControls(FirstSelected).WordWrap = True) Then - If InStr(_Clipboard$, Chr$(10)) Then + END IF + ELSEIF (PreviewControls(FirstSelected).Type = __UI_Type_Label AND PreviewControls(FirstSelected).WordWrap = True) THEN + IF INSTR(_CLIPBOARD$, CHR$(10)) THEN Control(PasteListBT).Top = Control(CaptionTB).Top Control(PasteListBT).Hidden = False - End If - End If + END IF + END IF 'Update the color mixer - Dim ThisColor As _Unsigned Long, ThisBackColor As _Unsigned Long + DIM ThisColor AS _UNSIGNED LONG, ThisBackColor AS _UNSIGNED LONG - Select EveryCase Control(ColorPropertiesList).Value - Case 0 + SELECT EVERYCASE Control(ColorPropertiesList).Value + CASE 0 Control(ColorPropertiesList).Value = 1 - Case Is > 5 + CASE IS > 5 Control(ColorPropertiesList).Value = 5 - Case 1, 2 'ForeColor, BackColor + CASE 1, 2 'ForeColor, BackColor ThisColor = PreviewControls(FirstSelected).ForeColor - If ThisColor = 0 Then ThisColor = PreviewControls(PreviewFormID).ForeColor - If ThisColor = 0 Then ThisColor = __UI_DefaultColor(__UI_Type_Form, 1) + IF ThisColor = 0 THEN ThisColor = PreviewControls(PreviewFormID).ForeColor + IF ThisColor = 0 THEN ThisColor = __UI_DefaultColor(__UI_Type_Form, 1) ThisBackColor = PreviewControls(FirstSelected).BackColor - If ThisBackColor = 0 Then ThisBackColor = PreviewControls(PreviewFormID).BackColor - If ThisBackColor = 0 Then ThisBackColor = __UI_DefaultColor(__UI_Type_Form, 2) - Case 3, 4 'SelectedForeColor, SelectedBackColor + IF ThisBackColor = 0 THEN ThisBackColor = PreviewControls(PreviewFormID).BackColor + IF ThisBackColor = 0 THEN ThisBackColor = __UI_DefaultColor(__UI_Type_Form, 2) + CASE 3, 4 'SelectedForeColor, SelectedBackColor ThisColor = PreviewControls(FirstSelected).SelectedForeColor - If ThisColor = 0 Then ThisColor = PreviewControls(PreviewFormID).SelectedForeColor - If ThisColor = 0 Then ThisColor = __UI_DefaultColor(__UI_Type_Form, 3) + IF ThisColor = 0 THEN ThisColor = PreviewControls(PreviewFormID).SelectedForeColor + IF ThisColor = 0 THEN ThisColor = __UI_DefaultColor(__UI_Type_Form, 3) ThisBackColor = PreviewControls(FirstSelected).SelectedBackColor - If ThisBackColor = 0 Then ThisBackColor = PreviewControls(PreviewFormID).SelectedBackColor - If ThisBackColor = 0 Then ThisBackColor = __UI_DefaultColor(__UI_Type_Form, 4) - Case 5 'BorderColor + IF ThisBackColor = 0 THEN ThisBackColor = PreviewControls(PreviewFormID).SelectedBackColor + IF ThisBackColor = 0 THEN ThisBackColor = __UI_DefaultColor(__UI_Type_Form, 4) + CASE 5 'BorderColor ThisColor = PreviewControls(FirstSelected).BorderColor - If ThisColor = 0 Then ThisColor = PreviewControls(PreviewFormID).BorderColor - If ThisColor = 0 Then ThisColor = __UI_DefaultColor(__UI_Type_Form, 5) + IF ThisColor = 0 THEN ThisColor = PreviewControls(PreviewFormID).BorderColor + IF ThisColor = 0 THEN ThisColor = __UI_DefaultColor(__UI_Type_Form, 5) ThisBackColor = PreviewControls(FirstSelected).BackColor - If ThisBackColor = 0 Then ThisBackColor = PreviewControls(PreviewFormID).BackColor - If ThisBackColor = 0 Then ThisBackColor = __UI_DefaultColor(__UI_Type_Form, 2) - Case 1, 3, 5 - If __UI_Focus <> Red And __UI_Focus <> RedValue Then - Control(Red).Value = _Red32(ThisColor) - Text(RedValue) = LTrim$(Str$(Control(Red).Value)) - End If - If __UI_Focus <> Green And __UI_Focus <> GreenValue Then - Control(Green).Value = _Green32(ThisColor) - Text(GreenValue) = LTrim$(Str$(Control(Green).Value)) - End If - If __UI_Focus <> Blue And __UI_Focus <> BlueValue Then - Control(Blue).Value = _Blue32(ThisColor) - Text(BlueValue) = LTrim$(Str$(Control(Blue).Value)) - End If - Case 2, 4 - If __UI_Focus <> Red And __UI_Focus <> RedValue Then - Control(Red).Value = _Red32(ThisBackColor) - Text(RedValue) = LTrim$(Str$(Control(Red).Value)) - End If - If __UI_Focus <> Green And __UI_Focus <> GreenValue Then - Control(Green).Value = _Green32(ThisBackColor) - Text(GreenValue) = LTrim$(Str$(Control(Green).Value)) - End If - If __UI_Focus <> Blue And __UI_Focus <> BlueValue Then - Control(Blue).Value = _Blue32(ThisBackColor) - Text(BlueValue) = LTrim$(Str$(Control(Blue).Value)) - End If - End Select + IF ThisBackColor = 0 THEN ThisBackColor = PreviewControls(PreviewFormID).BackColor + IF ThisBackColor = 0 THEN ThisBackColor = __UI_DefaultColor(__UI_Type_Form, 2) + CASE 1, 3, 5 + IF __UI_Focus <> Red AND __UI_Focus <> RedValue THEN + Control(Red).Value = _RED32(ThisColor) + Text(RedValue) = LTRIM$(STR$(Control(Red).Value)) + END IF + IF __UI_Focus <> Green AND __UI_Focus <> GreenValue THEN + Control(Green).Value = _GREEN32(ThisColor) + Text(GreenValue) = LTRIM$(STR$(Control(Green).Value)) + END IF + IF __UI_Focus <> Blue AND __UI_Focus <> BlueValue THEN + Control(Blue).Value = _BLUE32(ThisColor) + Text(BlueValue) = LTRIM$(STR$(Control(Blue).Value)) + END IF + CASE 2, 4 + IF __UI_Focus <> Red AND __UI_Focus <> RedValue THEN + Control(Red).Value = _RED32(ThisBackColor) + Text(RedValue) = LTRIM$(STR$(Control(Red).Value)) + END IF + IF __UI_Focus <> Green AND __UI_Focus <> GreenValue THEN + Control(Green).Value = _GREEN32(ThisBackColor) + Text(GreenValue) = LTRIM$(STR$(Control(Green).Value)) + END IF + IF __UI_Focus <> Blue AND __UI_Focus <> BlueValue THEN + Control(Blue).Value = _BLUE32(ThisBackColor) + Text(BlueValue) = LTRIM$(STR$(Control(Blue).Value)) + END IF + END SELECT - If Control(ColorPreview).HelperCanvas = 0 Then - Control(ColorPreview).HelperCanvas = _NewImage(Control(ColorPreview).Width, Control(ColorPreview).Height, 32) - End If + IF Control(ColorPreview).HelperCanvas = 0 THEN + Control(ColorPreview).HelperCanvas = _NEWIMAGE(Control(ColorPreview).Width, Control(ColorPreview).Height, 32) + END IF - Static PrevPreviewForeColor As _Unsigned Long, PrevPreviewBackColor As _Unsigned Long - Static PrevColorPropertiesListValue As _Byte - If PrevPreviewForeColor <> ThisColor Or PrevPreviewBackColor <> ThisBackColor Or PrevColorPropertiesListValue <> Control(ColorPropertiesList).Value Then + STATIC PrevPreviewForeColor AS _UNSIGNED LONG, PrevPreviewBackColor AS _UNSIGNED LONG + STATIC PrevColorPropertiesListValue AS _BYTE + IF PrevPreviewForeColor <> ThisColor OR PrevPreviewBackColor <> ThisBackColor OR PrevColorPropertiesListValue <> Control(ColorPropertiesList).Value THEN PrevPreviewForeColor = ThisColor PrevPreviewBackColor = ThisBackColor PrevColorPropertiesListValue = Control(ColorPropertiesList).Value UpdateColorPreview Control(ColorPropertiesList).Value, ThisColor, ThisBackColor - End If -End Sub + END IF +END SUB -Sub __UI_BeforeUnload - Dim Answer As _Byte - If Edited Then - $If WIN Then - Answer = MessageBox("Save the current form before leaving?", "", MsgBox_YesNoCancel + MsgBox_Question) - $Else - Answer = MessageBox("Save the current form before leaving?", "", MsgBox_YesNo + MsgBox_Question) - $End If - If Answer = MsgBox_Cancel Then +SUB __UI_BeforeUnload + DIM Answer AS _BYTE + IF Edited THEN + Answer = _MESSAGEBOX(UiEditorTitle$, "Save the current form before leaving?", "yesnocancel", "question", 1) + IF Answer = 0 THEN __UI_UnloadSignal = False - ElseIf Answer = MsgBox_Yes Then - If ThisFileName$ = "" Then + ELSEIF Answer = 1 THEN + IF ThisFileName$ = "" THEN ThisFileName$ = "untitled" - End If + END IF SaveForm False, False - End If - End If + END IF + END IF SaveSettings -End Sub +END SUB -Sub SaveSettings - Dim value$ +SUB SaveSettings + DIM value$ - If _DirExists("InForm") = 0 Then Exit Sub + IF _DIREXISTS("InForm") = 0 THEN EXIT SUB - If PreviewAttached Then value$ = "True" Else value$ = "False" - WriteSetting "InForm.ini", "InForm Settings", "Keep preview window attached", value$ + IF PreviewAttached THEN value$ = "True" ELSE value$ = "False" + WriteSetting "InForm/InForm.ini", "InForm Settings", "Keep preview window attached", value$ - If AutoNameControls Then value$ = "True" Else value$ = "False" - WriteSetting "InForm.ini", "InForm Settings", "Auto-name controls", value$ + IF AutoNameControls THEN value$ = "True" ELSE value$ = "False" + WriteSetting "InForm/InForm.ini", "InForm Settings", "Auto-name controls", value$ - If __UI_SnapLines Then value$ = "True" Else value$ = "False" - WriteSetting "InForm.ini", "InForm Settings", "Snap to edges", value$ + IF __UI_SnapLines THEN value$ = "True" ELSE value$ = "False" + WriteSetting "InForm/InForm.ini", "InForm Settings", "Snap to edges", value$ - If __UI_ShowPositionAndSize Then value$ = "True" Else value$ = "False" - WriteSetting "InForm.ini", "InForm Settings", "Show position and size", value$ + IF __UI_ShowPositionAndSize THEN value$ = "True" ELSE value$ = "False" + WriteSetting "InForm/InForm.ini", "InForm Settings", "Show position and size", value$ - If __UI_ShowInvisibleControls Then value$ = "True" Else value$ = "False" - WriteSetting "InForm.ini", "InForm Settings", "Show invisible controls", value$ + IF __UI_ShowInvisibleControls THEN value$ = "True" ELSE value$ = "False" + WriteSetting "InForm/InForm.ini", "InForm Settings", "Show invisible controls", value$ - value$ = "False" ' *** Removing the checking for update function - WriteSetting "InForm.ini", "InForm Settings", "Check for updates", value$ + value$ = "False" ' *** Removing the checking for update function + WriteSetting "InForm/InForm.ini", "InForm Settings", "Check for updates", value$ - value$ = "False" ' *** Removing the checking for update function - WriteSetting "InForm.ini", "InForm Settings", "Receive development updates", value$ + value$ = "False" ' *** Removing the checking for update function + WriteSetting "InForm/InForm.ini", "InForm Settings", "Receive development updates", value$ - If ShowFontList Then value$ = "True" Else value$ = "False" - WriteSetting "InForm.ini", "InForm Settings", "Show font list", value$ + IF ShowFontList THEN value$ = "True" ELSE value$ = "False" + WriteSetting "InForm/InForm.ini", "InForm Settings", "Show font list", value$ - $If WIN Then - $Else - IF __UI_MouseButtonsSwap THEN value$ = "True" ELSE value$ = "False" - WriteSetting "InForm.ini", "InForm Settings", "Swap mouse buttons", value$ - $End If -End Sub + $IF WIN THEN + $ELSE + IF __UI_MouseButtonsSwap THEN value$ = "True" ELSE value$ = "False" + WriteSetting "InForm/InForm.ini", "InForm Settings", "Swap mouse buttons", value$ + $END IF +END SUB -Sub __UI_BeforeInit +SUB __UI_BeforeInit __UI_KeepScreenHidden = True __UI_EditorMode = True -End Sub +END SUB -Sub __UI_FormResized -End Sub +SUB __UI_FormResized +END SUB -Sub Handshake +SUB Handshake 'Handshake: each module sends the other their PID: - Dim b$, i As Integer + DIM b$ Stream$ = "" 'clear buffer b$ = "EDITORPID>" + MKL$(__UI_GetPID) + "<END>" Send Client, b$ - $If WIN Then - Const TIMEOUT = 10 - $Else + $IF WIN THEN + CONST TIMEOUT = 10 + $ELSE CONST TIMEOUT = 120 - $End If + $END IF - Dim start!, incomingData$, thisData$ - start! = Timer - Do + DIM start!, incomingData$, thisData$ + start! = TIMER + DO incomingData$ = "" - Get #Client, , incomingData$ + GET #Client, , incomingData$ Stream$ = Stream$ + incomingData$ - If InStr(Stream$, "<END>") Then - thisData$ = Left$(Stream$, InStr(Stream$, "<END>") - 1) - Stream$ = Mid$(Stream$, Len(thisData$) + 6) - If Left$(thisData$, 11) = "PREVIEWPID>" Then - UiPreviewPID = CVL(Mid$(thisData$, 12)) - End If - Exit Do - End If - Loop Until Timer - start! > TIMEOUT + IF INSTR(Stream$, "<END>") THEN + thisData$ = LEFT$(Stream$, INSTR(Stream$, "<END>") - 1) + Stream$ = MID$(Stream$, LEN(thisData$) + 6) + IF LEFT$(thisData$, 11) = "PREVIEWPID>" THEN + UiPreviewPID = CVL(MID$(thisData$, 12)) + END IF + EXIT DO + END IF + LOOP UNTIL TIMER - start! > TIMEOUT - If UiPreviewPID = 0 Then - i = MessageBox("UiEditorPreview component not found or failed to load.", "UiEditor", MsgBox_OkOnly + MsgBox_Critical) - System - End If -End Sub + IF UiPreviewPID = 0 THEN + _MESSAGEBOX UiEditorTitle$, "UiEditorPreview component not found or failed to load.", "error" + SYSTEM + END IF +END SUB -Sub __UI_OnLoad - Dim i As Long, b$ - Dim prevDest As Long +SUB __UI_OnLoad + DIM i AS LONG, b$ + DIM prevDest AS LONG b$ = "Starting..." - GoSub ShowMessage + GOSUB ShowMessage 'Load splash image: - Dim tempIcon As Long - tempIcon = _LoadImage("resources/Application-icon-128.png", 32) + DIM tempIcon AS LONG + tempIcon = _LOADIMAGE("resources/Application-icon-128.png", 32) - GoSub ShowMessage + GOSUB ShowMessage b$ = "Opening communication port (click 'unblock' if your Operating System asks)..." - GoSub ShowMessage - Dim HostAttempts As Integer - Do + GOSUB ShowMessage + DIM HostAttempts AS INTEGER + DO HostAttempts = HostAttempts + 1 - InstanceHost = _OpenHost("TCP/IP:60680") '60680 = #ED08, as the functionality was implemented in Beta 8 of the EDitor ;-) - Loop Until InstanceHost <> 0 Or HostAttempts > 1000 + InstanceHost = _OPENHOST("TCP/IP:60680") '60680 = #ED08, as the functionality was implemented in Beta 8 of the EDitor ;-) + LOOP UNTIL InstanceHost <> 0 OR HostAttempts > 1000 - If InstanceHost = 0 Then + IF InstanceHost = 0 THEN 'There is probably another instance of InForm Designer running. '(i) attempt to communicate and pass parameters and '(ii) bring it to the front. HostAttempts = 0 - Do + DO HostAttempts = HostAttempts + 1 - Host = _OpenClient("TCP/IP:60680:localhost") - Loop Until Host <> 0 Or HostAttempts > 1000 + Host = _OPENCLIENT("TCP/IP:60680:localhost") + LOOP UNTIL Host <> 0 OR HostAttempts > 1000 - If Host Then - b$ = "NEWINSTANCE>" + Command$ + "<END>" + IF Host THEN + b$ = "NEWINSTANCE>" + COMMAND$ + "<END>" Send Host, b$ - _Delay 1 - Close Host - End If - System - End If + _DELAY 1 + CLOSE Host + END IF + SYSTEM + END IF - _ScreenShow - _Icon + _SCREENSHOW + _ICON - Randomize Timer + RANDOMIZE TIMER HostAttempts = 0 - Do + DO HostAttempts = HostAttempts + 1 - HostPort = LTrim$(Str$(Int(Rnd * 5000 + 60000))) - Host = _OpenHost("TCP/IP:" + HostPort) - Loop Until Host <> 0 Or HostAttempts > 1000 + HostPort = LTRIM$(STR$(INT(RND * 5000 + 60000))) + Host = _OPENHOST("TCP/IP:" + HostPort) + LOOP UNTIL Host <> 0 OR HostAttempts > 1000 - If Host = 0 Then - Dim Answer As _Byte - Answer = MessageBox("Unable to open communication port.", "", MsgBox_OkOnly + MsgBox_Critical) - System - End If + IF Host = 0 THEN + _MESSAGEBOX UiEditorTitle$, "Unable to open communication port.", "error" + SYSTEM + END IF PreviewAttached = True AutoNameControls = True @@ -2745,68 +2720,68 @@ Sub __UI_OnLoad i = RegisterKeyCombo("ctrl+y", EditMenuRedo) i = RegisterKeyCombo("f1", HelpMenuHelp) - Dim FileToOpen$, FreeFileNum As Integer + DIM FileToOpen$, FreeFileNum AS INTEGER b$ = "Reading settings..." - GoSub ShowMessage + GOSUB ShowMessage - If _DirExists("InForm") = 0 Then MkDir "InForm" + IF _DIREXISTS("InForm") = 0 THEN MKDIR "InForm" - Dim value$ - value$ = ReadSetting("InForm.ini", "InForm Settings", "Keep preview window attached") - If Len(value$) Then + DIM value$ + value$ = ReadSetting("InForm/InForm.ini", "InForm Settings", "Keep preview window attached") + IF LEN(value$) THEN PreviewAttached = (value$ = "True") - Else - WriteSetting "InForm.ini", "InForm Settings", "Keep preview window attached", "True" + ELSE + WriteSetting "InForm/InForm.ini", "InForm Settings", "Keep preview window attached", "True" PreviewAttached = True - End If + END IF - value$ = ReadSetting("InForm.ini", "InForm Settings", "Auto-name controls") - If Len(value$) Then + value$ = ReadSetting("InForm/InForm.ini", "InForm Settings", "Auto-name controls") + IF LEN(value$) THEN AutoNameControls = (value$ = "True") - Else - WriteSetting "InForm.ini", "InForm Settings", "Auto-name controls", "True" + ELSE + WriteSetting "InForm/InForm.ini", "InForm Settings", "Auto-name controls", "True" AutoNameControls = True - End If + END IF - value$ = ReadSetting("InForm.ini", "InForm Settings", "Snap to edges") - If Len(value$) Then + value$ = ReadSetting("InForm/InForm.ini", "InForm Settings", "Snap to edges") + IF LEN(value$) THEN __UI_SnapLines = (value$ = "True") - Else - WriteSetting "InForm.ini", "InForm Settings", "Snap to edges", "True" + ELSE + WriteSetting "InForm/InForm.ini", "InForm Settings", "Snap to edges", "True" __UI_SnapLines = True - End If + END IF - value$ = ReadSetting("InForm.ini", "InForm Settings", "Show position and size") - If Len(value$) Then + value$ = ReadSetting("InForm/InForm.ini", "InForm Settings", "Show position and size") + IF LEN(value$) THEN __UI_ShowPositionAndSize = (value$ = "True") - Else - WriteSetting "InForm.ini", "InForm Settings", "Show position and size", "True" + ELSE + WriteSetting "InForm/InForm.ini", "InForm Settings", "Show position and size", "True" __UI_ShowPositionAndSize = True - End If + END IF - value$ = ReadSetting("InForm.ini", "InForm Settings", "Show invisible controls") - If Len(value$) Then + value$ = ReadSetting("InForm/InForm.ini", "InForm Settings", "Show invisible controls") + IF LEN(value$) THEN __UI_ShowInvisibleControls = (value$ = "True") - Else - WriteSetting "InForm.ini", "InForm Settings", "Show invisible controls", "True" + ELSE + WriteSetting "InForm/InForm.ini", "InForm Settings", "Show invisible controls", "True" __UI_ShowInvisibleControls = True - End If + END IF - value$ = ReadSetting("InForm.ini", "InForm Settings", "Show font list") - If Len(value$) Then + value$ = ReadSetting("InForm/InForm.ini", "InForm Settings", "Show font list") + IF LEN(value$) THEN ShowFontList = (value$ = "True") - Else - WriteSetting "InForm.ini", "InForm Settings", "Show font list", "True" + ELSE + WriteSetting "InForm/InForm.ini", "InForm Settings", "Show font list", "True" ShowFontList = True - End If + END IF - $If WIN Then - $Else - value$ = ReadSetting("InForm.ini", "InForm Settings", "Swap mouse buttons") - __UI_MouseButtonsSwap = (value$ = "True") - Control(OptionsMenuSwapButtons).Value = __UI_MouseButtonsSwap - $End If + $IF WIN THEN + $ELSE + value$ = ReadSetting("InForm/InForm.ini", "InForm Settings", "Swap mouse buttons") + __UI_MouseButtonsSwap = (value$ = "True") + Control(OptionsMenuSwapButtons).Value = __UI_MouseButtonsSwap + $END IF Control(ViewMenuPreviewDetach).Value = PreviewAttached Control(OptionsMenuAutoName).Value = AutoNameControls @@ -2814,117 +2789,117 @@ Sub __UI_OnLoad Control(ViewMenuShowPositionAndSize).Value = __UI_ShowPositionAndSize Control(ViewMenuShowInvisibleControls).Value = __UI_ShowInvisibleControls - If _FileExists("UiEditorPreview.frmbin") Then Kill "UiEditorPreview.frmbin" + IF _FILEEXISTS("InForm/UiEditorPreview.frmbin") THEN KILL "InForm/UiEditorPreview.frmbin" b$ = "Parsing command line..." - GoSub ShowMessage + GOSUB ShowMessage - If _FileExists(Command$) Then - Select Case LCase$(Right$(Command$, 4)) - Case ".bas" + IF _FILEEXISTS(COMMAND$) THEN + SELECT CASE LCASE$(RIGHT$(COMMAND$, 4)) + CASE ".bas" 'Does this .bas $include a .frm? - FreeFileNum = FreeFile - Dim uB$ - Open Command$ For Binary As #FreeFileNum - b$ = Space$(LOF(FreeFileNum)) - Get #FreeFileNum, 1, b$ - Seek #FreeFileNum, 1 - If InStr(b$, Chr$(10) + "'$INCLUDE:'InForm\extensions\gifplay.bm'") > 0 Then + FreeFileNum = FREEFILE + DIM uB$ + OPEN COMMAND$ FOR BINARY AS #FreeFileNum + b$ = SPACE$(LOF(FreeFileNum)) + GET #FreeFileNum, 1, b$ + SEEK #FreeFileNum, 1 + IF INSTR(b$, CHR$(10) + "'$INCLUDE:'InForm\extensions\gifplay.bm'") > 0 THEN LoadedWithGifExtension = True - End If - Do - If EOF(FreeFileNum) Then Exit Do - Line Input #FreeFileNum, b$ - b$ = LTrim$(RTrim$(b$)) - uB$ = UCase$(b$) + END IF + DO + IF EOF(FreeFileNum) THEN EXIT DO + LINE INPUT #FreeFileNum, b$ + b$ = LTRIM$(RTRIM$(b$)) + uB$ = UCASE$(b$) IF (LEFT$(b$, 1) = "'" OR LEFT$(uB$, 4) = "REM ") AND _ INSTR(uB$, "$INCLUDE") > 0 THEN - Dim FirstMark As Integer, SecondMark As Integer - FirstMark = InStr(InStr(uB$, "$INCLUDE") + 8, uB$, "'") - If FirstMark > 0 Then - SecondMark = InStr(FirstMark + 1, uB$, "'") - If SecondMark > 0 Then - uB$ = Mid$(uB$, FirstMark + 1, SecondMark - FirstMark - 1) - If Right$(uB$, 4) = ".FRM" Then - FileToOpen$ = Mid$(b$, FirstMark + 1, SecondMark - FirstMark - 1) + DIM FirstMark AS INTEGER, SecondMark AS INTEGER + FirstMark = INSTR(INSTR(uB$, "$INCLUDE") + 8, uB$, "'") + IF FirstMark > 0 THEN + SecondMark = INSTR(FirstMark + 1, uB$, "'") + IF SecondMark > 0 THEN + uB$ = MID$(uB$, FirstMark + 1, SecondMark - FirstMark - 1) + IF RIGHT$(uB$, 4) = ".FRM" THEN + FileToOpen$ = MID$(b$, FirstMark + 1, SecondMark - FirstMark - 1) - If InStr(Command$, "/") > 0 Or InStr(Command$, "\") > 0 Then - For i = Len(Command$) To 1 Step -1 - If Asc(Command$, i) = 92 Or Asc(Command$, i) = 47 Then - FileToOpen$ = Left$(Command$, i - 1) + PathSep$ + FileToOpen$ - Exit For - End If - Next - End If + IF INSTR(COMMAND$, "/") > 0 OR INSTR(COMMAND$, "\") > 0 THEN + FOR i = LEN(COMMAND$) TO 1 STEP -1 + IF ASC(COMMAND$, i) = 92 OR ASC(COMMAND$, i) = 47 THEN + FileToOpen$ = LEFT$(COMMAND$, i - 1) + PathSep$ + FileToOpen$ + EXIT FOR + END IF + NEXT + END IF - Exit Do - End If - End If - End If - End If - Loop - Close #FreeFileNum - Case Else - If LCase$(Right$(Command$, 7)) = ".frmbin" Or LCase$(Right$(Command$, 4)) = ".frm" Then - FileToOpen$ = Command$ - If _FileExists(Left$(FileToOpen$, Len(FileToOpen$) - 4) + ".bas") Then - FreeFileNum = FreeFile - Open Left$(FileToOpen$, Len(FileToOpen$) - 4) + ".bas" For Binary As #FreeFileNum - b$ = Space$(LOF(FreeFileNum)) - Get #FreeFileNum, 1, b$ - Close #FreeFileNum - If InStr(b$, Chr$(10) + "'$INCLUDE:'InForm\extensions\gifplay.bm'") > 0 Then + EXIT DO + END IF + END IF + END IF + END IF + LOOP + CLOSE #FreeFileNum + CASE ELSE + IF LCASE$(RIGHT$(COMMAND$, 7)) = ".frmbin" OR LCASE$(RIGHT$(COMMAND$, 4)) = ".frm" THEN + FileToOpen$ = COMMAND$ + IF _FILEEXISTS(LEFT$(FileToOpen$, LEN(FileToOpen$) - 4) + ".bas") THEN + FreeFileNum = FREEFILE + OPEN LEFT$(FileToOpen$, LEN(FileToOpen$) - 4) + ".bas" FOR BINARY AS #FreeFileNum + b$ = SPACE$(LOF(FreeFileNum)) + GET #FreeFileNum, 1, b$ + CLOSE #FreeFileNum + IF INSTR(b$, CHR$(10) + "'$INCLUDE:'InForm\extensions\gifplay.bm'") > 0 THEN LoadedWithGifExtension = True - End If - End If - End If - End Select + END IF + END IF + END IF + END SELECT - If Len(FileToOpen$) > 0 Then - If InStr(FileToOpen$, "/") > 0 Or InStr(FileToOpen$, "\") > 0 Then - For i = Len(FileToOpen$) To 1 Step -1 - If Asc(FileToOpen$, i) = 92 Or Asc(FileToOpen$, i) = 47 Then - CurrentPath$ = Left$(FileToOpen$, i - 1) - ThisFileName$ = Mid$(FileToOpen$, i + 1) - Exit For - End If - Next - Else + IF LEN(FileToOpen$) > 0 THEN + IF INSTR(FileToOpen$, "/") > 0 OR INSTR(FileToOpen$, "\") > 0 THEN + FOR i = LEN(FileToOpen$) TO 1 STEP -1 + IF ASC(FileToOpen$, i) = 92 OR ASC(FileToOpen$, i) = 47 THEN + CurrentPath$ = LEFT$(FileToOpen$, i - 1) + ThisFileName$ = MID$(FileToOpen$, i + 1) + EXIT FOR + END IF + NEXT + ELSE ThisFileName$ = FileToOpen$ - End If - FreeFileNum = FreeFile - Open FileToOpen$ For Binary As #FreeFileNum - b$ = Space$(LOF(FreeFileNum)) - Get #FreeFileNum, 1, b$ - Close #FreeFileNum + END IF + FreeFileNum = FREEFILE + OPEN FileToOpen$ FOR BINARY AS #FreeFileNum + b$ = SPACE$(LOF(FreeFileNum)) + GET #FreeFileNum, 1, b$ + CLOSE #FreeFileNum - Open "UiEditorPreview.frmbin" For Binary As #FreeFileNum - Put #FreeFileNum, 1, b$ - Close #FreeFileNum - If LoadedWithGifExtension = False Then + OPEN "InForm/UiEditorPreview.frmbin" FOR BINARY AS #FreeFileNum + PUT #FreeFileNum, 1, b$ + CLOSE #FreeFileNum + IF LoadedWithGifExtension = False THEN LoadedWithGifExtension = 1 'Query whether this file contains the gif extension Control(AddGifExtensionToggle).Value = False - Else + ELSE Control(AddGifExtensionToggle).Value = True - End If + END IF AddToRecentList FileToOpen$ - End If - End If + END IF + END IF b$ = "Checking Preview component..." GOSUB ShowMessage - $IF WIN THEN - IF _FileExists("UiEditorPreview.exe") = 0 THEN GOTO UiEditorPreviewNotFound + $IF WIN THEN + IF _FILEEXISTS("InForm/UiEditorPreview.exe") = 0 THEN GOTO UiEditorPreviewNotFound $ELSE - IF _FILEEXISTS("UiEditorPreview") = 0 THEN GOTO UiEditorPreviewNotFound + IF _FILEEXISTS("InForm/UiEditorPreview") = 0 THEN GOTO UiEditorPreviewNotFound $END IF b$ = "Reading directory..." - GoSub ShowMessage + GOSUB ShowMessage 'Fill "open dialog" listboxes: '------------------------------------------------- - Dim TotalFiles% - If CurrentPath$ = "" Then CurrentPath$ = _StartDir$ + DIM TotalFiles% + IF CurrentPath$ = "" THEN CurrentPath$ = _STARTDIR$ Text(FileList) = idezfilelist$(CurrentPath$, 0, 1, TotalFiles%) Control(FileList).Max = TotalFiles% Control(FileList).LastVisibleItem = 0 'Reset it so it's recalculated @@ -2938,7 +2913,7 @@ Sub __UI_OnLoad 'Load font list b$ = "Loading font list..." - GoSub ShowMessage + GOSUB ShowMessage LoadFontList 'Assign InputBox IDs: @@ -2968,8 +2943,8 @@ Sub __UI_OnLoad i = i + 1: InputBox(i).ID = ContextMenuControlsList: InputBox(i).LabelID = ContextMenuLB: InputBox(i).DataType = DT_Text i = i + 1: InputBox(i).ID = KeyboardComboBT: InputBox(i).LabelID = KeyboardComboLB: InputBox(i).DataType = DT_Text - ReDim _Preserve InputBox(1 To i) As newInputBox - ReDim InputBoxText(1 To i) As String + REDIM _PRESERVE InputBox(1 TO i) AS newInputBox + REDIM InputBoxText(1 TO i) AS STRING 'Assign Toggles IDs: i = 0 @@ -2989,9 +2964,9 @@ Sub __UI_OnLoad i = i + 1: Toggles(i) = HideTicks i = i + 1: Toggles(i) = AutoPlayGif i = i + 1: Toggles(i) = AddGifExtensionToggle - ReDim _Preserve Toggles(1 To i) As Long + REDIM _PRESERVE Toggles(1 TO i) AS LONG - ToolTip(FontTB) = "Multiple fonts can be specified by separating them with a question mark (?)." + Chr$(10) + "The first font that can be found/loaded is used." + ToolTip(FontTB) = "Multiple fonts can be specified by separating them with a question mark (?)." + CHR$(10) + "The first font that can be found/loaded is used." ToolTip(FontList) = "System fonts may not be available in all computers. To specify a local font file, right-click 'Font' to the left of this list and disable 'Show system fonts list'." ToolTip(ColorPreview) = "Click to copy the current color's hex value to the clipboard." ToolTip(KeyboardComboBT) = "Click to assign a key combination to the selected control" @@ -2999,66 +2974,66 @@ Sub __UI_OnLoad StatusBarBackColor = Darken(__UI_DefaultColor(__UI_Type_Form, 2), 90) Control(StatusBar).BackColor = StatusBarBackColor - For i = 1 To 9 - RecentMenuItem(i) = __UI_GetID("FileMenuRecent" + LTrim$(Str$(i))) - Next + FOR i = 1 TO 9 + RecentMenuItem(i) = __UI_GetID("FileMenuRecent" + LTRIM$(STR$(i))) + NEXT b$ = "Loading images..." - GoSub ShowMessage + GOSUB ShowMessage 'Load toolbox images: - Dim CommControls As Long + DIM CommControls AS LONG CommControls = LoadEditorImage("commoncontrols.bmp") __UI_ClearColor CommControls, 0, 0 i = 0 - Control(AddButton).HelperCanvas = _NewImage(16, 16, 32) - i = i + 1: _PutImage (0, 0), CommControls, Control(AddButton).HelperCanvas, (0, i * 16 - 16)-Step(15, 15) - Control(AddLabel).HelperCanvas = _NewImage(16, 16, 32) - i = i + 1: _PutImage (0, 0), CommControls, Control(AddLabel).HelperCanvas, (0, i * 16 - 16)-Step(15, 15) - Control(AddTextBox).HelperCanvas = _NewImage(16, 16, 32) - i = i + 1: _PutImage (0, 0), CommControls, Control(AddTextBox).HelperCanvas, (0, i * 16 - 16)-Step(15, 15) - Control(AddCheckBox).HelperCanvas = _NewImage(16, 16, 32) - i = i + 1: _PutImage (0, 0), CommControls, Control(AddCheckBox).HelperCanvas, (0, i * 16 - 16)-Step(15, 15) - Control(AddRadioButton).HelperCanvas = _NewImage(16, 16, 32) - i = i + 1: _PutImage (0, 0), CommControls, Control(AddRadioButton).HelperCanvas, (0, i * 16 - 16)-Step(15, 15) - Control(AddListBox).HelperCanvas = _NewImage(16, 16, 32) - i = i + 1: _PutImage (0, 0), CommControls, Control(AddListBox).HelperCanvas, (0, i * 16 - 16)-Step(15, 15) - Control(AddDropdownList).HelperCanvas = _NewImage(16, 16, 32) - i = i + 1: _PutImage (0, 0), CommControls, Control(AddDropdownList).HelperCanvas, (0, i * 16 - 16)-Step(15, 15) - Control(AddTrackBar).HelperCanvas = _NewImage(16, 16, 32) - i = i + 1: _PutImage (0, 0), CommControls, Control(AddTrackBar).HelperCanvas, (0, i * 16 - 16)-Step(15, 15) - Control(AddProgressBar).HelperCanvas = _NewImage(16, 16, 32) - i = i + 1: _PutImage (0, 0), CommControls, Control(AddProgressBar).HelperCanvas, (0, i * 16 - 16)-Step(15, 15) - Control(AddPictureBox).HelperCanvas = _NewImage(16, 16, 32) - i = i + 1: _PutImage (0, 0), CommControls, Control(AddPictureBox).HelperCanvas, (0, i * 16 - 16)-Step(15, 15) - Control(AddFrame).HelperCanvas = _NewImage(16, 16, 32) - i = i + 1: _PutImage (0, 0), CommControls, Control(AddFrame).HelperCanvas, (0, i * 16 - 16)-Step(15, 15) + Control(AddButton).HelperCanvas = _NEWIMAGE(16, 16, 32) + i = i + 1: _PUTIMAGE (0, 0), CommControls, Control(AddButton).HelperCanvas, (0, i * 16 - 16)-STEP(15, 15) + Control(AddLabel).HelperCanvas = _NEWIMAGE(16, 16, 32) + i = i + 1: _PUTIMAGE (0, 0), CommControls, Control(AddLabel).HelperCanvas, (0, i * 16 - 16)-STEP(15, 15) + Control(AddTextBox).HelperCanvas = _NEWIMAGE(16, 16, 32) + i = i + 1: _PUTIMAGE (0, 0), CommControls, Control(AddTextBox).HelperCanvas, (0, i * 16 - 16)-STEP(15, 15) + Control(AddCheckBox).HelperCanvas = _NEWIMAGE(16, 16, 32) + i = i + 1: _PUTIMAGE (0, 0), CommControls, Control(AddCheckBox).HelperCanvas, (0, i * 16 - 16)-STEP(15, 15) + Control(AddRadioButton).HelperCanvas = _NEWIMAGE(16, 16, 32) + i = i + 1: _PUTIMAGE (0, 0), CommControls, Control(AddRadioButton).HelperCanvas, (0, i * 16 - 16)-STEP(15, 15) + Control(AddListBox).HelperCanvas = _NEWIMAGE(16, 16, 32) + i = i + 1: _PUTIMAGE (0, 0), CommControls, Control(AddListBox).HelperCanvas, (0, i * 16 - 16)-STEP(15, 15) + Control(AddDropdownList).HelperCanvas = _NEWIMAGE(16, 16, 32) + i = i + 1: _PUTIMAGE (0, 0), CommControls, Control(AddDropdownList).HelperCanvas, (0, i * 16 - 16)-STEP(15, 15) + Control(AddTrackBar).HelperCanvas = _NEWIMAGE(16, 16, 32) + i = i + 1: _PUTIMAGE (0, 0), CommControls, Control(AddTrackBar).HelperCanvas, (0, i * 16 - 16)-STEP(15, 15) + Control(AddProgressBar).HelperCanvas = _NEWIMAGE(16, 16, 32) + i = i + 1: _PUTIMAGE (0, 0), CommControls, Control(AddProgressBar).HelperCanvas, (0, i * 16 - 16)-STEP(15, 15) + Control(AddPictureBox).HelperCanvas = _NEWIMAGE(16, 16, 32) + i = i + 1: _PUTIMAGE (0, 0), CommControls, Control(AddPictureBox).HelperCanvas, (0, i * 16 - 16)-STEP(15, 15) + Control(AddFrame).HelperCanvas = _NEWIMAGE(16, 16, 32) + i = i + 1: _PUTIMAGE (0, 0), CommControls, Control(AddFrame).HelperCanvas, (0, i * 16 - 16)-STEP(15, 15) 'Draw ToggleSwitch icon - prevDest = _Dest - Control(AddToggleSwitch).HelperCanvas = _NewImage(16, 16, 32) - _Dest Control(AddToggleSwitch).HelperCanvas - Line (2, 4)-(13, 11), _RGB32(0, 128, 255), BF - Line (2, 4)-(13, 11), _RGB32(170, 170, 170), B - Line (8, 6)-(11, 9), _RGB32(255, 255, 255), BF + prevDest = _DEST + Control(AddToggleSwitch).HelperCanvas = _NEWIMAGE(16, 16, 32) + _DEST Control(AddToggleSwitch).HelperCanvas + LINE (2, 4)-(13, 11), _RGB32(0, 128, 255), BF + LINE (2, 4)-(13, 11), _RGB32(170, 170, 170), B + LINE (8, 6)-(11, 9), _RGB32(255, 255, 255), BF 'Draw AddNumericBox icon - Control(AddNumericBox).HelperCanvas = _NewImage(16, 16, 32) - _Dest Control(AddNumericBox).HelperCanvas - _Font 8 - Line (1, 3)-(15, 13), _RGB32(255, 255, 255), BF - Line (1, 3)-(15, 13), _RGB32(132, 165, 189), B - Color _RGB32(55, 55, 55), _RGBA32(0, 0, 0, 0) + Control(AddNumericBox).HelperCanvas = _NEWIMAGE(16, 16, 32) + _DEST Control(AddNumericBox).HelperCanvas + _FONT 8 + LINE (1, 3)-(15, 13), _RGB32(255, 255, 255), BF + LINE (1, 3)-(15, 13), _RGB32(132, 165, 189), B + COLOR _RGB32(55, 55, 55), _RGBA32(0, 0, 0, 0) __UI_PrintString 5, 3, "#" 'Draw PasteListBT icon - Control(PasteListBT).HelperCanvas = _NewImage(17, 17, 32) - _Dest Control(PasteListBT).HelperCanvas - _Font 16 - For i = 4 To 15 Step 4 - Line (3, i)-Step(_Width - 6, 1), _RGB32(122, 122, 122), BF - Next + Control(PasteListBT).HelperCanvas = _NEWIMAGE(17, 17, 32) + _DEST Control(PasteListBT).HelperCanvas + _FONT 16 + FOR i = 4 TO 15 STEP 4 + LINE (3, i)-STEP(_WIDTH - 6, 1), _RGB32(122, 122, 122), BF + NEXT 'Import Align menu icons from InForm.ui Control(AlignMenuAlignLeft).HelperCanvas = Control(__UI_GetID("__UI_PreviewMenuAlignLeft")).HelperCanvas @@ -3068,163 +3043,163 @@ Sub __UI_OnLoad Control(AlignMenuAlignCentersV).HelperCanvas = Control(__UI_GetID("__UI_PreviewMenuAlignCentersV")).HelperCanvas Control(AlignMenuAlignCentersH).HelperCanvas = Control(__UI_GetID("__UI_PreviewMenuAlignCentersH")).HelperCanvas - _Dest prevDest + _DEST prevDest Control(FileMenuSave).HelperCanvas = LoadEditorImage("disk.png") - _FreeImage CommControls + _FREEIMAGE CommControls b$ = "Launching Preview component..." - GoSub ShowMessage - $If WIN Then - Shell _DontWait ".\UiEditorPreview.exe " + HostPort - $Else - SHELL _DONTWAIT "./UiEditorPreview " + HostPort - $End If + GOSUB ShowMessage + $IF WIN THEN + SHELL _DONTWAIT ".\InForm\UiEditorPreview.exe " + HostPort + $ELSE + SHELL _DONTWAIT "./InForm/UiEditorPreview " + HostPort + $END IF b$ = "Connecting to preview component..." - GoSub ShowMessage - Do - Client = _OpenConnection(Host) - If Client Then Exit Do - If _Exit Then System 'Can't force user to wait... - _Display - _Limit 15 - Loop + GOSUB ShowMessage + DO + Client = _OPENCONNECTION(Host) + IF Client THEN EXIT DO + IF _EXIT THEN SYSTEM 'Can't force user to wait... + _DISPLAY + _LIMIT 15 + LOOP b$ = "Connected! Handshaking..." - GoSub ShowMessage + GOSUB ShowMessage Handshake __UI_RefreshMenuBar __UI_ForceRedraw = True - _FreeImage tempIcon + _FREEIMAGE tempIcon - _AcceptFileDrop + _ACCEPTFILEDROP - Exit Sub + EXIT SUB UiEditorPreviewNotFound: - i = MessageBox("UiEditorPreview component not found or failed to load.", "UiEditor", MsgBox_OkOnly + MsgBox_Critical) - System + _MESSAGEBOX UiEditorTitle$, "UiEditorPreview component not found or failed to load.", "error" + SYSTEM ShowMessage: - Dim PreserveDestMessage As Long - PreserveDestMessage = _Dest - _Dest 0 - _Font Control(__UI_FormID).Font - If tempIcon < -1 Then - Cls , _RGB32(255, 255, 255) - _PutImage (_Width / 2 - _Width(tempIcon) / 2, _Height / 2 - _Height(tempIcon) / 2), tempIcon - Color __UI_DefaultColor(__UI_Type_Form, 1), _RGBA32(0, 0, 0, 0) - __UI_PrintString _Width \ 2 - _PrintWidth(b$) \ 2, _Height / 2 + _Height(tempIcon) / 2 + _FontHeight, b$ - _Display - Else - Cls , __UI_DefaultColor(__UI_Type_Form, 2) - Color __UI_DefaultColor(__UI_Type_Form, 1), _RGBA32(0, 0, 0, 0) - __UI_PrintString _Width \ 2 - _PrintWidth(b$) \ 2, _Height \ 2 - _FontHeight \ 2, b$ - End If - _Display - _Dest PreserveDestMessage - Return -End Sub + DIM PreserveDestMessage AS LONG + PreserveDestMessage = _DEST + _DEST 0 + _FONT Control(__UI_FormID).Font + IF tempIcon < -1 THEN + CLS , _RGB32(255, 255, 255) + _PUTIMAGE (_WIDTH / 2 - _WIDTH(tempIcon) / 2, _HEIGHT / 2 - _HEIGHT(tempIcon) / 2), tempIcon + COLOR __UI_DefaultColor(__UI_Type_Form, 1), _RGBA32(0, 0, 0, 0) + __UI_PrintString _WIDTH \ 2 - _PRINTWIDTH(b$) \ 2, _HEIGHT / 2 + _HEIGHT(tempIcon) / 2 + _FONTHEIGHT, b$ + _DISPLAY + ELSE + CLS , __UI_DefaultColor(__UI_Type_Form, 2) + COLOR __UI_DefaultColor(__UI_Type_Form, 1), _RGBA32(0, 0, 0, 0) + __UI_PrintString _WIDTH \ 2 - _PRINTWIDTH(b$) \ 2, _HEIGHT \ 2 - _FONTHEIGHT \ 2, b$ + END IF + _DISPLAY + _DEST PreserveDestMessage + RETURN +END SUB -Sub __UI_KeyPress (id As Long) - Dim i As Long - LastKeyPress = Timer - Select EveryCase id - Case RedValue, GreenValue, BlueValue - Dim TempID As Long - If __UI_KeyHit = 18432 Then - If Val(Text(id)) < 255 Then - Text(id) = LTrim$(Str$(Val(Text(id)) + 1)) - End If +SUB __UI_KeyPress (id AS LONG) + DIM i AS LONG + LastKeyPress = TIMER + SELECT EVERYCASE id + CASE RedValue, GreenValue, BlueValue + DIM TempID AS LONG + IF __UI_KeyHit = 18432 THEN + IF VAL(Text(id)) < 255 THEN + Text(id) = LTRIM$(STR$(VAL(Text(id)) + 1)) + END IF SelectPropertyFully id - TempID = __UI_GetID(Left$(UCase$(RTrim$(Control(id).Name)), Len(UCase$(RTrim$(Control(id).Name))) - 5)) - Control(TempID).Value = Val(Text(id)) + TempID = __UI_GetID(LEFT$(UCASE$(RTRIM$(Control(id).Name)), LEN(UCASE$(RTRIM$(Control(id).Name))) - 5)) + Control(TempID).Value = VAL(Text(id)) SendNewRGB - ElseIf __UI_KeyHit = 20480 Then - If Val(Text(id)) > 0 Then - Text(id) = LTrim$(Str$(Val(Text(id)) - 1)) - End If + ELSEIF __UI_KeyHit = 20480 THEN + IF VAL(Text(id)) > 0 THEN + Text(id) = LTRIM$(STR$(VAL(Text(id)) - 1)) + END IF SelectPropertyFully id - TempID = __UI_GetID(Left$(UCase$(RTrim$(Control(id).Name)), Len(UCase$(RTrim$(Control(id).Name))) - 5)) - Control(TempID).Value = Val(Text(id)) + TempID = __UI_GetID(LEFT$(UCASE$(RTRIM$(Control(id).Name)), LEN(UCASE$(RTRIM$(Control(id).Name))) - 5)) + Control(TempID).Value = VAL(Text(id)) SendNewRGB - ElseIf __UI_KeyHit = 13 Then - TempID = __UI_GetID(Left$(UCase$(RTrim$(Control(id).Name)), Len(UCase$(RTrim$(Control(id).Name))) - 5)) - Control(TempID).Value = Val(Text(id)) + ELSEIF __UI_KeyHit = 13 THEN + TempID = __UI_GetID(LEFT$(UCASE$(RTRIM$(Control(id).Name)), LEN(UCASE$(RTRIM$(Control(id).Name))) - 5)) + Control(TempID).Value = VAL(Text(id)) SendNewRGB SelectPropertyFully id - End If + END IF Caption(StatusBar) = "Color changed." - Case FileNameTextBox - If OpenDialogOpen Then - If __UI_KeyHit = 27 Then + CASE FileNameTextBox + IF OpenDialogOpen THEN + IF __UI_KeyHit = 27 THEN __UI_KeyHit = 0 __UI_Click CancelBT - ElseIf __UI_KeyHit = 13 Then + ELSEIF __UI_KeyHit = 13 THEN __UI_KeyHit = 0 - If Caption(OpenFrame) = "Open" Then + IF Caption(OpenFrame) = "Open" THEN __UI_Click OpenBT - Else + ELSE __UI_Click SaveBT - End If - ElseIf __UI_KeyHit = 18432 Or __UI_KeyHit = 20480 Then - If Control(FileList).Max > 0 Then __UI_Focus = FileList - Else - If Control(FileList).Max > 0 Then - Select Case __UI_KeyHit - Case 48 To 57, 65 To 90, 97 To 122 'Alphanumeric - If Caption(OpenFrame) = "Open" Then + END IF + ELSEIF __UI_KeyHit = 18432 OR __UI_KeyHit = 20480 THEN + IF Control(FileList).Max > 0 THEN __UI_Focus = FileList + ELSE + IF Control(FileList).Max > 0 THEN + SELECT CASE __UI_KeyHit + CASE 48 TO 57, 65 TO 90, 97 TO 122 'Alphanumeric + IF Caption(OpenFrame) = "Open" THEN __UI_ListBoxSearchItem Control(FileList) - End If - End Select - End If - End If - End If - Case FileList, DirList, CancelBT, OpenBT, SaveBT, ShowOnlyFrmbinFilesCB, SaveFrmOnlyCB - If __UI_KeyHit = 27 Then + END IF + END SELECT + END IF + END IF + END IF + CASE FileList, DirList, CancelBT, OpenBT, SaveBT, ShowOnlyFrmbinFilesCB, SaveFrmOnlyCB + IF __UI_KeyHit = 27 THEN __UI_Click CancelBT - End If - Case FileList - If __UI_KeyHit = 13 Then + END IF + CASE FileList + IF __UI_KeyHit = 13 THEN __UI_KeyHit = 0 - If Caption(OpenFrame) = "Open" Then + IF Caption(OpenFrame) = "Open" THEN __UI_Click OpenBT - Else + ELSE __UI_Click SaveBT - End If - End If - Case ControlList, UpBT, DownBT, CloseZOrderingBT - If __UI_KeyHit = 27 Then + END IF + END IF + CASE ControlList, UpBT, DownBT, CloseZOrderingBT + IF __UI_KeyHit = 27 THEN __UI_Click CloseZOrderingBT - End If - Case NameTB, CaptionTB, TextTB, MaskTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, ValueTB, MinTB, MaxTB, IntervalTB, PaddingTB, MinIntervalTB, SizeTB - If __UI_KeyHit = 13 Then + END IF + CASE NameTB, CaptionTB, TextTB, MaskTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, ValueTB, MinTB, MaxTB, IntervalTB, PaddingTB, MinIntervalTB, SizeTB + IF __UI_KeyHit = 13 THEN 'Send the preview the new property value ConfirmEdits id - ElseIf __UI_KeyHit = 32 Then - If id = NameTB Then + ELSEIF __UI_KeyHit = 32 THEN + IF id = NameTB THEN __UI_KeyHit = 0 Caption(StatusBar) = "Control names cannot contain spaces" - BlinkStatusBar = Timer - Else + BlinkStatusBar = TIMER + ELSE InputBox(GetInputBoxFromID(id)).Sent = False Send Client, "LOCKCONTROLS><END>" - End If - ElseIf __UI_KeyHit = 27 Then + END IF + ELSEIF __UI_KeyHit = 27 THEN RevertEdit = True Caption(StatusBar) = "Previous property value restored." - Else + ELSE InputBox(GetInputBoxFromID(id)).Sent = False Send Client, "LOCKCONTROLS><END>" - End If - Case KeyboardComboBT - Dim Combo$ - If __UI_CtrlIsDown Then Combo$ = "Ctrl+" - If __UI_ShiftIsDown Then Combo$ = Combo$ + "Shift+" - Select Case __UI_KeyHit - Case 27 + END IF + CASE KeyboardComboBT + DIM Combo$ + IF __UI_CtrlIsDown THEN Combo$ = "Ctrl+" + IF __UI_ShiftIsDown THEN Combo$ = Combo$ + "Shift+" + SELECT CASE __UI_KeyHit + CASE 27 __UI_Focus = 0 __UI_BypassKeyCombos = False ToolTip(KeyboardComboBT) = "Click to assign a key combination to the selected control" @@ -3232,163 +3207,163 @@ Sub __UI_KeyPress (id As Long) __UI_ForceRedraw = True CASE __UI_FKey(1), __UI_FKey(2), __UI_FKey(3), __UI_FKey(4), __UI_FKey(5), __UI_FKey(6), _ __UI_FKey(7), __UI_FKey(8), __UI_FKey(9), __UI_FKey(10), __UI_FKey(11), __UI_FKey(12) - For i = 1 To 12 - If __UI_FKey(i) = __UI_KeyHit Then - Combo$ = Combo$ + "F" + LTrim$(Str$(i)) - SendData MKI$(Len(Combo$)) + Combo$, 43 + FOR i = 1 TO 12 + IF __UI_FKey(i) = __UI_KeyHit THEN + Combo$ = Combo$ + "F" + LTRIM$(STR$(i)) + SendData MKI$(LEN(Combo$)) + Combo$, 43 __UI_Focus = 0 __UI_BypassKeyCombos = False ToolTip(KeyboardComboBT) = "Click to assign a key combination to the selected control" __UI_ForceRedraw = True - Exit For - End If - Next - Case 65 To 90, 97 To 122 'Alphanumeric - Combo$ = Combo$ + UCase$(Chr$(__UI_KeyHit)) - If InStr(Combo$, "Ctrl+") > 0 Then - SendData MKI$(Len(Combo$)) + Combo$, 43 + EXIT FOR + END IF + NEXT + CASE 65 TO 90, 97 TO 122 'Alphanumeric + Combo$ = Combo$ + UCASE$(CHR$(__UI_KeyHit)) + IF INSTR(Combo$, "Ctrl+") > 0 THEN + SendData MKI$(LEN(Combo$)) + Combo$, 43 __UI_Focus = 0 __UI_BypassKeyCombos = False ToolTip(KeyboardComboBT) = "Click to assign a key combination to the selected control" __UI_ForceRedraw = True - End If - End Select - End Select -End Sub + END IF + END SELECT + END SELECT +END SUB -Sub ConfirmEdits (id As Long) - Dim b$, TempValue As Long +SUB ConfirmEdits (id AS LONG) + DIM b$, TempValue AS LONG IF InputBoxText(GetInputBoxFromID(id)) <> Text(id) AND _ InputBox(GetInputBoxFromID(id)).Sent = False THEN - Select Case InputBox(GetInputBoxFromID(id)).DataType - Case DT_Text - b$ = MKL$(Len(Text(id))) + Text(id) - Case DT_Integer - b$ = MKI$(Val(Text(id))) - Case DT_Float - b$ = _MK$(_Float, Val(Text(id))) - End Select + SELECT CASE InputBox(GetInputBoxFromID(id)).DataType + CASE DT_Text + b$ = MKL$(LEN(Text(id))) + Text(id) + CASE DT_Integer + b$ = MKI$(VAL(Text(id))) + CASE DT_Float + b$ = _MK$(_FLOAT, VAL(Text(id))) + END SELECT TempValue = GetPropertySignal(id) SendData b$, TempValue PropertySent = True Text(id) = RestoreCHR(Text(id)) SelectPropertyFully id InputBoxText(GetInputBoxFromID(id)) = Text(id) - InputBox(GetInputBoxFromID(id)).LastEdited = Timer + InputBox(GetInputBoxFromID(id)).LastEdited = TIMER InputBox(GetInputBoxFromID(id)).Sent = True Caption(StatusBar) = "Ready." - End If -End Sub + END IF +END SUB -Function GetPropertySignal& (id As Long) - Dim i As Long - For i = 1 To UBound(InputBox) - If InputBox(i).ID = id Then GetPropertySignal& = InputBox(i).Signal: Exit Function - Next -End Function +FUNCTION GetPropertySignal& (id AS LONG) + DIM i AS LONG + FOR i = 1 TO UBOUND(InputBox) + IF InputBox(i).ID = id THEN GetPropertySignal& = InputBox(i).Signal: EXIT FUNCTION + NEXT +END FUNCTION -Function GetInputBoxFromID& (id As Long) - Dim i As Long - For i = 1 To UBound(InputBox) - If InputBox(i).ID = id Then GetInputBoxFromID& = i: Exit Function - Next -End Function +FUNCTION GetInputBoxFromID& (id AS LONG) + DIM i AS LONG + FOR i = 1 TO UBOUND(InputBox) + IF InputBox(i).ID = id THEN GetInputBoxFromID& = i: EXIT FUNCTION + NEXT +END FUNCTION -Sub __UI_TextChanged (id As Long) - Select Case id - Case RedValue, GreenValue, BlueValue - Dim TempID As Long - TempID = __UI_GetID(Left$(UCase$(RTrim$(Control(id).Name)), Len(UCase$(RTrim$(Control(id).Name))) - 5)) - Control(TempID).Value = Val(Text(id)) - Case FileNameTextBox +SUB __UI_TextChanged (id AS LONG) + SELECT CASE id + CASE RedValue, GreenValue, BlueValue + DIM TempID AS LONG + TempID = __UI_GetID(LEFT$(UCASE$(RTRIM$(Control(id).Name)), LEN(UCASE$(RTRIM$(Control(id).Name))) - 5)) + Control(TempID).Value = VAL(Text(id)) + CASE FileNameTextBox PreselectFile - End Select -End Sub + END SELECT +END SUB -Sub __UI_ValueChanged (id As Long) - If __UI_StateHasChanged Then Exit Sub 'skip values changed programmatically +SUB __UI_ValueChanged (id AS LONG) + IF __UI_StateHasChanged THEN EXIT SUB 'skip values changed programmatically - Dim b$, i As Long - Select EveryCase id - Case AlignOptions - If __UI_Focus <> id Then Exit Sub + DIM b$, i AS LONG + SELECT EVERYCASE id + CASE AlignOptions + IF __UI_Focus <> id THEN EXIT SUB b$ = MKI$(Control(AlignOptions).Value - 1) SendData b$, 22 PropertySent = True - Case VAlignOptions - If __UI_Focus <> id Then Exit Sub + CASE VAlignOptions + IF __UI_Focus <> id THEN EXIT SUB b$ = MKI$(Control(VAlignOptions).Value - 1) SendData b$, 32 PropertySent = True - Case BulletOptions - If __UI_Focus <> id Then Exit Sub + CASE BulletOptions + IF __UI_Focus <> id THEN EXIT SUB b$ = MKI$(Control(BulletOptions).Value - 1) SendData b$, 37 PropertySent = True - Case BooleanOptions - b$ = _MK$(_Float, -(Control(BooleanOptions).Value - 1)) + CASE BooleanOptions + b$ = _MK$(_FLOAT, -(Control(BooleanOptions).Value - 1)) SendData b$, GetPropertySignal(BooleanOptions) PropertySent = True - Case ContextMenuControlsList + CASE ContextMenuControlsList i = Control(ContextMenuControlsList).Value - If i > 1 Then + IF i > 1 THEN b$ = GetItem(ContextMenuControlsList, i) - b$ = MKI$(Len(b$)) + b$ - Else + b$ = MKI$(LEN(b$)) + b$ + ELSE b$ = MKI$(0) - End If + END IF SendData b$, 41 - Case FontList, FontSizeList + CASE FontList, FontSizeList b$ = FontFile(Control(FontList).Value) + "," + GetItem$(FontSizeList, Control(FontSizeList).Value) - b$ = MKL$(Len(b$)) + b$ + b$ = MKL$(LEN(b$)) + b$ SendData b$, 8 PropertySent = True - Case Red - Text(RedValue) = LTrim$(Str$(Control(Red).Value)) - Case Green - Text(GreenValue) = LTrim$(Str$(Control(Green).Value)) - Case Blue - Text(BlueValue) = LTrim$(Str$(Control(Blue).Value)) - Case ControlList + CASE Red + Text(RedValue) = LTRIM$(STR$(Control(Red).Value)) + CASE Green + Text(GreenValue) = LTRIM$(STR$(Control(Green).Value)) + CASE Blue + Text(BlueValue) = LTRIM$(STR$(Control(Blue).Value)) + CASE ControlList Control(UpBT).Disabled = False Control(DownBT).Disabled = False - If Control(ControlList).Value = 1 Then + IF Control(ControlList).Value = 1 THEN Control(UpBT).Disabled = True - ElseIf Control(ControlList).Value = 0 Then + ELSEIF Control(ControlList).Value = 0 THEN Control(UpBT).Disabled = True Control(DownBT).Disabled = True - ElseIf Control(ControlList).Value = Control(ControlList).Max Then + ELSEIF Control(ControlList).Value = Control(ControlList).Max THEN Control(DownBT).Disabled = True - End If - If Control(ControlList).Value > 0 Then + END IF + IF Control(ControlList).Value > 0 THEN b$ = MKL$(zOrderIDs(Control(ControlList).Value)) - Else + ELSE b$ = MKL$(0) - End If + END IF SendData b$, 213 - Case FileList + CASE FileList Text(FileNameTextBox) = GetItem(FileList, Control(FileList).Value) - Case NameTB, CaptionTB, TextTB, MaskTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, ValueTB, MinTB, MaxTB, IntervalTB, PaddingTB, MinIntervalTB, SizeTB + CASE NameTB, CaptionTB, TextTB, MaskTB, TopTB, LeftTB, WidthTB, HeightTB, FontTB, TooltipTB, ValueTB, MinTB, MaxTB, IntervalTB, PaddingTB, MinIntervalTB, SizeTB Send Client, "LOCKCONTROLS><END>" - End Select -End Sub + END SELECT +END SUB -Sub PreselectFile - Dim b$ +SUB PreselectFile + DIM b$ b$ = GetItem(FileList, Control(FileList).Value) - If LCase$(Text(FileNameTextBox)) = LCase$(Left$(b$, Len(Text(FileNameTextBox)))) Then - Text(FileNameTextBox) = Text(FileNameTextBox) + Mid$(b$, Len(Text(FileNameTextBox)) + 1) + IF LCASE$(Text(FileNameTextBox)) = LCASE$(LEFT$(b$, LEN(Text(FileNameTextBox)))) THEN + Text(FileNameTextBox) = Text(FileNameTextBox) + MID$(b$, LEN(Text(FileNameTextBox)) + 1) Control(FileNameTextBox).TextIsSelected = True - Control(FileNameTextBox).SelectionStart = Len(Text(FileNameTextBox)) - End If -End Sub + Control(FileNameTextBox).SelectionStart = LEN(Text(FileNameTextBox)) + END IF +END SUB -Function EditorImageData$ (FileName$) - Dim A$ +FUNCTION EditorImageData$ (FileName$) + DIM A$ - Select Case LCase$(FileName$) - Case "disk.png" + SELECT CASE LCASE$(FileName$) + CASE "disk.png" A$ = MKI$(16) + MKI$(16) A$ = A$ + "0000005D@1AA15TB=MdA[`hQ7>c[ZZj<7:HOcPgL^=COc=g<0FGMbd7Nc=cH" A$ = A$ + "NiE<:A4A]<eC<eDEBmdE9UDB>0000`0GHIUb854?oWiUFj_iUCno4;\`o;Nh" @@ -3413,7 +3388,7 @@ Function EditorImageData$ (FileName$) A$ = A$ + "0000OcUFImoS;^ho:NhQo_8R8noR8Rho;R8Ro_8R8noR8Rho;R8Ro_8R8n_R" A$ = A$ + "7NholXC>iW@14X=9P02@<`03FLa5Gh4000`?000001000040000@00000100" A$ = A$ + "0040000@000001000040000@0000o@000<D5B81B0000%%70" - Case "commoncontrols.bmp" + CASE "commoncontrols.bmp" A$ = MKI$(16) + MKI$(176) A$ = A$ + "f3PmoK?0fo_m0Hoof3PmoK?0fo_m0Hoof3PmoK?0fo_m0Hoof3PmoK?0fo_m0Hoof3PmoK?0fo_m0Hoof3PmoK?0fo_emfjo<ZE:" A$ = A$ + "o?G>0loN21`ocU30o_W@0loLi0`ok940o?G>0loN21`ocU30o_W@0loN:1aoFKL[oK?0fo_cmFjoD^F>ok]c6ooooooooooooooo" @@ -3566,103 +3541,103 @@ Function EditorImageData$ (FileName$) A$ = A$ + "f3PmoK?0fo_m0Hoof3PmoK?0fo_m0Hoof3PmoK?0fo?WLBiof3PmoGJYDn?WLBioUb9Uoc9WDnOYUBioLb9UoG:WDn?WLBioUF:U" A$ = A$ + "oc9WDnOYLBioLb9UoGJYDn?WLBiof3PmoK?0fo_m0Hoof3PmoK?0fo_m0Hoof3PmoK?0fo_m0Hoof3PmoK?0fo_m0Hoof3PmoK?0" A$ = A$ + "fo_m0Hoof3PmoK?0%fo?" - End Select + END SELECT EditorImageData$ = A$ -End Function +END FUNCTION '--------------------------------------------------------------------------------- -Function LoadEditorImage& (FileName$) - Dim MemoryBlock As _MEM, TempImage As Long - Dim NewWidth As Integer, NewHeight As Integer, A$, BASFILE$ +FUNCTION LoadEditorImage& (FileName$) + DIM MemoryBlock AS _MEM, TempImage AS LONG + DIM NewWidth AS INTEGER, NewHeight AS INTEGER, A$, BASFILE$ A$ = EditorImageData$(FileName$) - If Len(A$) = 0 Then Exit Function + IF LEN(A$) = 0 THEN EXIT FUNCTION - NewWidth = CVI(Left$(A$, 2)) - NewHeight = CVI(Mid$(A$, 3, 2)) - A$ = Mid$(A$, 5) + NewWidth = CVI(LEFT$(A$, 2)) + NewHeight = CVI(MID$(A$, 3, 2)) + A$ = MID$(A$, 5) BASFILE$ = Unpack$(A$) - TempImage = _NewImage(NewWidth, NewHeight, 32) - MemoryBlock = _MemImage(TempImage) + TempImage = _NEWIMAGE(NewWidth, NewHeight, 32) + MemoryBlock = _MEMIMAGE(TempImage) - __UI_MemCopy MemoryBlock.OFFSET, _Offset(BASFILE$), Len(BASFILE$) - _MemFree MemoryBlock + __UI_MemCopy MemoryBlock.OFFSET, _OFFSET(BASFILE$), LEN(BASFILE$) + _MEMFREE MemoryBlock LoadEditorImage& = TempImage -End Function +END FUNCTION -Function Unpack$ (PackedData$) +FUNCTION Unpack$ (PackedData$) 'Adapted from Dav's BIN2BAS 'http://www.qbasicnews.com/dav/qb64.php - Dim A$, i&, B$, C%, F$, C$, t%, B&, X$, btemp$ + DIM A$, i&, B$, C%, F$, C$, t%, B&, X$, btemp$ A$ = PackedData$ - For i& = 1 To Len(A$) Step 4: B$ = Mid$(A$, i&, 4) - If InStr(1, B$, "%") Then - For C% = 1 To Len(B$): F$ = Mid$(B$, C%, 1) - If F$ <> "%" Then C$ = C$ + F$ - Next: B$ = C$ - End If: For t% = Len(B$) To 1 Step -1 - B& = B& * 64 + Asc(Mid$(B$, t%)) - 48 - Next: X$ = "": For t% = 1 To Len(B$) - 1 - X$ = X$ + Chr$(B& And 255): B& = B& \ 256 - Next: btemp$ = btemp$ + X$: Next + FOR i& = 1 TO LEN(A$) STEP 4: B$ = MID$(A$, i&, 4) + IF INSTR(1, B$, "%") THEN + FOR C% = 1 TO LEN(B$): F$ = MID$(B$, C%, 1) + IF F$ <> "%" THEN C$ = C$ + F$ + NEXT: B$ = C$ + END IF: FOR t% = LEN(B$) TO 1 STEP -1 + B& = B& * 64 + ASC(MID$(B$, t%)) - 48 + NEXT: X$ = "": FOR t% = 1 TO LEN(B$) - 1 + X$ = X$ + CHR$(B& AND 255): B& = B& \ 256 + NEXT: btemp$ = btemp$ + X$: NEXT Unpack$ = btemp$ -End Function +END FUNCTION -Function ReadSequential$ (Txt$, Bytes%) - ReadSequential$ = Left$(Txt$, Bytes%) - Txt$ = Mid$(Txt$, Bytes% + 1) -End Function +FUNCTION ReadSequential$ (Txt$, Bytes%) + ReadSequential$ = LEFT$(Txt$, Bytes%) + Txt$ = MID$(Txt$, Bytes% + 1) +END FUNCTION -Sub LoadPreview - Dim b$, __UI_EOF As _Byte, Answer As _Byte - Dim NewType As Integer, NewWidth As Integer, NewHeight As Integer - Dim NewLeft As Integer, NewTop As Integer, NewName As String - Dim NewParentID As String, FloatValue As _Float, Dummy As Long - Dim FormData$ - Static PrevTotalGifLoaded As Long +SUB LoadPreview + DIM b$, __UI_EOF AS _BYTE, Answer AS _BYTE + DIM NewType AS INTEGER, NewWidth AS INTEGER, NewHeight AS INTEGER + DIM NewLeft AS INTEGER, NewTop AS INTEGER, NewName AS STRING + DIM NewParentID AS STRING, FloatValue AS _FLOAT, Dummy AS LONG + DIM FormData$ + STATIC PrevTotalGifLoaded AS LONG - Timer(__UI_EventsTimer) Off - Timer(__UI_RefreshTimer) Off + TIMER(__UI_EventsTimer) OFF + TIMER(__UI_RefreshTimer) OFF FormData$ = LastFormData$ AddGifExtension = False TotalGifLoaded = 0 - If LoadedWithGifExtension = 1 Then PrevTotalGifLoaded = 0 + IF LoadedWithGifExtension = 1 THEN PrevTotalGifLoaded = 0 b$ = ReadSequential$(FormData$, 4) - ReDim PreviewCaptions(0 To CVL(b$)) As String - ReDim PreviewTexts(0 To CVL(b$)) As String - ReDim PreviewMasks(0 To CVL(b$)) As String - ReDim PreviewTips(0 To CVL(b$)) As String - ReDim PreviewFonts(0 To CVL(b$)) As String - ReDim PreviewActualFonts(0 To CVL(b$)) As String - ReDim PreviewControls(0 To CVL(b$)) As __UI_ControlTYPE - ReDim PreviewParentIDS(0 To CVL(b$)) As String - ReDim PreviewContextMenu(0 To CVL(b$)) As String - ReDim PreviewBoundTo(0 To CVL(b$)) As String - ReDim PreviewBoundProperty(0 To CVL(b$)) As String - ReDim PreviewKeyCombos(0 To CVL(b$)) As String - ReDim PreviewAnimatedGif(0 To CVL(b$)) As _Byte - ReDim PreviewAutoPlayGif(0 To CVL(b$)) As _Byte + REDIM PreviewCaptions(0 TO CVL(b$)) AS STRING + REDIM PreviewTexts(0 TO CVL(b$)) AS STRING + REDIM PreviewMasks(0 TO CVL(b$)) AS STRING + REDIM PreviewTips(0 TO CVL(b$)) AS STRING + REDIM PreviewFonts(0 TO CVL(b$)) AS STRING + REDIM PreviewActualFonts(0 TO CVL(b$)) AS STRING + REDIM PreviewControls(0 TO CVL(b$)) AS __UI_ControlTYPE + REDIM PreviewParentIDS(0 TO CVL(b$)) AS STRING + REDIM PreviewContextMenu(0 TO CVL(b$)) AS STRING + REDIM PreviewBoundTo(0 TO CVL(b$)) AS STRING + REDIM PreviewBoundProperty(0 TO CVL(b$)) AS STRING + REDIM PreviewKeyCombos(0 TO CVL(b$)) AS STRING + REDIM PreviewAnimatedGif(0 TO CVL(b$)) AS _BYTE + REDIM PreviewAutoPlayGif(0 TO CVL(b$)) AS _BYTE ResetList ContextMenuControlsList AddItem ContextMenuControlsList, "(none)" b$ = ReadSequential$(FormData$, 2) - If CVI(b$) <> -1 Then GoTo LoadError - Do + IF CVI(b$) <> -1 THEN GOTO LoadError + DO b$ = ReadSequential$(FormData$, 4) Dummy = CVL(b$) - If Dummy <= 0 Or Dummy > UBound(PreviewControls) Then Exit Do 'Corrupted exchange file. + IF Dummy <= 0 OR Dummy > UBOUND(PreviewControls) THEN EXIT DO 'Corrupted exchange file. b$ = ReadSequential$(FormData$, 2) NewType = CVI(b$) b$ = ReadSequential$(FormData$, 2) @@ -3677,18 +3652,18 @@ Sub LoadPreview b$ = ReadSequential$(FormData$, 2) NewTop = CVI(b$) b$ = ReadSequential$(FormData$, 2) - If CVI(b$) > 0 Then + IF CVI(b$) > 0 THEN NewParentID = ReadSequential$(FormData$, CVI(b$)) - Else + ELSE NewParentID = "" - End If + END IF - If NewType = __UI_Type_ContextMenu Then + IF NewType = __UI_Type_ContextMenu THEN AddItem ContextMenuControlsList, NewName - End If + END IF PreviewControls(Dummy).ID = Dummy - PreviewParentIDS(Dummy) = RTrim$(NewParentID) + PreviewParentIDS(Dummy) = RTRIM$(NewParentID) PreviewControls(Dummy).Type = NewType PreviewControls(Dummy).Name = NewName PreviewControls(Dummy).Width = NewWidth @@ -3696,276 +3671,276 @@ Sub LoadPreview PreviewControls(Dummy).Left = NewLeft PreviewControls(Dummy).Top = NewTop - Do 'read properties + DO 'read properties b$ = ReadSequential$(FormData$, 2) - Select Case CVI(b$) - Case -2 'Caption + SELECT CASE CVI(b$) + CASE -2 'Caption b$ = ReadSequential$(FormData$, 4) b$ = ReadSequential$(FormData$, CVL(b$)) PreviewCaptions(Dummy) = b$ - Case -3 'Text + CASE -3 'Text b$ = ReadSequential$(FormData$, 4) b$ = ReadSequential$(FormData$, CVL(b$)) PreviewTexts(Dummy) = b$ - Case -4 'Stretch + CASE -4 'Stretch PreviewControls(Dummy).Stretch = True - Case -5 'Font - Dim FontSetup$ - Dim NewFontSize$ + CASE -5 'Font + DIM FontSetup$ + DIM NewFontSize$ b$ = ReadSequential$(FormData$, 2) FontSetup$ = ReadSequential$(FormData$, CVI(b$)) PreviewFonts(Dummy) = FontSetup$ - NewFontSize$ = Mid$(FontSetup$, InStr(FontSetup$, ",")) + NewFontSize$ = MID$(FontSetup$, INSTR(FontSetup$, ",")) b$ = ReadSequential$(FormData$, 2) FontSetup$ = ReadSequential$(FormData$, CVI(b$)) PreviewActualFonts(Dummy) = FontSetup$ + NewFontSize$ - Case -6 'ForeColor + CASE -6 'ForeColor b$ = ReadSequential$(FormData$, 4) - PreviewControls(Dummy).ForeColor = _CV(_Unsigned Long, b$) - Case -7 'BackColor + PreviewControls(Dummy).ForeColor = _CV(_UNSIGNED LONG, b$) + CASE -7 'BackColor b$ = ReadSequential$(FormData$, 4) - PreviewControls(Dummy).BackColor = _CV(_Unsigned Long, b$) - Case -8 'SelectedForeColor + PreviewControls(Dummy).BackColor = _CV(_UNSIGNED LONG, b$) + CASE -8 'SelectedForeColor b$ = ReadSequential$(FormData$, 4) - PreviewControls(Dummy).SelectedForeColor = _CV(_Unsigned Long, b$) - Case -9 'SelectedBackColor + PreviewControls(Dummy).SelectedForeColor = _CV(_UNSIGNED LONG, b$) + CASE -9 'SelectedBackColor b$ = ReadSequential$(FormData$, 4) - PreviewControls(Dummy).SelectedBackColor = _CV(_Unsigned Long, b$) - Case -10 'BorderColor + PreviewControls(Dummy).SelectedBackColor = _CV(_UNSIGNED LONG, b$) + CASE -10 'BorderColor b$ = ReadSequential$(FormData$, 4) - PreviewControls(Dummy).BorderColor = _CV(_Unsigned Long, b$) - Case -11 + PreviewControls(Dummy).BorderColor = _CV(_UNSIGNED LONG, b$) + CASE -11 PreviewControls(Dummy).BackStyle = __UI_Transparent - Case -12 + CASE -12 PreviewControls(Dummy).HasBorder = True - Case -13 + CASE -13 b$ = ReadSequential$(FormData$, 1) - PreviewControls(Dummy).Align = _CV(_Byte, b$) - Case -14 - b$ = ReadSequential$(FormData$, Len(FloatValue)) - PreviewControls(Dummy).Value = _CV(_Float, b$) - Case -15 - b$ = ReadSequential$(FormData$, Len(FloatValue)) - PreviewControls(Dummy).Min = _CV(_Float, b$) - Case -16 - b$ = ReadSequential$(FormData$, Len(FloatValue)) - PreviewControls(Dummy).Max = _CV(_Float, b$) - Case -19 + PreviewControls(Dummy).Align = _CV(_BYTE, b$) + CASE -14 + b$ = ReadSequential$(FormData$, LEN(FloatValue)) + PreviewControls(Dummy).Value = _CV(_FLOAT, b$) + CASE -15 + b$ = ReadSequential$(FormData$, LEN(FloatValue)) + PreviewControls(Dummy).Min = _CV(_FLOAT, b$) + CASE -16 + b$ = ReadSequential$(FormData$, LEN(FloatValue)) + PreviewControls(Dummy).Max = _CV(_FLOAT, b$) + CASE -19 PreviewControls(Dummy).ShowPercentage = True - Case -20 + CASE -20 PreviewControls(Dummy).CanHaveFocus = True - Case -21 + CASE -21 PreviewControls(Dummy).Disabled = True - Case -22 + CASE -22 PreviewControls(Dummy).Hidden = True - Case -23 + CASE -23 PreviewControls(Dummy).CenteredWindow = True - Case -24 'Tips + CASE -24 'Tips b$ = ReadSequential$(FormData$, 4) b$ = ReadSequential$(FormData$, CVL(b$)) PreviewTips(Dummy) = b$ - Case -25 'ContextMenu + CASE -25 'ContextMenu b$ = ReadSequential$(FormData$, 2) b$ = ReadSequential$(FormData$, CVI(b$)) PreviewContextMenu(Dummy) = b$ - Case -26 - b$ = ReadSequential$(FormData$, Len(FloatValue)) - PreviewControls(Dummy).Interval = _CV(_Float, b$) - Case -27 + CASE -26 + b$ = ReadSequential$(FormData$, LEN(FloatValue)) + PreviewControls(Dummy).Interval = _CV(_FLOAT, b$) + CASE -27 PreviewControls(Dummy).WordWrap = True - Case -29 + CASE -29 PreviewControls(Dummy).CanResize = True - Case -31 + CASE -31 b$ = ReadSequential$(FormData$, 2) PreviewControls(Dummy).Padding = CVI(b$) - Case -32 + CASE -32 b$ = ReadSequential$(FormData$, 1) - PreviewControls(Dummy).VAlign = _CV(_Byte, b$) - Case -33 + PreviewControls(Dummy).VAlign = _CV(_BYTE, b$) + CASE -33 PreviewControls(Dummy).PasswordField = True - Case -34 + CASE -34 b$ = ReadSequential$(FormData$, 4) PreviewControls(Dummy).Encoding = CVL(b$) - Case -35 + CASE -35 PreviewDefaultButtonID = Dummy - Case -36 'Mask + CASE -36 'Mask b$ = ReadSequential$(FormData$, 4) b$ = ReadSequential$(FormData$, CVL(b$)) PreviewMasks(Dummy) = b$ - Case -37 - b$ = ReadSequential$(FormData$, Len(FloatValue)) - PreviewControls(Dummy).MinInterval = _CV(_Float, b$) - Case -38 + CASE -37 + b$ = ReadSequential$(FormData$, LEN(FloatValue)) + PreviewControls(Dummy).MinInterval = _CV(_FLOAT, b$) + CASE -38 PreviewControls(Dummy).NumericOnly = True - Case -39 + CASE -39 PreviewControls(Dummy).NumericOnly = __UI_NumericWithBounds - Case -40 + CASE -40 PreviewControls(Dummy).BulletStyle = __UI_Bullet - Case -41 + CASE -41 PreviewControls(Dummy).AutoScroll = True - Case -42 + CASE -42 PreviewControls(Dummy).AutoSize = True - Case -43 + CASE -43 b$ = ReadSequential$(FormData$, 2) PreviewControls(Dummy).BorderSize = CVI(b$) - Case -44 'Key combo + CASE -44 'Key combo b$ = ReadSequential$(FormData$, 2) b$ = ReadSequential$(FormData$, CVI(b$)) PreviewKeyCombos(Dummy) = b$ - Case -45 'Animated Gif + CASE -45 'Animated Gif PreviewAnimatedGif(Dummy) = True TotalGifLoaded = TotalGifLoaded + 1 AddGifExtension = True - If LoadedWithGifExtension = 1 Then + IF LoadedWithGifExtension = 1 THEN LoadedWithGifExtension = True Control(AddGifExtensionToggle).Value = True - End If - Case -46 'Auto-play Gif + END IF + CASE -46 'Auto-play Gif PreviewAutoPlayGif(Dummy) = True - Case -47 'ControlIsSelected + CASE -47 'ControlIsSelected PreviewControls(Dummy).ControlIsSelected = True - Case -48 'BoundTo + CASE -48 'BoundTo b$ = ReadSequential$(FormData$, 2) b$ = ReadSequential$(FormData$, CVI(b$)) PreviewBoundTo(Dummy) = b$ b$ = ReadSequential$(FormData$, 2) b$ = ReadSequential$(FormData$, CVI(b$)) PreviewBoundProperty(Dummy) = b$ - Case -1 'new control - Exit Do - Case -1024 + CASE -1 'new control + EXIT DO + CASE -1024 __UI_EOF = True - Exit Do - Case Else - Exit Do - End Select - Loop - Loop Until __UI_EOF + EXIT DO + CASE ELSE + EXIT DO + END SELECT + LOOP + LOOP UNTIL __UI_EOF LoadError: - Timer(__UI_EventsTimer) On - Timer(__UI_RefreshTimer) On - If LoadedWithGifExtension = 1 Then LoadedWithGifExtension = False - If PrevTotalGifLoaded <> TotalGifLoaded Then - If PrevTotalGifLoaded = 0 And LoadedWithGifExtension = False Then - Answer = MessageBox("You loaded an animated GIF file.\nDo you want to include the GIF extension?", "", MsgBox_YesNo + MsgBox_Question) - If Answer = MsgBox_Yes Then + TIMER(__UI_EventsTimer) ON + TIMER(__UI_RefreshTimer) ON + IF LoadedWithGifExtension = 1 THEN LoadedWithGifExtension = False + IF PrevTotalGifLoaded <> TotalGifLoaded THEN + IF PrevTotalGifLoaded = 0 AND LoadedWithGifExtension = False THEN + Answer = _MESSAGEBOX(UiEditorTitle$, "You loaded an animated GIF file.\nDo you want to include the GIF extension?", "yesno", "question", 1) + IF Answer = 1 THEN Control(AddGifExtensionToggle).Value = True - Else + ELSE b$ = "PAUSEALLGIF>" + "<END>" Send Client, b$ Control(AddGifExtensionToggle).Value = False - End If - End If + END IF + END IF PrevTotalGifLoaded = TotalGifLoaded - End If -End Sub + END IF +END SUB -Sub SendData (b$, Property As Integer) +SUB SendData (b$, Property AS INTEGER) 'IF PreviewSelectionRectangle THEN EXIT SUB b$ = "PROPERTY>" + MKI$(Property) + b$ + "<END>" Send Client, b$ -End Sub +END SUB -Sub Send (channel As Long, b$) - totalBytesSent = totalBytesSent + Len(b$) - Put #channel, , b$ -End Sub +SUB Send (channel AS LONG, b$) + totalBytesSent = totalBytesSent + LEN(b$) + PUT #channel, , b$ +END SUB -Sub SendSignal (Value As Integer) - Dim b$ +SUB SendSignal (Value AS INTEGER) + DIM b$ b$ = "SIGNAL>" + MKI$(Value) + "<END>" Send Client, b$ -End Sub +END SUB -Sub UpdateColorPreview (Attribute As _Byte, ForeColor As _Unsigned Long, BackColor As _Unsigned Long) - _Dest Control(ColorPreview).HelperCanvas - _Font Control(ColorPreview).Font - If Attribute = 5 Then - Cls , BackColor - Line (20, 20)-Step(_Width - 41, _Height - 41), ForeColor, B - Line (21, 21)-Step(_Width - 43, _Height - 43), ForeColor, B - ColorPreviewWord$ = "#" + Mid$(Hex$(ForeColor), 3) - Color ForeColor, BackColor - __UI_PrintString _Width \ 2 - _PrintWidth(ColorPreviewWord$) \ 2, _Height \ 2 - _FontHeight \ 2, ColorPreviewWord$ - Else - Cls , BackColor - Color ForeColor, BackColor - Select Case Attribute - Case 1, 3 - ColorPreviewWord$ = "FG: #" + Mid$(Hex$(ForeColor), 3) - Case 2, 4 - ColorPreviewWord$ = "BG: #" + Mid$(Hex$(BackColor), 3) - End Select - __UI_PrintString _Width \ 2 - _PrintWidth(ColorPreviewWord$) \ 2, _Height \ 2 - _FontHeight \ 2, ColorPreviewWord$ - ColorPreviewWord$ = Mid$(ColorPreviewWord$, 5) - End If - _Dest 0 +SUB UpdateColorPreview (Attribute AS _BYTE, ForeColor AS _UNSIGNED LONG, BackColor AS _UNSIGNED LONG) + _DEST Control(ColorPreview).HelperCanvas + _FONT Control(ColorPreview).Font + IF Attribute = 5 THEN + CLS , BackColor + LINE (20, 20)-STEP(_WIDTH - 41, _HEIGHT - 41), ForeColor, B + LINE (21, 21)-STEP(_WIDTH - 43, _HEIGHT - 43), ForeColor, B + ColorPreviewWord$ = "#" + MID$(HEX$(ForeColor), 3) + COLOR ForeColor, BackColor + __UI_PrintString _WIDTH \ 2 - _PRINTWIDTH(ColorPreviewWord$) \ 2, _HEIGHT \ 2 - _FONTHEIGHT \ 2, ColorPreviewWord$ + ELSE + CLS , BackColor + COLOR ForeColor, BackColor + SELECT CASE Attribute + CASE 1, 3 + ColorPreviewWord$ = "FG: #" + MID$(HEX$(ForeColor), 3) + CASE 2, 4 + ColorPreviewWord$ = "BG: #" + MID$(HEX$(BackColor), 3) + END SELECT + __UI_PrintString _WIDTH \ 2 - _PRINTWIDTH(ColorPreviewWord$) \ 2, _HEIGHT \ 2 - _FONTHEIGHT \ 2, ColorPreviewWord$ + ColorPreviewWord$ = MID$(ColorPreviewWord$, 5) + END IF + _DEST 0 Control(ColorPreview).Redraw = True 'Force update -End Sub +END SUB -Sub QuickColorPreview (ThisColor As _Unsigned Long) - _Dest Control(ColorPreview).HelperCanvas - Cls , __UI_DefaultColor(__UI_Type_Form, 2) - Line (0, 0)-Step(_Width, _Height / 2), ThisColor, BF - Line (0, _Height / 2)-Step(_Width, _Height / 2), OldColor, BF - _Dest 0 +SUB QuickColorPreview (ThisColor AS _UNSIGNED LONG) + _DEST Control(ColorPreview).HelperCanvas + CLS , __UI_DefaultColor(__UI_Type_Form, 2) + LINE (0, 0)-STEP(_WIDTH, _HEIGHT / 2), ThisColor, BF + LINE (0, _HEIGHT / 2)-STEP(_WIDTH, _HEIGHT / 2), OldColor, BF + _DEST 0 Control(ColorPreview).Redraw = True 'Force update -End Sub +END SUB -Sub CheckPreview +SUB CheckPreview 'Check if the preview window is still alive - Dim b$ + DIM b$ - If OpenDialogOpen Then Exit Sub + IF OpenDialogOpen THEN EXIT SUB - $If WIN Then - Dim hnd&, b&, c&, ExitCode& - If UiPreviewPID > 0 Then + $IF WIN THEN + DIM hnd&, b&, c&, ExitCode& + IF UiPreviewPID > 0 THEN hnd& = OpenProcess(&H400, 0, UiPreviewPID) b& = GetExitCodeProcess(hnd&, ExitCode&) c& = CloseHandle(hnd&) - If b& = 1 And ExitCode& = 259 Then + IF b& = 1 AND ExitCode& = 259 THEN 'Preview is active. Control(ViewMenuPreview).Disabled = True - Else + ELSE 'Preview was closed. - Timer(__UI_EventsTimer) Off + TIMER(__UI_EventsTimer) OFF __UI_WaitMessage = "Reloading preview window..." UiPreviewPID = 0 __UI_ProcessInputTimer = 0 'Make the "Please wait" message show up immediataly - Close Client + CLOSE Client Client = 0 __UI_UpdateDisplay - Shell _DontWait ".\UiEditorPreview.exe " + HostPort + SHELL _DONTWAIT ".\InForm\UiEditorPreview.exe " + HostPort - Do - Client = _OpenConnection(Host) - If Client Then Exit Do - If _Exit Then System 'Can't force user to wait... - _Display - _Limit 15 - Loop + DO + Client = _OPENCONNECTION(Host) + IF Client THEN EXIT DO + IF _EXIT THEN SYSTEM 'Can't force user to wait... + _DISPLAY + _LIMIT 15 + LOOP Handshake - If Len(LastFormData$) Then + IF LEN(LastFormData$) THEN b$ = "RESTORECRASH>" + LastFormData$ + "<END>" Send Client, b$ prevScreenX = -1 prevScreenY = -1 UndoPointer = 0 TotalUndoImages = 0 - End If + END IF - Timer(__UI_EventsTimer) On - End If - End If - $Else + TIMER(__UI_EventsTimer) ON + END IF + END IF + $ELSE IF UiPreviewPID > 0 THEN IF PROCESS_CLOSED(UiPreviewPID, 0) THEN 'Preview was closed. @@ -3980,7 +3955,7 @@ Sub CheckPreview __UI_UpdateDisplay - SHELL _DONTWAIT "./UiEditorPreview " + HostPort + SHELL _DONTWAIT "./InForm/UiEditorPreview " + HostPort DO Client = _OPENCONNECTION(Host) @@ -4007,872 +3982,867 @@ Sub CheckPreview Control(ViewMenuPreview).Disabled = True END IF END IF - $End If -End Sub + $END IF +END SUB -Sub SaveForm (ExitToQB64 As _Byte, SaveOnlyFrm As _Byte) - Dim BaseOutputFileName As String, j As Long - Dim TextFileNum As Integer, Answer As _Byte, b$, i As Long - Dim a$, FontSetup$, FindSep As Integer, NewFontFile As String - Dim Dummy As Long, BackupFile$ - Dim PreserveBackup As _Byte, BackupCode$ - Dim tempThisFileName$ +SUB SaveForm (ExitToQB64 AS _BYTE, SaveOnlyFrm AS _BYTE) + DIM BaseOutputFileName AS STRING, j AS LONG + DIM TextFileNum AS INTEGER, Answer AS _BYTE, b$, i AS LONG + DIM a$, FontSetup$, FindSep AS INTEGER, NewFontFile AS STRING + DIM Dummy AS LONG, BackupFile$ + DIM PreserveBackup AS _BYTE, BackupCode$ + DIM tempThisFileName$ tempThisFileName$ = ThisFileName$ - If UCase$(Right$(tempThisFileName$, 4)) = ".FRM" Or UCase$(Right$(tempThisFileName$, 4)) = ".BAS" Then - tempThisFileName$ = Left$(tempThisFileName$, Len(tempThisFileName$) - 4) - End If + IF UCASE$(RIGHT$(tempThisFileName$, 4)) = ".FRM" OR UCASE$(RIGHT$(tempThisFileName$, 4)) = ".BAS" THEN + tempThisFileName$ = LEFT$(tempThisFileName$, LEN(tempThisFileName$) - 4) + END IF BaseOutputFileName = CurrentPath$ + PathSep$ + tempThisFileName$ - If (_FileExists(BaseOutputFileName + ".bas") And SaveOnlyFrm = False) And _FileExists(BaseOutputFileName + ".frm") Then - b$ = "These files will be overwritten:" + Chr$(10) + " " - b$ = b$ + tempThisFileName$ + ".bas" + Chr$(10) + " " - b$ = b$ + tempThisFileName$ + ".frm" + Chr$(10) + IF (_FILEEXISTS(BaseOutputFileName + ".bas") AND SaveOnlyFrm = False) AND _FILEEXISTS(BaseOutputFileName + ".frm") THEN + b$ = "These files will be overwritten:" + CHR$(10) + " " + b$ = b$ + tempThisFileName$ + ".bas" + CHR$(10) + " " + b$ = b$ + tempThisFileName$ + ".frm" + CHR$(10) b$ = b$ + "Proceed?" - ElseIf (_FileExists(BaseOutputFileName + ".bas") And SaveOnlyFrm = False) And _FileExists(BaseOutputFileName + ".frm") = 0 Then - b$ = "'" + tempThisFileName$ + ".bas" + "' will be overwritten." + Chr$(10) + ELSEIF (_FILEEXISTS(BaseOutputFileName + ".bas") AND SaveOnlyFrm = False) AND _FILEEXISTS(BaseOutputFileName + ".frm") = 0 THEN + b$ = "'" + tempThisFileName$ + ".bas" + "' will be overwritten." + CHR$(10) b$ = b$ + "Proceed?" - ElseIf _FileExists(BaseOutputFileName + ".frm") Then - b$ = "'" + tempThisFileName$ + ".frm" + "' will be overwritten." + Chr$(10) + ELSEIF _FILEEXISTS(BaseOutputFileName + ".frm") THEN + b$ = "'" + tempThisFileName$ + ".frm" + "' will be overwritten." + CHR$(10) b$ = b$ + "Proceed?" - End If + END IF - If Len(b$) > 0 Then - Answer = MessageBox(b$, "", MsgBox_YesNo + MsgBox_Question) - If Answer = MsgBox_No Then Exit Sub - End If + IF LEN(b$) > 0 THEN + Answer = _MESSAGEBOX(UiEditorTitle$, b$, "yesno", "question", 0) + IF Answer = 0 THEN EXIT SUB + END IF AddGifExtension = Control(AddGifExtensionToggle).Value - If (AddGifExtension Or Control(AddGifExtensionToggle).Value) And LoadedWithGifExtension = False And TotalGifLoaded = 0 Then - Answer = MessageBox("Are you sure you want to include the GIF extension?\n(no animated GIFs have been added to this form)", "", MsgBox_YesNo + MsgBox_Question) - AddGifExtension = (Answer = MsgBox_Yes) - End If + IF (AddGifExtension OR Control(AddGifExtensionToggle).Value) AND LoadedWithGifExtension = False AND TotalGifLoaded = 0 THEN + Answer = _MESSAGEBOX(UiEditorTitle$, "Are you sure you want to include the GIF extension?\n(no animated GIFs have been added to this form)", "yesno", "question", 0) + AddGifExtension = (Answer = 1) + END IF AddToRecentList BaseOutputFileName + ".frm" 'Backup existing files - For i = 1 To 2 - If i = 1 Then - If SaveOnlyFrm Then - _Continue - Else + FOR i = 1 TO 2 + IF i = 1 THEN + IF SaveOnlyFrm THEN + _CONTINUE + ELSE BackupFile$ = BaseOutputFileName + ".bas" - End If - End If - If i = 2 Then BackupFile$ = BaseOutputFileName + ".frm" + END IF + END IF + IF i = 2 THEN BackupFile$ = BaseOutputFileName + ".frm" - If _FileExists(BackupFile$) Then - TextFileNum = FreeFile - Open BackupFile$ For Binary As #TextFileNum - b$ = Space$(LOF(TextFileNum)) - Get #TextFileNum, 1, b$ - Close #TextFileNum + IF _FILEEXISTS(BackupFile$) THEN + TextFileNum = FREEFILE + OPEN BackupFile$ FOR BINARY AS #TextFileNum + b$ = SPACE$(LOF(TextFileNum)) + GET #TextFileNum, 1, b$ + CLOSE #TextFileNum - TextFileNum = FreeFile - Open BackupFile$ + "-backup" For Output As #TextFileNum: Close #TextFileNum - Open BackupFile$ + "-backup" For Binary As #TextFileNum - Put #TextFileNum, 1, b$ - Close #TextFileNum + TextFileNum = FREEFILE + OPEN BackupFile$ + "-backup" FOR OUTPUT AS #TextFileNum: CLOSE #TextFileNum + OPEN BackupFile$ + "-backup" FOR BINARY AS #TextFileNum + PUT #TextFileNum, 1, b$ + CLOSE #TextFileNum - If i = 1 Then - BackupCode$ = Replace$(b$, Chr$(13) + Chr$(10), Chr$(10), 0, 0) + IF i = 1 THEN + BackupCode$ = Replace$(b$, CHR$(13) + CHR$(10), CHR$(10), 0, 0) PreserveBackup = True - End If - End If - Next + END IF + END IF + NEXT '.FRM file - TextFileNum = FreeFile - Open BaseOutputFileName + ".frm" For Output As #TextFileNum - Print #TextFileNum, "': This form was generated by" - Print #TextFileNum, "': InForm - GUI library for QB64 - "; __UI_Version - Print #TextFileNum, "': Fellippe Heitor, " + __UI_CopyrightSpan + " - fellippe@qb64.org - @fellippeheitor" - Print #TextFileNum, "': https://github.com/FellippeHeitor/InForm" - Print #TextFileNum, "'-----------------------------------------------------------" - Print #TextFileNum, "SUB __UI_LoadForm" - Print #TextFileNum, - If Len(PreviewTexts(PreviewFormID)) > 0 Then - Print #TextFileNum, " $EXEICON:'" + PreviewTexts(PreviewFormID) + "'" - End If - If PreviewControls(PreviewFormID).CanResize Then - Print #TextFileNum, " $RESIZE:ON" - End If - Print #TextFileNum, " DIM __UI_NewID AS LONG, __UI_RegisterResult AS LONG" - Print #TextFileNum, + TextFileNum = FREEFILE + OPEN BaseOutputFileName + ".frm" FOR OUTPUT AS #TextFileNum + PRINT #TextFileNum, "': This form was generated by" + PRINT #TextFileNum, "': InForm - GUI library for QB64 - "; __UI_Version + PRINT #TextFileNum, "': Fellippe Heitor, " + __UI_CopyrightSpan + " - fellippe@qb64.org - @fellippeheitor" + PRINT #TextFileNum, "': https://github.com/FellippeHeitor/InForm" + PRINT #TextFileNum, "'-----------------------------------------------------------" + PRINT #TextFileNum, "SUB __UI_LoadForm" + PRINT #TextFileNum, + IF LEN(PreviewTexts(PreviewFormID)) > 0 THEN + PRINT #TextFileNum, " $EXEICON:'" + PreviewTexts(PreviewFormID) + "'" + END IF + IF PreviewControls(PreviewFormID).CanResize THEN + PRINT #TextFileNum, " $RESIZE:ON" + END IF + PRINT #TextFileNum, " DIM __UI_NewID AS LONG, __UI_RegisterResult AS LONG" + PRINT #TextFileNum, 'First pass is for the main form and containers (frames and menubars). 'Second pass is for the rest of controls. 'Controls named __UI_+anything are ignored, as they are automatically created. - Dim ThisPass As _Byte, AddContextMenuToForm As String - For ThisPass = 1 To 2 - For i = 1 To UBound(PreviewControls) - If PreviewControls(i).ID > 0 And PreviewControls(i).Type <> __UI_Type_MenuPanel And PreviewControls(i).Type <> __UI_Type_Font And Len(RTrim$(PreviewControls(i).Name)) > 0 Then - If UCase$(Left$(PreviewControls(i).Name, 5)) = "__UI_" Then GoTo EndOfThisPass 'Internal controls + DIM ThisPass AS _BYTE, AddContextMenuToForm AS STRING + FOR ThisPass = 1 TO 2 + FOR i = 1 TO UBOUND(PreviewControls) + IF PreviewControls(i).ID > 0 AND PreviewControls(i).Type <> __UI_Type_MenuPanel AND PreviewControls(i).Type <> __UI_Type_Font AND LEN(RTRIM$(PreviewControls(i).Name)) > 0 THEN + IF UCASE$(LEFT$(PreviewControls(i).Name, 5)) = "__UI_" THEN GOTO EndOfThisPass 'Internal controls a$ = " __UI_NewID = __UI_NewControl(" - Select Case PreviewControls(i).Type - Case __UI_Type_Form: a$ = a$ + "__UI_Type_Form, ": If ThisPass = 2 Then GoTo EndOfThisPass - Case __UI_Type_Frame: a$ = a$ + "__UI_Type_Frame, ": If ThisPass = 2 Then GoTo EndOfThisPass - Case __UI_Type_Button: a$ = a$ + "__UI_Type_Button, ": If ThisPass = 1 Then GoTo EndOfThisPass - Case __UI_Type_Label: a$ = a$ + "__UI_Type_Label, ": If ThisPass = 1 Then GoTo EndOfThisPass - Case __UI_Type_CheckBox: a$ = a$ + "__UI_Type_CheckBox, ": If ThisPass = 1 Then GoTo EndOfThisPass - Case __UI_Type_RadioButton: a$ = a$ + "__UI_Type_RadioButton, ": If ThisPass = 1 Then GoTo EndOfThisPass - Case __UI_Type_TextBox: a$ = a$ + "__UI_Type_TextBox, ": If ThisPass = 1 Then GoTo EndOfThisPass - Case __UI_Type_ProgressBar: a$ = a$ + "__UI_Type_ProgressBar, ": If ThisPass = 1 Then GoTo EndOfThisPass - Case __UI_Type_ListBox: a$ = a$ + "__UI_Type_ListBox, ": If ThisPass = 1 Then GoTo EndOfThisPass - Case __UI_Type_DropdownList: a$ = a$ + "__UI_Type_DropdownList, ": If ThisPass = 1 Then GoTo EndOfThisPass - Case __UI_Type_MenuBar: a$ = a$ + "__UI_Type_MenuBar, ": If ThisPass = 2 Then GoTo EndOfThisPass - Case __UI_Type_MenuItem: a$ = a$ + "__UI_Type_MenuItem, ": If ThisPass = 1 Then GoTo EndOfThisPass - Case __UI_Type_PictureBox: a$ = a$ + "__UI_Type_PictureBox, ": If ThisPass = 1 Then GoTo EndOfThisPass - Case __UI_Type_TrackBar: a$ = a$ + "__UI_Type_TrackBar, ": If ThisPass = 1 Then GoTo EndOfThisPass - Case __UI_Type_ContextMenu: a$ = a$ + "__UI_Type_ContextMenu, ": If ThisPass = 2 Then GoTo EndOfThisPass - Case __UI_Type_ToggleSwitch: a$ = a$ + "__UI_Type_ToggleSwitch, ": If ThisPass = 1 Then GoTo EndOfThisPass - End Select - a$ = a$ + Chr$(34) + RTrim$(PreviewControls(i).Name) + Chr$(34) + "," - a$ = a$ + Str$(PreviewControls(i).Width) + "," - a$ = a$ + Str$(PreviewControls(i).Height) + "," - a$ = a$ + Str$(PreviewControls(i).Left) + "," - a$ = a$ + Str$(PreviewControls(i).Top) + "," - If Len(PreviewParentIDS(i)) > 0 Then - a$ = a$ + " __UI_GetID(" + Chr$(34) + PreviewParentIDS(i) + Chr$(34) + "))" - Else + SELECT CASE PreviewControls(i).Type + CASE __UI_Type_Form: a$ = a$ + "__UI_Type_Form, ": IF ThisPass = 2 THEN GOTO EndOfThisPass + CASE __UI_Type_Frame: a$ = a$ + "__UI_Type_Frame, ": IF ThisPass = 2 THEN GOTO EndOfThisPass + CASE __UI_Type_Button: a$ = a$ + "__UI_Type_Button, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_Label: a$ = a$ + "__UI_Type_Label, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_CheckBox: a$ = a$ + "__UI_Type_CheckBox, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_RadioButton: a$ = a$ + "__UI_Type_RadioButton, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_TextBox: a$ = a$ + "__UI_Type_TextBox, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_ProgressBar: a$ = a$ + "__UI_Type_ProgressBar, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_ListBox: a$ = a$ + "__UI_Type_ListBox, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_DropdownList: a$ = a$ + "__UI_Type_DropdownList, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_MenuBar: a$ = a$ + "__UI_Type_MenuBar, ": IF ThisPass = 2 THEN GOTO EndOfThisPass + CASE __UI_Type_MenuItem: a$ = a$ + "__UI_Type_MenuItem, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_PictureBox: a$ = a$ + "__UI_Type_PictureBox, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_TrackBar: a$ = a$ + "__UI_Type_TrackBar, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + CASE __UI_Type_ContextMenu: a$ = a$ + "__UI_Type_ContextMenu, ": IF ThisPass = 2 THEN GOTO EndOfThisPass + CASE __UI_Type_ToggleSwitch: a$ = a$ + "__UI_Type_ToggleSwitch, ": IF ThisPass = 1 THEN GOTO EndOfThisPass + END SELECT + a$ = a$ + CHR$(34) + RTRIM$(PreviewControls(i).Name) + CHR$(34) + "," + a$ = a$ + STR$(PreviewControls(i).Width) + "," + a$ = a$ + STR$(PreviewControls(i).Height) + "," + a$ = a$ + STR$(PreviewControls(i).Left) + "," + a$ = a$ + STR$(PreviewControls(i).Top) + "," + IF LEN(PreviewParentIDS(i)) > 0 THEN + a$ = a$ + " __UI_GetID(" + CHR$(34) + PreviewParentIDS(i) + CHR$(34) + "))" + ELSE a$ = a$ + " 0)" - End If - Print #TextFileNum, a$ - Print #TextFileNum, " __UI_RegisterResult = 0" + END IF + PRINT #TextFileNum, a$ + PRINT #TextFileNum, " __UI_RegisterResult = 0" - If PreviewControls(i).Type = __UI_Type_ContextMenu Then - Print #TextFileNum, - If Len(AddContextMenuToForm) > 0 And RTrim$(PreviewControls(i).Name) = AddContextMenuToForm Then - Print #TextFileNum, " Control(__UI_FormID).ContextMenuID = __UI_GetID(" + Chr$(34) + AddContextMenuToForm + Chr$(34) + ")" - Print #TextFileNum, + IF PreviewControls(i).Type = __UI_Type_ContextMenu THEN + PRINT #TextFileNum, + IF LEN(AddContextMenuToForm) > 0 AND RTRIM$(PreviewControls(i).Name) = AddContextMenuToForm THEN + PRINT #TextFileNum, " Control(__UI_FormID).ContextMenuID = __UI_GetID(" + CHR$(34) + AddContextMenuToForm + CHR$(34) + ")" + PRINT #TextFileNum, AddContextMenuToForm = "" - End If - _Continue - End If + END IF + _CONTINUE + END IF - If PreviewDefaultButtonID = i Then - Print #TextFileNum, " __UI_DefaultButtonID = __UI_NewID" - End If + IF PreviewDefaultButtonID = i THEN + PRINT #TextFileNum, " __UI_DefaultButtonID = __UI_NewID" + END IF - If Len(PreviewCaptions(i)) > 0 Then - Select Case PreviewControls(i).Type + IF LEN(PreviewCaptions(i)) > 0 THEN + SELECT CASE PreviewControls(i).Type CASE __UI_Type_Form, __UI_Type_Frame, __UI_Type_Button, _ __UI_Type_Label, __UI_Type_CheckBox, __UI_Type_RadioButton, _ __UI_Type_TextBox, __UI_Type_ProgressBar, __UI_Type_MenuBar, _ __UI_Type_MenuItem a$ = " SetCaption __UI_NewID, " + SpecialCharsToEscapeCode$(PreviewCaptions(i)) - Print #TextFileNum, a$ - End Select - End If + PRINT #TextFileNum, a$ + END SELECT + END IF - If Len(PreviewTips(i)) > 0 Then + IF LEN(PreviewTips(i)) > 0 THEN a$ = " ToolTip(__UI_NewID) = " + SpecialCharsToEscapeCode$(PreviewTips(i)) - Print #TextFileNum, a$ - End If + PRINT #TextFileNum, a$ + END IF - If Len(PreviewTexts(i)) > 0 Then - Select Case PreviewControls(i).Type - Case __UI_Type_ListBox, __UI_Type_DropdownList - Dim TempCaption$, TempText$, ThisItem% - Dim findLF& + IF LEN(PreviewTexts(i)) > 0 THEN + SELECT CASE PreviewControls(i).Type + CASE __UI_Type_ListBox, __UI_Type_DropdownList + DIM TempCaption$, TempText$, ThisItem% + DIM findLF& TempText$ = PreviewTexts(i) ThisItem% = 0 - Do While Len(TempText$) + DO WHILE LEN(TempText$) ThisItem% = ThisItem% + 1 - findLF& = InStr(TempText$, Chr$(10)) - If findLF& Then - TempCaption$ = Left$(TempText$, findLF& - 1) - TempText$ = Mid$(TempText$, findLF& + 1) - Else + findLF& = INSTR(TempText$, CHR$(10)) + IF findLF& THEN + TempCaption$ = LEFT$(TempText$, findLF& - 1) + TempText$ = MID$(TempText$, findLF& + 1) + ELSE TempCaption$ = TempText$ TempText$ = "" - End If - a$ = " AddItem __UI_NewID, " + Chr$(34) + TempCaption$ + Chr$(34) - Print #TextFileNum, a$ - Loop - Case __UI_Type_PictureBox, __UI_Type_Button, __UI_Type_MenuItem - If AddGifExtension And PreviewAnimatedGif(i) Then - a$ = " __UI_RegisterResult = OpenGif(__UI_NewID, " + Chr$(34) + PreviewTexts(i) + Chr$(34) + ")" - Else - a$ = " LoadImage Control(__UI_NewID), " + Chr$(34) + PreviewTexts(i) + Chr$(34) - End If - Print #TextFileNum, a$ + END IF + a$ = " AddItem __UI_NewID, " + CHR$(34) + TempCaption$ + CHR$(34) + PRINT #TextFileNum, a$ + LOOP + CASE __UI_Type_PictureBox, __UI_Type_Button, __UI_Type_MenuItem + IF AddGifExtension AND PreviewAnimatedGif(i) THEN + a$ = " __UI_RegisterResult = OpenGif(__UI_NewID, " + CHR$(34) + PreviewTexts(i) + CHR$(34) + ")" + ELSE + a$ = " LoadImage Control(__UI_NewID), " + CHR$(34) + PreviewTexts(i) + CHR$(34) + END IF + PRINT #TextFileNum, a$ - If AddGifExtension And PreviewAutoPlayGif(i) Then + IF AddGifExtension AND PreviewAutoPlayGif(i) THEN a$ = " IF __UI_RegisterResult THEN PlayGif __UI_NewID" - Print #TextFileNum, a$ - End If - Case Else - If PreviewControls(i).Type = __UI_Type_TextBox And PreviewControls(i).NumericOnly <> 0 Then + PRINT #TextFileNum, a$ + END IF + CASE ELSE + IF PreviewControls(i).Type = __UI_Type_TextBox AND PreviewControls(i).NumericOnly <> 0 THEN 'skip saving Text() for NumericTextBox controls - Else + ELSE a$ = " Text(__UI_NewID) = " + SpecialCharsToEscapeCode$(PreviewTexts(i)) - Print #TextFileNum, a$ - End If - End Select - End If - If Len(PreviewMasks(i)) > 0 Then + PRINT #TextFileNum, a$ + END IF + END SELECT + END IF + IF LEN(PreviewMasks(i)) > 0 THEN a$ = " Mask(__UI_NewID) = " + SpecialCharsToEscapeCode$(PreviewMasks(i)) - Print #TextFileNum, a$ - End If - If PreviewControls(i).TransparentColor > 0 Then - Print #TextFileNum, " __UI_ClearColor Control(__UI_NewID).HelperCanvas, " + LTrim$(Str$(PreviewControls(i).TransparentColor)) + ", -1" - End If - If PreviewControls(i).Stretch = True Then - Print #TextFileNum, " Control(__UI_NewID).Stretch = True" - End If + PRINT #TextFileNum, a$ + END IF + IF PreviewControls(i).TransparentColor > 0 THEN + PRINT #TextFileNum, " __UI_ClearColor Control(__UI_NewID).HelperCanvas, " + LTRIM$(STR$(PreviewControls(i).TransparentColor)) + ", -1" + END IF + IF PreviewControls(i).Stretch = True THEN + PRINT #TextFileNum, " Control(__UI_NewID).Stretch = True" + END IF 'Fonts - If Len(PreviewFonts(i)) > 0 Then + IF LEN(PreviewFonts(i)) > 0 THEN FontSetup$ = PreviewFonts(i) 'Parse FontSetup$ into Font variables - FindSep = InStr(FontSetup$, ",") - NewFontFile = Left$(FontSetup$, FindSep - 1) - FontSetup$ = Mid$(FontSetup$, FindSep + 1) + FindSep = INSTR(FontSetup$, ",") + NewFontFile = LEFT$(FontSetup$, FindSep - 1) + FontSetup$ = MID$(FontSetup$, FindSep + 1) - FontSetup$ = "SetFont(" + Chr$(34) + NewFontFile + Chr$(34) + ", " + FontSetup$ + ")" - Print #TextFileNum, " Control(__UI_NewID).Font = " + FontSetup$ - End If + FontSetup$ = "SetFont(" + CHR$(34) + NewFontFile + CHR$(34) + ", " + FontSetup$ + ")" + PRINT #TextFileNum, " Control(__UI_NewID).Font = " + FontSetup$ + END IF 'Colors are saved only if they differ from the theme's defaults - If PreviewControls(i).ForeColor > 0 And PreviewControls(i).ForeColor <> __UI_DefaultColor(PreviewControls(i).Type, 1) Then - Print #TextFileNum, " Control(__UI_NewID).ForeColor = _RGB32(" + LTrim$(Str$(_Red32(PreviewControls(i).ForeColor))) + ", " + LTrim$(Str$(_Green32(PreviewControls(i).ForeColor))) + ", " + LTrim$(Str$(_Blue32(PreviewControls(i).ForeColor))) + ")" - End If - If PreviewControls(i).BackColor > 0 And PreviewControls(i).BackColor <> __UI_DefaultColor(PreviewControls(i).Type, 2) Then - Print #TextFileNum, " Control(__UI_NewID).BackColor = _RGB32(" + LTrim$(Str$(_Red32(PreviewControls(i).BackColor))) + ", " + LTrim$(Str$(_Green32(PreviewControls(i).BackColor))) + ", " + LTrim$(Str$(_Blue32(PreviewControls(i).BackColor))) + ")" - End If - If PreviewControls(i).SelectedForeColor > 0 And PreviewControls(i).SelectedForeColor <> __UI_DefaultColor(PreviewControls(i).Type, 3) Then - Print #TextFileNum, " Control(__UI_NewID).SelectedForeColor = _RGB32(" + LTrim$(Str$(_Red32(PreviewControls(i).SelectedForeColor))) + ", " + LTrim$(Str$(_Green32(PreviewControls(i).SelectedForeColor))) + ", " + LTrim$(Str$(_Blue32(PreviewControls(i).SelectedForeColor))) + ")" - End If - If PreviewControls(i).SelectedBackColor > 0 And PreviewControls(i).SelectedBackColor <> __UI_DefaultColor(PreviewControls(i).Type, 4) Then - Print #TextFileNum, " Control(__UI_NewID).SelectedBackColor = _RGB32(" + LTrim$(Str$(_Red32(PreviewControls(i).SelectedBackColor))) + ", " + LTrim$(Str$(_Green32(PreviewControls(i).SelectedBackColor))) + ", " + LTrim$(Str$(_Blue32(PreviewControls(i).SelectedBackColor))) + ")" - End If - If PreviewControls(i).BorderColor > 0 And PreviewControls(i).BorderColor <> __UI_DefaultColor(PreviewControls(i).Type, 5) Then - Print #TextFileNum, " Control(__UI_NewID).BorderColor = _RGB32(" + LTrim$(Str$(_Red32(PreviewControls(i).BorderColor))) + ", " + LTrim$(Str$(_Green32(PreviewControls(i).BorderColor))) + ", " + LTrim$(Str$(_Blue32(PreviewControls(i).BorderColor))) + ")" - End If - If PreviewControls(i).BackStyle = __UI_Transparent Then - Print #TextFileNum, " Control(__UI_NewID).BackStyle = __UI_Transparent" - End If - If PreviewControls(i).HasBorder Then - Print #TextFileNum, " Control(__UI_NewID).HasBorder = True" - Else - Print #TextFileNum, " Control(__UI_NewID).HasBorder = False" - End If - If PreviewControls(i).Align = __UI_Center Then - Print #TextFileNum, " Control(__UI_NewID).Align = __UI_Center" - ElseIf PreviewControls(i).Align = __UI_Right Then - Print #TextFileNum, " Control(__UI_NewID).Align = __UI_Right" - End If - If PreviewControls(i).VAlign = __UI_Middle Then - Print #TextFileNum, " Control(__UI_NewID).VAlign = __UI_Middle" - ElseIf PreviewControls(i).VAlign = __UI_Bottom Then - Print #TextFileNum, " Control(__UI_NewID).VAlign = __UI_Bottom" - End If - If PreviewControls(i).PasswordField = True And PreviewControls(i).Type = __UI_Type_TextBox Then - Print #TextFileNum, " Control(__UI_NewID).PasswordField = True" - End If - If PreviewControls(i).Value <> 0 Then - Print #TextFileNum, " Control(__UI_NewID).Value = " + LTrim$(Str$(PreviewControls(i).Value)) - End If - If PreviewControls(i).Min <> 0 Then - Print #TextFileNum, " Control(__UI_NewID).Min = " + LTrim$(Str$(PreviewControls(i).Min)) - End If - If PreviewControls(i).Max <> 0 Then + IF PreviewControls(i).ForeColor > 0 AND PreviewControls(i).ForeColor <> __UI_DefaultColor(PreviewControls(i).Type, 1) THEN + PRINT #TextFileNum, " Control(__UI_NewID).ForeColor = _RGB32(" + LTRIM$(STR$(_RED32(PreviewControls(i).ForeColor))) + ", " + LTRIM$(STR$(_GREEN32(PreviewControls(i).ForeColor))) + ", " + LTRIM$(STR$(_BLUE32(PreviewControls(i).ForeColor))) + ")" + END IF + IF PreviewControls(i).BackColor > 0 AND PreviewControls(i).BackColor <> __UI_DefaultColor(PreviewControls(i).Type, 2) THEN + PRINT #TextFileNum, " Control(__UI_NewID).BackColor = _RGB32(" + LTRIM$(STR$(_RED32(PreviewControls(i).BackColor))) + ", " + LTRIM$(STR$(_GREEN32(PreviewControls(i).BackColor))) + ", " + LTRIM$(STR$(_BLUE32(PreviewControls(i).BackColor))) + ")" + END IF + IF PreviewControls(i).SelectedForeColor > 0 AND PreviewControls(i).SelectedForeColor <> __UI_DefaultColor(PreviewControls(i).Type, 3) THEN + PRINT #TextFileNum, " Control(__UI_NewID).SelectedForeColor = _RGB32(" + LTRIM$(STR$(_RED32(PreviewControls(i).SelectedForeColor))) + ", " + LTRIM$(STR$(_GREEN32(PreviewControls(i).SelectedForeColor))) + ", " + LTRIM$(STR$(_BLUE32(PreviewControls(i).SelectedForeColor))) + ")" + END IF + IF PreviewControls(i).SelectedBackColor > 0 AND PreviewControls(i).SelectedBackColor <> __UI_DefaultColor(PreviewControls(i).Type, 4) THEN + PRINT #TextFileNum, " Control(__UI_NewID).SelectedBackColor = _RGB32(" + LTRIM$(STR$(_RED32(PreviewControls(i).SelectedBackColor))) + ", " + LTRIM$(STR$(_GREEN32(PreviewControls(i).SelectedBackColor))) + ", " + LTRIM$(STR$(_BLUE32(PreviewControls(i).SelectedBackColor))) + ")" + END IF + IF PreviewControls(i).BorderColor > 0 AND PreviewControls(i).BorderColor <> __UI_DefaultColor(PreviewControls(i).Type, 5) THEN + PRINT #TextFileNum, " Control(__UI_NewID).BorderColor = _RGB32(" + LTRIM$(STR$(_RED32(PreviewControls(i).BorderColor))) + ", " + LTRIM$(STR$(_GREEN32(PreviewControls(i).BorderColor))) + ", " + LTRIM$(STR$(_BLUE32(PreviewControls(i).BorderColor))) + ")" + END IF + IF PreviewControls(i).BackStyle = __UI_Transparent THEN + PRINT #TextFileNum, " Control(__UI_NewID).BackStyle = __UI_Transparent" + END IF + IF PreviewControls(i).HasBorder THEN + PRINT #TextFileNum, " Control(__UI_NewID).HasBorder = True" + ELSE + PRINT #TextFileNum, " Control(__UI_NewID).HasBorder = False" + END IF + IF PreviewControls(i).Align = __UI_Center THEN + PRINT #TextFileNum, " Control(__UI_NewID).Align = __UI_Center" + ELSEIF PreviewControls(i).Align = __UI_Right THEN + PRINT #TextFileNum, " Control(__UI_NewID).Align = __UI_Right" + END IF + IF PreviewControls(i).VAlign = __UI_Middle THEN + PRINT #TextFileNum, " Control(__UI_NewID).VAlign = __UI_Middle" + ELSEIF PreviewControls(i).VAlign = __UI_Bottom THEN + PRINT #TextFileNum, " Control(__UI_NewID).VAlign = __UI_Bottom" + END IF + IF PreviewControls(i).PasswordField = True AND PreviewControls(i).Type = __UI_Type_TextBox THEN + PRINT #TextFileNum, " Control(__UI_NewID).PasswordField = True" + END IF + IF PreviewControls(i).Value <> 0 THEN + PRINT #TextFileNum, " Control(__UI_NewID).Value = " + LTRIM$(STR$(PreviewControls(i).Value)) + END IF + IF PreviewControls(i).Min <> 0 THEN + PRINT #TextFileNum, " Control(__UI_NewID).Min = " + LTRIM$(STR$(PreviewControls(i).Min)) + END IF + IF PreviewControls(i).Max <> 0 THEN IF PreviewControls(i).Type <> __UI_Type_ListBox AND _ PreviewControls(i).Type <> __UI_Type_DropdownList THEN - Print #TextFileNum, " Control(__UI_NewID).Max = " + LTrim$(Str$(PreviewControls(i).Max)) - End If - End If - If PreviewControls(i).ShowPercentage Then - Print #TextFileNum, " Control(__UI_NewID).ShowPercentage = True" - End If - If PreviewControls(i).CanHaveFocus Then - Print #TextFileNum, " Control(__UI_NewID).CanHaveFocus = True" - End If - If PreviewControls(i).Disabled Then - Print #TextFileNum, " Control(__UI_NewID).Disabled = True" - End If - If PreviewControls(i).Hidden Then - Print #TextFileNum, " Control(__UI_NewID).Hidden = True" - End If - If PreviewControls(i).CenteredWindow Then - Print #TextFileNum, " Control(__UI_NewID).CenteredWindow = True" - End If - If Len(PreviewContextMenu(i)) Then - If PreviewControls(i).Type = __UI_Type_Form Then + PRINT #TextFileNum, " Control(__UI_NewID).Max = " + LTRIM$(STR$(PreviewControls(i).Max)) + END IF + END IF + IF PreviewControls(i).ShowPercentage THEN + PRINT #TextFileNum, " Control(__UI_NewID).ShowPercentage = True" + END IF + IF PreviewControls(i).CanHaveFocus THEN + PRINT #TextFileNum, " Control(__UI_NewID).CanHaveFocus = True" + END IF + IF PreviewControls(i).Disabled THEN + PRINT #TextFileNum, " Control(__UI_NewID).Disabled = True" + END IF + IF PreviewControls(i).Hidden THEN + PRINT #TextFileNum, " Control(__UI_NewID).Hidden = True" + END IF + IF PreviewControls(i).CenteredWindow THEN + PRINT #TextFileNum, " Control(__UI_NewID).CenteredWindow = True" + END IF + IF LEN(PreviewContextMenu(i)) THEN + IF PreviewControls(i).Type = __UI_Type_Form THEN AddContextMenuToForm = PreviewContextMenu(i) - Else - Print #TextFileNum, " Control(__UI_NewID).ContextMenuID = __UI_GetID(" + Chr$(34) + PreviewContextMenu(i) + Chr$(34) + ")" - End If - End If - If Len(PreviewKeyCombos(i)) Then - Print #TextFileNum, " __UI_RegisterResult = RegisterKeyCombo(" + Chr$(34) + PreviewKeyCombos(i) + Chr$(34) + ", __UI_NewID)" - End If - If PreviewControls(i).Interval Then - Print #TextFileNum, " Control(__UI_NewID).Interval = " + LTrim$(Str$(PreviewControls(i).Interval)) - End If - If PreviewControls(i).MinInterval Then - Print #TextFileNum, " Control(__UI_NewID).MinInterval = " + LTrim$(Str$(PreviewControls(i).MinInterval)) - End If - If PreviewControls(i).WordWrap Then - Print #TextFileNum, " Control(__UI_NewID).WordWrap = True" - End If - If PreviewControls(i).CanResize And PreviewControls(i).Type = __UI_Type_Form Then - Print #TextFileNum, " Control(__UI_NewID).CanResize = True" - End If - If PreviewControls(i).Padding > 0 Then - Print #TextFileNum, " Control(__UI_NewID).Padding = " + LTrim$(Str$(PreviewControls(i).Padding)) - End If - If PreviewControls(i).BorderSize > 0 Then - Print #TextFileNum, " Control(__UI_NewID).BorderSize = " + LTrim$(Str$(PreviewControls(i).BorderSize)) - End If - If PreviewControls(i).Encoding > 0 Then - Print #TextFileNum, " Control(__UI_NewID).Encoding = " + LTrim$(Str$(PreviewControls(i).Encoding)) - End If - If PreviewControls(i).NumericOnly = True Then - Print #TextFileNum, " Control(__UI_NewID).NumericOnly = True" - ElseIf PreviewControls(i).NumericOnly = __UI_NumericWithBounds Then - Print #TextFileNum, " Control(__UI_NewID).NumericOnly = __UI_NumericWithBounds" - End If - If PreviewControls(i).BulletStyle > 0 Then - Select Case PreviewControls(i).BulletStyle - Case __UI_Bullet - Print #TextFileNum, " Control(__UI_NewID).BulletStyle = __UI_Bullet" - End Select - End If - If PreviewControls(i).AutoScroll Then - Print #TextFileNum, " Control(__UI_NewID).AutoScroll = True" - End If - If PreviewControls(i).AutoSize Then - Print #TextFileNum, " Control(__UI_NewID).AutoSize = True" - End If - Print #TextFileNum, - End If + ELSE + PRINT #TextFileNum, " Control(__UI_NewID).ContextMenuID = __UI_GetID(" + CHR$(34) + PreviewContextMenu(i) + CHR$(34) + ")" + END IF + END IF + IF LEN(PreviewKeyCombos(i)) THEN + PRINT #TextFileNum, " __UI_RegisterResult = RegisterKeyCombo(" + CHR$(34) + PreviewKeyCombos(i) + CHR$(34) + ", __UI_NewID)" + END IF + IF PreviewControls(i).Interval THEN + PRINT #TextFileNum, " Control(__UI_NewID).Interval = " + LTRIM$(STR$(PreviewControls(i).Interval)) + END IF + IF PreviewControls(i).MinInterval THEN + PRINT #TextFileNum, " Control(__UI_NewID).MinInterval = " + LTRIM$(STR$(PreviewControls(i).MinInterval)) + END IF + IF PreviewControls(i).WordWrap THEN + PRINT #TextFileNum, " Control(__UI_NewID).WordWrap = True" + END IF + IF PreviewControls(i).CanResize AND PreviewControls(i).Type = __UI_Type_Form THEN + PRINT #TextFileNum, " Control(__UI_NewID).CanResize = True" + END IF + IF PreviewControls(i).Padding > 0 THEN + PRINT #TextFileNum, " Control(__UI_NewID).Padding = " + LTRIM$(STR$(PreviewControls(i).Padding)) + END IF + IF PreviewControls(i).BorderSize > 0 THEN + PRINT #TextFileNum, " Control(__UI_NewID).BorderSize = " + LTRIM$(STR$(PreviewControls(i).BorderSize)) + END IF + IF PreviewControls(i).Encoding > 0 THEN + PRINT #TextFileNum, " Control(__UI_NewID).Encoding = " + LTRIM$(STR$(PreviewControls(i).Encoding)) + END IF + IF PreviewControls(i).NumericOnly = True THEN + PRINT #TextFileNum, " Control(__UI_NewID).NumericOnly = True" + ELSEIF PreviewControls(i).NumericOnly = __UI_NumericWithBounds THEN + PRINT #TextFileNum, " Control(__UI_NewID).NumericOnly = __UI_NumericWithBounds" + END IF + IF PreviewControls(i).BulletStyle > 0 THEN + SELECT CASE PreviewControls(i).BulletStyle + CASE __UI_Bullet + PRINT #TextFileNum, " Control(__UI_NewID).BulletStyle = __UI_Bullet" + END SELECT + END IF + IF PreviewControls(i).AutoScroll THEN + PRINT #TextFileNum, " Control(__UI_NewID).AutoScroll = True" + END IF + IF PreviewControls(i).AutoSize THEN + PRINT #TextFileNum, " Control(__UI_NewID).AutoSize = True" + END IF + PRINT #TextFileNum, + END IF EndOfThisPass: - Next - Next ThisPass + NEXT + NEXT ThisPass 'Save control bindings - Dim BindingsSection As _Byte - Dim BindingDone(0 To UBound(PreviewControls)) As _Byte - For i = 1 To UBound(PreviewControls) - If Len(PreviewBoundTo(i)) > 0 And BindingDone(i) = False Then - If BindingsSection = False Then - Print #TextFileNum, " 'Control bindings:" + DIM BindingsSection AS _BYTE + DIM BindingDone(0 TO UBOUND(PreviewControls)) AS _BYTE + FOR i = 1 TO UBOUND(PreviewControls) + IF LEN(PreviewBoundTo(i)) > 0 AND BindingDone(i) = False THEN + IF BindingsSection = False THEN + PRINT #TextFileNum, " 'Control bindings:" BindingsSection = True - End If + END IF BindingDone(i) = True - Print #TextFileNum, " __UI_Bind __UI_GetID(" + Chr$(34); - Print #TextFileNum, RTrim$(__UI_TrimAt0$(PreviewControls(i).Name)) + Chr$(34) + "), "; - Print #TextFileNum, "__UI_GetID(" + Chr$(34); - Print #TextFileNum, PreviewBoundTo(i) + Chr$(34) + "), "; - Print #TextFileNum, Chr$(34) + PreviewBoundProperty(i) + Chr$(34) + ", "; - For j = 1 To UBound(PreviewControls) - If PreviewBoundTo(j) = RTrim$(__UI_TrimAt0$(PreviewControls(i).Name)) Then + PRINT #TextFileNum, " __UI_Bind __UI_GetID(" + CHR$(34); + PRINT #TextFileNum, RTRIM$(__UI_TrimAt0$(PreviewControls(i).Name)) + CHR$(34) + "), "; + PRINT #TextFileNum, "__UI_GetID(" + CHR$(34); + PRINT #TextFileNum, PreviewBoundTo(i) + CHR$(34) + "), "; + PRINT #TextFileNum, CHR$(34) + PreviewBoundProperty(i) + CHR$(34) + ", "; + FOR j = 1 TO UBOUND(PreviewControls) + IF PreviewBoundTo(j) = RTRIM$(__UI_TrimAt0$(PreviewControls(i).Name)) THEN BindingDone(j) = True - Print #TextFileNum, Chr$(34) + PreviewBoundProperty(j) + Chr$(34) - Exit For - End If - Next - End If - Next + PRINT #TextFileNum, CHR$(34) + PreviewBoundProperty(j) + CHR$(34) + EXIT FOR + END IF + NEXT + END IF + NEXT - Print #TextFileNum, "END SUB" - Print #TextFileNum, - Print #TextFileNum, "SUB __UI_AssignIDs" - For i = 1 To UBound(PreviewControls) - If PreviewControls(i).ID > 0 And PreviewControls(i).Type <> __UI_Type_Font And PreviewControls(i).Type <> __UI_Type_MenuPanel Then - Print #TextFileNum, " " + RTrim$(__UI_TrimAt0$(PreviewControls(i).Name)) + " = __UI_GetID(" + Chr$(34) + RTrim$(__UI_TrimAt0$(PreviewControls(i).Name)) + Chr$(34) + ")" - End If - Next - Print #TextFileNum, "END SUB" - Close #TextFileNum + PRINT #TextFileNum, "END SUB" + PRINT #TextFileNum, + PRINT #TextFileNum, "SUB __UI_AssignIDs" + FOR i = 1 TO UBOUND(PreviewControls) + IF PreviewControls(i).ID > 0 AND PreviewControls(i).Type <> __UI_Type_Font AND PreviewControls(i).Type <> __UI_Type_MenuPanel THEN + PRINT #TextFileNum, " " + RTRIM$(__UI_TrimAt0$(PreviewControls(i).Name)) + " = __UI_GetID(" + CHR$(34) + RTRIM$(__UI_TrimAt0$(PreviewControls(i).Name)) + CHR$(34) + ")" + END IF + NEXT + PRINT #TextFileNum, "END SUB" + CLOSE #TextFileNum '.BAS file - If Not SaveOnlyFrm Then - If PreserveBackup Then - Dim insertionPoint As Long, endPoint As Long, firstCASE As Long - Dim insertionPoint2 As Long, endPoint2 As Long - Dim temp$, thisBlock$, addedItems$, indenting As Long - Dim checkConditionResult As _Byte, controlToRemove$, found As _Byte - Dim charSep$ + IF NOT SaveOnlyFrm THEN + IF PreserveBackup THEN + DIM insertionPoint AS LONG, endPoint AS LONG, firstCASE AS LONG + DIM insertionPoint2 AS LONG, endPoint2 AS LONG + DIM temp$, thisBlock$, addedItems$, indenting AS LONG + DIM checkConditionResult AS _BYTE, controlToRemove$, found AS _BYTE + DIM charSep$ - charSep$ = " =<>+-/\^:;,*()'" + Chr$(10) + charSep$ = " =<>+-/\^:;,*()'" + CHR$(10) 'Check which controls got removed/renamed since this form was loaded - If Len(InitialControlSet) Then - insertionPoint2 = InStr(InitialControlSet, Chr$(10)) - Do - endPoint2 = InStr(insertionPoint2 + 1, InitialControlSet, Chr$(10)) - thisBlock$ = Mid$(InitialControlSet, insertionPoint2 + 1, endPoint2 - insertionPoint2 - 1) + IF LEN(InitialControlSet) THEN + insertionPoint2 = INSTR(InitialControlSet, CHR$(10)) + DO + endPoint2 = INSTR(insertionPoint2 + 1, InitialControlSet, CHR$(10)) + thisBlock$ = MID$(InitialControlSet, insertionPoint2 + 1, endPoint2 - insertionPoint2 - 1) temp$ = thisBlock$ controlToRemove$ = "" - If InStr(temp$, Chr$(11)) Then + IF INSTR(temp$, CHR$(11)) THEN 'control was in the initial state but got renamed - controlToRemove$ = Left$(temp$, InStr(temp$, Chr$(11)) - 1) - temp$ = Mid$(temp$, InStr(temp$, Chr$(11)) + 1) - Else + controlToRemove$ = LEFT$(temp$, INSTR(temp$, CHR$(11)) - 1) + temp$ = MID$(temp$, INSTR(temp$, CHR$(11)) + 1) + ELSE controlToRemove$ = temp$ - End If + END IF found = False - For i = 1 To UBound(PreviewControls) - If PreviewControls(i).ID > 0 And PreviewControls(i).Type <> __UI_Type_Font And PreviewControls(i).Type <> __UI_Type_MenuPanel Then - If LCase$(RTrim$(PreviewControls(i).Name)) = LCase$(temp$) Then + FOR i = 1 TO UBOUND(PreviewControls) + IF PreviewControls(i).ID > 0 AND PreviewControls(i).Type <> __UI_Type_Font AND PreviewControls(i).Type <> __UI_Type_MenuPanel THEN + IF LCASE$(RTRIM$(PreviewControls(i).Name)) = LCASE$(temp$) THEN found = True - Exit For - End If - End If - Next + EXIT FOR + END IF + END IF + NEXT - If found Then - If InStr(thisBlock$, Chr$(11)) Then + IF found THEN + IF INSTR(thisBlock$, CHR$(11)) THEN 'controlToRemove$ was in the initial state but got renamed to temp$ - insertionPoint = InStr(BackupCode$, controlToRemove$) - Do While insertionPoint > 0 + insertionPoint = INSTR(BackupCode$, controlToRemove$) + DO WHILE insertionPoint > 0 found = True - If OutsideQuotes(BackupCode$, insertionPoint) Then - a$ = Mid$(BackupCode$, insertionPoint - 1, 1) - b$ = Mid$(BackupCode$, insertionPoint + Len(controlToRemove$), 1) - If Len(a$) > 0 And InStr(charSep$, a$) = 0 Then found = False - If Len(b$) > 0 And InStr(charSep$, b$) = 0 Then found = False - If found Then - BackupCode$ = Left$(BackupCode$, insertionPoint - 1) + temp$ + Mid$(BackupCode$, insertionPoint + Len(controlToRemove$)) - End If - End If - insertionPoint = InStr(insertionPoint + 1, BackupCode$, controlToRemove$) - Loop - End If - Else + IF OutsideQuotes(BackupCode$, insertionPoint) THEN + a$ = MID$(BackupCode$, insertionPoint - 1, 1) + b$ = MID$(BackupCode$, insertionPoint + LEN(controlToRemove$), 1) + IF LEN(a$) > 0 AND INSTR(charSep$, a$) = 0 THEN found = False + IF LEN(b$) > 0 AND INSTR(charSep$, b$) = 0 THEN found = False + IF found THEN + BackupCode$ = LEFT$(BackupCode$, insertionPoint - 1) + temp$ + MID$(BackupCode$, insertionPoint + LEN(controlToRemove$)) + END IF + END IF + insertionPoint = INSTR(insertionPoint + 1, BackupCode$, controlToRemove$) + LOOP + END IF + ELSE 'comment next controlToRemove$ occurrences, since the control no longer exists - insertionPoint = InStr(BackupCode$, controlToRemove$) - Do While insertionPoint > 0 + insertionPoint = INSTR(BackupCode$, controlToRemove$) + DO WHILE insertionPoint > 0 found = True - Color 8: Print insertionPoint, Mid$(BackupCode$, insertionPoint, 30) - If OutsideQuotes(BackupCode$, insertionPoint) Then - a$ = Mid$(BackupCode$, insertionPoint - 1, 1) - b$ = Mid$(BackupCode$, insertionPoint + Len(controlToRemove$), 1) - If Len(a$) > 0 And InStr(charSep$, a$) = 0 Then found = False - If Len(b$) > 0 And InStr(charSep$, b$) = 0 Then found = False - If found Then - endPoint = InStr(insertionPoint, BackupCode$, Chr$(10)) - If endPoint = 0 Then endPoint = Len(BackupCode$) - temp$ = " '<-- " + Chr$(34) + controlToRemove$ + Chr$(34) + " deleted from Form on " + Date$ - BackupCode$ = Left$(BackupCode$, endPoint - 1) + temp$ + Mid$(BackupCode$, endPoint) - Color 14: Print insertionPoint, Mid$(BackupCode$, insertionPoint, 30) - End If - End If - Sleep - insertionPoint = InStr(insertionPoint + 1, BackupCode$, controlToRemove$) - Loop - End If + COLOR 8: PRINT insertionPoint, MID$(BackupCode$, insertionPoint, 30) + IF OutsideQuotes(BackupCode$, insertionPoint) THEN + a$ = MID$(BackupCode$, insertionPoint - 1, 1) + b$ = MID$(BackupCode$, insertionPoint + LEN(controlToRemove$), 1) + IF LEN(a$) > 0 AND INSTR(charSep$, a$) = 0 THEN found = False + IF LEN(b$) > 0 AND INSTR(charSep$, b$) = 0 THEN found = False + IF found THEN + endPoint = INSTR(insertionPoint, BackupCode$, CHR$(10)) + IF endPoint = 0 THEN endPoint = LEN(BackupCode$) + temp$ = " '<-- " + CHR$(34) + controlToRemove$ + CHR$(34) + " deleted from Form on " + DATE$ + BackupCode$ = LEFT$(BackupCode$, endPoint - 1) + temp$ + MID$(BackupCode$, endPoint) + COLOR 14: PRINT insertionPoint, MID$(BackupCode$, insertionPoint, 30) + END IF + END IF + SLEEP + insertionPoint = INSTR(insertionPoint + 1, BackupCode$, controlToRemove$) + LOOP + END IF insertionPoint2 = endPoint2 + 1 - Loop While insertionPoint2 < Len(InitialControlSet) - End If + LOOP WHILE insertionPoint2 < LEN(InitialControlSet) + END IF 'Find insertion points in BackupCode$ for eventual new controls '1- Controls' IDs addedItems$ = "" - For i = 1 To UBound(PreviewControls) - If PreviewControls(i).ID > 0 And PreviewControls(i).Type <> __UI_Type_Font And PreviewControls(i).Type <> __UI_Type_MenuPanel Then - temp$ = "DIM SHARED " + RTrim$(__UI_TrimAt0$(PreviewControls(i).Name)) + " AS LONG" - If InStr(BackupCode$, temp$) = 0 Then - addedItems$ = addedItems$ + temp$ + Chr$(10) - End If - End If - Next + FOR i = 1 TO UBOUND(PreviewControls) + IF PreviewControls(i).ID > 0 AND PreviewControls(i).Type <> __UI_Type_Font AND PreviewControls(i).Type <> __UI_Type_MenuPanel THEN + temp$ = "DIM SHARED " + RTRIM$(__UI_TrimAt0$(PreviewControls(i).Name)) + " AS LONG" + IF INSTR(BackupCode$, temp$) = 0 THEN + addedItems$ = addedItems$ + temp$ + CHR$(10) + END IF + END IF + NEXT - insertionPoint = InStr(BackupCode$, "DIM SHARED ") - If Len(addedItems$) Then - BackupCode$ = Left$(BackupCode$, insertionPoint - 1) + addedItems$ + Mid$(BackupCode$, insertionPoint) - End If + insertionPoint = INSTR(BackupCode$, "DIM SHARED ") + IF LEN(addedItems$) THEN + BackupCode$ = LEFT$(BackupCode$, insertionPoint - 1) + addedItems$ + MID$(BackupCode$, insertionPoint) + END IF '2- Remove "control deleted" comments, if any has been readded. - For i = 1 To UBound(PreviewControls) - If PreviewControls(i).ID > 0 And PreviewControls(i).Type <> __UI_Type_Font And PreviewControls(i).Type <> __UI_Type_MenuPanel Then - temp$ = " '<-- " + Chr$(34) + RTrim$(__UI_TrimAt0$(PreviewControls(i).Name)) + Chr$(34) + " deleted from Form on" - insertionPoint = InStr(BackupCode$, temp$) - Do While insertionPoint > 0 - endPoint = InStr(insertionPoint, BackupCode$, Chr$(10)) - BackupCode$ = Left$(BackupCode$, insertionPoint - 1) + Mid$(BackupCode$, endPoint) - insertionPoint = InStr(BackupCode$, temp$) - Loop - End If - Next + FOR i = 1 TO UBOUND(PreviewControls) + IF PreviewControls(i).ID > 0 AND PreviewControls(i).Type <> __UI_Type_Font AND PreviewControls(i).Type <> __UI_Type_MenuPanel THEN + temp$ = " '<-- " + CHR$(34) + RTRIM$(__UI_TrimAt0$(PreviewControls(i).Name)) + CHR$(34) + " deleted from Form on" + insertionPoint = INSTR(BackupCode$, temp$) + DO WHILE insertionPoint > 0 + endPoint = INSTR(insertionPoint, BackupCode$, CHR$(10)) + BackupCode$ = LEFT$(BackupCode$, insertionPoint - 1) + MID$(BackupCode$, endPoint) + insertionPoint = INSTR(BackupCode$, temp$) + LOOP + END IF + NEXT '3- Even procedures - For i = 4 To 13 - Select EveryCase i - Case 4: temp$ = "SUB __UI_Click (id AS LONG)" - Case 5: temp$ = "SUB __UI_MouseEnter (id AS LONG)" - Case 6: temp$ = "SUB __UI_MouseLeave (id AS LONG)" - Case 7: temp$ = "SUB __UI_FocusIn (id AS LONG)" - Case 8: temp$ = "SUB __UI_FocusOut (id AS LONG)" - Case 9: temp$ = "SUB __UI_MouseDown (id AS LONG)" - Case 10: temp$ = "SUB __UI_MouseUp (id AS LONG)" - Case 11: temp$ = "SUB __UI_KeyPress (id AS LONG)" - Case 12: temp$ = "SUB __UI_TextChanged (id AS LONG)" - Case 13: temp$ = "SUB __UI_ValueChanged (id AS LONG)" + FOR i = 4 TO 13 + SELECT EVERYCASE i + CASE 4: temp$ = "SUB __UI_Click (id AS LONG)" + CASE 5: temp$ = "SUB __UI_MouseEnter (id AS LONG)" + CASE 6: temp$ = "SUB __UI_MouseLeave (id AS LONG)" + CASE 7: temp$ = "SUB __UI_FocusIn (id AS LONG)" + CASE 8: temp$ = "SUB __UI_FocusOut (id AS LONG)" + CASE 9: temp$ = "SUB __UI_MouseDown (id AS LONG)" + CASE 10: temp$ = "SUB __UI_MouseUp (id AS LONG)" + CASE 11: temp$ = "SUB __UI_KeyPress (id AS LONG)" + CASE 12: temp$ = "SUB __UI_TextChanged (id AS LONG)" + CASE 13: temp$ = "SUB __UI_ValueChanged (id AS LONG)" - Case 4 To 13 - insertionPoint = InStr(BackupCode$, temp$) - endPoint = InStr(insertionPoint, BackupCode$, "END SUB" + Chr$(10)) + 8 - thisBlock$ = Mid$(BackupCode$, insertionPoint, endPoint - insertionPoint) + CASE 4 TO 13 + insertionPoint = INSTR(BackupCode$, temp$) + endPoint = INSTR(insertionPoint, BackupCode$, "END SUB" + CHR$(10)) + 8 + thisBlock$ = MID$(BackupCode$, insertionPoint, endPoint - insertionPoint) - If InStr(thisBlock$, "SELECT CASE id") Then - firstCASE = InStr(thisBlock$, " CASE ") - If firstCASE Then - firstCASE = _InStrRev(firstCASE, thisBlock$, Chr$(10)) - indenting = InStr(firstCASE, thisBlock$, "CASE ") - firstCASE - 1 - Else + IF INSTR(thisBlock$, "SELECT CASE id") THEN + firstCASE = INSTR(thisBlock$, " CASE ") + IF firstCASE THEN + firstCASE = _INSTRREV(firstCASE, thisBlock$, CHR$(10)) + indenting = INSTR(firstCASE, thisBlock$, "CASE ") - firstCASE - 1 + ELSE indenting = 8 - firstCASE = _InStrRev(InStr(thisBlock$, "END SELECT"), thisBlock$, Chr$(10)) - End If + firstCASE = _INSTRREV(INSTR(thisBlock$, "END SELECT"), thisBlock$, CHR$(10)) + END IF addedItems$ = "" - For Dummy = 1 To UBound(PreviewControls) - GoSub checkCondition - If checkConditionResult Then + FOR Dummy = 1 TO UBOUND(PreviewControls) + GOSUB checkCondition + IF checkConditionResult THEN IF INSTR(thisBlock$, " CASE " + RTRIM$(PreviewControls(Dummy).Name) + CHR$(10)) = 0 AND _ INSTR(thisBlock$, " CASE " + RTRIM$(PreviewControls(Dummy).Name) + " '<-- " + CHR$(34) + RTRIM$(PreviewControls(Dummy).Name) + CHR$(34) + " deleted from Form on ") = 0 THEN - addedItems$ = addedItems$ + Space$(indenting) + "CASE " + RTrim$(PreviewControls(Dummy).Name) + Chr$(10) + Chr$(10) - ElseIf InStr(thisBlock$, " CASE " + RTrim$(PreviewControls(Dummy).Name) + " '<-- " + Chr$(34) + RTrim$(PreviewControls(Dummy).Name) + Chr$(34) + " deleted from Form on ") > 0 Then + addedItems$ = addedItems$ + SPACE$(indenting) + "CASE " + RTRIM$(PreviewControls(Dummy).Name) + CHR$(10) + CHR$(10) + ELSEIF INSTR(thisBlock$, " CASE " + RTRIM$(PreviewControls(Dummy).Name) + " '<-- " + CHR$(34) + RTRIM$(PreviewControls(Dummy).Name) + CHR$(34) + " deleted from Form on ") > 0 THEN thisBlock$ = LEFT$(thisBlock$, INSTR(thisBlock$, " CASE " + RTRIM$(PreviewControls(Dummy).Name) + _ " '<-- " + CHR$(34)) + 5 + LEN(RTRIM$(PreviewControls(Dummy).Name))) + _ MID$(thisBlock$, INSTR(INSTR(thisBlock$, " CASE " + RTRIM$(PreviewControls(Dummy).Name) + _ " '<-- " + CHR$(34) + RTRIM$(PreviewControls(Dummy).Name) + CHR$(34) + _ " deleted from Form on "), thisBlock$, CHR$(10))) - End If - End If - Next + END IF + END IF + NEXT - If Len(addedItems$) Then - thisBlock$ = Left$(thisBlock$, firstCASE) + addedItems$ + Mid$(thisBlock$, firstCASE + 1) - End If + IF LEN(addedItems$) THEN + thisBlock$ = LEFT$(thisBlock$, firstCASE) + addedItems$ + MID$(thisBlock$, firstCASE + 1) + END IF - BackupCode$ = Left$(BackupCode$, insertionPoint - 1) + thisBlock$ + Mid$(BackupCode$, endPoint) - End If - End Select - Next + BackupCode$ = LEFT$(BackupCode$, insertionPoint - 1) + thisBlock$ + MID$(BackupCode$, endPoint) + END IF + END SELECT + NEXT - Open BaseOutputFileName + ".bas" For Output As #TextFileNum: Close #TextFileNum - Open BaseOutputFileName + ".bas" For Binary As #TextFileNum - Put #TextFileNum, , BackupCode$ - Else - Open BaseOutputFileName + ".bas" For Output As #TextFileNum - Print #TextFileNum, "': This program uses" - Print #TextFileNum, "': InForm - GUI library for QB64 - "; __UI_Version - Print #TextFileNum, "': Fellippe Heitor, " + __UI_CopyrightSpan + " - fellippe@qb64.org - @fellippeheitor" - Print #TextFileNum, "': https://github.com/FellippeHeitor/InForm" - Print #TextFileNum, "'-----------------------------------------------------------" - Print #TextFileNum, - Print #TextFileNum, "': Controls' IDs: ------------------------------------------------------------------" - For i = 1 To UBound(PreviewControls) - If PreviewControls(i).ID > 0 And PreviewControls(i).Type <> __UI_Type_Font And PreviewControls(i).Type <> __UI_Type_MenuPanel Then - Print #TextFileNum, "DIM SHARED " + RTrim$(__UI_TrimAt0$(PreviewControls(i).Name)) + " AS LONG" - End If - Next - Print #TextFileNum, - Print #TextFileNum, "': External modules: ---------------------------------------------------------------" - If AddGifExtension Then - Print #TextFileNum, "'$INCLUDE:'InForm\extensions\gifplay.bi'" - End If - Print #TextFileNum, "'$INCLUDE:'InForm\InForm.bi'" - Print #TextFileNum, "'$INCLUDE:'InForm\xp.uitheme'" - Print #TextFileNum, "'$INCLUDE:'" + Mid$(BaseOutputFileName, Len(CurrentPath$) + 2) + ".frm'" - If AddGifExtension Then - Print #TextFileNum, "'$INCLUDE:'InForm\extensions\gifplay.bm'" - End If - Print #TextFileNum, - Print #TextFileNum, "': Event procedures: ---------------------------------------------------------------" - For i = 0 To 14 - Select EveryCase i - Case 0: Print #TextFileNum, "SUB __UI_BeforeInit" - Case 1: Print #TextFileNum, "SUB __UI_OnLoad" - Case 2 - Print #TextFileNum, "SUB __UI_BeforeUpdateDisplay" - Print #TextFileNum, " 'This event occurs at approximately 60 frames per second." - Print #TextFileNum, " 'You can change the update frequency by calling SetFrameRate DesiredRate%" - Case 3 - Print #TextFileNum, "SUB __UI_BeforeUnload" - Print #TextFileNum, " 'If you set __UI_UnloadSignal = False here you can" - Print #TextFileNum, " 'cancel the user's request to close." - Case 4: Print #TextFileNum, "SUB __UI_Click (id AS LONG)" - Case 5: Print #TextFileNum, "SUB __UI_MouseEnter (id AS LONG)" - Case 6: Print #TextFileNum, "SUB __UI_MouseLeave (id AS LONG)" - Case 7: Print #TextFileNum, "SUB __UI_FocusIn (id AS LONG)" - Case 8 - Print #TextFileNum, "SUB __UI_FocusOut (id AS LONG)" - Print #TextFileNum, " 'This event occurs right before a control loses focus." - Print #TextFileNum, " 'To prevent a control from losing focus, set __UI_KeepFocus = True below." - Case 9: Print #TextFileNum, "SUB __UI_MouseDown (id AS LONG)" - Case 10: Print #TextFileNum, "SUB __UI_MouseUp (id AS LONG)" - Case 11 - Print #TextFileNum, "SUB __UI_KeyPress (id AS LONG)" - Print #TextFileNum, " 'When this event is fired, __UI_KeyHit will contain the code of the key hit." - Print #TextFileNum, " 'You can change it and even cancel it by making it = 0" - Case 12: Print #TextFileNum, "SUB __UI_TextChanged (id AS LONG)" - Case 13: Print #TextFileNum, "SUB __UI_ValueChanged (id AS LONG)" - Case 14: Print #TextFileNum, "SUB __UI_FormResized" + OPEN BaseOutputFileName + ".bas" FOR OUTPUT AS #TextFileNum: CLOSE #TextFileNum + OPEN BaseOutputFileName + ".bas" FOR BINARY AS #TextFileNum + PUT #TextFileNum, , BackupCode$ + ELSE + OPEN BaseOutputFileName + ".bas" FOR OUTPUT AS #TextFileNum + PRINT #TextFileNum, "': This program uses" + PRINT #TextFileNum, "': InForm - GUI library for QB64 - "; __UI_Version + PRINT #TextFileNum, "': Fellippe Heitor, " + __UI_CopyrightSpan + " - fellippe@qb64.org - @fellippeheitor" + PRINT #TextFileNum, "': https://github.com/FellippeHeitor/InForm" + PRINT #TextFileNum, "'-----------------------------------------------------------" + PRINT #TextFileNum, + PRINT #TextFileNum, "': Controls' IDs: ------------------------------------------------------------------" + FOR i = 1 TO UBOUND(PreviewControls) + IF PreviewControls(i).ID > 0 AND PreviewControls(i).Type <> __UI_Type_Font AND PreviewControls(i).Type <> __UI_Type_MenuPanel THEN + PRINT #TextFileNum, "DIM SHARED " + RTRIM$(__UI_TrimAt0$(PreviewControls(i).Name)) + " AS LONG" + END IF + NEXT + PRINT #TextFileNum, + PRINT #TextFileNum, "': External modules: ---------------------------------------------------------------" + IF AddGifExtension THEN + PRINT #TextFileNum, "'$INCLUDE:'InForm\extensions\gifplay.bi'" + END IF + PRINT #TextFileNum, "'$INCLUDE:'InForm\InForm.bi'" + PRINT #TextFileNum, "'$INCLUDE:'InForm\xp.uitheme'" + PRINT #TextFileNum, "'$INCLUDE:'" + MID$(BaseOutputFileName, LEN(CurrentPath$) + 2) + ".frm'" + IF AddGifExtension THEN + PRINT #TextFileNum, "'$INCLUDE:'InForm\extensions\gifplay.bm'" + END IF + PRINT #TextFileNum, + PRINT #TextFileNum, "': Event procedures: ---------------------------------------------------------------" + FOR i = 0 TO 14 + SELECT EVERYCASE i + CASE 0: PRINT #TextFileNum, "SUB __UI_BeforeInit" + CASE 1: PRINT #TextFileNum, "SUB __UI_OnLoad" + CASE 2 + PRINT #TextFileNum, "SUB __UI_BeforeUpdateDisplay" + PRINT #TextFileNum, " 'This event occurs at approximately 60 frames per second." + PRINT #TextFileNum, " 'You can change the update frequency by calling SetFrameRate DesiredRate%" + CASE 3 + PRINT #TextFileNum, "SUB __UI_BeforeUnload" + PRINT #TextFileNum, " 'If you set __UI_UnloadSignal = False here you can" + PRINT #TextFileNum, " 'cancel the user's request to close." + CASE 4: PRINT #TextFileNum, "SUB __UI_Click (id AS LONG)" + CASE 5: PRINT #TextFileNum, "SUB __UI_MouseEnter (id AS LONG)" + CASE 6: PRINT #TextFileNum, "SUB __UI_MouseLeave (id AS LONG)" + CASE 7: PRINT #TextFileNum, "SUB __UI_FocusIn (id AS LONG)" + CASE 8 + PRINT #TextFileNum, "SUB __UI_FocusOut (id AS LONG)" + PRINT #TextFileNum, " 'This event occurs right before a control loses focus." + PRINT #TextFileNum, " 'To prevent a control from losing focus, set __UI_KeepFocus = True below." + CASE 9: PRINT #TextFileNum, "SUB __UI_MouseDown (id AS LONG)" + CASE 10: PRINT #TextFileNum, "SUB __UI_MouseUp (id AS LONG)" + CASE 11 + PRINT #TextFileNum, "SUB __UI_KeyPress (id AS LONG)" + PRINT #TextFileNum, " 'When this event is fired, __UI_KeyHit will contain the code of the key hit." + PRINT #TextFileNum, " 'You can change it and even cancel it by making it = 0" + CASE 12: PRINT #TextFileNum, "SUB __UI_TextChanged (id AS LONG)" + CASE 13: PRINT #TextFileNum, "SUB __UI_ValueChanged (id AS LONG)" + CASE 14: PRINT #TextFileNum, "SUB __UI_FormResized" - Case 0, 3, 14 - Print #TextFileNum, + CASE 0, 3, 14 + PRINT #TextFileNum, - Case 1 - If PreviewDefaultButtonID > 0 Then - Print #TextFileNum, " __UI_DefaultButtonID = " + RTrim$(__UI_TrimAt0$(PreviewControls(PreviewDefaultButtonID).Name)) - Else - Print #TextFileNum, - End If + CASE 1 + IF PreviewDefaultButtonID > 0 THEN + PRINT #TextFileNum, " __UI_DefaultButtonID = " + RTRIM$(__UI_TrimAt0$(PreviewControls(PreviewDefaultButtonID).Name)) + ELSE + PRINT #TextFileNum, + END IF - Case 2 - If AddGifExtension = True And TotalGifLoaded > 0 Then - Print #TextFileNum, - Print #TextFileNum, " 'The lines below ensure your GIFs will display properly;" - Print #TextFileNum, " 'Please refer to the documentation in 'extensions/README - gifplay.txt'" - For Dummy = 1 To UBound(PreviewControls) - If PreviewAnimatedGif(Dummy) Then - Print #TextFileNum, " UpdateGif " + RTrim$(PreviewControls(Dummy).Name) - End If - Next - Else - Print #TextFileNum, - End If + CASE 2 + IF AddGifExtension = True AND TotalGifLoaded > 0 THEN + PRINT #TextFileNum, + PRINT #TextFileNum, " 'The lines below ensure your GIFs will display properly;" + PRINT #TextFileNum, " 'Please refer to the documentation in 'extensions/README - gifplay.txt'" + FOR Dummy = 1 TO UBOUND(PreviewControls) + IF PreviewAnimatedGif(Dummy) THEN + PRINT #TextFileNum, " UpdateGif " + RTRIM$(PreviewControls(Dummy).Name) + END IF + NEXT + ELSE + PRINT #TextFileNum, + END IF - Case 4 To 6, 9, 10 'All controls except for Menu panels, and internal context menus - Print #TextFileNum, " SELECT CASE id" - For Dummy = 1 To UBound(PreviewControls) - If PreviewControls(Dummy).ID > 0 And PreviewControls(Dummy).Type <> __UI_Type_Font And PreviewControls(Dummy).Type <> __UI_Type_ContextMenu Then - Print #TextFileNum, " CASE " + RTrim$(PreviewControls(Dummy).Name) - Print #TextFileNum, - End If - Next - Print #TextFileNum, " END SELECT" + CASE 4 TO 6, 9, 10 'All controls except for Menu panels, and internal context menus + PRINT #TextFileNum, " SELECT CASE id" + FOR Dummy = 1 TO UBOUND(PreviewControls) + IF PreviewControls(Dummy).ID > 0 AND PreviewControls(Dummy).Type <> __UI_Type_Font AND PreviewControls(Dummy).Type <> __UI_Type_ContextMenu THEN + PRINT #TextFileNum, " CASE " + RTRIM$(PreviewControls(Dummy).Name) + PRINT #TextFileNum, + END IF + NEXT + PRINT #TextFileNum, " END SELECT" - Case 7, 8, 11 'Controls that can have focus only - Print #TextFileNum, " SELECT CASE id" - For Dummy = 1 To UBound(PreviewControls) - If PreviewControls(Dummy).ID > 0 And PreviewControls(Dummy).CanHaveFocus Then - Print #TextFileNum, " CASE " + RTrim$(PreviewControls(Dummy).Name) - Print #TextFileNum, - End If - Next - Print #TextFileNum, " END SELECT" + CASE 7, 8, 11 'Controls that can have focus only + PRINT #TextFileNum, " SELECT CASE id" + FOR Dummy = 1 TO UBOUND(PreviewControls) + IF PreviewControls(Dummy).ID > 0 AND PreviewControls(Dummy).CanHaveFocus THEN + PRINT #TextFileNum, " CASE " + RTRIM$(PreviewControls(Dummy).Name) + PRINT #TextFileNum, + END IF + NEXT + PRINT #TextFileNum, " END SELECT" - Case 12 'Text boxes - Print #TextFileNum, " SELECT CASE id" - For Dummy = 1 To UBound(PreviewControls) - If PreviewControls(Dummy).ID > 0 And (PreviewControls(Dummy).Type = __UI_Type_TextBox) Then - Print #TextFileNum, " CASE " + RTrim$(PreviewControls(Dummy).Name) - Print #TextFileNum, - End If - Next - Print #TextFileNum, " END SELECT" + CASE 12 'Text boxes + PRINT #TextFileNum, " SELECT CASE id" + FOR Dummy = 1 TO UBOUND(PreviewControls) + IF PreviewControls(Dummy).ID > 0 AND (PreviewControls(Dummy).Type = __UI_Type_TextBox) THEN + PRINT #TextFileNum, " CASE " + RTRIM$(PreviewControls(Dummy).Name) + PRINT #TextFileNum, + END IF + NEXT + PRINT #TextFileNum, " END SELECT" - Case 13 'Dropdown list, List box, Track bar, ToggleSwitch, CheckBox - Print #TextFileNum, " SELECT CASE id" - For Dummy = 1 To UBound(PreviewControls) - If PreviewControls(Dummy).ID > 0 And (PreviewControls(Dummy).Type = __UI_Type_ListBox Or PreviewControls(Dummy).Type = __UI_Type_DropdownList Or PreviewControls(Dummy).Type = __UI_Type_TrackBar Or PreviewControls(Dummy).Type = __UI_Type_ToggleSwitch Or PreviewControls(Dummy).Type = __UI_Type_CheckBox Or PreviewControls(Dummy).Type = __UI_Type_RadioButton) Then - Print #TextFileNum, " CASE " + RTrim$(PreviewControls(Dummy).Name) - Print #TextFileNum, - End If - Next - Print #TextFileNum, " END SELECT" - End Select - Print #TextFileNum, "END SUB" - Print #TextFileNum, - Next - End If - Print #TextFileNum, "'$INCLUDE:'InForm\InForm.ui'" - Close #TextFileNum - End If + CASE 13 'Dropdown list, List box, Track bar, ToggleSwitch, CheckBox + PRINT #TextFileNum, " SELECT CASE id" + FOR Dummy = 1 TO UBOUND(PreviewControls) + IF PreviewControls(Dummy).ID > 0 AND (PreviewControls(Dummy).Type = __UI_Type_ListBox OR PreviewControls(Dummy).Type = __UI_Type_DropdownList OR PreviewControls(Dummy).Type = __UI_Type_TrackBar OR PreviewControls(Dummy).Type = __UI_Type_ToggleSwitch OR PreviewControls(Dummy).Type = __UI_Type_CheckBox OR PreviewControls(Dummy).Type = __UI_Type_RadioButton) THEN + PRINT #TextFileNum, " CASE " + RTRIM$(PreviewControls(Dummy).Name) + PRINT #TextFileNum, + END IF + NEXT + PRINT #TextFileNum, " END SELECT" + END SELECT + PRINT #TextFileNum, "END SUB" + PRINT #TextFileNum, + NEXT + END IF + PRINT #TextFileNum, "'$INCLUDE:'InForm\InForm.ui'" + CLOSE #TextFileNum + END IF AddToRecentList BaseOutputFileName + ".frm" - b$ = "Exporting successful. Files output:" + Chr$(10) - If Not SaveOnlyFrm Then b$ = b$ + " " + Mid$(BaseOutputFileName, Len(CurrentPath$) + 2) + ".bas" + Chr$(10) - b$ = b$ + " " + Mid$(BaseOutputFileName, Len(CurrentPath$) + 2) + ".frm" + b$ = "Exporting successful. Files output:" + CHR$(10) + IF NOT SaveOnlyFrm THEN b$ = b$ + " " + MID$(BaseOutputFileName, LEN(CurrentPath$) + 2) + ".bas" + CHR$(10) + b$ = b$ + " " + MID$(BaseOutputFileName, LEN(CurrentPath$) + 2) + ".frm" - If ExitToQB64 And Not SaveOnlyFrm Then - IF _FILEEXISTS(".." + PathSep$ + QB64_EXE) THEN - b$ = b$ + Chr$(10) + Chr$(10) + "Exit to " + QB64_DISPLAY + "?" - Answer = MessageBox(b$, "", MsgBox_YesNo + MsgBox_Question) - If Answer = MsgBox_No Then Edited = False:EXIT SUB - IF _FileExists("UiEditorPreview.frmbin") THEN Kill "UiEditorPreview.frmbin" - $IF WIN THEN - IF _FileExists("..\UiEditorPreview.frmbin") THEN Kill "..\UiEditorPreview.frmbin" - Shell _DontWait ".." + PathSep$ + QB64_EXE + " " + QuotedFilename$(BaseOutputFileName + ".bas") - $ELSE - SHELL _DONTWAIT ".." + PathSep$ + + QB64_EXE + " " + QuotedFilename$(BaseOutputFileName + ".bas") - $END IF - System + IF ExitToQB64 AND NOT SaveOnlyFrm THEN + IF _FILEEXISTS(QB64_EXE_PATH) THEN + b$ = b$ + CHR$(10) + CHR$(10) + "Exit to " + QB64_DISPLAY + "?" + Answer = _MESSAGEBOX(UiEditorTitle$, b$, "yesno", "question", 0) + IF Answer = 0 THEN Edited = False: EXIT SUB + IF _FILEEXISTS("InForm/UiEditorPreview.frmbin") THEN KILL "InForm/UiEditorPreview.frmbin" + SHELL _DONTWAIT QB64_EXE_PATH + " " + QuotedFilename$(BaseOutputFileName + ".bas") + SYSTEM ELSE - b$ = b$ + Chr$(10) + Chr$(10) + "Close the editor?" - Answer = MessageBox(b$, "", MsgBox_YesNo + MsgBox_Question) - If Answer = MsgBox_No Then Edited = False: EXIT SUB - END IF - Else - Answer = MessageBox(b$, "", MsgBox_OkOnly + MsgBox_Information) + b$ = b$ + CHR$(10) + CHR$(10) + "Close the editor?" + Answer = _MESSAGEBOX(UiEditorTitle$, b$, "yesno", "question", 0) + IF Answer = 0 THEN Edited = False: EXIT SUB + END IF + ELSE + _MESSAGEBOX UiEditorTitle$, b$, "info" Edited = False - End If + END IF - Exit Sub + EXIT SUB checkCondition: checkConditionResult = False - Select Case i - Case 4 To 6, 9, 10 'All controls except for Menu panels, and internal context menus - If PreviewControls(Dummy).ID > 0 And PreviewControls(Dummy).Type <> __UI_Type_Font And PreviewControls(Dummy).Type <> __UI_Type_ContextMenu Then + SELECT CASE i + CASE 4 TO 6, 9, 10 'All controls except for Menu panels, and internal context menus + IF PreviewControls(Dummy).ID > 0 AND PreviewControls(Dummy).Type <> __UI_Type_Font AND PreviewControls(Dummy).Type <> __UI_Type_ContextMenu THEN checkConditionResult = True - End If + END IF - Case 7, 8, 11 'Controls that can have focus only - If PreviewControls(Dummy).ID > 0 And PreviewControls(Dummy).CanHaveFocus Then + CASE 7, 8, 11 'Controls that can have focus only + IF PreviewControls(Dummy).ID > 0 AND PreviewControls(Dummy).CanHaveFocus THEN checkConditionResult = True - End If + END IF - Case 12 'Text boxes - If PreviewControls(Dummy).ID > 0 And (PreviewControls(Dummy).Type = __UI_Type_TextBox) Then + CASE 12 'Text boxes + IF PreviewControls(Dummy).ID > 0 AND (PreviewControls(Dummy).Type = __UI_Type_TextBox) THEN checkConditionResult = True - End If + END IF - Case 13 'Dropdown list, List box, Track bar, ToggleSwitch, CheckBox - If PreviewControls(Dummy).ID > 0 And (PreviewControls(Dummy).Type = __UI_Type_ListBox Or PreviewControls(Dummy).Type = __UI_Type_DropdownList Or PreviewControls(Dummy).Type = __UI_Type_TrackBar Or PreviewControls(Dummy).Type = __UI_Type_ToggleSwitch Or PreviewControls(Dummy).Type = __UI_Type_CheckBox Or PreviewControls(Dummy).Type = __UI_Type_RadioButton) Then + CASE 13 'Dropdown list, List box, Track bar, ToggleSwitch, CheckBox + IF PreviewControls(Dummy).ID > 0 AND (PreviewControls(Dummy).Type = __UI_Type_ListBox OR PreviewControls(Dummy).Type = __UI_Type_DropdownList OR PreviewControls(Dummy).Type = __UI_Type_TrackBar OR PreviewControls(Dummy).Type = __UI_Type_ToggleSwitch OR PreviewControls(Dummy).Type = __UI_Type_CheckBox OR PreviewControls(Dummy).Type = __UI_Type_RadioButton) THEN checkConditionResult = True - End If - End Select - Return + END IF + END SELECT + RETURN -End Sub +END SUB -$If WIN Then - Sub LoadFontList - Dim hKey As _Offset - Dim Ky As _Offset - Dim SubKey As String - Dim Value As String - Dim bData As String - Dim dwType As _Unsigned Long - Dim numBytes As _Unsigned Long - Dim numTchars As _Unsigned Long - Dim l As Long - Dim dwIndex As _Unsigned Long +$IF WIN THEN + SUB LoadFontList + DIM hKey AS _OFFSET + DIM Ky AS _OFFSET + DIM SubKey AS STRING + DIM Value AS STRING + DIM bData AS STRING + DIM dwType AS _UNSIGNED LONG + DIM numBytes AS _UNSIGNED LONG + DIM numTchars AS _UNSIGNED LONG + DIM l AS LONG + DIM dwIndex AS _UNSIGNED LONG hKey = hKey 'no warnings on my watch Ky = HKEY_LOCAL_MACHINE - SubKey = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" + Chr$(0) - Value = Space$(261) 'ANSI Value name limit 260 chars + 1 null - bData = Space$(&H7FFF) 'arbitrary + SubKey = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" + CHR$(0) + Value = SPACE$(261) 'ANSI Value name limit 260 chars + 1 null + bData = SPACE$(&H7FFF) 'arbitrary HasFontList = True AddItem FontList, "Built-in VGA font" TotalFontsFound = 1 - l = RegOpenKeyExA(Ky, _Offset(SubKey), 0, KEY_READ, _Offset(hKey)) - If l Then + l = RegOpenKeyExA(Ky, _OFFSET(SubKey), 0, KEY_READ, _OFFSET(hKey)) + IF l THEN 'HasFontList = False - Exit Sub - Else + EXIT SUB + ELSE dwIndex = 0 - Do - numBytes = Len(bData) - numTchars = Len(Value) - l = RegEnumValueA(hKey, dwIndex, _Offset(Value), _Offset(numTchars), 0, _Offset(dwType), _Offset(bData), _Offset(numBytes)) - If l Then - If l <> ERROR_NO_MORE_ITEMS Then + DO + numBytes = LEN(bData) + numTchars = LEN(Value) + l = RegEnumValueA(hKey, dwIndex, _OFFSET(Value), _OFFSET(numTchars), 0, _OFFSET(dwType), _OFFSET(bData), _OFFSET(numBytes)) + IF l THEN + IF l <> ERROR_NO_MORE_ITEMS THEN 'HasFontList = False - Exit Sub - End If - Exit Do - Else - If UCase$(Right$(formatData(dwType, numBytes, bData), 4)) = ".TTF" Or UCase$(Right$(formatData(dwType, numBytes, bData), 4)) = ".OTF" Then + EXIT SUB + END IF + EXIT DO + ELSE + IF UCASE$(RIGHT$(formatData(dwType, numBytes, bData), 4)) = ".TTF" OR UCASE$(RIGHT$(formatData(dwType, numBytes, bData), 4)) = ".OTF" THEN TotalFontsFound = TotalFontsFound + 1 - If TotalFontsFound > UBound(FontFile) Then - ReDim _Preserve FontFile(TotalFontsFound) As String - End If - Dim tempName$ - tempName$ = Left$(Value, numTchars) - If Right$(tempName$, 11) = " (TrueType)" Then - tempName$ = Left$(tempName$, Len(tempName$) - 11) - End If + IF TotalFontsFound > UBOUND(FontFile) THEN + REDIM _PRESERVE FontFile(TotalFontsFound) AS STRING + END IF + DIM tempName$ + tempName$ = LEFT$(Value, numTchars) + IF RIGHT$(tempName$, 11) = " (TrueType)" THEN + tempName$ = LEFT$(tempName$, LEN(tempName$) - 11) + END IF AddItem FontList, tempName$ FontFile(TotalFontsFound) = formatData(dwType, numBytes, bData) - End If - End If + END IF + END IF dwIndex = dwIndex + 1 - Loop + LOOP l = RegCloseKey(hKey) - End If + END IF - For l = 8 To 120 - AddItem FontSizeList, LTrim$(Str$(l)) - Next - End Sub + FOR l = 8 TO 120 + AddItem FontSizeList, LTRIM$(STR$(l)) + NEXT + END SUB - Function whatType$ (dwType As _Unsigned Long) - Select Case dwType - Case REG_SZ: whatType = "REG_SZ" - Case REG_EXPAND_SZ: whatType = "REG_EXPAND_SZ" - Case REG_BINARY: whatType = "REG_BINARY" - Case REG_DWORD: whatType = "REG_DWORD" - Case REG_DWORD_BIG_ENDIAN: whatType = "REG_DWORD_BIG_ENDIAN" - Case REG_LINK: whatType = "REG_LINK" - Case REG_MULTI_SZ: whatType = "REG_MULTI_SZ" - Case REG_RESOURCE_LIST: whatType = "REG_RESOURCE_LIST" - Case REG_FULL_RESOURCE_DESCRIPTOR: whatType = "REG_FULL_RESOURCE_DESCRIPTOR" - Case REG_RESOURCE_REQUIREMENTS_LIST: whatType = "REG_RESOURCE_REQUIREMENTS_LIST" - Case REG_QWORD: whatType = "REG_QWORD" - Case Else: whatType = "unknown" - End Select - End Function + FUNCTION whatType$ (dwType AS _UNSIGNED LONG) + SELECT CASE dwType + CASE REG_SZ: whatType = "REG_SZ" + CASE REG_EXPAND_SZ: whatType = "REG_EXPAND_SZ" + CASE REG_BINARY: whatType = "REG_BINARY" + CASE REG_DWORD: whatType = "REG_DWORD" + CASE REG_DWORD_BIG_ENDIAN: whatType = "REG_DWORD_BIG_ENDIAN" + CASE REG_LINK: whatType = "REG_LINK" + CASE REG_MULTI_SZ: whatType = "REG_MULTI_SZ" + CASE REG_RESOURCE_LIST: whatType = "REG_RESOURCE_LIST" + CASE REG_FULL_RESOURCE_DESCRIPTOR: whatType = "REG_FULL_RESOURCE_DESCRIPTOR" + CASE REG_RESOURCE_REQUIREMENTS_LIST: whatType = "REG_RESOURCE_REQUIREMENTS_LIST" + CASE REG_QWORD: whatType = "REG_QWORD" + CASE ELSE: whatType = "unknown" + END SELECT + END FUNCTION - Function whatKey$ (hKey As _Offset) + FUNCTION whatKey$ (hKey AS _OFFSET) hKey = hKey 'the lengths I'll go not to have warnings.... - Select Case hKey - Case HKEY_CLASSES_ROOT: whatKey = "HKEY_CLASSES_ROOT" - Case HKEY_CURRENT_USER: whatKey = "HKEY_CURRENT_USER" - Case HKEY_LOCAL_MACHINE: whatKey = "HKEY_LOCAL_MACHINE" - Case HKEY_USERS: whatKey = "HKEY_USERS" - Case HKEY_PERFORMANCE_DATA: whatKey = "HKEY_PERFORMANCE_DATA" - Case HKEY_CURRENT_CONFIG: whatKey = "HKEY_CURRENT_CONFIG" - Case HKEY_DYN_DATA: whatKey = "HKEY_DYN_DATA" - End Select - End Function + SELECT CASE hKey + CASE HKEY_CLASSES_ROOT: whatKey = "HKEY_CLASSES_ROOT" + CASE HKEY_CURRENT_USER: whatKey = "HKEY_CURRENT_USER" + CASE HKEY_LOCAL_MACHINE: whatKey = "HKEY_LOCAL_MACHINE" + CASE HKEY_USERS: whatKey = "HKEY_USERS" + CASE HKEY_PERFORMANCE_DATA: whatKey = "HKEY_PERFORMANCE_DATA" + CASE HKEY_CURRENT_CONFIG: whatKey = "HKEY_CURRENT_CONFIG" + CASE HKEY_DYN_DATA: whatKey = "HKEY_DYN_DATA" + END SELECT + END FUNCTION - Function formatData$ (dwType As _Unsigned Long, numBytes As _Unsigned Long, bData As String) - Dim t As String - Dim ul As _Unsigned Long - Dim b As _Unsigned _Byte - Select Case dwType - Case REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ - formatData = Left$(bData, numBytes - 1) - Case REG_DWORD - t = LCase$(Hex$(CVL(Left$(bData, 4)))) - formatData = "0x" + String$(8 - Len(t), &H30) + t - Case Else - If numBytes Then - b = Asc(Left$(bData, 1)) - If b < &H10 Then - t = t + "0" + LCase$(Hex$(b)) - Else - t = t + LCase$(Hex$(b)) - End If - End If - For ul = 2 To numBytes - b = Asc(Mid$(bData, ul, 1)) - If b < &H10 Then - t = t + " 0" + LCase$(Hex$(b)) - Else - t = t + " " + LCase$(Hex$(b)) - End If - Next + FUNCTION formatData$ (dwType AS _UNSIGNED LONG, numBytes AS _UNSIGNED LONG, bData AS STRING) + DIM t AS STRING + DIM ul AS _UNSIGNED LONG + DIM b AS _UNSIGNED _BYTE + SELECT CASE dwType + CASE REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ + formatData = LEFT$(bData, numBytes - 1) + CASE REG_DWORD + t = LCASE$(HEX$(CVL(LEFT$(bData, 4)))) + formatData = "0x" + STRING$(8 - LEN(t), &H30) + t + CASE ELSE + IF numBytes THEN + b = ASC(LEFT$(bData, 1)) + IF b < &H10 THEN + t = t + "0" + LCASE$(HEX$(b)) + ELSE + t = t + LCASE$(HEX$(b)) + END IF + END IF + FOR ul = 2 TO numBytes + b = ASC(MID$(bData, ul, 1)) + IF b < &H10 THEN + t = t + " 0" + LCASE$(HEX$(b)) + ELSE + t = t + " " + LCASE$(HEX$(b)) + END IF + NEXT formatData = t - End Select - End Function -$Else + END SELECT + END FUNCTION +$ELSE SUB LoadFontList DIM TotalFiles%, FontPath$, i AS LONG, ThisFont$, depth%, x AS INTEGER @@ -4924,34 +4894,34 @@ $Else HasFontList = True END SUB -$End If +$END IF 'FUNCTION idezfilelist$ and idezpathlist$ (and helper functions) were 'adapted from ide_methods.bas (QB64): -Function idezfilelist$ (path$, method, depth%, TotalFound As Integer) 'method0=*.frm and *.frmbin, method1=*.* - Dim sep As String * 1, filelist$, a$, dummy% - sep = Chr$(10) +FUNCTION idezfilelist$ (path$, method, depth%, TotalFound AS INTEGER) 'method0=*.frm and *.frmbin, method1=*.* + DIM sep AS STRING * 1, filelist$, a$, dummy% + sep = CHR$(10) TotalFound = 0 dummy% = depth% - $If WIN Then - Open "opendlgfiles.dat" For Output As #150: Close #150 - If method = 0 Then Shell _Hide "dir /b /ON /A-D " + QuotedFilename$(path$) + "\*.frm >opendlgfiles.dat" - If method = 1 Then Shell _Hide "dir /b /ON /A-D " + QuotedFilename$(path$) + "\*.* >opendlgfiles.dat" + $IF WIN THEN + OPEN "opendlgfiles.dat" FOR OUTPUT AS #150: CLOSE #150 + IF method = 0 THEN SHELL _HIDE "dir /b /ON /A-D " + QuotedFilename$(path$) + "\*.frm >opendlgfiles.dat" + IF method = 1 THEN SHELL _HIDE "dir /b /ON /A-D " + QuotedFilename$(path$) + "\*.* >opendlgfiles.dat" filelist$ = "" - Open "opendlgfiles.dat" For Input As #150 - Do Until EOF(150) - Line Input #150, a$ - If Len(a$) Then 'skip blank entries - If filelist$ = "" Then filelist$ = a$ Else filelist$ = filelist$ + sep + a$ + OPEN "opendlgfiles.dat" FOR INPUT AS #150 + DO UNTIL EOF(150) + LINE INPUT #150, a$ + IF LEN(a$) THEN 'skip blank entries + IF filelist$ = "" THEN filelist$ = a$ ELSE filelist$ = filelist$ + sep + a$ TotalFound = TotalFound + 1 - End If - Loop - Close #150 - Kill "opendlgfiles.dat" + END IF + LOOP + CLOSE #150 + KILL "opendlgfiles.dat" idezfilelist$ = filelist$ - Exit Function - $Else + EXIT FUNCTION + $ELSE filelist$ = "" DIM i AS INTEGER, x AS INTEGER, a2$ FOR i = 1 TO 2 - method @@ -4984,47 +4954,47 @@ Function idezfilelist$ (path$, method, depth%, TotalFound As Integer) 'method0=* KILL "opendlgfiles.dat" idezfilelist$ = filelist$ EXIT FUNCTION - $End If -End Function + $END IF +END FUNCTION -Function idezpathlist$ (path$, TotalFound%) - Dim sep As String * 1, a$, pathlist$, c As Integer, x As Integer, b$ - Dim i As Integer - sep = Chr$(10) +FUNCTION idezpathlist$ (path$, TotalFound%) + DIM sep AS STRING * 1, a$, pathlist$, c AS INTEGER, x AS INTEGER, b$ + DIM i AS INTEGER + sep = CHR$(10) TotalFound% = 0 - $If WIN Then - Open "opendlgfiles.dat" For Output As #150: Close #150 - a$ = "": If Right$(path$, 1) = ":" Then a$ = "\" 'use a \ after a drive letter - Shell _Hide "dir /b /ON /AD " + QuotedFilename$(path$ + a$) + " >opendlgfiles.dat" + $IF WIN THEN + OPEN "opendlgfiles.dat" FOR OUTPUT AS #150: CLOSE #150 + a$ = "": IF RIGHT$(path$, 1) = ":" THEN a$ = "\" 'use a \ after a drive letter + SHELL _HIDE "dir /b /ON /AD " + QuotedFilename$(path$ + a$) + " >opendlgfiles.dat" pathlist$ = "" - Open "opendlgfiles.dat" For Input As #150 - Do Until EOF(150) - Line Input #150, a$ - If pathlist$ = "" Then pathlist$ = a$ Else pathlist$ = pathlist$ + sep + a$ + OPEN "opendlgfiles.dat" FOR INPUT AS #150 + DO UNTIL EOF(150) + LINE INPUT #150, a$ + IF pathlist$ = "" THEN pathlist$ = a$ ELSE pathlist$ = pathlist$ + sep + a$ TotalFound% = TotalFound% + 1 - Loop - Close #150 - Kill "opendlgfiles.dat" + LOOP + CLOSE #150 + KILL "opendlgfiles.dat" 'count instances of / or \ c = 0 - For x = 1 To Len(path$) - b$ = Mid$(path$, x, 1) - If b$ = PathSep$ Then c = c + 1 - Next - If c >= 1 Then - If Len(pathlist$) Then pathlist$ = ".." + sep + pathlist$ Else pathlist$ = ".." + FOR x = 1 TO LEN(path$) + b$ = MID$(path$, x, 1) + IF b$ = PathSep$ THEN c = c + 1 + NEXT + IF c >= 1 THEN + IF LEN(pathlist$) THEN pathlist$ = ".." + sep + pathlist$ ELSE pathlist$ = ".." TotalFound% = TotalFound% + 1 - End If + END IF 'add drive paths - For i = 0 To 25 - If Len(pathlist$) Then pathlist$ = pathlist$ + sep - pathlist$ = pathlist$ + Chr$(65 + i) + ":" + FOR i = 0 TO 25 + IF LEN(pathlist$) THEN pathlist$ = pathlist$ + sep + pathlist$ = pathlist$ + CHR$(65 + i) + ":" TotalFound% = TotalFound% + 1 - Next + NEXT idezpathlist$ = pathlist$ - Exit Function - $Else + EXIT FUNCTION + $ELSE pathlist$ = "" DIM a2$ OPEN "opendlgfiles.dat" FOR OUTPUT AS #150: CLOSE #150 @@ -5055,34 +5025,34 @@ Function idezpathlist$ (path$, TotalFound%) idezpathlist$ = pathlist$ EXIT FUNCTION - $End If -End Function + $END IF +END FUNCTION -Function idezchangepath$ (path$, newpath$) - Dim x As Integer, a$ +FUNCTION idezchangepath$ (path$, newpath$) + DIM x AS INTEGER, a$ idezchangepath$ = path$ 'default (for unsuccessful cases) - $If WIN Then + $IF WIN THEN 'go back a path - If newpath$ = ".." Then - For x = Len(path$) To 1 Step -1 - a$ = Mid$(path$, x, 1) - If a$ = "\" Then - idezchangepath$ = Left$(path$, x - 1) - Exit For - End If - Next - Exit Function - End If + IF newpath$ = ".." THEN + FOR x = LEN(path$) TO 1 STEP -1 + a$ = MID$(path$, x, 1) + IF a$ = "\" THEN + idezchangepath$ = LEFT$(path$, x - 1) + EXIT FOR + END IF + NEXT + EXIT FUNCTION + END IF 'change drive - If Len(newpath$) = 2 And Right$(newpath$, 1) = ":" Then + IF LEN(newpath$) = 2 AND RIGHT$(newpath$, 1) = ":" THEN idezchangepath$ = newpath$ - Exit Function - End If + EXIT FUNCTION + END IF idezchangepath$ = path$ + "\" + newpath$ - Exit Function - $Else + EXIT FUNCTION + $ELSE 'go back a path IF newpath$ = ".." THEN FOR x = LEN(path$) TO 1 STEP -1 @@ -5097,47 +5067,47 @@ Function idezchangepath$ (path$, newpath$) END IF IF path$ = "/" THEN idezchangepath$ = "/" + newpath$ ELSE idezchangepath$ = path$ + "/" + newpath$ EXIT FUNCTION - $End If + $END IF -End Function +END FUNCTION -Function QuotedFilename$ (f$) - $If WIN Then - QuotedFilename$ = Chr$(34) + f$ + Chr$(34) - $Else +FUNCTION QuotedFilename$ (f$) + $IF WIN THEN + QuotedFilename$ = CHR$(34) + f$ + CHR$(34) + $ELSE QuotedFilename$ = "'" + f$ + "'" - $End If -End Function + $END IF +END FUNCTION '--------------------------------------------------------------------------------- -Function SpecialCharsToEscapeCode$ (Text$) - Dim i As Long, Temp$ +FUNCTION SpecialCharsToEscapeCode$ (Text$) + DIM i AS LONG, Temp$ - Temp$ = Chr$(34) - For i = 1 To Len(Text$) - If Asc(Text$, i) < 32 Or Asc(Text$, i) = 34 Or Asc(Text$, i) = 92 Then - Temp$ = Temp$ + "\" + LTrim$(Str$(Asc(Text$, i))) + ";" - Else - Temp$ = Temp$ + Mid$(Text$, i, 1) - End If - Next - SpecialCharsToEscapeCode$ = Temp$ + Chr$(34) -End Function + Temp$ = CHR$(34) + FOR i = 1 TO LEN(Text$) + IF ASC(Text$, i) < 32 OR ASC(Text$, i) = 34 OR ASC(Text$, i) = 92 THEN + Temp$ = Temp$ + "\" + LTRIM$(STR$(ASC(Text$, i))) + ";" + ELSE + Temp$ = Temp$ + MID$(Text$, i, 1) + END IF + NEXT + SpecialCharsToEscapeCode$ = Temp$ + CHR$(34) +END FUNCTION '--------------------------------------------------------------------------------- -Function OutsideQuotes%% (text$, position As Long) - Dim quote%% - Dim start As Long - Dim i As Long +FUNCTION OutsideQuotes%% (text$, position AS LONG) + DIM quote%% + DIM start AS LONG + DIM i AS LONG - start = _InStrRev(position, text$, Chr$(10)) + 1 + start = _INSTRREV(position, text$, CHR$(10)) + 1 quote%% = False - For i = start To position - If Asc(text$, i) = 34 Then quote%% = Not quote%% - If Asc(text$, i) = 10 Then Exit For - Next - OutsideQuotes%% = Not quote%% -End Function + FOR i = start TO position + IF ASC(text$, i) = 34 THEN quote%% = NOT quote%% + IF ASC(text$, i) = 10 THEN EXIT FOR + NEXT + OutsideQuotes%% = NOT quote%% +END FUNCTION '$include:'InForm.ui' diff --git a/InForm/UiEditorPreview.bas b/InForm/UiEditorPreview.bas index e3d458f..d37c3c2 100644 --- a/InForm/UiEditorPreview.bas +++ b/InForm/UiEditorPreview.bas @@ -1,24 +1,25 @@ -Option _Explicit -Option _ExplicitArray +OPTION _EXPLICIT +OPTION _EXPLICITARRAY +$UNSTABLE:HTTP -Dim Shared UiEditorPID As Long, ExeIcon As Long -Dim Shared AutoNameControls As _Byte -Dim Shared UndoPointer As Integer, TotalUndoImages As Integer, MidUndo As _Byte -ReDim Shared UndoImage(100) As String -Dim Shared IsCreating As _Byte -Dim Shared Host As Long, HostPort As String -Dim Shared Stream$, RestoreCrashData$ -Dim Shared LastPreviewDataSent$ -Dim Shared ContextMenuIcon As Long -ReDim Shared LockedControls(0) As Long, TotalLockedControls As Long -ReDim Shared AutoPlayGif(0) As _Byte +DIM SHARED UiEditorPID AS LONG, ExeIcon AS LONG +DIM SHARED AutoNameControls AS _BYTE +DIM SHARED UndoPointer AS INTEGER, TotalUndoImages AS INTEGER +REDIM SHARED UndoImage(100) AS STRING +DIM SHARED IsCreating AS _BYTE +DIM SHARED Host AS LONG, HostPort AS STRING +DIM SHARED Stream$, RestoreCrashData$ +DIM SHARED LastPreviewDataSent$ +DIM SHARED ContextMenuIcon AS LONG +REDIM SHARED LockedControls(0) AS LONG, TotalLockedControls AS LONG +REDIM SHARED AutoPlayGif(0) AS _BYTE -ReDim Shared QB64KEYWORDS(0) As String +REDIM SHARED QB64KEYWORDS(0) AS STRING READ_KEYWORDS -ChDir ".." +CHDIR ".." -Const EmptyForm$ = "9iVA_9GK1P<000`ooO7000@00D006mVL]53;1`B000000000noO100006mVL]5cno760cEfI_EFMYi2MdIf?Q9GJQaV;dAWIol2CY9VLQ9GN_HdK^AgL_4TLY56K^@7MVmCB^IdKbef;bEfL_EWLSEfL_hdKdmFC_ifK]8EIWE7KQ9W;dAWIo<fKe9W;dAWIZXB<b00o%%%0" +CONST EmptyForm$ = "9iVA_9GK1P<000`ooO7000@00D006mVL]53;1`B000000000noO100006mVL]5cno760cEfI_EFMYi2MdIf?Q9GJQaV;dAWIol2CY9VLQ9GN_HdK^AgL_4TLY56K^@7MVmCB^IdKbef;bEfL_EWLSEfL_hdKdmFC_ifK]8EIWE7KQ9W;dAWIo<fKe9W;dAWIZXB<b00o%%%0" 'Signals sent from Editor to Preview: ' 201 = Align Left @@ -51,40 +52,40 @@ Const EmptyForm$ = "9iVA_9GK1P<000`ooO7000@00D006mVL]53;1`B000000000noO100006mVL ' 228 = Bind/Unbind selected controls 'SavePreview parameters: -Const InDisk = 1 -Const InClipboard = 2 -Const ToEditor = 3 -Const ToUndoBuffer = 4 -Const FromEditor = 5 +CONST InDisk = 1 +CONST InClipboard = 2 +CONST ToEditor = 3 +CONST ToUndoBuffer = 4 +CONST FromEditor = 5 -Dim i As Long -Dim Shared AlphaNumeric(255) -For i = 48 To 57: AlphaNumeric(i) = -1: Next -For i = 65 To 90: AlphaNumeric(i) = -1: Next -For i = 97 To 122: AlphaNumeric(i) = -1: Next +DIM i AS LONG +DIM SHARED AlphaNumeric(255) +FOR i = 48 TO 57: AlphaNumeric(i) = -1: NEXT +FOR i = 65 TO 90: AlphaNumeric(i) = -1: NEXT +FOR i = 97 TO 122: AlphaNumeric(i) = -1: NEXT AlphaNumeric(95) = -1 -Dim Shared Alpha(255) -For i = 65 To 90: Alpha(i) = -1: Next -For i = 97 To 122: Alpha(i) = -1: Next +DIM SHARED Alpha(255) +FOR i = 65 TO 90: Alpha(i) = -1: NEXT +FOR i = 97 TO 122: Alpha(i) = -1: NEXT Alpha(95) = -1 -Dim Shared Numeric(255) -For i = 48 To 57: Numeric(i) = -1: Next +DIM SHARED Numeric(255) +FOR i = 48 TO 57: Numeric(i) = -1: NEXT -$If WIN Then - Declare Dynamic Library "kernel32" - Function OpenProcess& (ByVal dwDesiredAccess As Long, Byval bInheritHandle As Long, Byval dwProcessId As Long) - Function CloseHandle& (ByVal hObject As Long) - Function GetExitCodeProcess& (ByVal hProcess As Long, lpExitCode As Long) - End Declare - Const PathSep$ = "\" -$Else - DECLARE LIBRARY - FUNCTION PROCESS_CLOSED& ALIAS kill (BYVAL pid AS INTEGER, BYVAL signal AS INTEGER) +$IF WIN THEN + DECLARE DYNAMIC LIBRARY "kernel32" + FUNCTION OpenProcess& (BYVAL dwDesiredAccess AS LONG, BYVAL bInheritHandle AS LONG, BYVAL dwProcessId AS LONG) + FUNCTION CloseHandle& (BYVAL hObject AS LONG) + FUNCTION GetExitCodeProcess& (BYVAL hProcess AS LONG, lpExitCode AS LONG) END DECLARE - CONST PathSep$ = "/" -$End If + CONST PathSep$ = "\" +$ELSE + DECLARE LIBRARY + FUNCTION PROCESS_CLOSED& ALIAS kill (BYVAL pid AS INTEGER, BYVAL signal AS INTEGER) + END DECLARE + CONST PathSep$ = "/" +$END IF 'Load context menu icon image: ContextMenuIcon = LoadEditorImage("contextmenu.bmp") @@ -97,356 +98,355 @@ __UI_ClearColor ContextMenuIcon, 0, 0 '$include:'extensions/gifplay.bm' 'Event procedures: --------------------------------------------------------------- -Sub __UI_Click (id As Long) -End Sub +SUB __UI_Click (id AS LONG) +END SUB -Sub __UI_MouseEnter (id As Long) -End Sub +SUB __UI_MouseEnter (id AS LONG) +END SUB -Sub __UI_MouseLeave (id As Long) -End Sub +SUB __UI_MouseLeave (id AS LONG) +END SUB -Sub __UI_FocusIn (id As Long) -End Sub +SUB __UI_FocusIn (id AS LONG) +END SUB -Sub __UI_FocusOut (id As Long) -End Sub +SUB __UI_FocusOut (id AS LONG) +END SUB -Sub __UI_MouseDown (id As Long) -End Sub +SUB __UI_MouseDown (id AS LONG) +END SUB -Sub __UI_MouseUp (id As Long) -End Sub +SUB __UI_MouseUp (id AS LONG) +END SUB -Function AddNewMenuBarControl& - Dim i As Long, TempValue As Long +FUNCTION AddNewMenuBarControl& + DIM i AS LONG, TempValue AS LONG 'Before adding a menu bar item, reset all other menu bar items' alignment - For i = 1 To UBound(Control) - If Control(i).Type = __UI_Type_MenuBar Then + FOR i = 1 TO UBOUND(Control) + IF Control(i).Type = __UI_Type_MenuBar THEN Control(i).Align = __UI_Left - End If - Next + END IF + NEXT TempValue = __UI_NewControl(__UI_Type_MenuBar, "", 0, 0, 0, 0, 0) - SetCaption TempValue, RTrim$(Control(TempValue).Name) + SetCaption TempValue, RTRIM$(Control(TempValue).Name) __UI_RefreshMenuBar __UI_ActivateMenu Control(TempValue), False AddNewMenuBarControl& = TempValue -End Function +END FUNCTION -Sub SelectNewControl (id As Long) - Dim i As Long - For i = 1 To UBound(Control) +SUB SelectNewControl (id AS LONG) + DIM i AS LONG + FOR i = 1 TO UBOUND(Control) Control(i).ControlIsSelected = False - Next + NEXT Control(id).ControlIsSelected = True __UI_TotalSelectedControls = 1 __UI_FirstSelectedID = id __UI_ForceRedraw = True -End Sub +END SUB -Sub __UI_BeforeUpdateDisplay - Dim a$, b$, TempValue As Long, i As Long, j As Long - Dim NewControl As Integer, FileNameToLoad$ - Static UiEditorFile As Integer, EditorWasActive As _Byte - Static WasDragging As _Byte, WasResizing As _Byte - Static NewWindowTop As Integer, NewWindowLeft As Integer +SUB __UI_BeforeUpdateDisplay + DIM a$, b$, TempValue AS LONG, i AS LONG, j AS LONG + DIM FileNameToLoad$ + STATIC EditorWasActive AS _BYTE + STATIC WasDragging AS _BYTE, WasResizing AS _BYTE + STATIC NewWindowTop AS INTEGER, NewWindowLeft AS INTEGER - If __UI_TotalSelectedControls < 0 Then __UI_TotalSelectedControls = 0 + IF __UI_TotalSelectedControls < 0 THEN __UI_TotalSelectedControls = 0 SavePreview ToEditor - If UBound(LockedControls) <> UBound(Control) Then - ReDim _Preserve LockedControls(UBound(Control)) As Long - End If + IF UBOUND(LockedControls) <> UBOUND(Control) THEN + REDIM _PRESERVE LockedControls(UBOUND(Control)) AS LONG + END IF - If UBound(AutoPlayGif) <> UBound(Control) Then - ReDim _Preserve AutoPlayGif(UBound(Control)) As _Byte - End If + IF UBOUND(AutoPlayGif) <> UBOUND(Control) THEN + REDIM _PRESERVE AutoPlayGif(UBOUND(Control)) AS _BYTE + END IF - For i = 1 To UBound(AutoPlayGif) - If AutoPlayGif(i) Then UpdateGif i - Next + FOR i = 1 TO UBOUND(AutoPlayGif) + IF AutoPlayGif(i) THEN UpdateGif i + NEXT - Static prevDefaultButton As Long, prevMenuPanelActive As Integer - Static prevSelectionRectangle As Integer, prevUndoPointer As Integer - Static prevTotalUndoImages As Integer, prevShowInvisibleControls As _Byte + STATIC prevDefaultButton AS LONG, prevMenuPanelActive AS INTEGER + STATIC prevSelectionRectangle AS INTEGER, prevUndoPointer AS INTEGER + STATIC prevTotalUndoImages AS INTEGER, prevShowInvisibleControls AS _BYTE - If __UI_DefaultButtonID <> prevDefaultButton Then + IF __UI_DefaultButtonID <> prevDefaultButton THEN prevDefaultButton = __UI_DefaultButtonID b$ = MKL$(__UI_DefaultButtonID) SendData b$, "DEFAULTBUTTONID" - End If + END IF - If prevShowInvisibleControls <> __UI_ShowInvisibleControls Then + IF prevShowInvisibleControls <> __UI_ShowInvisibleControls THEN prevShowInvisibleControls = __UI_ShowInvisibleControls b$ = MKI$(__UI_ShowInvisibleControls) SendData b$, "SHOWINVISIBLECONTROLS" - End If + END IF - If prevMenuPanelActive <> (__UI_TotalActiveMenus > 0 And Left$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) <> "__UI_") Then - prevMenuPanelActive = (__UI_TotalActiveMenus > 0 And Left$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) <> "__UI_") + IF prevMenuPanelActive <> (__UI_TotalActiveMenus > 0 AND LEFT$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) <> "__UI_") THEN + prevMenuPanelActive = (__UI_TotalActiveMenus > 0 AND LEFT$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) <> "__UI_") b$ = MKI$(prevMenuPanelActive) SendData b$, "MENUPANELACTIVE" - End If + END IF - If prevSelectionRectangle <> (__UI_SelectionRectangle) Then + IF prevSelectionRectangle <> (__UI_SelectionRectangle) THEN prevSelectionRectangle = (__UI_SelectionRectangle) b$ = MKI$(prevSelectionRectangle) SendData b$, "SELECTIONRECTANGLE" - End If + END IF - If prevUndoPointer <> UndoPointer Then + IF prevUndoPointer <> UndoPointer THEN prevUndoPointer = UndoPointer b$ = MKI$(UndoPointer) SendData b$, "UNDOPOINTER" - End If + END IF - If prevTotalUndoImages <> TotalUndoImages Then + IF prevTotalUndoImages <> TotalUndoImages THEN prevTotalUndoImages = TotalUndoImages b$ = MKI$(TotalUndoImages) SendData b$, "TOTALUNDOIMAGES" - End If + END IF - Dim incomingData$, Signal$, Property$ + DIM incomingData$, Signal$, Property$ - Get #Host, , incomingData$ + GET #Host, , incomingData$ Stream$ = Stream$ + incomingData$ - Dim ThisContainer As Long, TempWidth As Integer, TempHeight As Integer - Dim TempTop As Integer - If Control(Control(__UI_FirstSelectedID).ParentID).Type = __UI_Type_Frame Then + DIM ThisContainer AS LONG, TempWidth AS INTEGER, TempHeight AS INTEGER + DIM TempTop AS INTEGER + IF Control(Control(__UI_FirstSelectedID).ParentID).Type = __UI_Type_Frame THEN ThisContainer = Control(__UI_FirstSelectedID).ParentID TempWidth = Control(Control(__UI_FirstSelectedID).ParentID).Width TempHeight = Control(Control(__UI_FirstSelectedID).ParentID).Height TempTop = TempHeight \ 2 - ElseIf Control(__UI_FirstSelectedID).Type = __UI_Type_Frame Then + ELSEIF Control(__UI_FirstSelectedID).Type = __UI_Type_Frame THEN ThisContainer = Control(__UI_FirstSelectedID).ID TempWidth = Control(__UI_FirstSelectedID).Width TempHeight = Control(__UI_FirstSelectedID).Height TempTop = TempHeight \ 2 - Else + ELSE TempWidth = Control(__UI_FormID).Width TempHeight = Control(__UI_FormID).Height TempTop = (TempHeight - __UI_MenuBarOffsetV) \ 2 + __UI_MenuBarOffsetV - End If + END IF - Dim thisData$, thisCommand$ - Do While InStr(Stream$, "<END>") > 0 - thisData$ = Left$(Stream$, InStr(Stream$, "<END>") - 1) - Stream$ = Mid$(Stream$, InStr(Stream$, "<END>") + 5) - thisCommand$ = Left$(thisData$, InStr(thisData$, ">") - 1) - thisData$ = Mid$(thisData$, Len(thisCommand$) + 2) - Select Case UCase$(thisCommand$) - Case "RESTORECRASH" + DIM thisData$, thisCommand$ + DO WHILE INSTR(Stream$, "<END>") > 0 + thisData$ = LEFT$(Stream$, INSTR(Stream$, "<END>") - 1) + Stream$ = MID$(Stream$, INSTR(Stream$, "<END>") + 5) + thisCommand$ = LEFT$(thisData$, INSTR(thisData$, ">") - 1) + thisData$ = MID$(thisData$, LEN(thisCommand$) + 2) + SELECT CASE UCASE$(thisCommand$) + CASE "RESTORECRASH" RestoreCrashData$ = thisData$ LoadPreview FromEditor - Exit Sub - Case "WINDOWPOSITION" - NewWindowLeft = CVI(Left$(thisData$, 2)) - NewWindowTop = CVI(Mid$(thisData$, 3, 2)) - Case "AUTONAME" + EXIT SUB + CASE "WINDOWPOSITION" + NewWindowLeft = CVI(LEFT$(thisData$, 2)) + NewWindowTop = CVI(MID$(thisData$, 3, 2)) + CASE "AUTONAME" AutoNameControls = CVI(thisData$) - Case "MOUSESWAP" + CASE "MOUSESWAP" __UI_MouseButtonsSwap = CVI(thisData$) - Case "SHOWPOSSIZE" + CASE "SHOWPOSSIZE" __UI_ShowPositionAndSize = CVI(thisData$) - Case "SHOWINVISIBLECONTROLS" + CASE "SHOWINVISIBLECONTROLS" __UI_ShowInvisibleControls = CVI(thisData$) - Case "SNAPLINES" + CASE "SNAPLINES" __UI_SnapLines = CVI(thisData$) - Case "SIGNAL" + CASE "SIGNAL" Signal$ = Signal$ + thisData$ - Case "PROPERTY" + CASE "PROPERTY" Property$ = Property$ + thisData$ - Case "OPENFILE" + CASE "OPENFILE" FileNameToLoad$ = thisData$ - Case "NEWCONTROL" + CASE "NEWCONTROL" TempValue = CVI(thisData$) - If TempValue > 0 Then - Dim defW As Integer, defH As Integer - Dim tempType As Long + IF TempValue > 0 THEN + DIM defW AS INTEGER, defH AS INTEGER + DIM tempType AS LONG defW = __UI_Type(TempValue).DefaultWidth defH = __UI_Type(TempValue).DefaultHeight tempType = TempValue SaveUndoImage 'Enforce no frame inside frame: - If tempType = __UI_Type_Frame Then + IF tempType = __UI_Type_Frame THEN ThisContainer = 0 TempWidth = Control(__UI_FormID).Width TempHeight = Control(__UI_FormID).Height TempTop = (TempHeight - __UI_MenuBarOffsetV) \ 2 + __UI_MenuBarOffsetV - End If + END IF - If tempType = __UI_Type_MenuBar Then + IF tempType = __UI_Type_MenuBar THEN TempValue = AddNewMenuBarControl - ElseIf tempType = __UI_Type_MenuItem Then - If __UI_TotalActiveMenus > 0 And Left$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) <> "__UI_" Then + ELSEIF tempType = __UI_Type_MenuItem THEN + IF __UI_TotalActiveMenus > 0 AND LEFT$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) <> "__UI_" THEN TempValue = __UI_NewControl(tempType, "", 0, 0, 0, 0, __UI_ParentMenu(__UI_TotalActiveMenus)) - SetCaption TempValue, RTrim$(Control(TempValue).Name) + SetCaption TempValue, RTRIM$(Control(TempValue).Name) ThisContainer = __UI_ParentMenu(__UI_TotalActiveMenus) __UI_CloseAllMenus __UI_ActivateMenu Control(ThisContainer), False - End If - Else + END IF + ELSE TempValue = __UI_NewControl(TempValue, "", defW, defH, TempWidth \ 2 - defW \ 2, TempTop - defH \ 2, ThisContainer) - SetCaption TempValue, RTrim$(Control(TempValue).Name) - End If + SetCaption TempValue, RTRIM$(Control(TempValue).Name) + END IF - Select Case tempType - Case __UI_Type_ProgressBar + SELECT CASE tempType + CASE __UI_Type_ProgressBar SetCaption TempValue, "\#" - Case __UI_Type_ContextMenu - Control(TempValue).HelperCanvas = _CopyImage(ContextMenuIcon, 32) + CASE __UI_Type_ContextMenu + Control(TempValue).HelperCanvas = _COPYIMAGE(ContextMenuIcon, 32) RefreshContextMenus __UI_ActivateMenu Control(TempValue), False - End Select + END SELECT - If __UI_TotalActiveMenus > 0 And (Control(TempValue).Type <> __UI_Type_ContextMenu And Control(TempValue).Type <> __UI_Type_MenuBar And Control(TempValue).Type <> __UI_Type_MenuItem) Then + IF __UI_TotalActiveMenus > 0 AND (Control(TempValue).Type <> __UI_Type_ContextMenu AND Control(TempValue).Type <> __UI_Type_MenuBar AND Control(TempValue).Type <> __UI_Type_MenuItem) THEN __UI_CloseAllMenus - End If + END IF SelectNewControl TempValue - End If - Case "LOCKCONTROLS" + END IF + CASE "LOCKCONTROLS" 'When the user starts editing a property in UiEditor, 'a list of the currently selected controls is built so 'that the property can be applied to the same controls 'later; allows for" ' "click control, change property, click another control" TotalLockedControls = 0 - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN TotalLockedControls = TotalLockedControls + 1 LockedControls(TotalLockedControls) = i - End If - Next - Case "PAUSEALLGIF" - For i = 1 To UBound(Control) - If AutoPlayGif(i) Then + END IF + NEXT + CASE "PAUSEALLGIF" + FOR i = 1 TO UBOUND(Control) + IF AutoPlayGif(i) THEN AutoPlayGif(i) = False StopGif i - End If - Next - Case "BINDCONTROLS" - Dim BindInfo$(1 To 4) + END IF + NEXT + CASE "BINDCONTROLS" + DIM BindInfo$(1 TO 4) - For i = 1 To 4 - TempValue = CVL(Left$(thisData$, 4)) - thisData$ = Mid$(thisData$, 5) - BindInfo$(i) = Left$(thisData$, TempValue) - thisData$ = Mid$(thisData$, TempValue + 1) - Next + FOR i = 1 TO 4 + TempValue = CVL(LEFT$(thisData$, 4)) + thisData$ = MID$(thisData$, 5) + BindInfo$(i) = LEFT$(thisData$, TempValue) + thisData$ = MID$(thisData$, TempValue + 1) + NEXT __UI_Bind __UI_GetID(BindInfo$(1)), __UI_GetID(BindInfo$(2)), BindInfo$(3), BindInfo$(4) - Case "UNBINDCONTROLS" + CASE "UNBINDCONTROLS" __UI_UnBind __UI_GetID(thisData$) - End Select - Loop + END SELECT + LOOP - For i = 1 To _TotalDroppedFiles - Dim tempImage& - tempImage& = _LoadImage(_DroppedFile(i), 32) - If tempImage& < -1 Then - defW = _Width(tempImage&) - defH = _Height(tempImage&) - _FreeImage tempImage& + FOR i = 1 TO _TOTALDROPPEDFILES + DIM tempImage& + tempImage& = _LOADIMAGE(_DROPPEDFILE(i), 32) + IF tempImage& < -1 THEN + defW = _WIDTH(tempImage&) + defH = _HEIGHT(tempImage&) + _FREEIMAGE tempImage& tempType = __UI_Type_PictureBox SaveUndoImage - TempValue = __UI_NewControl(tempType, "", defW, defH, _MouseX - defW \ 2, _MouseY - defH \ 2, ThisContainer) - If ThisContainer > 0 Then + TempValue = __UI_NewControl(tempType, "", defW, defH, _MOUSEX - defW \ 2, _MOUSEY - defH \ 2, ThisContainer) + IF ThisContainer > 0 THEN Control(TempValue).Left = 0 Control(TempValue).Top = 0 - End If + END IF - If __UI_TotalActiveMenus > 0 Then + IF __UI_TotalActiveMenus > 0 THEN __UI_CloseAllMenus - End If + END IF SelectNewControl TempValue - PreviewLoadImage Control(TempValue), _DroppedFile(i) + PreviewLoadImage Control(TempValue), _DROPPEDFILE(i) - b$ = Mid$(_DroppedFile(i), _InStrRev(_DroppedFile(i), PathSep$) + 1) - Swap i, TempValue - GoSub AutoName - Swap i, TempValue - End If - If i = _TotalDroppedFiles Then _FinishDrop - Next + b$ = MID$(_DROPPEDFILE(i), _INSTRREV(_DROPPEDFILE(i), PathSep$) + 1) + SWAP i, TempValue + GOSUB AutoName + SWAP i, TempValue + END IF + IF i = _TOTALDROPPEDFILES THEN _FINISHDROP + NEXT - $If WIN Then - If NewWindowLeft <> -32001 And NewWindowTop <> -32001 And (NewWindowLeft <> _ScreenX Or NewWindowTop <> _ScreenY) Then - _ScreenMove NewWindowLeft + 612, NewWindowTop - End If - $End If + $IF WIN THEN + IF NewWindowLeft <> -32001 AND NewWindowTop <> -32001 AND (NewWindowLeft <> _SCREENX OR NewWindowTop <> _SCREENY) THEN + _SCREENMOVE NewWindowLeft + 612, NewWindowTop + END IF + $END IF 'Check if the editor is still alive - $If WIN Then - Dim hnd&, b&, ExitCode& + $IF WIN THEN + DIM hnd&, b&, ExitCode& hnd& = OpenProcess(&H400, 0, UiEditorPID) b& = GetExitCodeProcess(hnd&, ExitCode&) - If b& = 1 And ExitCode& = 259 Then + IF b& = 1 AND ExitCode& = 259 THEN 'Editor is active. EditorWasActive = True - Else + ELSE 'Editor was closed. - If EditorWasActive = False Then + IF EditorWasActive = False THEN 'Preview was launched by user - Dim Answer As Long - _ScreenHide - Answer = MessageBox("InForm Designer is not running. Please run the main program.", "InForm Preview", 0) - End If - If _FileExists("..\UiEditorPreview.frmbin") Then Kill "..\UiEditorPreview.frmbin" - System - End If + _SCREENHIDE + _MESSAGEBOX "InForm Preview", "__UI_BeforeUpdateDisplay: InForm Designer is not running. Please run the main program.", "error" + END IF + IF _FILEEXISTS("InForm/UiEditorPreview.frmbin") THEN KILL "InForm/UiEditorPreview.frmbin" + SYSTEM + END IF b& = CloseHandle(hnd&) - $Else - IF PROCESS_CLOSED(UiEditorPID, 0) THEN - If _FileExists("UiEditorPreview.frmbin") Then Kill "UiEditorPreview.frmbin" - SYSTEM - END IF - $End If + $ELSE + IF PROCESS_CLOSED(UiEditorPID, 0) THEN + If _FileExists("InForm/UiEditorPreview.frmbin") Then Kill "InForm/UiEditorPreview.frmbin" + SYSTEM + END IF + $END IF - If __UI_IsDragging Then - If Not WasDragging Then + IF __UI_IsDragging THEN + IF NOT WasDragging THEN WasDragging = True - End If - Else - If WasDragging Then + END IF + ELSE + IF WasDragging THEN SaveUndoImage WasDragging = False - End If - End If + END IF + END IF - If __UI_IsResizing Then - If Not WasResizing Then + IF __UI_IsResizing THEN + IF NOT WasResizing THEN WasResizing = True - End If - Else - If WasResizing Then + END IF + ELSE + IF WasResizing THEN SaveUndoImage WasResizing = False - End If - End If + END IF + END IF - Static prevImgWidthSent As Integer, prevImgHeightSent As Integer - Static prevTurnsInto As Integer - If __UI_FirstSelectedID > 0 Then - If Control(__UI_FirstSelectedID).Type = __UI_Type_PictureBox And Len(Text(__UI_FirstSelectedID)) > 0 Then + STATIC prevImgWidthSent AS INTEGER, prevImgHeightSent AS INTEGER + STATIC prevTurnsInto AS INTEGER + IF __UI_FirstSelectedID > 0 THEN + IF Control(__UI_FirstSelectedID).Type = __UI_Type_PictureBox AND LEN(Text(__UI_FirstSelectedID)) > 0 THEN IF prevImgWidthSent <> _WIDTH(Control(__UI_FirstSelectedID).HelperCanvas) OR _ prevImgHeightSent <> _HEIGHT(Control(__UI_FirstSelectedID).HelperCanvas) THEN - prevImgWidthSent = _Width(Control(__UI_FirstSelectedID).HelperCanvas) - prevImgHeightSent = _Height(Control(__UI_FirstSelectedID).HelperCanvas) - b$ = MKI$(_Width(Control(__UI_FirstSelectedID).HelperCanvas)) + prevImgWidthSent = _WIDTH(Control(__UI_FirstSelectedID).HelperCanvas) + prevImgHeightSent = _HEIGHT(Control(__UI_FirstSelectedID).HelperCanvas) + b$ = MKI$(_WIDTH(Control(__UI_FirstSelectedID).HelperCanvas)) SendData b$, "ORIGINALIMAGEWIDTH" - b$ = MKI$(_Height(Control(__UI_FirstSelectedID).HelperCanvas)) + b$ = MKI$(_HEIGHT(Control(__UI_FirstSelectedID).HelperCanvas)) SendData b$, "ORIGINALIMAGEHEIGHT" - End If - Else + END IF + ELSE IF prevImgWidthSent <> 0 OR _ prevImgHeightSent <> 0 THEN prevImgWidthSent = 0 @@ -454,178 +454,178 @@ Sub __UI_BeforeUpdateDisplay b$ = MKI$(0) SendData b$, "ORIGINALIMAGEWIDTH" SendData b$, "ORIGINALIMAGEHEIGHT" - End If - End If + END IF + END IF - If __UI_TotalSelectedControls = 1 Then - If prevTurnsInto <> __UI_Type(Control(__UI_FirstSelectedID).Type).TurnsInto Or Control(__UI_FirstSelectedID).Type = __UI_Type_TextBox Then + IF __UI_TotalSelectedControls = 1 THEN + IF prevTurnsInto <> __UI_Type(Control(__UI_FirstSelectedID).Type).TurnsInto OR Control(__UI_FirstSelectedID).Type = __UI_Type_TextBox THEN prevTurnsInto = __UI_Type(Control(__UI_FirstSelectedID).Type).TurnsInto - If Control(__UI_FirstSelectedID).Type = __UI_Type_TextBox Then + IF Control(__UI_FirstSelectedID).Type = __UI_Type_TextBox THEN 'Offer to turn text to numeric-only TextBox and vice-versa - If Control(__UI_FirstSelectedID).NumericOnly = False Then + IF Control(__UI_FirstSelectedID).NumericOnly = False THEN prevTurnsInto = -1 - Else + ELSE prevTurnsInto = -2 - End If - End If + END IF + END IF b$ = MKI$(prevTurnsInto) SendData b$, "TURNSINTO" - End If + END IF - If __UI_DesignMode = True And __UI_ShowInvisibleControls = True Then + IF __UI_DesignMode = True AND __UI_ShowInvisibleControls = True THEN 'Check if this control has a ContextMenu attached to it 'and indicate that - If Control(__UI_FirstSelectedID).Type = __UI_Type_ContextMenu Then - For i = 1 To UBound(Control) - If Control(i).Type = __UI_Type_ContextMenu Then - If __UI_FirstSelectedID = Control(i).ID Then + IF Control(__UI_FirstSelectedID).Type = __UI_Type_ContextMenu THEN + FOR i = 1 TO UBOUND(Control) + IF Control(i).Type = __UI_Type_ContextMenu THEN + IF __UI_FirstSelectedID = Control(i).ID THEN Control(i).ControlState = 2 - Else + ELSE Control(i).ControlState = 1 - End If + END IF Control(i).Redraw = True - End If - Next - Else - For i = 1 To UBound(Control) - If Control(i).Type = __UI_Type_ContextMenu Then - If Control(__UI_FirstSelectedID).ContextMenuID = Control(i).ID Then + END IF + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).Type = __UI_Type_ContextMenu THEN + IF Control(__UI_FirstSelectedID).ContextMenuID = Control(i).ID THEN Control(i).ControlState = 2 - Else + ELSE Control(i).ControlState = 1 - End If + END IF Control(i).Redraw = True - End If - Next - End If - End If - ElseIf __UI_TotalSelectedControls > 1 Then - Dim SearchType As Integer, AllControlsTurnInto As _Byte + END IF + NEXT + END IF + END IF + ELSEIF __UI_TotalSelectedControls > 1 THEN + DIM SearchType AS INTEGER, AllControlsTurnInto AS _BYTE SearchType = Control(__UI_FirstSelectedID).Type AllControlsTurnInto = True - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - If SearchType = __UI_Type_TextBox Then - If Control(i).NumericOnly <> Control(__UI_FirstSelectedID).NumericOnly Then + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + IF SearchType = __UI_Type_TextBox THEN + IF Control(i).NumericOnly <> Control(__UI_FirstSelectedID).NumericOnly THEN AllControlsTurnInto = False - Exit For - End If - Else - If Control(i).Type <> SearchType Then + EXIT FOR + END IF + ELSE + IF Control(i).Type <> SearchType THEN AllControlsTurnInto = False - Exit For - End If - End If - End If - Next + EXIT FOR + END IF + END IF + END IF + NEXT SearchType = __UI_Type(SearchType).TurnsInto - If SearchType = 0 And Control(__UI_FirstSelectedID).Type = __UI_Type_TextBox Then - If Control(__UI_FirstSelectedID).NumericOnly = False Then + IF SearchType = 0 AND Control(__UI_FirstSelectedID).Type = __UI_Type_TextBox THEN + IF Control(__UI_FirstSelectedID).NumericOnly = False THEN SearchType = -1 - Else + ELSE SearchType = -2 - End If - End If - If Not AllControlsTurnInto Then SearchType = 0 - If prevTurnsInto <> SearchType Then + END IF + END IF + IF NOT AllControlsTurnInto THEN SearchType = 0 + IF prevTurnsInto <> SearchType THEN prevTurnsInto = SearchType b$ = MKI$(prevTurnsInto) SendData b$, "TURNSINTO" - End If + END IF - If __UI_DesignMode = True And __UI_ShowInvisibleControls = True Then + IF __UI_DesignMode = True AND __UI_ShowInvisibleControls = True THEN 'Check if all selected controls have the same ContextMenu 'attached to them and indicate that - Dim SelectionContextMenu As Long, AllControlsHaveTheSameContextMenu As _Byte + DIM SelectionContextMenu AS LONG, AllControlsHaveTheSameContextMenu AS _BYTE AllControlsHaveTheSameContextMenu = True SelectionContextMenu = Control(__UI_FirstSelectedID).ContextMenuID - If SelectionContextMenu > 0 Then - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - If Control(i).ContextMenuID <> SelectionContextMenu Then + IF SelectionContextMenu > 0 THEN + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + IF Control(i).ContextMenuID <> SelectionContextMenu THEN AllControlsHaveTheSameContextMenu = False - Exit For - End If - End If - Next - Else + EXIT FOR + END IF + END IF + NEXT + ELSE AllControlsHaveTheSameContextMenu = False - End If + END IF - If AllControlsHaveTheSameContextMenu Then - For i = 1 To UBound(Control) - If Control(i).Type = __UI_Type_ContextMenu Then - If SelectionContextMenu = Control(i).ID Then + IF AllControlsHaveTheSameContextMenu THEN + FOR i = 1 TO UBOUND(Control) + IF Control(i).Type = __UI_Type_ContextMenu THEN + IF SelectionContextMenu = Control(i).ID THEN Control(i).ControlState = 2 - Else + ELSE Control(i).ControlState = 1 - End If + END IF Control(i).Redraw = True - End If - Next - Else - For i = 1 To UBound(Control) - If Control(i).Type = __UI_Type_ContextMenu Then + END IF + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).Type = __UI_Type_ContextMenu THEN Control(i).ControlState = 1 Control(i).Redraw = True - End If - Next - End If - End If - End If - Else - For i = 1 To UBound(Control) - If Control(i).Type = __UI_Type_ContextMenu Then + END IF + NEXT + END IF + END IF + END IF + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).Type = __UI_Type_ContextMenu THEN Control(i).ControlState = 1 'normal state Control(i).Redraw = True - End If - Next - End If + END IF + NEXT + END IF - Do While Len(Signal$) - b$ = Left$(Signal$, 2) - Signal$ = Mid$(Signal$, 3) + DO WHILE LEN(Signal$) + b$ = LEFT$(Signal$, 2) + Signal$ = MID$(Signal$, 3) TempValue = CVI(b$) - If TempValue = -2 Then + IF TempValue = -2 THEN 'Hide the preview - _ScreenHide - ElseIf TempValue = -3 Then + _SCREENHIDE + ELSEIF TempValue = -3 THEN 'Show the preview - _ScreenShow - ElseIf TempValue = -4 Then + _SCREENSHOW + ELSEIF TempValue = -4 THEN 'Load an existing file IsCreating = True - Dim FileToLoad As Integer - FileToLoad = FreeFile - Open FileNameToLoad$ For Binary As #FileToLoad - a$ = Space$(LOF(FileToLoad)) - Get #FileToLoad, 1, a$ - Close #FileToLoad + DIM FileToLoad AS INTEGER + FileToLoad = FREEFILE + OPEN FileNameToLoad$ FOR BINARY AS #FileToLoad + a$ = SPACE$(LOF(FileToLoad)) + GET #FileToLoad, 1, a$ + CLOSE #FileToLoad - FileToLoad = FreeFile - Open "UiEditorPreview.frmbin" For Binary As #FileToLoad - Put #FileToLoad, 1, a$ - Close #FileToLoad + FileToLoad = FREEFILE + OPEN "InForm/UiEditorPreview.frmbin" FOR BINARY AS #FileToLoad + PUT #FileToLoad, 1, a$ + CLOSE #FileToLoad __UI_DefaultButtonID = 0 - _ScreenShow - If InStr(a$, "SUB __UI_LoadForm") > 0 Then + _SCREENSHOW + IF INSTR(a$, "SUB __UI_LoadForm") > 0 THEN LoadPreviewText - Else + ELSE LoadPreview InDisk - End If + END IF UndoPointer = 0 TotalUndoImages = 0 SendSignal -7 'Form just loaded - ElseIf TempValue = -5 Then + ELSEIF TempValue = -5 THEN 'Reset request (new form) IsCreating = True a$ = Unpack$(EmptyForm$) - FileToLoad = FreeFile - Open "UiEditorPreview.frmbin" For Binary As #FileToLoad - Put #FileToLoad, 1, a$ - Close #FileToLoad + FileToLoad = FREEFILE + OPEN "InForm/UiEditorPreview.frmbin" FOR BINARY AS #FileToLoad + PUT #FileToLoad, 1, a$ + CLOSE #FileToLoad LoadPreview InDisk LoadDefaultFonts @@ -634,1174 +634,1174 @@ Sub __UI_BeforeUpdateDisplay UndoPointer = 0 TotalUndoImages = 0 __UI_DefaultButtonID = 0 - _Icon + _ICON SendSignal -7 'New form created - ElseIf TempValue = -6 Then + ELSEIF TempValue = -6 THEN 'Set current button as default - If __UI_DefaultButtonID = __UI_FirstSelectedID Then + IF __UI_DefaultButtonID = __UI_FirstSelectedID THEN __UI_DefaultButtonID = 0 - Else + ELSE __UI_DefaultButtonID = __UI_FirstSelectedID - End If - ElseIf TempValue = -7 Then + END IF + ELSEIF TempValue = -7 THEN __UI_RestoreImageOriginalSize - ElseIf TempValue = -8 Then + ELSEIF TempValue = -8 THEN 'Editor is manipulated, preview menus must be closed. - If __UI_TotalActiveMenus > 0 And Left$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) = "__UI_" Then + IF __UI_TotalActiveMenus > 0 AND LEFT$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) = "__UI_" THEN __UI_CloseAllMenus - End If - ElseIf TempValue = 214 Then + END IF + ELSEIF TempValue = 214 THEN RestoreUndoImage - ElseIf TempValue = 215 Then + ELSEIF TempValue = 215 THEN RestoreRedoImage - End If - Loop + END IF + LOOP - Dim PropertyApplied As _Byte, LockedControlsGOSUB As _Byte + DIM PropertyApplied AS _BYTE, LockedControlsGOSUB AS _BYTE PropertyApplied = False - If TotalLockedControls Then LockedControlsGOSUB = True Else LockedControlsGOSUB = False - Do While Len(Property$) - Dim FloatValue As _Float, temp$, temp2$ + IF TotalLockedControls THEN LockedControlsGOSUB = True ELSE LockedControlsGOSUB = False + DO WHILE LEN(Property$) + DIM FloatValue AS _FLOAT, temp$, temp2$ 'Editor sent property value b$ = ReadSequential$(Property$, 2) TempValue = CVI(b$) SaveUndoImage PropertyApplied = True - Select Case TempValue - Case 1 'Name + SELECT CASE TempValue + CASE 1 'Name b$ = ReadSequential$(Property$, 4) b$ = ReadSequential$(Property$, CVL(b$)) - If TotalLockedControls = 1 Then + IF TotalLockedControls = 1 THEN temp$ = AdaptName$(b$, LockedControls(1)) - temp2$ = RTrim$(Control(LockedControls(1)).Name) + Chr$(10) + temp$ + temp2$ = RTRIM$(Control(LockedControls(1)).Name) + CHR$(10) + temp$ SendData temp2$, "CONTROLRENAMED" Control(LockedControls(1)).Name = temp$ - Else - If __UI_TotalSelectedControls = 1 Then + ELSE + IF __UI_TotalSelectedControls = 1 THEN temp$ = AdaptName$(b$, __UI_FirstSelectedID) - temp2$ = RTrim$(Control(__UI_FirstSelectedID).Name) + Chr$(10) + temp$ + temp2$ = RTRIM$(Control(__UI_FirstSelectedID).Name) + CHR$(10) + temp$ SendData temp2$, "CONTROLRENAMED" Control(__UI_FirstSelectedID).Name = temp$ - ElseIf __UI_TotalSelectedControls = 0 Then + ELSEIF __UI_TotalSelectedControls = 0 THEN temp$ = AdaptName$(b$, __UI_FormID) - temp2$ = RTrim$(Control(__UI_FormID).Name) + Chr$(10) + temp$ + temp2$ = RTRIM$(Control(__UI_FormID).Name) + CHR$(10) + temp$ SendData temp2$, "CONTROLRENAMED" Control(__UI_FormID).Name = temp$ - End If - End If - Case 2 'Caption + END IF + END IF + CASE 2 'Caption b$ = ReadSequential$(Property$, 4) b$ = ReadSequential$(Property$, CVL(b$)) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls i = LockedControls(j) - GoSub ChangeCaption - Next - Else - If __UI_TotalSelectedControls > 0 Then - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + GOSUB ChangeCaption + NEXT + ELSE + IF __UI_TotalSelectedControls > 0 THEN + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN ChangeCaption: - If Control(i).Type = __UI_Type_Label Then - Dim TotalReplacements As Long - b$ = Replace(b$, "\n", Chr$(10), False, TotalReplacements) - End If + IF Control(i).Type = __UI_Type_Label THEN + DIM TotalReplacements AS LONG + b$ = Replace(b$, "\n", CHR$(10), False, TotalReplacements) + END IF SetCaption i, b$ - If Control(i).Type = __UI_Type_Label Then AutoSizeLabel Control(i) - If Len(b$) > 0 And b$ <> "&" Then GoSub AutoName - If Control(i).Type = __UI_Type_MenuItem Then + IF Control(i).Type = __UI_Type_Label THEN AutoSizeLabel Control(i) + IF LEN(b$) > 0 AND b$ <> "&" THEN GOSUB AutoName + IF Control(i).Type = __UI_Type_MenuItem THEN __UI_ActivateMenu Control(Control(i).ParentID), False - End If - If LockedControlsGOSUB Then Return - End If - Next - Else + END IF + IF LockedControlsGOSUB THEN RETURN + END IF + NEXT + ELSE Caption(__UI_FormID) = b$ i = __UI_FormID - If Len(b$) > 0 And b$ <> "&" Then GoSub AutoName - End If - End If + IF LEN(b$) > 0 AND b$ <> "&" THEN GOSUB AutoName + END IF + END IF - GoTo SkipAutoName + GOTO SkipAutoName AutoName: - If AutoNameControls Then - Dim NewName$ + IF AutoNameControls THEN + DIM NewName$ - NewName$ = RTrim$(b$) + NewName$ = RTRIM$(b$) - If Control(i).Type = __UI_Type_MenuBar Then - If Len(NewName$) > 36 Then NewName$ = Left$(NewName$, 36) - ElseIf Control(i).Type <> __UI_Type_Form And Control(i).Type <> __UI_Type_MenuItem And Control(i).Type <> __UI_Type_ListBox And Control(i).Type <> __UI_Type_TrackBar And Control(i).Type <> __UI_Type_DropdownList Then - If Len(NewName$) > 38 Then NewName$ = Left$(NewName$, 38) - End If - Select Case Control(i).Type - Case __UI_Type_Button: NewName$ = NewName$ + "BT" - Case __UI_Type_Label: NewName$ = NewName$ + "LB" - Case __UI_Type_CheckBox: NewName$ = NewName$ + "CB" - Case __UI_Type_RadioButton: NewName$ = NewName$ + "RB" - Case __UI_Type_TextBox: NewName$ = NewName$ + "TB" - Case __UI_Type_ProgressBar: NewName$ = NewName$ + "PB" - Case __UI_Type_MenuBar: NewName$ = NewName$ + "Menu" - Case __UI_Type_MenuItem - NewName$ = RTrim$(Control(Control(i).ParentID).Name) + NewName$ - Case __UI_Type_PictureBox: NewName$ = NewName$ + "PX" - End Select + IF Control(i).Type = __UI_Type_MenuBar THEN + IF LEN(NewName$) > 36 THEN NewName$ = LEFT$(NewName$, 36) + ELSEIF Control(i).Type <> __UI_Type_Form AND Control(i).Type <> __UI_Type_MenuItem AND Control(i).Type <> __UI_Type_ListBox AND Control(i).Type <> __UI_Type_TrackBar AND Control(i).Type <> __UI_Type_DropdownList THEN + IF LEN(NewName$) > 38 THEN NewName$ = LEFT$(NewName$, 38) + END IF + SELECT CASE Control(i).Type + CASE __UI_Type_Button: NewName$ = NewName$ + "BT" + CASE __UI_Type_Label: NewName$ = NewName$ + "LB" + CASE __UI_Type_CheckBox: NewName$ = NewName$ + "CB" + CASE __UI_Type_RadioButton: NewName$ = NewName$ + "RB" + CASE __UI_Type_TextBox: NewName$ = NewName$ + "TB" + CASE __UI_Type_ProgressBar: NewName$ = NewName$ + "PB" + CASE __UI_Type_MenuBar: NewName$ = NewName$ + "Menu" + CASE __UI_Type_MenuItem + NewName$ = RTRIM$(Control(Control(i).ParentID).Name) + NewName$ + CASE __UI_Type_PictureBox: NewName$ = NewName$ + "PX" + END SELECT temp$ = AdaptName$(NewName$, i) - temp2$ = RTrim$(Control(i).Name) + Chr$(10) + temp$ + temp2$ = RTRIM$(Control(i).Name) + CHR$(10) + temp$ SendData temp2$, "CONTROLRENAMED" Control(i).Name = temp$ - End If - Return + END IF + RETURN SkipAutoName: - Case 3 'Text + CASE 3 'Text b$ = ReadSequential$(Property$, 4) b$ = ReadSequential$(Property$, CVL(b$)) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls i = LockedControls(j) - GoSub ChangeText - Next - Else - If __UI_TotalSelectedControls > 0 Then - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + GOSUB ChangeText + NEXT + ELSE + IF __UI_TotalSelectedControls > 0 THEN + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN ChangeText: Text(i) = b$ - If Control(i).Type = __UI_Type_TextBox And Control(i).NumericOnly Then + IF Control(i).Type = __UI_Type_TextBox AND Control(i).NumericOnly THEN Text(i) = b$ - Control(i).Value = Val(b$) - ElseIf Control(i).Type = __UI_Type_TextBox And Control(i).Max > 0 Then - Text(i) = Left$(b$, Control(i).Max) - End If - If Control(i).Type = __UI_Type_Button Or Control(i).Type = __UI_Type_MenuItem Then + Control(i).Value = VAL(b$) + ELSEIF Control(i).Type = __UI_Type_TextBox AND Control(i).Max > 0 THEN + Text(i) = LEFT$(b$, Control(i).Max) + END IF + IF Control(i).Type = __UI_Type_Button OR Control(i).Type = __UI_Type_MenuItem THEN LoadImage Control(i), b$ - ElseIf Control(i).Type = __UI_Type_PictureBox Then + ELSEIF Control(i).Type = __UI_Type_PictureBox THEN PreviewLoadImage Control(i), b$ - If Len(Text(i)) > 0 Then 'Load successful + IF LEN(Text(i)) > 0 THEN 'Load successful 'Keep aspect ratio at load - Control(i).Height = (_Height(Control(i).HelperCanvas) / _Width(Control(i).HelperCanvas)) * Control(i).Width - If Len(b$) > 0 And b$ <> "&" Then GoSub AutoName - End If - ElseIf Control(i).Type = __UI_Type_ListBox Or Control(i).Type = __UI_Type_DropdownList Then - Text(i) = Replace(b$, "\n", Chr$(10), False, TotalReplacements) - If Control(i).Max < TotalReplacements + 1 Then Control(i).Max = TotalReplacements + 1 + Control(i).Height = (_HEIGHT(Control(i).HelperCanvas) / _WIDTH(Control(i).HelperCanvas)) * Control(i).Width + IF LEN(b$) > 0 AND b$ <> "&" THEN GOSUB AutoName + END IF + ELSEIF Control(i).Type = __UI_Type_ListBox OR Control(i).Type = __UI_Type_DropdownList THEN + Text(i) = Replace(b$, "\n", CHR$(10), False, TotalReplacements) + IF Control(i).Max < TotalReplacements + 1 THEN Control(i).Max = TotalReplacements + 1 Control(i).LastVisibleItem = 0 'Reset it so it's recalculated - End If - If LockedControlsGOSUB Then Return - End If - Next - Else - If ExeIcon <> 0 Then _FreeImage ExeIcon: ExeIcon = 0 + END IF + IF LockedControlsGOSUB THEN RETURN + END IF + NEXT + ELSE + IF ExeIcon <> 0 THEN _FREEIMAGE ExeIcon: ExeIcon = 0 ExeIcon = IconPreview&(b$) - If ExeIcon < -1 Then - _Icon ExeIcon + IF ExeIcon < -1 THEN + _ICON ExeIcon Text(__UI_FormID) = b$ - Else - _Icon - If _FileExists(b$) Then - If LCase$(Right$(b$, 4)) <> ".ico" Then + ELSE + _ICON + IF _FILEEXISTS(b$) THEN + IF LCASE$(RIGHT$(b$, 4)) <> ".ico" THEN SendSignal -6 Text(__UI_FormID) = "" - Else + ELSE SendSignal -4 Text(__UI_FormID) = b$ - End If - Else + END IF + ELSE Text(__UI_FormID) = "" - End If - End If - End If - End If - Case 4 'Top + END IF + END IF + END IF + END IF + CASE 4 'Top b$ = ReadSequential$(Property$, 2) TempValue = CVI(b$) - If TotalLockedControls > 0 Then - For i = 1 To TotalLockedControls + IF TotalLockedControls > 0 THEN + FOR i = 1 TO TotalLockedControls Control(LockedControls(i)).Top = TempValue - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).Top = TempValue - End If - Next - End If - Case 5 'Left + END IF + NEXT + END IF + CASE 5 'Left b$ = ReadSequential$(Property$, 2) TempValue = CVI(b$) - If TotalLockedControls > 0 Then - For i = 1 To TotalLockedControls + IF TotalLockedControls > 0 THEN + FOR i = 1 TO TotalLockedControls Control(LockedControls(i)).Left = TempValue - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).Left = TempValue - End If - Next - End If - Case 6 'Width + END IF + NEXT + END IF + CASE 6 'Width b$ = ReadSequential$(Property$, 2) TempValue = CVI(b$) - If TempValue < 1 Then TempValue = 1 - If TotalLockedControls > 0 Then - For i = 1 To TotalLockedControls + IF TempValue < 1 THEN TempValue = 1 + IF TotalLockedControls > 0 THEN + FOR i = 1 TO TotalLockedControls IF __UI_Type(Control(LockedControls(i)).Type).RestrictResize <> __UI_CantResizeH AND _ __UI_Type(Control(LockedControls(i)).Type).RestrictResize <> __UI_CantResize THEN Control(LockedControls(i)).Width = TempValue - End If - Next - Else - If __UI_TotalSelectedControls > 0 Then - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + END IF + NEXT + ELSE + IF __UI_TotalSelectedControls > 0 THEN + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN IF __UI_Type(Control(i).Type).RestrictResize <> __UI_CantResizeH AND _ __UI_Type(Control(i).Type).RestrictResize <> __UI_CantResize THEN Control(i).Width = TempValue - End If - End If - Next - Else - If TempValue < 20 Then TempValue = 20 + END IF + END IF + NEXT + ELSE + IF TempValue < 20 THEN TempValue = 20 Control(__UI_FormID).Width = TempValue - End If - End If - Case 7 'Height + END IF + END IF + CASE 7 'Height b$ = ReadSequential$(Property$, 2) TempValue = CVI(b$) - If TempValue < 1 Then TempValue = 1 - If TotalLockedControls > 0 Then - For i = 1 To TotalLockedControls + IF TempValue < 1 THEN TempValue = 1 + IF TotalLockedControls > 0 THEN + FOR i = 1 TO TotalLockedControls IF __UI_Type(Control(LockedControls(i)).Type).RestrictResize <> __UI_CantResizeV AND _ __UI_Type(Control(LockedControls(i)).Type).RestrictResize <> __UI_CantResize THEN Control(LockedControls(i)).Height = TempValue - End If - Next - Else - If __UI_TotalSelectedControls > 0 Then - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + END IF + NEXT + ELSE + IF __UI_TotalSelectedControls > 0 THEN + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN IF __UI_Type(Control(i).Type).RestrictResize <> __UI_CantResizeV AND _ __UI_Type(Control(i).Type).RestrictResize <> __UI_CantResize THEN Control(i).Height = TempValue - End If - End If - Next - Else - If TempValue < 20 Then TempValue = 20 + END IF + END IF + NEXT + ELSE + IF TempValue < 20 THEN TempValue = 20 Control(__UI_FormID).Height = TempValue - End If - End If - Case 8 'Font + END IF + END IF + CASE 8 'Font b$ = ReadSequential$(Property$, 4) b$ = ReadSequential$(Property$, CVL(b$)) - Dim NewFontFile As String - Dim NewFontSize As Integer - Dim FindSep As Integer, TotalSep As Integer + DIM NewFontFile AS STRING + DIM NewFontSize AS INTEGER + DIM FindSep AS INTEGER, TotalSep AS INTEGER 'Parse b$ into Font data - FindSep = InStr(b$, ",") - If FindSep Then TotalSep = TotalSep + 1 - NewFontFile = Left$(b$, FindSep - 1) - b$ = Mid$(b$, FindSep + 1) + FindSep = INSTR(b$, ",") + IF FindSep THEN TotalSep = TotalSep + 1 + NewFontFile = LEFT$(b$, FindSep - 1) + b$ = MID$(b$, FindSep + 1) - NewFontSize = Val(b$) + NewFontSize = VAL(b$) - If TotalSep = 1 And NewFontSize > 0 Then - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalSep = 1 AND NewFontSize > 0 THEN + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls i = LockedControls(j) - GoSub ChangeFont - Next - Else - If __UI_TotalSelectedControls > 0 Then - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + GOSUB ChangeFont + NEXT + ELSE + IF __UI_TotalSelectedControls > 0 THEN + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN ChangeFont: Control(i).Font = SetFont(NewFontFile, NewFontSize) - Dim tempFont As Long - tempFont = _Font - _Font Control(i).Font - Select Case Control(i).Type - Case __UI_Type_Label - If Control(i).WordWrap = False Then - Control(i).Height = uspacing + 6 + (Abs(Control(i).HasBorder) * Control(i).BorderSize) + DIM tempFont AS LONG + tempFont = _FONT + _FONT Control(i).Font + SELECT CASE Control(i).Type + CASE __UI_Type_Label + IF Control(i).WordWrap = False THEN + Control(i).Height = uspacing + 6 + (ABS(Control(i).HasBorder) * Control(i).BorderSize) AutoSizeLabel Control(i) - End If - Case __UI_Type_TextBox - If Control(i).Multiline = False Then - Control(i).Height = uspacing + 6 + (Abs(Control(i).HasBorder) * Control(i).BorderSize) - End If - Case __UI_Type_CheckBox, __UI_Type_RadioButton + END IF + CASE __UI_Type_TextBox + IF Control(i).Multiline = False THEN + Control(i).Height = uspacing + 6 + (ABS(Control(i).HasBorder) * Control(i).BorderSize) + END IF + CASE __UI_Type_CheckBox, __UI_Type_RadioButton Control(i).Height = uspacing + 6 - Case __UI_Type_ProgressBar - If InStr(Caption(i), Chr$(10)) = 0 Then + CASE __UI_Type_ProgressBar + IF INSTR(Caption(i), CHR$(10)) = 0 THEN Control(i).Height = uspacing + 6 - End If - End Select - If Control(i).HotKey > 0 Then - If Control(i).HotKeyPosition = 1 Then + END IF + END SELECT + IF Control(i).HotKey > 0 THEN + IF Control(i).HotKeyPosition = 1 THEN Control(i).HotKeyOffset = 0 - Else - Control(i).HotKeyOffset = __UI_PrintWidth(Left$(Caption(i), Control(i).HotKeyPosition - 1)) - End If - End If - _Font tempFont - If LockedControlsGOSUB Then Return - End If - Next - Else + ELSE + Control(i).HotKeyOffset = __UI_PrintWidth(LEFT$(Caption(i), Control(i).HotKeyPosition - 1)) + END IF + END IF + _FONT tempFont + IF LockedControlsGOSUB THEN RETURN + END IF + NEXT + ELSE Control(__UI_FormID).Font = SetFont(NewFontFile, NewFontSize) - Dim MustRedrawMenus As _Byte - For i = 1 To UBound(Control) - If Control(i).Type = __UI_Type_MenuBar Or Control(i).Type = __UI_Type_MenuItem Or Control(i).Type = __UI_Type_MenuPanel Or Control(i).Type = __UI_Type_ContextMenu Then + DIM MustRedrawMenus AS _BYTE + FOR i = 1 TO UBOUND(Control) + IF Control(i).Type = __UI_Type_MenuBar OR Control(i).Type = __UI_Type_MenuItem OR Control(i).Type = __UI_Type_MenuPanel OR Control(i).Type = __UI_Type_ContextMenu THEN Control(i).Font = SetFont(NewFontFile, NewFontSize) MustRedrawMenus = True - End If - Next - If MustRedrawMenus Then __UI_RefreshMenuBar - End If - End If - End If - Case 9 'Tooltip + END IF + NEXT + IF MustRedrawMenus THEN __UI_RefreshMenuBar + END IF + END IF + END IF + CASE 9 'Tooltip b$ = ReadSequential$(Property$, 4) b$ = ReadSequential$(Property$, CVL(b$)) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls i = LockedControls(j) - GoSub ChangeTooltip - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + GOSUB ChangeTooltip + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN ChangeTooltip: - ToolTip(i) = Replace(b$, "\n", Chr$(10), False, 0) - If LockedControlsGOSUB Then Return - End If - Next - End If - Case 10 'Value - b$ = ReadSequential$(Property$, Len(FloatValue)) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + ToolTip(i) = Replace(b$, "\n", CHR$(10), False, 0) + IF LockedControlsGOSUB THEN RETURN + END IF + NEXT + END IF + CASE 10 'Value + b$ = ReadSequential$(Property$, LEN(FloatValue)) + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls i = LockedControls(j) - GoSub ChangeValue - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + GOSUB ChangeValue + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN ChangeValue: - If Control(i).Type = __UI_Type_CheckBox Or (Control(i).Type = __UI_Type_MenuItem And Control(i).BulletStyle = __UI_CheckMark) Or Control(i).Type = __UI_Type_ToggleSwitch Then - If _CV(_Float, b$) <> 0 Then + IF Control(i).Type = __UI_Type_CheckBox OR (Control(i).Type = __UI_Type_MenuItem AND Control(i).BulletStyle = __UI_CheckMark) OR Control(i).Type = __UI_Type_ToggleSwitch THEN + IF _CV(_FLOAT, b$) <> 0 THEN Control(i).Value = True - Else + ELSE Control(i).Value = False - End If - ElseIf Control(i).Type = __UI_Type_RadioButton Or (Control(i).Type = __UI_Type_MenuItem And Control(i).BulletStyle = __UI_Bullet) Then - If _CV(_Float, b$) <> 0 Then + END IF + ELSEIF Control(i).Type = __UI_Type_RadioButton OR (Control(i).Type = __UI_Type_MenuItem AND Control(i).BulletStyle = __UI_Bullet) THEN + IF _CV(_FLOAT, b$) <> 0 THEN SetRadioButtonValue i - Else + ELSE Control(i).Value = False - End If - Else - Control(i).Value = _CV(_Float, b$) - End If - If LockedControlsGOSUB Then Return - End If - Next - End If - Case 11 'Min - b$ = ReadSequential$(Property$, Len(FloatValue)) - If TotalLockedControls Then - For j = 1 To TotalLockedControls - Control(LockedControls(j)).Min = _CV(_Float, b$) - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - Control(i).Min = _CV(_Float, b$) - End If - Next - End If - Case 12 'Max - b$ = ReadSequential$(Property$, Len(FloatValue)) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + END IF + ELSE + Control(i).Value = _CV(_FLOAT, b$) + END IF + IF LockedControlsGOSUB THEN RETURN + END IF + NEXT + END IF + CASE 11 'Min + b$ = ReadSequential$(Property$, LEN(FloatValue)) + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls + Control(LockedControls(j)).Min = _CV(_FLOAT, b$) + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + Control(i).Min = _CV(_FLOAT, b$) + END IF + NEXT + END IF + CASE 12 'Max + b$ = ReadSequential$(Property$, LEN(FloatValue)) + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls i = LockedControls(j) - GoSub ChangeMax - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + GOSUB ChangeMax + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN ChangeMax: - Control(i).Max = _CV(_Float, b$) - If Control(i).Type = __UI_Type_TextBox Then - Text(i) = Left$(Text(i), Int(Control(i).Max)) - If Len(Mask(i)) > 0 Then Mask(i) = "" - End If - If LockedControlsGOSUB Then Return - End If - Next - End If - Case 13 'Interval - b$ = ReadSequential$(Property$, Len(FloatValue)) - If TotalLockedControls Then - For j = 1 To TotalLockedControls - Control(LockedControls(j)).Interval = _CV(_Float, b$) - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - Control(i).Interval = _CV(_Float, b$) - End If - Next - End If - Case 14 'Stretch + Control(i).Max = _CV(_FLOAT, b$) + IF Control(i).Type = __UI_Type_TextBox THEN + Text(i) = LEFT$(Text(i), INT(Control(i).Max)) + IF LEN(Mask(i)) > 0 THEN Mask(i) = "" + END IF + IF LockedControlsGOSUB THEN RETURN + END IF + NEXT + END IF + CASE 13 'Interval + b$ = ReadSequential$(Property$, LEN(FloatValue)) + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls + Control(LockedControls(j)).Interval = _CV(_FLOAT, b$) + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + Control(i).Interval = _CV(_FLOAT, b$) + END IF + NEXT + END IF + CASE 14 'Stretch b$ = ReadSequential$(Property$, 2) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls Control(LockedControls(j)).Stretch = CVI(b$) - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).Stretch = CVI(b$) - End If - Next - End If - Case 15 'Has border + END IF + NEXT + END IF + CASE 15 'Has border b$ = ReadSequential$(Property$, 2) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls Control(LockedControls(j)).HasBorder = CVI(b$) - If CVI(b$) Then - If Control(LockedControls(j)).BorderSize = 0 Then + IF CVI(b$) THEN + IF Control(LockedControls(j)).BorderSize = 0 THEN Control(LockedControls(j)).BorderSize = 1 - End If - End If - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + END IF + END IF + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).HasBorder = CVI(b$) - If CVI(b$) Then - If Control(i).BorderSize = 0 Then + IF CVI(b$) THEN + IF Control(i).BorderSize = 0 THEN Control(i).BorderSize = 1 - End If - End If - End If - Next - End If - Case 16 'Show percentage + END IF + END IF + END IF + NEXT + END IF + CASE 16 'Show percentage b$ = ReadSequential$(Property$, 2) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls Control(LockedControls(j)).ShowPercentage = CVI(b$) - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).ShowPercentage = CVI(b$) - End If - Next - End If - Case 17 'Word wrap + END IF + NEXT + END IF + CASE 17 'Word wrap b$ = ReadSequential$(Property$, 2) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls Control(LockedControls(j)).WordWrap = CVI(b$) - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).WordWrap = CVI(b$) - End If - Next - End If - Case 18 'Can have focus + END IF + NEXT + END IF + CASE 18 'Can have focus b$ = ReadSequential$(Property$, 2) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls Control(LockedControls(j)).CanHaveFocus = CVI(b$) - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).CanHaveFocus = CVI(b$) - End If - Next - End If - Case 19 'Disabled + END IF + NEXT + END IF + CASE 19 'Disabled b$ = ReadSequential$(Property$, 2) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls Control(LockedControls(j)).Disabled = CVI(b$) - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).Disabled = CVI(b$) - End If - Next - End If - Case 20 'Hidden + END IF + NEXT + END IF + CASE 20 'Hidden b$ = ReadSequential$(Property$, 2) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls i = LockedControls(j) - GoSub ChangeHidden - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + GOSUB ChangeHidden + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN ChangeHidden: Control(i).Hidden = CVI(b$) - If Control(i).Type = __UI_Type_MenuItem And __UI_ParentMenu(__UI_TotalActiveMenus) = Control(i).ParentID Then + IF Control(i).Type = __UI_Type_MenuItem AND __UI_ParentMenu(__UI_TotalActiveMenus) = Control(i).ParentID THEN __UI_ActivateMenu Control(Control(i).ParentID), False - End If - If LockedControlsGOSUB Then Return - End If - Next - End If - Case 21 'CenteredWindow - Form only + END IF + IF LockedControlsGOSUB THEN RETURN + END IF + NEXT + END IF + CASE 21 'CenteredWindow - Form only b$ = ReadSequential$(Property$, 2) TempValue = CVI(b$) - If TotalLockedControls = 0 And __UI_TotalSelectedControls = 0 Then + IF TotalLockedControls = 0 AND __UI_TotalSelectedControls = 0 THEN Control(__UI_FormID).CenteredWindow = TempValue - End If - Case 22 'Alignment + END IF + CASE 22 'Alignment b$ = ReadSequential$(Property$, 2) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls i = LockedControls(j) - GoSub ChangeAlignment - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + GOSUB ChangeAlignment + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN ChangeAlignment: Control(i).Align = CVI(b$) - If Control(i).Type = __UI_Type_MenuBar Then - If Control(i).Align <> __UI_Left Then Control(i).Align = __UI_Right - If __UI_TotalActiveMenus > 0 Then __UI_CloseAllMenus + IF Control(i).Type = __UI_Type_MenuBar THEN + IF Control(i).Align <> __UI_Left THEN Control(i).Align = __UI_Right + IF __UI_TotalActiveMenus > 0 THEN __UI_CloseAllMenus __UI_RefreshMenuBar - End If - If LockedControlsGOSUB Then Return - End If - Next - End If - Case 23 'ForeColor + END IF + IF LockedControlsGOSUB THEN RETURN + END IF + NEXT + END IF + CASE 23 'ForeColor b$ = ReadSequential$(Property$, 4) - If TotalLockedControls Then - For j = 1 To TotalLockedControls - Control(LockedControls(j)).ForeColor = _CV(_Unsigned Long, b$) - Next - Else - If __UI_TotalSelectedControls > 0 Then - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - Control(i).ForeColor = _CV(_Unsigned Long, b$) - End If - Next - Else - Control(__UI_FormID).ForeColor = _CV(_Unsigned Long, b$) - For i = 1 To UBound(Control) - If Control(i).Type = __UI_Type_MenuBar Then - Control(i).ForeColor = _CV(_Unsigned Long, b$) - End If - Next - End If - End If - Case 24 'BackColor + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls + Control(LockedControls(j)).ForeColor = _CV(_UNSIGNED LONG, b$) + NEXT + ELSE + IF __UI_TotalSelectedControls > 0 THEN + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + Control(i).ForeColor = _CV(_UNSIGNED LONG, b$) + END IF + NEXT + ELSE + Control(__UI_FormID).ForeColor = _CV(_UNSIGNED LONG, b$) + FOR i = 1 TO UBOUND(Control) + IF Control(i).Type = __UI_Type_MenuBar THEN + Control(i).ForeColor = _CV(_UNSIGNED LONG, b$) + END IF + NEXT + END IF + END IF + CASE 24 'BackColor b$ = ReadSequential$(Property$, 4) - If TotalLockedControls Then - For j = 1 To TotalLockedControls - Control(LockedControls(j)).BackColor = _CV(_Unsigned Long, b$) - Next - Else - If __UI_TotalSelectedControls > 0 Then - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - Control(i).BackColor = _CV(_Unsigned Long, b$) - End If - Next - Else - Control(__UI_FormID).BackColor = _CV(_Unsigned Long, b$) - For i = 1 To UBound(Control) - If Control(i).Type = __UI_Type_MenuBar Then - Control(i).BackColor = _CV(_Unsigned Long, b$) - End If - Next - End If - End If - Case 25 'SelectedForeColor + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls + Control(LockedControls(j)).BackColor = _CV(_UNSIGNED LONG, b$) + NEXT + ELSE + IF __UI_TotalSelectedControls > 0 THEN + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + Control(i).BackColor = _CV(_UNSIGNED LONG, b$) + END IF + NEXT + ELSE + Control(__UI_FormID).BackColor = _CV(_UNSIGNED LONG, b$) + FOR i = 1 TO UBOUND(Control) + IF Control(i).Type = __UI_Type_MenuBar THEN + Control(i).BackColor = _CV(_UNSIGNED LONG, b$) + END IF + NEXT + END IF + END IF + CASE 25 'SelectedForeColor b$ = ReadSequential$(Property$, 4) - If TotalLockedControls Then - For j = 1 To TotalLockedControls - Control(LockedControls(j)).SelectedForeColor = _CV(_Unsigned Long, b$) - Next - Else - If __UI_TotalSelectedControls > 0 Then - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - Control(i).SelectedForeColor = _CV(_Unsigned Long, b$) - End If - Next - Else - Control(__UI_FormID).SelectedForeColor = _CV(_Unsigned Long, b$) - For i = 1 To UBound(Control) - If Control(i).Type = __UI_Type_MenuBar Or Control(i).Type = __UI_Type_MenuItem Or Control(i).Type = __UI_Type_MenuPanel Or Control(i).Type = __UI_Type_ContextMenu Then - Control(i).SelectedForeColor = _CV(_Unsigned Long, b$) - End If - Next - End If - End If - Case 26 'SelectedBackColor + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls + Control(LockedControls(j)).SelectedForeColor = _CV(_UNSIGNED LONG, b$) + NEXT + ELSE + IF __UI_TotalSelectedControls > 0 THEN + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + Control(i).SelectedForeColor = _CV(_UNSIGNED LONG, b$) + END IF + NEXT + ELSE + Control(__UI_FormID).SelectedForeColor = _CV(_UNSIGNED LONG, b$) + FOR i = 1 TO UBOUND(Control) + IF Control(i).Type = __UI_Type_MenuBar OR Control(i).Type = __UI_Type_MenuItem OR Control(i).Type = __UI_Type_MenuPanel OR Control(i).Type = __UI_Type_ContextMenu THEN + Control(i).SelectedForeColor = _CV(_UNSIGNED LONG, b$) + END IF + NEXT + END IF + END IF + CASE 26 'SelectedBackColor b$ = ReadSequential$(Property$, 4) - If TotalLockedControls Then - For j = 1 To TotalLockedControls - Control(LockedControls(j)).SelectedBackColor = _CV(_Unsigned Long, b$) - Next - Else - If __UI_TotalSelectedControls > 0 Then - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - Control(i).SelectedBackColor = _CV(_Unsigned Long, b$) - End If - Next - Else - Control(__UI_FormID).SelectedBackColor = _CV(_Unsigned Long, b$) - For i = 1 To UBound(Control) - If Control(i).Type = __UI_Type_MenuBar Or Control(i).Type = __UI_Type_MenuItem Or Control(i).Type = __UI_Type_MenuPanel Or Control(i).Type = __UI_Type_ContextMenu Then - Control(i).SelectedBackColor = _CV(_Unsigned Long, b$) - End If - Next - End If - End If - Case 27 'BorderColor + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls + Control(LockedControls(j)).SelectedBackColor = _CV(_UNSIGNED LONG, b$) + NEXT + ELSE + IF __UI_TotalSelectedControls > 0 THEN + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + Control(i).SelectedBackColor = _CV(_UNSIGNED LONG, b$) + END IF + NEXT + ELSE + Control(__UI_FormID).SelectedBackColor = _CV(_UNSIGNED LONG, b$) + FOR i = 1 TO UBOUND(Control) + IF Control(i).Type = __UI_Type_MenuBar OR Control(i).Type = __UI_Type_MenuItem OR Control(i).Type = __UI_Type_MenuPanel OR Control(i).Type = __UI_Type_ContextMenu THEN + Control(i).SelectedBackColor = _CV(_UNSIGNED LONG, b$) + END IF + NEXT + END IF + END IF + CASE 27 'BorderColor b$ = ReadSequential$(Property$, 4) - If TotalLockedControls Then - For j = 1 To TotalLockedControls - Control(LockedControls(j)).BorderColor = _CV(_Unsigned Long, b$) - Next - Else - If __UI_TotalSelectedControls > 0 Then - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - Control(i).BorderColor = _CV(_Unsigned Long, b$) - End If - Next - Else - Control(__UI_FormID).BorderColor = _CV(_Unsigned Long, b$) - End If - End If - Case 28 'BackStyle + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls + Control(LockedControls(j)).BorderColor = _CV(_UNSIGNED LONG, b$) + NEXT + ELSE + IF __UI_TotalSelectedControls > 0 THEN + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + Control(i).BorderColor = _CV(_UNSIGNED LONG, b$) + END IF + NEXT + ELSE + Control(__UI_FormID).BorderColor = _CV(_UNSIGNED LONG, b$) + END IF + END IF + CASE 28 'BackStyle b$ = ReadSequential$(Property$, 2) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls Control(LockedControls(j)).BackStyle = CVI(b$) - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).BackStyle = CVI(b$) - End If - Next - End If - Case 29 'CanResize - Form only + END IF + NEXT + END IF + CASE 29 'CanResize - Form only b$ = ReadSequential$(Property$, 2) TempValue = CVI(b$) - If TotalLockedControls = 0 And __UI_TotalSelectedControls = 0 Then + IF TotalLockedControls = 0 AND __UI_TotalSelectedControls = 0 THEN Control(__UI_FormID).CanResize = TempValue - End If - Case 31 'Padding + END IF + CASE 31 'Padding b$ = ReadSequential$(Property$, 2) TempValue = CVI(b$) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls Control(LockedControls(j)).Padding = TempValue - Next - ElseIf __UI_TotalSelectedControls > 0 Then - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + NEXT + ELSEIF __UI_TotalSelectedControls > 0 THEN + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).Padding = TempValue - End If - Next - End If - Case 32 'Vertical Alignment + END IF + NEXT + END IF + CASE 32 'Vertical Alignment b$ = ReadSequential$(Property$, 2) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls Control(LockedControls(j)).VAlign = CVI(b$) - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).VAlign = CVI(b$) - End If - Next - End If - Case 33 'Password field + END IF + NEXT + END IF + CASE 33 'Password field b$ = ReadSequential$(Property$, 2) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls Control(LockedControls(j)).PasswordField = CVI(b$) - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).PasswordField = CVI(b$) - End If - Next - End If - Case 34 'Encoding - Form only + END IF + NEXT + END IF + CASE 34 'Encoding - Form only b$ = ReadSequential$(Property$, 4) Control(__UI_FormID).Encoding = CVL(b$) - Case 35 'Mask + CASE 35 'Mask b$ = ReadSequential$(Property$, 4) b$ = ReadSequential$(Property$, CVL(b$)) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls i = LockedControls(j) - GoSub ChangeMask - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + GOSUB ChangeMask + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN ChangeMask: Mask(i) = b$ Text(i) = "" - If Len(Mask(i)) Then Control(i).Max = 0 - If LockedControlsGOSUB Then Return - End If - Next - End If - Case 36 'MinInterval - b$ = ReadSequential$(Property$, Len(FloatValue)) - If TotalLockedControls Then - For j = 1 To TotalLockedControls - Control(LockedControls(j)).MinInterval = _CV(_Float, b$) - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - Control(i).MinInterval = _CV(_Float, b$) - End If - Next - End If - Case 37 'BulletStyle + IF LEN(Mask(i)) THEN Control(i).Max = 0 + IF LockedControlsGOSUB THEN RETURN + END IF + NEXT + END IF + CASE 36 'MinInterval + b$ = ReadSequential$(Property$, LEN(FloatValue)) + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls + Control(LockedControls(j)).MinInterval = _CV(_FLOAT, b$) + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + Control(i).MinInterval = _CV(_FLOAT, b$) + END IF + NEXT + END IF + CASE 37 'BulletStyle b$ = ReadSequential$(Property$, 2) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls Control(LockedControls(j)).BulletStyle = CVI(b$) - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).BulletStyle = CVI(b$) - End If - Next - End If - Case 38 'AutoScroll + END IF + NEXT + END IF + CASE 38 'AutoScroll b$ = ReadSequential$(Property$, 2) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls Control(LockedControls(j)).AutoScroll = CVI(b$) - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).AutoScroll = CVI(b$) - End If - Next - End If - Case 39 'AutoSize + END IF + NEXT + END IF + CASE 39 'AutoSize b$ = ReadSequential$(Property$, 2) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls Control(LockedControls(j)).AutoSize = CVI(b$) - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).AutoSize = CVI(b$) - End If - Next - End If - Case 40 'BorderSize + END IF + NEXT + END IF + CASE 40 'BorderSize b$ = ReadSequential$(Property$, 2) TempValue = CVI(b$) - If TotalLockedControls Then - For j = 1 To TotalLockedControls - If Control(LockedControls(j)).Type <> __UI_Type_Frame Then + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls + IF Control(LockedControls(j)).Type <> __UI_Type_Frame THEN Control(LockedControls(j)).BorderSize = TempValue - If Control(LockedControls(j)).Type = __UI_Type_TextBox Then - tempFont = _Font - _Font Control(LockedControls(j)).Font - If Control(LockedControls(j)).Multiline = False Then Control(LockedControls(j)).Height = uspacing + 6 + (Abs(Control(LockedControls(j)).HasBorder) * Control(LockedControls(j)).BorderSize) - _Font tempFont - End If - End If - Next - ElseIf __UI_TotalSelectedControls > 0 Then - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - If Control(i).Type <> __UI_Type_Frame Then + IF Control(LockedControls(j)).Type = __UI_Type_TextBox THEN + tempFont = _FONT + _FONT Control(LockedControls(j)).Font + IF Control(LockedControls(j)).Multiline = False THEN Control(LockedControls(j)).Height = uspacing + 6 + (ABS(Control(LockedControls(j)).HasBorder) * Control(LockedControls(j)).BorderSize) + _FONT tempFont + END IF + END IF + NEXT + ELSEIF __UI_TotalSelectedControls > 0 THEN + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + IF Control(i).Type <> __UI_Type_Frame THEN Control(i).BorderSize = TempValue - If Control(i).Type = __UI_Type_TextBox Then - tempFont = _Font - _Font Control(i).Font - If Control(i).Multiline = False Then Control(i).Height = uspacing + 6 + (Abs(Control(i).HasBorder) * Control(i).BorderSize) - _Font tempFont - End If - End If - End If - Next - End If - Case 41 'ContextMenuID + IF Control(i).Type = __UI_Type_TextBox THEN + tempFont = _FONT + _FONT Control(i).Font + IF Control(i).Multiline = False THEN Control(i).Height = uspacing + 6 + (ABS(Control(i).HasBorder) * Control(i).BorderSize) + _FONT tempFont + END IF + END IF + END IF + NEXT + END IF + CASE 41 'ContextMenuID b$ = ReadSequential$(Property$, 2) b$ = ReadSequential$(Property$, CVI(b$)) Control(__UI_GetID(b$)).ControlState = 2 'highlight ContextMenu handle Control(__UI_GetID(b$)).Redraw = True 'highlight ContextMenu handle - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls i = LockedControls(j) Control(i).ContextMenuID = __UI_GetID(b$) - Next - Else - If __UI_TotalSelectedControls > 0 Then - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + NEXT + ELSE + IF __UI_TotalSelectedControls > 0 THEN + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).ContextMenuID = __UI_GetID(b$) - End If - Next - Else + END IF + NEXT + ELSE Control(__UI_FormID).ContextMenuID = __UI_GetID(b$) - End If - End If - Case 42 'HideTicks + END IF + END IF + CASE 42 'HideTicks b$ = ReadSequential$(Property$, 2) - If TotalLockedControls Then - For j = 1 To TotalLockedControls - If CVI(b$) Then + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls + IF CVI(b$) THEN Control(LockedControls(j)).Height = __UI_Type(__UI_Type_TrackBar).MinimumHeight - Else + ELSE Control(LockedControls(j)).Height = __UI_Type(__UI_Type_TrackBar).DefaultHeight - End If - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - If CVI(b$) Then + END IF + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + IF CVI(b$) THEN Control(i).Height = __UI_Type(__UI_Type_TrackBar).MinimumHeight - Else + ELSE Control(i).Height = __UI_Type(__UI_Type_TrackBar).DefaultHeight - End If - End If - Next - End If - Case 43 'Key combo + END IF + END IF + NEXT + END IF + CASE 43 'Key combo b$ = ReadSequential$(Property$, 2) b$ = ReadSequential$(Property$, CVI(b$)) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls i = RegisterKeyCombo(b$, LockedControls(j)) - If Control(LockedControls(j)).Type = __UI_Type_MenuItem Then + IF Control(LockedControls(j)).Type = __UI_Type_MenuItem THEN __UI_ActivateMenu Control(Control(LockedControls(j)).ParentID), False - Exit For - End If - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + EXIT FOR + END IF + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN j = RegisterKeyCombo(b$, Control(i).ID) - If Control(i).Type = __UI_Type_MenuItem Then + IF Control(i).Type = __UI_Type_MenuItem THEN __UI_ActivateMenu Control(Control(i).ParentID), False - Exit For - End If - End If - Next - End If - Case 44 'Auto-play (GIF extension) + EXIT FOR + END IF + END IF + NEXT + END IF + CASE 44 'Auto-play (GIF extension) b$ = ReadSequential$(Property$, 2) - If TotalLockedControls Then - For j = 1 To TotalLockedControls + IF TotalLockedControls THEN + FOR j = 1 TO TotalLockedControls AutoPlayGif(LockedControls(j)) = CVI(b$) - If AutoPlayGif(LockedControls(j)) Then PlayGif LockedControls(j) Else StopGif LockedControls(j) - Next - Else - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + IF AutoPlayGif(LockedControls(j)) THEN PlayGif LockedControls(j) ELSE StopGif LockedControls(j) + NEXT + ELSE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN AutoPlayGif(i) = CVI(b$) - If AutoPlayGif(i) Then PlayGif i Else StopGif i - End If - Next - End If - Case 201 To 210 + IF AutoPlayGif(i) THEN PlayGif i ELSE StopGif i + END IF + NEXT + END IF + CASE 201 TO 210 'Alignment commands b$ = ReadSequential$(Property$, 2) DoAlign TempValue - Case 211, 212 'Z-Ordering -> Move up/down - Dim tID1 As Long, tID2 As Long + CASE 211, 212 'Z-Ordering -> Move up/down + DIM tID1 AS LONG, tID2 AS LONG a$ = ReadSequential$(Property$, 4) b$ = ReadSequential$(Property$, 4) tID1 = Control(CVL(a$)).ID tID2 = Control(CVL(b$)).ID - Swap Control(CVL(b$)), Control(CVL(a$)) - Swap Caption(CVL(b$)), Caption(CVL(a$)) - Swap Text(CVL(b$)), Text(CVL(a$)) - Swap ToolTip(CVL(b$)), ToolTip(CVL(a$)) + SWAP Control(CVL(b$)), Control(CVL(a$)) + SWAP Caption(CVL(b$)), Caption(CVL(a$)) + SWAP Text(CVL(b$)), Text(CVL(a$)) + SWAP ToolTip(CVL(b$)), ToolTip(CVL(a$)) Control(CVL(a$)).ID = tID1 Control(CVL(b$)).ID = tID2 'Restore ParentIDs based on ParentName - For i = 1 To UBound(Control) + FOR i = 1 TO UBOUND(Control) Control(i).ParentID = __UI_GetID(Control(i).ParentName) - Next + NEXT - If __UI_TotalActiveMenus > 0 And Left$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) <> "__UI_" Then - If Control(CVL(a$)).Type = __UI_Type_MenuItem Then + IF __UI_TotalActiveMenus > 0 AND LEFT$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) <> "__UI_" THEN + IF Control(CVL(a$)).Type = __UI_Type_MenuItem THEN __UI_ActivateMenu Control(Control(CVL(a$)).ParentID), False - ElseIf Control(CVL(b$)).Type = __UI_Type_MenuItem Then + ELSEIF Control(CVL(b$)).Type = __UI_Type_MenuItem THEN __UI_ActivateMenu Control(Control(CVL(b$)).ParentID), False - Else + ELSE __UI_CloseAllMenus - End If - End If - Case 213 + END IF + END IF + CASE 213 'Select control b$ = ReadSequential$(Property$, 4) 'Desselect all first: - For i = 1 To UBound(Control) + FOR i = 1 TO UBOUND(Control) Control(i).ControlIsSelected = False - Next + NEXT - If CVL(b$) > 0 Then Control(CVL(b$)).ControlIsSelected = True - Case 216 To 221 + IF CVL(b$) > 0 THEN Control(CVL(b$)).ControlIsSelected = True + CASE 216 TO 221 __UI_KeyPress TempValue - Case 222 'New textbox control with the NumericOnly property set to true + CASE 222 'New textbox control with the NumericOnly property set to true b$ = ReadSequential$(Property$, 2) TempValue = __UI_NewControl(__UI_Type_TextBox, "", 120, 23, TempWidth \ 2 - 60, TempTop - 12, ThisContainer) Control(TempValue).Name = "Numeric" + Control(TempValue).Name - SetCaption TempValue, RTrim$(Control(TempValue).Name) + SetCaption TempValue, RTRIM$(Control(TempValue).Name) Control(TempValue).NumericOnly = __UI_NumericWithBounds Control(TempValue).Min = -32768 Control(TempValue).Max = 32767 - If __UI_TotalActiveMenus > 0 Then + IF __UI_TotalActiveMenus > 0 THEN __UI_CloseAllMenus - End If + END IF - For i = 1 To UBound(Control) + FOR i = 1 TO UBOUND(Control) Control(i).ControlIsSelected = False - Next + NEXT Control(TempValue).ControlIsSelected = True __UI_TotalSelectedControls = 1 __UI_FirstSelectedID = TempValue __UI_ForceRedraw = True - Case 223 + CASE 223 b$ = ReadSequential$(Property$, 2) AlternateNumericOnlyProperty - Case 225 + CASE 225 ConvertControlToAlternativeType - End Select + END SELECT __UI_ForceRedraw = True - Loop - If PropertyApplied Then TotalLockedControls = 0 + LOOP + IF PropertyApplied THEN TotalLockedControls = 0 - If __UI_TotalActiveMenus > 0 And Left$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) = "__UI_" And __UI_CantShowContextMenu Then + IF __UI_TotalActiveMenus > 0 AND LEFT$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) = "__UI_" AND __UI_CantShowContextMenu THEN __UI_CloseAllMenus b$ = "SIGNAL>" + MKI$(-2) + "<END>" 'Signal to the editor that the preview can't show the context menu - Put #Host, , b$ - ElseIf __UI_TotalActiveMenus > 0 And Left$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) = "__UI_" Then - Static LocalMenuShown As _Byte, LocalMenuShownSignalSent As _Byte + PUT #Host, , b$ + ELSEIF __UI_TotalActiveMenus > 0 AND LEFT$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) = "__UI_" THEN + STATIC LocalMenuShown AS _BYTE, LocalMenuShownSignalSent AS _BYTE LocalMenuShown = True - Else + ELSE LocalMenuShown = False LocalMenuShownSignalSent = False - End If + END IF - If LocalMenuShown And Not LocalMenuShownSignalSent Then + IF LocalMenuShown AND NOT LocalMenuShownSignalSent THEN b$ = "SIGNAL>" + MKI$(-5) + "<END>" 'Signal to the editor that a context menu is successfully shown - Put #Host, , b$ + PUT #Host, , b$ LocalMenuShownSignalSent = True - End If + END IF - Static prevTotalSelected As Long, prevFirstSelected As Long - Static prevFormID As Long + STATIC prevTotalSelected AS LONG, prevFirstSelected AS LONG + STATIC prevFormID AS LONG - If __UI_TotalSelectedControls <> prevTotalSelected Then + IF __UI_TotalSelectedControls <> prevTotalSelected THEN prevTotalSelected = __UI_TotalSelectedControls b$ = "TOTALSELECTEDCONTROLS>" + MKL$(__UI_TotalSelectedControls) + "<END>" - Put #Host, , b$ - End If + PUT #Host, , b$ + END IF - If Control(__UI_FirstSelectedID).ID = 0 Then __UI_FirstSelectedID = 0 - If __UI_FirstSelectedID <> prevFirstSelected Then + IF Control(__UI_FirstSelectedID).ID = 0 THEN __UI_FirstSelectedID = 0 + IF __UI_FirstSelectedID <> prevFirstSelected THEN prevFirstSelected = __UI_FirstSelectedID b$ = "FIRSTSELECTED>" + MKL$(__UI_FirstSelectedID) + "<END>" - Put #Host, , b$ - End If + PUT #Host, , b$ + END IF - If __UI_FormID <> prevFormID Then + IF __UI_FormID <> prevFormID THEN prevFormID = __UI_FormID b$ = "FORMID>" + MKL$(__UI_FormID) + "<END>" - Put #Host, , b$ - End If -End Sub + PUT #Host, , b$ + END IF +END SUB -Sub __UI_BeforeUnload +SUB __UI_BeforeUnload __UI_UnloadSignal = False SendSignal -9 -End Sub +END SUB -Sub __UI_BeforeInit +SUB __UI_BeforeInit __UI_DesignMode = True - If _FileExists("UiEditorPreview.frmbin") Then - Dim FileToLoad As Integer, a$ - FileToLoad = FreeFile - Open "UiEditorPreview.frmbin" For Binary As #FileToLoad - a$ = Space$(LOF(FileToLoad)) - Get #FileToLoad, 1, a$ - Close #FileToLoad + IF _FILEEXISTS("InForm/UiEditorPreview.frmbin") THEN + DIM FileToLoad AS INTEGER, a$ + FileToLoad = FREEFILE + OPEN "InForm/UiEditorPreview.frmbin" FOR BINARY AS #FileToLoad + a$ = SPACE$(LOF(FileToLoad)) + GET #FileToLoad, 1, a$ + CLOSE #FileToLoad - If InStr(a$, "SUB __UI_LoadForm") > 0 Then + IF INSTR(a$, "SUB __UI_LoadForm") > 0 THEN LoadPreviewText - Else + ELSE LoadPreview InDisk - End If - End If -End Sub + END IF + END IF +END SUB -Sub __UI_FormResized - Static TimesResized As Integer +SUB __UI_FormResized + STATIC TimesResized AS INTEGER - If IsCreating Then TimesResized = 0: IsCreating = False + IF IsCreating THEN TimesResized = 0: IsCreating = False TimesResized = TimesResized + 1 - If TimesResized > 5 Then + IF TimesResized > 5 THEN 'Manually resizing a form triggers this event a few times; 'Loading a form triggers it 2 or three times usually. TimesResized = 0 SendSignal -8 - End If -End Sub + END IF +END SUB -Sub __UI_OnLoad - Dim b$, Answer As Integer, start! +SUB __UI_OnLoad + DIM b$, start! LoadDefaultFonts b$ = "Connecting to InForm Designer..." - GoSub ShowMessage + GOSUB ShowMessage - HostPort = Command$(1) - If Val(HostPort) < 60000 Then + HostPort = COMMAND$(1) + IF VAL(HostPort) < 60000 THEN ForceQuit: - _ScreenHide - Answer = MessageBox("InForm Designer is not running. Please run the main program.", "InForm Preview", 0) - System - End If + _SCREENHIDE + _MESSAGEBOX "InForm Preview", "__UI_OnLoad: InForm Designer is not running. Please run the main program.", "error" + SYSTEM + END IF - $If WIN Then - Const TIMEOUT = 10 - $Else + $IF WIN THEN + CONST TIMEOUT = 10 + $ELSE CONST TIMEOUT = 120 - $End If + $END IF - start! = Timer - Do - Host = _OpenClient("TCP/IP:" + HostPort + ":localhost") - _Display - Loop Until Host < 0 Or Timer - start! > TIMEOUT + start! = TIMER + DO + Host = _OPENCLIENT("TCP/IP:" + HostPort + ":localhost") + _DISPLAY + LOOP UNTIL Host < 0 OR TIMER - start! > TIMEOUT - If Host = 0 Then GoTo ForceQuit + IF Host = 0 THEN GOTO ForceQuit b$ = "Connected! Handshaking..." - GoSub ShowMessage + GOSUB ShowMessage 'Handshake: each module sends the other their PID: - Dim incomingData$, thisData$ - start! = Timer - Do + DIM incomingData$, thisData$ + start! = TIMER + DO incomingData$ = "" - Get #Host, , incomingData$ + GET #Host, , incomingData$ Stream$ = Stream$ + incomingData$ - If InStr(Stream$, "<END>") Then - thisData$ = Left$(Stream$, InStr(Stream$, "<END>") - 1) - Stream$ = Mid$(Stream$, Len(thisData$) + 6) - If Left$(thisData$, 10) = "EDITORPID>" Then - UiEditorPID = CVL(Mid$(thisData$, 11)) - End If - Exit Do - End If - Loop Until Timer - start! > TIMEOUT + IF INSTR(Stream$, "<END>") THEN + thisData$ = LEFT$(Stream$, INSTR(Stream$, "<END>") - 1) + Stream$ = MID$(Stream$, LEN(thisData$) + 6) + IF LEFT$(thisData$, 10) = "EDITORPID>" THEN + UiEditorPID = CVL(MID$(thisData$, 11)) + END IF + EXIT DO + END IF + LOOP UNTIL TIMER - start! > TIMEOUT - If UiEditorPID = 0 Then GoTo ForceQuit + IF UiEditorPID = 0 THEN GOTO ForceQuit b$ = "PREVIEWPID>" + MKL$(__UI_GetPID) + "<END>" - Put #Host, , b$ + PUT #Host, , b$ - _AcceptFileDrop + _ACCEPTFILEDROP - Exit Sub + EXIT SUB ShowMessage: - Dim PreserveDestMessage As Long - PreserveDestMessage = _Dest - _Dest 0 - _Font Control(__UI_FormID).Font - Cls , __UI_DefaultColor(__UI_Type_Form, 2) - Color __UI_DefaultColor(__UI_Type_Form, 1), _RGBA32(0, 0, 0, 0) - __UI_PrintString _Width \ 2 - _PrintWidth(b$) \ 2, _Height \ 2 - _FontHeight \ 2, b$ - _Display - _Dest PreserveDestMessage - Return -End Sub + DIM PreserveDestMessage AS LONG + PreserveDestMessage = _DEST + _DEST 0 + _FONT Control(__UI_FormID).Font + CLS , __UI_DefaultColor(__UI_Type_Form, 2) + COLOR __UI_DefaultColor(__UI_Type_Form, 1), _RGBA32(0, 0, 0, 0) + __UI_PrintString _WIDTH \ 2 - _PRINTWIDTH(b$) \ 2, _HEIGHT \ 2 - _FONTHEIGHT \ 2, b$ + _DISPLAY + _DEST PreserveDestMessage + RETURN +END SUB -Sub __UI_KeyPress (id As Long) - Select Case id - Case 201 To 210 +SUB __UI_KeyPress (id AS LONG) + SELECT CASE id + CASE 201 TO 210 DoAlign id - Case 214 + CASE 214 RestoreUndoImage - Case 215 + CASE 215 RestoreRedoImage - Case 216 + CASE 216 SaveUndoImage - Case 217 'Copy selected controls to clipboard + CASE 217 'Copy selected controls to clipboard SavePreview InClipboard - Case 218 'Restore selected controls from clipboard + CASE 218 'Restore selected controls from clipboard LoadPreview InClipboard - Case 219 'Cut selected controls to clipboard + CASE 219 'Cut selected controls to clipboard SavePreview InClipboard DeleteSelectedControls - Case 220 'Delete selected controls + CASE 220 'Delete selected controls DeleteSelectedControls - Case 221 'Select all controls + CASE 221 'Select all controls SelectAllControls - Case 223 + CASE 223 AlternateNumericOnlyProperty - Case 224 - Dim TempValue As Long + CASE 224 + DIM TempValue AS LONG TempValue = AddNewMenuBarControl SelectNewControl TempValue - Case 225 + CASE 225 ConvertControlToAlternativeType - Case 226 'Add new ContextMenu control + CASE 226 'Add new ContextMenu control TempValue = __UI_NewControl(__UI_Type_ContextMenu, "", 22, 22, 0, 0, 0) - Control(TempValue).HelperCanvas = _CopyImage(ContextMenuIcon, 32) + Control(TempValue).HelperCanvas = _COPYIMAGE(ContextMenuIcon, 32) RefreshContextMenus __UI_ActivateMenu Control(TempValue), False SelectNewControl TempValue - Case 227 'Toggle __UI_ShowInvisibleControls - __UI_ShowInvisibleControls = Not __UI_ShowInvisibleControls - Case 228 'Bind/unbind controls + CASE 227 'Toggle __UI_ShowInvisibleControls + __UI_ShowInvisibleControls = NOT __UI_ShowInvisibleControls + CASE 228 'Bind/unbind controls 'DIM a$, b$, c$, found AS _BYTE 'DIM i AS LONG, j AS LONG 'FOR i = 1 TO UBOUND(Control) @@ -1818,381 +1818,381 @@ Sub __UI_KeyPress (id As Long) 'NEXT 'c$ = MKL$(LEN(a$)) + a$ + MKL$(LEN(b$)) + b$ SendData "", "SHOWBINDCONTROLDIALOG" - End Select -End Sub + END SELECT +END SUB -Sub AlternateNumericOnlyProperty - If Control(__UI_FirstSelectedID).NumericOnly = True Then +SUB AlternateNumericOnlyProperty + IF Control(__UI_FirstSelectedID).NumericOnly = True THEN Control(__UI_FirstSelectedID).NumericOnly = __UI_NumericWithBounds - If Val(Text(__UI_FirstSelectedID)) > Control(__UI_FirstSelectedID).Max Then - Text(__UI_FirstSelectedID) = LTrim$(Str$(Control(__UI_FirstSelectedID).Max)) - ElseIf Val(Text(__UI_FirstSelectedID)) < Control(__UI_FirstSelectedID).Min Then - Text(__UI_FirstSelectedID) = LTrim$(Str$(Control(__UI_FirstSelectedID).Min)) - End If - ElseIf Control(__UI_FirstSelectedID).NumericOnly = __UI_NumericWithBounds Then + IF VAL(Text(__UI_FirstSelectedID)) > Control(__UI_FirstSelectedID).Max THEN + Text(__UI_FirstSelectedID) = LTRIM$(STR$(Control(__UI_FirstSelectedID).Max)) + ELSEIF VAL(Text(__UI_FirstSelectedID)) < Control(__UI_FirstSelectedID).Min THEN + Text(__UI_FirstSelectedID) = LTRIM$(STR$(Control(__UI_FirstSelectedID).Min)) + END IF + ELSEIF Control(__UI_FirstSelectedID).NumericOnly = __UI_NumericWithBounds THEN Control(__UI_FirstSelectedID).NumericOnly = True - End If -End Sub + END IF +END SUB -Sub DoAlign (AlignMode As Integer) - Dim i As Long - Dim LeftMost As Integer - Dim RightMost As Integer - Dim TopMost As Integer, BottomMost As Integer, SelectionHeight As Integer - Dim TopDifference As Integer, NewTopMost As Integer - Dim SelectionWidth As Integer - Dim LeftDifference As Integer, NewLeftMost As Integer - Dim FindTops As Integer - Dim FindLefts As Integer, NextControlToDistribute As Long - Dim TotalSpace As Integer, BinSize As Integer +SUB DoAlign (AlignMode AS INTEGER) + DIM i AS LONG + DIM LeftMost AS INTEGER + DIM RightMost AS INTEGER + DIM TopMost AS INTEGER, BottomMost AS INTEGER, SelectionHeight AS INTEGER + DIM TopDifference AS INTEGER, NewTopMost AS INTEGER + DIM SelectionWidth AS INTEGER + DIM LeftDifference AS INTEGER, NewLeftMost AS INTEGER + DIM FindTops AS INTEGER + DIM FindLefts AS INTEGER, NextControlToDistribute AS LONG + DIM TotalSpace AS INTEGER, BinSize AS INTEGER - Select Case AlignMode - Case 201 'Lefts - If __UI_TotalSelectedControls > 1 Then + SELECT CASE AlignMode + CASE 201 'Lefts + IF __UI_TotalSelectedControls > 1 THEN LeftMost = Control(__UI_FormID).Width - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - If Control(i).Left < LeftMost Then LeftMost = Control(i).Left - End If - Next - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + IF Control(i).Left < LeftMost THEN LeftMost = Control(i).Left + END IF + NEXT + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).Left = LeftMost - End If - Next - End If - Case 202 'Rights - If __UI_TotalSelectedControls > 1 Then + END IF + NEXT + END IF + CASE 202 'Rights + IF __UI_TotalSelectedControls > 1 THEN RightMost = 0 - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - If Control(i).Left + Control(i).Width - 1 > RightMost Then RightMost = Control(i).Left + Control(i).Width - 1 - End If - Next - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + IF Control(i).Left + Control(i).Width - 1 > RightMost THEN RightMost = Control(i).Left + Control(i).Width - 1 + END IF + NEXT + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).Left = RightMost - (Control(i).Width - 1) - End If - Next - End If - Case 203 'Tops - If __UI_TotalSelectedControls > 1 Then + END IF + NEXT + END IF + CASE 203 'Tops + IF __UI_TotalSelectedControls > 1 THEN TopMost = Control(__UI_FormID).Height - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - If Control(i).Top < TopMost Then TopMost = Control(i).Top - End If - Next - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + IF Control(i).Top < TopMost THEN TopMost = Control(i).Top + END IF + NEXT + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).Top = TopMost - End If - Next - End If - Case 204 'Bottoms - If __UI_TotalSelectedControls > 1 Then + END IF + NEXT + END IF + CASE 204 'Bottoms + IF __UI_TotalSelectedControls > 1 THEN BottomMost = 0 - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - If Control(i).Top + Control(i).Height - 1 > BottomMost Then BottomMost = Control(i).Top + Control(i).Height - 1 - End If - Next - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + IF Control(i).Top + Control(i).Height - 1 > BottomMost THEN BottomMost = Control(i).Top + Control(i).Height - 1 + END IF + NEXT + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).Top = BottomMost - (Control(i).Height - 1) - End If - Next - End If - Case 205 'Centers vertically - If __UI_TotalSelectedControls > 1 Then - If Control(__UI_FirstSelectedID).ParentID = 0 Then + END IF + NEXT + END IF + CASE 205 'Centers vertically + IF __UI_TotalSelectedControls > 1 THEN + IF Control(__UI_FirstSelectedID).ParentID = 0 THEN TopMost = Control(__UI_FormID).Height - Else + ELSE TopMost = Control(Control(__UI_FirstSelectedID).ParentID).Height - End If + END IF BottomMost = 0 - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - If Control(i).Top < TopMost Then TopMost = Control(i).Top - If Control(i).Top + Control(i).Height - 1 > BottomMost Then BottomMost = Control(i).Top + Control(i).Height - 1 - End If - Next + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + IF Control(i).Top < TopMost THEN TopMost = Control(i).Top + IF Control(i).Top + Control(i).Height - 1 > BottomMost THEN BottomMost = Control(i).Top + Control(i).Height - 1 + END IF + NEXT SelectionHeight = BottomMost - TopMost NewTopMost = TopMost + SelectionHeight / 2 - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).Top = NewTopMost - Control(i).Height / 2 - End If - Next - End If - Case 206 'Centers horizontally - If __UI_TotalSelectedControls > 1 Then - If Control(__UI_FirstSelectedID).ParentID = 0 Then + END IF + NEXT + END IF + CASE 206 'Centers horizontally + IF __UI_TotalSelectedControls > 1 THEN + IF Control(__UI_FirstSelectedID).ParentID = 0 THEN LeftMost = Control(__UI_FormID).Width - Else + ELSE LeftMost = Control(Control(__UI_FirstSelectedID).ParentID).Width - End If + END IF RightMost = 0 - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - If Control(i).Left < LeftMost Then LeftMost = Control(i).Left - If Control(i).Left + Control(i).Width - 1 > RightMost Then RightMost = Control(i).Left + Control(i).Width - 1 - End If - Next + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + IF Control(i).Left < LeftMost THEN LeftMost = Control(i).Left + IF Control(i).Left + Control(i).Width - 1 > RightMost THEN RightMost = Control(i).Left + Control(i).Width - 1 + END IF + NEXT SelectionWidth = RightMost - LeftMost NewLeftMost = LeftMost + SelectionWidth / 2 - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).Left = NewLeftMost - Control(i).Width / 2 - End If - Next - End If - Case 207 'Center vertically to form - If __UI_TotalSelectedControls = 1 Then - If Control(__UI_FirstSelectedID).ParentID = 0 Then + END IF + NEXT + END IF + CASE 207 'Center vertically to form + IF __UI_TotalSelectedControls = 1 THEN + IF Control(__UI_FirstSelectedID).ParentID = 0 THEN Control(__UI_FirstSelectedID).Top = (Control(__UI_FormID).Height - __UI_MenuBarOffsetV) / 2 - Control(__UI_FirstSelectedID).Height / 2 + __UI_MenuBarOffsetV - Else + ELSE Control(__UI_FirstSelectedID).Top = Control(Control(__UI_FirstSelectedID).ParentID).Height / 2 - Control(__UI_FirstSelectedID).Height / 2 - End If - ElseIf __UI_TotalSelectedControls > 1 Then - If Control(__UI_FirstSelectedID).ParentID = 0 Then + END IF + ELSEIF __UI_TotalSelectedControls > 1 THEN + IF Control(__UI_FirstSelectedID).ParentID = 0 THEN TopMost = Control(__UI_FormID).Height - Else + ELSE TopMost = Control(Control(__UI_FirstSelectedID).ParentID).Height - End If + END IF BottomMost = 0 - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - If Control(i).Top < TopMost Then TopMost = Control(i).Top - If Control(i).Top + Control(i).Height - 1 > BottomMost Then BottomMost = Control(i).Top + Control(i).Height - 1 - End If - Next + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + IF Control(i).Top < TopMost THEN TopMost = Control(i).Top + IF Control(i).Top + Control(i).Height - 1 > BottomMost THEN BottomMost = Control(i).Top + Control(i).Height - 1 + END IF + NEXT SelectionHeight = BottomMost - TopMost - If Control(__UI_FirstSelectedID).ParentID = 0 Then + IF Control(__UI_FirstSelectedID).ParentID = 0 THEN NewTopMost = (Control(__UI_FormID).Height - __UI_MenuBarOffsetV) / 2 - SelectionHeight / 2 - Else + ELSE NewTopMost = Control(Control(__UI_FirstSelectedID).ParentID).Height / 2 - SelectionHeight / 2 - End If + END IF TopDifference = TopMost - NewTopMost - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).Top = Control(i).Top - TopDifference + __UI_MenuBarOffsetV - End If - Next - End If - Case 208 'Center horizontally to form - If __UI_TotalSelectedControls = 1 Then - If Control(__UI_FirstSelectedID).ParentID = 0 Then + END IF + NEXT + END IF + CASE 208 'Center horizontally to form + IF __UI_TotalSelectedControls = 1 THEN + IF Control(__UI_FirstSelectedID).ParentID = 0 THEN Control(__UI_FirstSelectedID).Left = Control(__UI_FormID).Width / 2 - Control(__UI_FirstSelectedID).Width / 2 - Else + ELSE Control(__UI_FirstSelectedID).Left = Control(Control(__UI_FirstSelectedID).ParentID).Width / 2 - Control(__UI_FirstSelectedID).Width / 2 - End If - ElseIf __UI_TotalSelectedControls > 1 Then - If Control(__UI_FirstSelectedID).ParentID = 0 Then + END IF + ELSEIF __UI_TotalSelectedControls > 1 THEN + IF Control(__UI_FirstSelectedID).ParentID = 0 THEN LeftMost = Control(__UI_FormID).Width - Else + ELSE LeftMost = Control(Control(__UI_FirstSelectedID).ParentID).Width - End If + END IF RightMost = 0 - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then - If Control(i).Left < LeftMost Then LeftMost = Control(i).Left - If Control(i).Left + Control(i).Width - 1 > RightMost Then RightMost = Control(i).Left + Control(i).Width - 1 - End If - Next + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN + IF Control(i).Left < LeftMost THEN LeftMost = Control(i).Left + IF Control(i).Left + Control(i).Width - 1 > RightMost THEN RightMost = Control(i).Left + Control(i).Width - 1 + END IF + NEXT SelectionWidth = RightMost - LeftMost - If Control(__UI_FirstSelectedID).ParentID = 0 Then + IF Control(__UI_FirstSelectedID).ParentID = 0 THEN NewLeftMost = Control(__UI_FormID).Width / 2 - SelectionWidth / 2 - Else + ELSE NewLeftMost = Control(Control(__UI_FirstSelectedID).ParentID).Width / 2 - SelectionWidth / 2 - End If + END IF LeftDifference = LeftMost - NewLeftMost - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).Left = Control(i).Left - LeftDifference - End If - Next - End If - Case 209 'Distribute vertically + END IF + NEXT + END IF + CASE 209 'Distribute vertically 'Build a sublist containing the selected controls in the order they 'are currently placed vertically: - ReDim SubList(1 To __UI_TotalSelectedControls) As Long + REDIM SubList(1 TO __UI_TotalSelectedControls) AS LONG __UI_AutoRefresh = False - For FindTops = 0 To Control(__UI_FormID).Height - 1 - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected And Control(i).Top = FindTops Then - If NextControlToDistribute > 0 Then - If SubList(NextControlToDistribute) <> i Then + FOR FindTops = 0 TO Control(__UI_FormID).Height - 1 + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected AND Control(i).Top = FindTops THEN + IF NextControlToDistribute > 0 THEN + IF SubList(NextControlToDistribute) <> i THEN NextControlToDistribute = NextControlToDistribute + 1 SubList(NextControlToDistribute) = i - Exit For - End If - Else + EXIT FOR + END IF + ELSE NextControlToDistribute = NextControlToDistribute + 1 SubList(NextControlToDistribute) = i - Exit For - End If - End If - Next - If NextControlToDistribute = __UI_TotalSelectedControls Then Exit For - Next + EXIT FOR + END IF + END IF + NEXT + IF NextControlToDistribute = __UI_TotalSelectedControls THEN EXIT FOR + NEXT TotalSpace = (Control(SubList(__UI_TotalSelectedControls)).Top + Control(SubList(__UI_TotalSelectedControls)).Height) - Control(SubList(1)).Top - For i = 1 To __UI_TotalSelectedControls + FOR i = 1 TO __UI_TotalSelectedControls TotalSpace = TotalSpace - Control(SubList(i)).Height - Next + NEXT BinSize = TotalSpace \ (__UI_TotalSelectedControls - 1) FindTops = Control(SubList(1)).Top - BinSize - For i = 1 To __UI_TotalSelectedControls + FOR i = 1 TO __UI_TotalSelectedControls FindTops = FindTops + BinSize Control(SubList(i)).Top = FindTops FindTops = FindTops + Control(SubList(i)).Height - Next + NEXT __UI_AutoRefresh = True __UI_ForceRedraw = True - Case 210 'Distribute horizontally + CASE 210 'Distribute horizontally 'Build a sublist containing the selected controls in the order they 'are currently placed horizontally: - ReDim SubList(1 To __UI_TotalSelectedControls) As Long + REDIM SubList(1 TO __UI_TotalSelectedControls) AS LONG __UI_AutoRefresh = False - For FindLefts = 0 To Control(__UI_FormID).Width - 1 - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected And Control(i).Left = FindLefts Then - If NextControlToDistribute > 0 Then - If SubList(NextControlToDistribute) <> i Then + FOR FindLefts = 0 TO Control(__UI_FormID).Width - 1 + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected AND Control(i).Left = FindLefts THEN + IF NextControlToDistribute > 0 THEN + IF SubList(NextControlToDistribute) <> i THEN NextControlToDistribute = NextControlToDistribute + 1 SubList(NextControlToDistribute) = i - Exit For - End If - Else + EXIT FOR + END IF + ELSE NextControlToDistribute = NextControlToDistribute + 1 SubList(NextControlToDistribute) = i - Exit For - End If - End If - Next - If NextControlToDistribute = __UI_TotalSelectedControls Then Exit For - Next + EXIT FOR + END IF + END IF + NEXT + IF NextControlToDistribute = __UI_TotalSelectedControls THEN EXIT FOR + NEXT TotalSpace = (Control(SubList(__UI_TotalSelectedControls)).Left + Control(SubList(__UI_TotalSelectedControls)).Width) - Control(SubList(1)).Left - For i = 1 To __UI_TotalSelectedControls + FOR i = 1 TO __UI_TotalSelectedControls TotalSpace = TotalSpace - Control(SubList(i)).Width - Next + NEXT BinSize = TotalSpace \ (__UI_TotalSelectedControls - 1) FindLefts = Control(SubList(1)).Left - BinSize - For i = 1 To __UI_TotalSelectedControls + FOR i = 1 TO __UI_TotalSelectedControls FindLefts = FindLefts + BinSize Control(SubList(i)).Left = FindLefts FindLefts = FindLefts + Control(SubList(i)).Width - Next + NEXT __UI_AutoRefresh = True __UI_ForceRedraw = True - End Select -End Sub + END SELECT +END SUB -Sub ConvertControlToAlternativeType - Dim i As Long - Dim NewType As Integer +SUB ConvertControlToAlternativeType + DIM i AS LONG + DIM NewType AS INTEGER NewType = __UI_Type(Control(__UI_FirstSelectedID).Type).TurnsInto - If NewType = 0 Then NewType = __UI_Type_TextBox + IF NewType = 0 THEN NewType = __UI_Type_TextBox - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN Control(i).Type = NewType Control(i).Width = __UI_Type(NewType).DefaultWidth Control(i).Height = __UI_Type(NewType).DefaultHeight - If NewType = __UI_Type_MenuBar Then - Caption(i) = RTrim$(Control(i).Name) + IF NewType = __UI_Type_MenuBar THEN + Caption(i) = RTRIM$(Control(i).Name) __UI_AdjustNewMenuBarTopHeight i - ElseIf NewType = __UI_Type_ContextMenu Then - If Control(i).HelperCanvas = 0 Then - Control(i).HelperCanvas = _CopyImage(ContextMenuIcon, 32) - End If - ElseIf NewType = __UI_Type_TextBox Then - If Control(i).NumericOnly = False Then + ELSEIF NewType = __UI_Type_ContextMenu THEN + IF Control(i).HelperCanvas = 0 THEN + Control(i).HelperCanvas = _COPYIMAGE(ContextMenuIcon, 32) + END IF + ELSEIF NewType = __UI_Type_TextBox THEN + IF Control(i).NumericOnly = False THEN Control(i).NumericOnly = __UI_NumericWithBounds - If Control(i).Min = 0 And Control(i).Max = 0 Then + IF Control(i).Min = 0 AND Control(i).Max = 0 THEN Control(i).Min = -32768 Control(i).Max = 32767 - End If - Else + END IF + ELSE Control(i).NumericOnly = False - If Control(i).Min = -32768 And Control(i).Max = 32767 Then + IF Control(i).Min = -32768 AND Control(i).Max = 32767 THEN Control(i).Min = 0 Control(i).Max = 0 - End If - End If - End If - End If - Next + END IF + END IF + END IF + END IF + NEXT - If NewType = __UI_Type_MenuBar Or NewType = __UI_Type_ContextMenu Then + IF NewType = __UI_Type_MenuBar OR NewType = __UI_Type_ContextMenu THEN __UI_RefreshMenuBar __UI_HasMenuBar = (__UI_FirstMenuBarControl > 0) RefreshContextMenus __UI_ActivateMenu Control(__UI_FirstSelectedID), False - End If + END IF __UI_ForceRedraw = True -End Sub +END SUB -Sub SelectAllControls - Dim i As Long - If __UI_TotalSelectedControls = 1 And Control(__UI_FirstSelectedID).Type = __UI_Type_Frame Then - Dim ThisContainer As Long +SUB SelectAllControls + DIM i AS LONG + IF __UI_TotalSelectedControls = 1 AND Control(__UI_FirstSelectedID).Type = __UI_Type_Frame THEN + DIM ThisContainer AS LONG ThisContainer = Control(__UI_FirstSelectedID).ID Control(__UI_FirstSelectedID).ControlIsSelected = False __UI_TotalSelectedControls = 0 - For i = 1 To UBound(Control) - If Control(i).Type <> __UI_Type_Frame And Control(i).Type <> __UI_Type_Form And Control(i).Type <> __UI_Type_Font And Control(i).Type <> __UI_Type_MenuBar And Control(i).Type <> __UI_Type_MenuItem And Control(i).Type <> __UI_Type_MenuPanel And Control(i).Type <> __UI_Type_ContextMenu And Control(i).Type <> __UI_Type_MenuItem Then - If Control(i).ID > 0 And Control(i).ParentID = ThisContainer Then + FOR i = 1 TO UBOUND(Control) + IF Control(i).Type <> __UI_Type_Frame AND Control(i).Type <> __UI_Type_Form AND Control(i).Type <> __UI_Type_Font AND Control(i).Type <> __UI_Type_MenuBar AND Control(i).Type <> __UI_Type_MenuItem AND Control(i).Type <> __UI_Type_MenuPanel AND Control(i).Type <> __UI_Type_ContextMenu AND Control(i).Type <> __UI_Type_MenuItem THEN + IF Control(i).ID > 0 AND Control(i).ParentID = ThisContainer THEN Control(i).ControlIsSelected = True __UI_TotalSelectedControls = __UI_TotalSelectedControls + 1 - If __UI_TotalSelectedControls = 1 Then __UI_FirstSelectedID = Control(i).ID - End If - End If - Next - Else + IF __UI_TotalSelectedControls = 1 THEN __UI_FirstSelectedID = Control(i).ID + END IF + END IF + NEXT + ELSE __UI_TotalSelectedControls = 0 - For i = 1 To UBound(Control) - If Control(i).Type <> __UI_Type_Frame And Control(i).Type <> __UI_Type_Form And Control(i).Type <> __UI_Type_Font And Control(i).Type <> __UI_Type_MenuBar And Control(i).Type <> __UI_Type_MenuItem And Control(i).Type <> __UI_Type_MenuPanel And Control(i).Type <> __UI_Type_ContextMenu And Control(i).Type <> __UI_Type_MenuItem Then - If Control(i).ID > 0 And Control(i).ParentID = 0 Then + FOR i = 1 TO UBOUND(Control) + IF Control(i).Type <> __UI_Type_Frame AND Control(i).Type <> __UI_Type_Form AND Control(i).Type <> __UI_Type_Font AND Control(i).Type <> __UI_Type_MenuBar AND Control(i).Type <> __UI_Type_MenuItem AND Control(i).Type <> __UI_Type_MenuPanel AND Control(i).Type <> __UI_Type_ContextMenu AND Control(i).Type <> __UI_Type_MenuItem THEN + IF Control(i).ID > 0 AND Control(i).ParentID = 0 THEN Control(i).ControlIsSelected = True __UI_TotalSelectedControls = __UI_TotalSelectedControls + 1 - If __UI_TotalSelectedControls = 1 Then __UI_FirstSelectedID = Control(i).ID - End If - End If - Next - End If -End Sub + IF __UI_TotalSelectedControls = 1 THEN __UI_FirstSelectedID = Control(i).ID + END IF + END IF + NEXT + END IF +END SUB -Sub SelectChildrenControls (id As Long) - Dim i As Long - For i = 1 To UBound(Control) - If Control(i).ParentID = id Then - If Control(i).ControlIsSelected = False Then +SUB SelectChildrenControls (id AS LONG) + DIM i AS LONG + FOR i = 1 TO UBOUND(Control) + IF Control(i).ParentID = id THEN + IF Control(i).ControlIsSelected = False THEN Control(i).ControlIsSelected = True __UI_TotalSelectedControls = __UI_TotalSelectedControls + 1 - If Control(i).Type = __UI_Type_MenuItem Then + IF Control(i).Type = __UI_Type_MenuItem THEN 'Recursively select children's children too: SelectChildrenControls Control(i).ID - End If - End If - End If - Next -End Sub + END IF + END IF + END IF + NEXT +END SUB -Sub DeleteSelectedControls - Dim i As Long, j As Long, didDelete As _Byte +SUB DeleteSelectedControls + DIM i AS LONG, didDelete AS _BYTE 'A container's contents will be deleted with it if it's 'the only selected control. @@ -2202,234 +2202,234 @@ Sub DeleteSelectedControls Control(__UI_FirstSelectedID).Type = __UI_Type_MenuItem OR _ Control(__UI_FirstSelectedID).Type = __UI_Type_ContextMenu) THEN SelectChildrenControls __UI_FirstSelectedID - End If + END IF 'Iterate over control list and delete selected controls. - For i = UBound(Control) To 1 Step -1 - If Control(i).Type = __UI_Type_Form Then _Continue - If Control(i).ControlIsSelected Then - If Control(i).Type = __UI_Type_MenuBar Or Control(i).Type = __UI_Type_ContextMenu Then - Dim MustRefreshMenuBar As _Byte, MustRefreshContextMenus As _Byte - If Control(i).Type = __UI_Type_MenuBar Then + FOR i = UBOUND(Control) TO 1 STEP -1 + IF Control(i).Type = __UI_Type_Form THEN _CONTINUE + IF Control(i).ControlIsSelected THEN + IF Control(i).Type = __UI_Type_MenuBar OR Control(i).Type = __UI_Type_ContextMenu THEN + DIM MustRefreshMenuBar AS _BYTE, MustRefreshContextMenus AS _BYTE + IF Control(i).Type = __UI_Type_MenuBar THEN MustRefreshMenuBar = True - Else + ELSE MustRefreshContextMenus = True - End If - End If - If __UI_TotalActiveMenus > 0 And __UI_ParentMenu(__UI_TotalActiveMenus) = Control(i).ID Then + END IF + END IF + IF __UI_TotalActiveMenus > 0 AND __UI_ParentMenu(__UI_TotalActiveMenus) = Control(i).ID THEN __UI_CloseAllMenus - End If + END IF CloseGif i __UI_DestroyControl Control(i) - If MustRefreshMenuBar Then __UI_RefreshMenuBar - If MustRefreshContextMenus Then RefreshContextMenus + IF MustRefreshMenuBar THEN __UI_RefreshMenuBar + IF MustRefreshContextMenus THEN RefreshContextMenus __UI_ForceRedraw = True didDelete = True - End If - Next - If didDelete Then __UI_TotalSelectedControls = 0 -End Sub + END IF + NEXT + IF didDelete THEN __UI_TotalSelectedControls = 0 +END SUB -Sub RefreshContextMenus - Dim i As Long - Dim ctxMenuCount As Long +SUB RefreshContextMenus + DIM i AS LONG + DIM ctxMenuCount AS LONG - For i = 1 To UBound(Control) - If Control(i).Type = __UI_Type_ContextMenu And Left$(Control(i).Name, 5) <> "__UI_" Then + FOR i = 1 TO UBOUND(Control) + IF Control(i).Type = __UI_Type_ContextMenu AND LEFT$(Control(i).Name, 5) <> "__UI_" THEN ctxMenuCount = ctxMenuCount + 1 Control(i).Left = __UI_SnapDistanceFromForm + ((ctxMenuCount - 1) * Control(i).Width) Control(i).Left = Control(i).Left + ((ctxMenuCount - 1) * __UI_SnapDistance) Control(i).Top = Control(__UI_FormID).Height - Control(i).Height - __UI_SnapDistanceFromForm - End If - Next -End Sub + END IF + NEXT +END SUB -Sub __UI_TextChanged (id As Long) -End Sub +SUB __UI_TextChanged (id AS LONG) +END SUB -Sub __UI_ValueChanged (id As Long) -End Sub +SUB __UI_ValueChanged (id AS LONG) +END SUB -Function Pack$ (__DataIn$) +FUNCTION Pack$ (__DataIn$) 'Adapted from: '================== ' BASFILE.BAS v0.10 '================== 'Coded by Dav for QB64 (c) 2009 'http://www.qbasicnews.com/dav/qb64.php - Dim DataIn$, OriginalLength As Long - Dim a$, BC&, LL&, DataOut$ - Dim T%, B&, c$, g$ - Dim B$ + DIM DataIn$, OriginalLength AS LONG + DIM a$, BC&, LL&, DataOut$ + DIM T%, B&, c$, g$ + DIM B$ DataIn$ = __DataIn$ - OriginalLength = Len(DataIn$) - Do + OriginalLength = LEN(DataIn$) + DO a$ = ReadSequential(DataIn$, 3) BC& = BC& + 3: LL& = LL& + 4 - GoSub Encode + GOSUB Encode DataOut$ = DataOut$ + a$ - If OriginalLength - BC& < 3 Then + IF OriginalLength - BC& < 3 THEN a$ = ReadSequential(DataIn$, OriginalLength - BC&) - GoSub Encode + GOSUB Encode B$ = a$ - Select Case Len(B$) - Case 1: a$ = "%%%" + B$ - Case 2: a$ = "%%" + B$ - Case 3: a$ = "%" + B$ - End Select + SELECT CASE LEN(B$) + CASE 1: a$ = "%%%" + B$ + CASE 2: a$ = "%%" + B$ + CASE 3: a$ = "%" + B$ + END SELECT DataOut$ = DataOut$ + a$ - Exit Do - End If - Loop + EXIT DO + END IF + LOOP Pack$ = DataOut$ - Exit Function + EXIT FUNCTION Encode: - For T% = Len(a$) To 1 Step -1 - B& = B& * 256 + Asc(Mid$(a$, T%)) - Next + FOR T% = LEN(a$) TO 1 STEP -1 + B& = B& * 256 + ASC(MID$(a$, T%)) + NEXT c$ = "" - For T% = 1 To Len(a$) + 1 - g$ = Chr$(48 + (B& And 63)): B& = B& \ 64 + FOR T% = 1 TO LEN(a$) + 1 + g$ = CHR$(48 + (B& AND 63)): B& = B& \ 64 'If < and > are here, replace them with # and * 'Just so there's no HTML tag problems with forums. 'They'll be restored during the decoding process.. 'IF g$ = "<" THEN g$ = "#" 'IF g$ = ">" THEN g$ = "*" c$ = c$ + g$ - Next + NEXT a$ = c$ - Return -End Function + RETURN +END FUNCTION -Function Unpack$ (PackedData$) +FUNCTION Unpack$ (PackedData$) 'Adapted from: '================== ' BASFILE.BAS v0.10 '================== 'Coded by Dav for QB64 (c) 2009 'http://www.qbasicnews.com/dav/qb64.php - Dim A$, i&, B$, C%, F$, C$, t%, B&, X$, btemp$, BASFILE$ + DIM A$, i&, B$, C%, F$, C$, t%, B&, X$, btemp$ A$ = PackedData$ - For i& = 1 To Len(A$) Step 4: B$ = Mid$(A$, i&, 4) - If InStr(1, B$, "%") Then - For C% = 1 To Len(B$): F$ = Mid$(B$, C%, 1) - If F$ <> "%" Then C$ = C$ + F$ - Next: B$ = C$ - End If: For t% = Len(B$) To 1 Step -1 - B& = B& * 64 + Asc(Mid$(B$, t%)) - 48 - Next: X$ = "": For t% = 1 To Len(B$) - 1 - X$ = X$ + Chr$(B& And 255): B& = B& \ 256 - Next: btemp$ = btemp$ + X$: Next + FOR i& = 1 TO LEN(A$) STEP 4: B$ = MID$(A$, i&, 4) + IF INSTR(1, B$, "%") THEN + FOR C% = 1 TO LEN(B$): F$ = MID$(B$, C%, 1) + IF F$ <> "%" THEN C$ = C$ + F$ + NEXT: B$ = C$ + END IF: FOR t% = LEN(B$) TO 1 STEP -1 + B& = B& * 64 + ASC(MID$(B$, t%)) - 48 + NEXT: X$ = "": FOR t% = 1 TO LEN(B$) - 1 + X$ = X$ + CHR$(B& AND 255): B& = B& \ 256 + NEXT: btemp$ = btemp$ + X$: NEXT Unpack$ = btemp$ -End Function +END FUNCTION -Function ReadSequential$ (Txt$, Bytes%) - ReadSequential$ = Left$(Txt$, Bytes%) - Txt$ = Mid$(Txt$, Bytes% + 1) -End Function +FUNCTION ReadSequential$ (Txt$, Bytes%) + ReadSequential$ = LEFT$(Txt$, Bytes%) + Txt$ = MID$(Txt$, Bytes% + 1) +END FUNCTION -Sub LoadPreview (Destination As _Byte) - Dim a$, b$, i As Long, __UI_EOF As _Byte, Answer As _Byte - Dim NewType As Integer, NewWidth As Integer, NewHeight As Integer - Dim NewLeft As Integer, NewTop As Integer, NewName As String - Dim NewParentID As String, FloatValue As _Float, TempValue As Long - Dim Dummy As Long, Disk As _Byte, Clip$, FirstToBeSelected As Long - Dim BinaryFileNum As Integer, LogFileNum As Integer - Dim CorruptedData As _Byte, UndoBuffer As _Byte +SUB LoadPreview (Destination AS _BYTE) + DIM a$, b$, i AS LONG, __UI_EOF AS _BYTE + DIM NewType AS INTEGER, NewWidth AS INTEGER, NewHeight AS INTEGER + DIM NewLeft AS INTEGER, NewTop AS INTEGER, NewName AS STRING + DIM NewParentID AS STRING, FloatValue AS _FLOAT, TempValue AS LONG + DIM Dummy AS LONG, Disk AS _BYTE, Clip$, FirstToBeSelected AS LONG + DIM BinaryFileNum AS INTEGER, LogFileNum AS INTEGER + DIM CorruptedData AS _BYTE, UndoBuffer AS _BYTE - Const LogFileLoad = False + CONST LogFileLoad = False - If _FileExists("UiEditorPreview.frmbin") = 0 And Destination = InDisk Then - Exit Sub - End If + IF _FILEEXISTS("InForm/UiEditorPreview.frmbin") = 0 AND Destination = InDisk THEN + EXIT SUB + END IF - If Destination = InDisk Then + IF Destination = InDisk THEN Disk = True - BinaryFileNum = FreeFile - Open "UiEditorPreview.frmbin" For Binary As #BinaryFileNum - ElseIf Destination = ToUndoBuffer Then + BinaryFileNum = FREEFILE + OPEN "InForm/UiEditorPreview.frmbin" FOR BINARY AS #BinaryFileNum + ELSEIF Destination = ToUndoBuffer THEN UndoBuffer = True - End If + END IF - LogFileNum = FreeFile - If LogFileLoad Then Open "ui_log.txt" For Output As #LogFileNum + LogFileNum = FREEFILE + IF LogFileLoad THEN OPEN "ui_log.txt" FOR OUTPUT AS #LogFileNum - If Disk Then - b$ = Space$(7): Get #BinaryFileNum, 1, b$ - If b$ <> "InForm" + Chr$(1) Then - GoTo LoadError - Exit Sub - End If - ElseIf UndoBuffer Then - If UndoPointer = TotalUndoImages Then Exit Sub + IF Disk THEN + b$ = SPACE$(7): GET #BinaryFileNum, 1, b$ + IF b$ <> "InForm" + CHR$(1) THEN + GOTO LoadError + EXIT SUB + END IF + ELSEIF UndoBuffer THEN + IF UndoPointer = TotalUndoImages THEN EXIT SUB Clip$ = UndoImage$(UndoPointer) - ElseIf Destination = FromEditor Then + ELSEIF Destination = FromEditor THEN Clip$ = RestoreCrashData$ UndoBuffer = True - Else - Clip$ = _Clipboard$ - b$ = ReadSequential$(Clip$, Len(__UI_ClipboardCheck$)) - If b$ <> __UI_ClipboardCheck$ Then - GoTo LoadError - Exit Sub - End If - End If + ELSE + Clip$ = _CLIPBOARD$ + b$ = ReadSequential$(Clip$, LEN(__UI_ClipboardCheck$)) + IF b$ <> __UI_ClipboardCheck$ THEN + GOTO LoadError + EXIT SUB + END IF + END IF - If LogFileLoad Then Print #LogFileNum, "FOUND INFORM+1" + IF LogFileLoad THEN PRINT #LogFileNum, "FOUND INFORM+1" __UI_AutoRefresh = False - If Disk Then - For i = UBound(Control) To 1 Step -1 - If Left$(Control(i).Name, 5) <> "__UI_" Then + IF Disk THEN + FOR i = UBOUND(Control) TO 1 STEP -1 + IF LEFT$(Control(i).Name, 5) <> "__UI_" THEN CloseGif i __UI_DestroyControl Control(i) - End If - Next - If LogFileLoad Then Print #LogFileNum, "DESTROYED CONTROLS" + END IF + NEXT + IF LogFileLoad THEN PRINT #LogFileNum, "DESTROYED CONTROLS" - b$ = Space$(4): Get #BinaryFileNum, , b$ - If LogFileLoad Then Print #LogFileNum, "READ NEW ARRAYS:" + Str$(CVL(b$)) + b$ = SPACE$(4): GET #BinaryFileNum, , b$ + IF LogFileLoad THEN PRINT #LogFileNum, "READ NEW ARRAYS:" + STR$(CVL(b$)) - ReDim _Preserve Caption(1 To CVL(b$)) As String - ReDim __UI_TempCaptions(1 To CVL(b$)) As String - ReDim Text(1 To CVL(b$)) As String - ReDim __UI_TempTexts(1 To CVL(b$)) As String - ReDim ToolTip(1 To CVL(b$)) As String - ReDim __UI_TempTips(1 To CVL(b$)) As String - ReDim _Preserve Control(0 To CVL(b$)) As __UI_ControlTYPE - ElseIf UndoBuffer Then - For i = UBound(Control) To 1 Step -1 - If Left$(Control(i).Name, 5) <> "__UI_" Then + REDIM _PRESERVE Caption(1 TO CVL(b$)) AS STRING + REDIM __UI_TempCaptions(1 TO CVL(b$)) AS STRING + REDIM Text(1 TO CVL(b$)) AS STRING + REDIM __UI_TempTexts(1 TO CVL(b$)) AS STRING + REDIM ToolTip(1 TO CVL(b$)) AS STRING + REDIM __UI_TempTips(1 TO CVL(b$)) AS STRING + REDIM _PRESERVE Control(0 TO CVL(b$)) AS __UI_ControlTYPE + ELSEIF UndoBuffer THEN + FOR i = UBOUND(Control) TO 1 STEP -1 + IF LEFT$(Control(i).Name, 5) <> "__UI_" THEN CloseGif i __UI_DestroyControl Control(i) - End If - Next - If LogFileLoad Then Print #LogFileNum, "DESTROYED CONTROLS" + END IF + NEXT + IF LogFileLoad THEN PRINT #LogFileNum, "DESTROYED CONTROLS" b$ = ReadSequential$(Clip$, 4) - If LogFileLoad Then Print #LogFileNum, "READ NEW ARRAYS:" + Str$(CVL(b$)) + IF LogFileLoad THEN PRINT #LogFileNum, "READ NEW ARRAYS:" + STR$(CVL(b$)) - ReDim _Preserve Caption(1 To CVL(b$)) As String - ReDim __UI_TempCaptions(1 To CVL(b$)) As String - ReDim Text(1 To CVL(b$)) As String - ReDim __UI_TempTexts(1 To CVL(b$)) As String - ReDim ToolTip(1 To CVL(b$)) As String - ReDim __UI_TempTips(1 To CVL(b$)) As String - ReDim _Preserve Control(0 To CVL(b$)) As __UI_ControlTYPE - Else - Dim ShiftPosition As _Byte - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected Then ShiftPosition = True + REDIM _PRESERVE Caption(1 TO CVL(b$)) AS STRING + REDIM __UI_TempCaptions(1 TO CVL(b$)) AS STRING + REDIM Text(1 TO CVL(b$)) AS STRING + REDIM __UI_TempTexts(1 TO CVL(b$)) AS STRING + REDIM ToolTip(1 TO CVL(b$)) AS STRING + REDIM __UI_TempTips(1 TO CVL(b$)) AS STRING + REDIM _PRESERVE Control(0 TO CVL(b$)) AS __UI_ControlTYPE + ELSE + DIM ShiftPosition AS _BYTE + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected THEN ShiftPosition = True Control(i).ControlIsSelected = False - Next + NEXT __UI_TotalSelectedControls = 0 @@ -2441,682 +2441,682 @@ Sub LoadPreview (Destination As _Byte) 'Clip$ = Clip$ + STRING$(60, "-") + CHR$(10) 'Clip$ = Clip$ + "END CONTROL DATA" - Dim ClipLen$ - Do + DIM ClipLen$ + DO a$ = ReadSequential$(Clip$, 1) - If a$ = Chr$(10) Then Exit Do - If a$ = "" Then GoTo LoadError + IF a$ = CHR$(10) THEN EXIT DO + IF a$ = "" THEN GOTO LoadError ClipLen$ = ClipLen$ + a$ - Loop + LOOP - b$ = ReadSequential$(Clip$, Val("&H" + ClipLen$)) - b$ = Replace$(b$, Chr$(10), "", False, 0) + b$ = ReadSequential$(Clip$, VAL("&H" + ClipLen$)) + b$ = Replace$(b$, CHR$(10), "", False, 0) Clip$ = Unpack$(b$) - End If + END IF - If Not Disk Then b$ = ReadSequential$(Clip$, 2) Else b$ = Space$(2): Get #BinaryFileNum, , b$ - If LogFileLoad Then Print #LogFileNum, "READ NEW CONTROL:" + Str$(CVI(b$)) - If CVI(b$) <> -1 Then GoTo LoadError - Do - If Not Disk Then b$ = ReadSequential$(Clip$, 4) Else b$ = Space$(4): Get #BinaryFileNum, , b$ + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 2) ELSE b$ = SPACE$(2): GET #BinaryFileNum, , b$ + IF LogFileLoad THEN PRINT #LogFileNum, "READ NEW CONTROL:" + STR$(CVI(b$)) + IF CVI(b$) <> -1 THEN GOTO LoadError + DO + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 4) ELSE b$ = SPACE$(4): GET #BinaryFileNum, , b$ Dummy = CVL(b$) - If Not Disk Then b$ = ReadSequential$(Clip$, 2) Else b$ = Space$(2): Get #BinaryFileNum, , b$ + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 2) ELSE b$ = SPACE$(2): GET #BinaryFileNum, , b$ NewType = CVI(b$) - If LogFileLoad Then Print #LogFileNum, "TYPE:" + Str$(CVI(b$)) - If Not Disk Then b$ = ReadSequential$(Clip$, 2) Else b$ = Space$(2): Get #BinaryFileNum, , b$ - If Not Disk Then b$ = ReadSequential$(Clip$, CVI(b$)) Else b$ = Space$(CVI(b$)): Get #BinaryFileNum, , b$ + IF LogFileLoad THEN PRINT #LogFileNum, "TYPE:" + STR$(CVI(b$)) + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 2) ELSE b$ = SPACE$(2): GET #BinaryFileNum, , b$ + IF NOT Disk THEN b$ = ReadSequential$(Clip$, CVI(b$)) ELSE b$ = SPACE$(CVI(b$)): GET #BinaryFileNum, , b$ NewName = b$ - If LogFileLoad Then Print #LogFileNum, "NAME:" + NewName - If Not Disk Then b$ = ReadSequential$(Clip$, 2) Else b$ = Space$(2): Get #BinaryFileNum, , b$ + IF LogFileLoad THEN PRINT #LogFileNum, "NAME:" + NewName + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 2) ELSE b$ = SPACE$(2): GET #BinaryFileNum, , b$ NewWidth = CVI(b$) - If LogFileLoad Then Print #LogFileNum, "WIDTH:" + Str$(CVI(b$)) - If Not Disk Then b$ = ReadSequential$(Clip$, 2) Else b$ = Space$(2): Get #BinaryFileNum, , b$ + IF LogFileLoad THEN PRINT #LogFileNum, "WIDTH:" + STR$(CVI(b$)) + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 2) ELSE b$ = SPACE$(2): GET #BinaryFileNum, , b$ NewHeight = CVI(b$) - If LogFileLoad Then Print #LogFileNum, "HEIGHT:" + Str$(CVI(b$)) - If Not Disk Then b$ = ReadSequential$(Clip$, 2) Else b$ = Space$(2): Get #BinaryFileNum, , b$ + IF LogFileLoad THEN PRINT #LogFileNum, "HEIGHT:" + STR$(CVI(b$)) + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 2) ELSE b$ = SPACE$(2): GET #BinaryFileNum, , b$ NewLeft = CVI(b$) - If LogFileLoad Then Print #LogFileNum, "LEFT:" + Str$(CVI(b$)) - If Not Disk Then b$ = ReadSequential$(Clip$, 2) Else b$ = Space$(2): Get #BinaryFileNum, , b$ + IF LogFileLoad THEN PRINT #LogFileNum, "LEFT:" + STR$(CVI(b$)) + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 2) ELSE b$ = SPACE$(2): GET #BinaryFileNum, , b$ NewTop = CVI(b$) - If Not Disk Then - If ShiftPosition Then + IF NOT Disk THEN + IF ShiftPosition THEN NewLeft = NewLeft + 20 NewTop = NewTop + 20 - End If - End If - If LogFileLoad Then Print #LogFileNum, "TOP:" + Str$(CVI(b$)) - If Not Disk Then b$ = ReadSequential$(Clip$, 2) Else b$ = Space$(2): Get #BinaryFileNum, , b$ - If CVI(b$) > 0 Then - If Not Disk Then NewParentID = ReadSequential$(Clip$, CVI(b$)) Else NewParentID = Space$(CVI(b$)): Get #BinaryFileNum, , NewParentID - If LogFileLoad Then Print #LogFileNum, "PARENT:" + NewParentID - Else + END IF + END IF + IF LogFileLoad THEN PRINT #LogFileNum, "TOP:" + STR$(CVI(b$)) + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 2) ELSE b$ = SPACE$(2): GET #BinaryFileNum, , b$ + IF CVI(b$) > 0 THEN + IF NOT Disk THEN NewParentID = ReadSequential$(Clip$, CVI(b$)) ELSE NewParentID = SPACE$(CVI(b$)): GET #BinaryFileNum, , NewParentID + IF LogFileLoad THEN PRINT #LogFileNum, "PARENT:" + NewParentID + ELSE NewParentID = "" - If LogFileLoad Then Print #LogFileNum, "PARENT: ORPHAN/CONTAINER" - End If + IF LogFileLoad THEN PRINT #LogFileNum, "PARENT: ORPHAN/CONTAINER" + END IF - If Not Disk Then + IF NOT Disk THEN 'Change control's name in case this form already has one with the same name - Dim TempName$, c$, OriginalIndex$, NameChanges$ - Dim OriginalName$, DidRename As _Byte + DIM TempName$, c$, OriginalIndex$, NameChanges$ + DIM OriginalName$, DidRename AS _BYTE - OriginalName$ = RTrim$(NewName) + OriginalName$ = RTRIM$(NewName) DidRename = False - Do While __UI_GetID(NewName) > 0 + DO WHILE __UI_GetID(NewName) > 0 DidRename = True - If InStr(NameChanges$, OriginalName$ + "=") = 0 Then + IF INSTR(NameChanges$, OriginalName$ + "=") = 0 THEN NameChanges$ = NameChanges$ + OriginalName$ + "=" - End If - TempName$ = RTrim$(NewName) - c$ = Right$(TempName$, 1) - If Asc(c$) >= 48 And Asc(c$) <= 57 Then + END IF + TempName$ = RTRIM$(NewName) + c$ = RIGHT$(TempName$, 1) + IF ASC(c$) >= 48 AND ASC(c$) <= 57 THEN 'Update this control's name by the ID # assigned to it, if any OriginalIndex$ = c$ - TempName$ = Left$(TempName$, Len(TempName$) - 1) - Do - c$ = Right$(TempName$, 1) - If Asc(c$) >= 48 And Asc(c$) <= 57 Then + TempName$ = LEFT$(TempName$, LEN(TempName$) - 1) + DO + c$ = RIGHT$(TempName$, 1) + IF ASC(c$) >= 48 AND ASC(c$) <= 57 THEN OriginalIndex$ = c$ + OriginalIndex$ - TempName$ = Left$(TempName$, Len(TempName$) - 1) - If Len(TempName$) = 0 Then Exit Do - Else - Exit Do - End If - Loop - Else + TempName$ = LEFT$(TempName$, LEN(TempName$) - 1) + IF LEN(TempName$) = 0 THEN EXIT DO + ELSE + EXIT DO + END IF + LOOP + ELSE OriginalIndex$ = "1" - End If - NewName = TempName$ + LTrim$(Str$(Val(OriginalIndex$) + 1)) - Loop - If DidRename Then + END IF + NewName = TempName$ + LTRIM$(STR$(VAL(OriginalIndex$) + 1)) + LOOP + IF DidRename THEN NameChanges$ = NameChanges$ + NewName + ";" - End If - End If + END IF + END IF - If Len(NewParentID) > 0 And InStr(NameChanges$, NewParentID + "=") Then + IF LEN(NewParentID) > 0 AND INSTR(NameChanges$, NewParentID + "=") THEN 'This control's container had a name change when it was 'pasted, so we'll reassign it to its new cloned parent: - Dim NewID As Long, EndNewID As Long - NewID = InStr(NameChanges$, NewParentID + "=") + Len(NewParentID + "=") - EndNewID = InStr(NewID, NameChanges$, ";") - NewParentID = Mid$(NameChanges$, NewID, EndNewID - NewID) - End If + DIM NewID AS LONG, EndNewID AS LONG + NewID = INSTR(NameChanges$, NewParentID + "=") + LEN(NewParentID + "=") + EndNewID = INSTR(NewID, NameChanges$, ";") + NewParentID = MID$(NameChanges$, NewID, EndNewID - NewID) + END IF TempValue = __UI_NewControl(NewType, NewName, NewWidth, NewHeight, NewLeft, NewTop, __UI_GetID(NewParentID)) - If Not Disk And Not UndoBuffer Then + IF NOT Disk AND NOT UndoBuffer THEN Control(TempValue).ControlIsSelected = True __UI_TotalSelectedControls = __UI_TotalSelectedControls + 1 - If __UI_TotalSelectedControls = 1 Then FirstToBeSelected = TempValue - End If - If NewType = __UI_Type_PictureBox Then + IF __UI_TotalSelectedControls = 1 THEN FirstToBeSelected = TempValue + END IF + IF NewType = __UI_Type_PictureBox THEN Control(TempValue).HasBorder = False Control(TempValue).Stretch = False - ElseIf NewType = __UI_Type_ContextMenu Then - Control(TempValue).HelperCanvas = _CopyImage(ContextMenuIcon, 32) + ELSEIF NewType = __UI_Type_ContextMenu THEN + Control(TempValue).HelperCanvas = _COPYIMAGE(ContextMenuIcon, 32) Control(TempValue).Width = 22 Control(TempValue).Height = 22 RefreshContextMenus - End If + END IF - Do 'read properties - If Not Disk Then b$ = ReadSequential$(Clip$, 2) Else b$ = Space$(2): Get #BinaryFileNum, , b$ - If LogFileLoad Then Print #LogFileNum, "PROPERTY:" + Str$(CVI(b$)) + " :"; - Select Case CVI(b$) - Case -2 'Caption - If Not Disk Then b$ = ReadSequential$(Clip$, 4) Else b$ = Space$(4): Get #BinaryFileNum, , b$ - If Not Disk Then b$ = ReadSequential$(Clip$, CVL(b$)) Else b$ = Space$(CVL(b$)): Get #BinaryFileNum, , b$ + DO 'read properties + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 2) ELSE b$ = SPACE$(2): GET #BinaryFileNum, , b$ + IF LogFileLoad THEN PRINT #LogFileNum, "PROPERTY:" + STR$(CVI(b$)) + " :"; + SELECT CASE CVI(b$) + CASE -2 'Caption + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 4) ELSE b$ = SPACE$(4): GET #BinaryFileNum, , b$ + IF NOT Disk THEN b$ = ReadSequential$(Clip$, CVL(b$)) ELSE b$ = SPACE$(CVL(b$)): GET #BinaryFileNum, , b$ SetCaption TempValue, b$ - If LogFileLoad Then Print #LogFileNum, "CAPTION:" + Caption(TempValue) - Case -3 'Text - If Not Disk Then b$ = ReadSequential$(Clip$, 4) Else b$ = Space$(4): Get #BinaryFileNum, , b$ - If Not Disk Then b$ = ReadSequential$(Clip$, CVL(b$)) Else b$ = Space$(CVL(b$)): Get #BinaryFileNum, , b$ + IF LogFileLoad THEN PRINT #LogFileNum, "CAPTION:" + Caption(TempValue) + CASE -3 'Text + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 4) ELSE b$ = SPACE$(4): GET #BinaryFileNum, , b$ + IF NOT Disk THEN b$ = ReadSequential$(Clip$, CVL(b$)) ELSE b$ = SPACE$(CVL(b$)): GET #BinaryFileNum, , b$ Text(TempValue) = b$ - If Control(TempValue).Type = __UI_Type_PictureBox Then + IF Control(TempValue).Type = __UI_Type_PictureBox THEN PreviewLoadImage Control(TempValue), Text(TempValue) - ElseIf Control(TempValue).Type = __UI_Type_Button Or Control(TempValue).Type = __UI_Type_MenuItem Then + ELSEIF Control(TempValue).Type = __UI_Type_Button OR Control(TempValue).Type = __UI_Type_MenuItem THEN LoadImage Control(TempValue), Text(TempValue) - ElseIf Control(TempValue).Type = __UI_Type_Form Then - If ExeIcon <> 0 Then _FreeImage ExeIcon: ExeIcon = 0 + ELSEIF Control(TempValue).Type = __UI_Type_Form THEN + IF ExeIcon <> 0 THEN _FREEIMAGE ExeIcon: ExeIcon = 0 ExeIcon = IconPreview&(Text(TempValue)) - If ExeIcon < -1 Then - _Icon ExeIcon - End If - End If - If LogFileLoad Then Print #LogFileNum, "TEXT:" + Text(TempValue) - Case -4 'Stretch + IF ExeIcon < -1 THEN + _ICON ExeIcon + END IF + END IF + IF LogFileLoad THEN PRINT #LogFileNum, "TEXT:" + Text(TempValue) + CASE -4 'Stretch Control(TempValue).Stretch = True - If LogFileLoad Then Print #LogFileNum, "STRETCH" - Case -5 'Font - If LogFileLoad Then Print #LogFileNum, "FONT:"; - Dim FontSetup$, FindSep As Integer - Dim NewFontName As String, NewFontFile As String - Dim NewFontSize As Integer - If Not Disk Then b$ = ReadSequential$(Clip$, 2) Else b$ = Space$(2): Get #BinaryFileNum, , b$ - If Not Disk Then FontSetup$ = ReadSequential$(Clip$, CVI(b$)) Else FontSetup$ = Space$(CVI(b$)): Get #BinaryFileNum, , FontSetup$ - If LogFileLoad Then Print #LogFileNum, FontSetup$ + IF LogFileLoad THEN PRINT #LogFileNum, "STRETCH" + CASE -5 'Font + IF LogFileLoad THEN PRINT #LogFileNum, "FONT:"; + DIM FontSetup$, FindSep AS INTEGER + DIM NewFontFile AS STRING + DIM NewFontSize AS INTEGER + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 2) ELSE b$ = SPACE$(2): GET #BinaryFileNum, , b$ + IF NOT Disk THEN FontSetup$ = ReadSequential$(Clip$, CVI(b$)) ELSE FontSetup$ = SPACE$(CVI(b$)): GET #BinaryFileNum, , FontSetup$ + IF LogFileLoad THEN PRINT #LogFileNum, FontSetup$ - FindSep = InStr(FontSetup$, ",") - NewFontFile = Left$(FontSetup$, FindSep - 1) - FontSetup$ = Mid$(FontSetup$, FindSep + 1) + FindSep = INSTR(FontSetup$, ",") + NewFontFile = LEFT$(FontSetup$, FindSep - 1) + FontSetup$ = MID$(FontSetup$, FindSep + 1) - NewFontSize = Val(FontSetup$) + NewFontSize = VAL(FontSetup$) Control(TempValue).Font = SetFont(NewFontFile, NewFontSize) - If Not Disk Then b$ = ReadSequential$(Clip$, 2) Else b$ = Space$(2): Get #BinaryFileNum, , b$ - If Not Disk Then FontSetup$ = ReadSequential$(Clip$, CVI(b$)) Else FontSetup$ = Space$(CVI(b$)): Get #BinaryFileNum, , FontSetup$ - Case -6 'ForeColor - If Not Disk Then b$ = ReadSequential$(Clip$, 4) Else b$ = Space$(4): Get #BinaryFileNum, , b$ - Control(TempValue).ForeColor = _CV(_Unsigned Long, b$) - If LogFileLoad Then Print #LogFileNum, "FORECOLOR" - Case -7 'BackColor - If Not Disk Then b$ = ReadSequential$(Clip$, 4) Else b$ = Space$(4): Get #BinaryFileNum, , b$ - Control(TempValue).BackColor = _CV(_Unsigned Long, b$) - If LogFileLoad Then Print #LogFileNum, "BACKCOLOR" - Case -8 'SelectedForeColor - If Not Disk Then b$ = ReadSequential$(Clip$, 4) Else b$ = Space$(4): Get #BinaryFileNum, , b$ - Control(TempValue).SelectedForeColor = _CV(_Unsigned Long, b$) - If LogFileLoad Then Print #LogFileNum, "SELECTEDFORECOLOR" - Case -9 'SelectedBackColor - If Not Disk Then b$ = ReadSequential$(Clip$, 4) Else b$ = Space$(4): Get #BinaryFileNum, , b$ - Control(TempValue).SelectedBackColor = _CV(_Unsigned Long, b$) - If LogFileLoad Then Print #LogFileNum, "SELECTEDBACKCOLOR" - Case -10 'BorderColor - If Not Disk Then b$ = ReadSequential$(Clip$, 4) Else b$ = Space$(4): Get #BinaryFileNum, , b$ - Control(TempValue).BorderColor = _CV(_Unsigned Long, b$) - If LogFileLoad Then Print #LogFileNum, "BORDERCOLOR" - Case -11 + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 2) ELSE b$ = SPACE$(2): GET #BinaryFileNum, , b$ + IF NOT Disk THEN FontSetup$ = ReadSequential$(Clip$, CVI(b$)) ELSE FontSetup$ = SPACE$(CVI(b$)): GET #BinaryFileNum, , FontSetup$ + CASE -6 'ForeColor + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 4) ELSE b$ = SPACE$(4): GET #BinaryFileNum, , b$ + Control(TempValue).ForeColor = _CV(_UNSIGNED LONG, b$) + IF LogFileLoad THEN PRINT #LogFileNum, "FORECOLOR" + CASE -7 'BackColor + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 4) ELSE b$ = SPACE$(4): GET #BinaryFileNum, , b$ + Control(TempValue).BackColor = _CV(_UNSIGNED LONG, b$) + IF LogFileLoad THEN PRINT #LogFileNum, "BACKCOLOR" + CASE -8 'SelectedForeColor + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 4) ELSE b$ = SPACE$(4): GET #BinaryFileNum, , b$ + Control(TempValue).SelectedForeColor = _CV(_UNSIGNED LONG, b$) + IF LogFileLoad THEN PRINT #LogFileNum, "SELECTEDFORECOLOR" + CASE -9 'SelectedBackColor + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 4) ELSE b$ = SPACE$(4): GET #BinaryFileNum, , b$ + Control(TempValue).SelectedBackColor = _CV(_UNSIGNED LONG, b$) + IF LogFileLoad THEN PRINT #LogFileNum, "SELECTEDBACKCOLOR" + CASE -10 'BorderColor + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 4) ELSE b$ = SPACE$(4): GET #BinaryFileNum, , b$ + Control(TempValue).BorderColor = _CV(_UNSIGNED LONG, b$) + IF LogFileLoad THEN PRINT #LogFileNum, "BORDERCOLOR" + CASE -11 Control(TempValue).BackStyle = __UI_Transparent - If LogFileLoad Then Print #LogFileNum, "BACKSTYLE:TRANSPARENT" - Case -12 + IF LogFileLoad THEN PRINT #LogFileNum, "BACKSTYLE:TRANSPARENT" + CASE -12 Control(TempValue).HasBorder = True - If Control(TempValue).BorderSize = 0 Then + IF Control(TempValue).BorderSize = 0 THEN Control(TempValue).BorderSize = 1 - End If - If LogFileLoad Then Print #LogFileNum, "HASBORDER" - Case -13 - If Not Disk Then b$ = ReadSequential$(Clip$, 1) Else b$ = Space$(1): Get #BinaryFileNum, , b$ - Control(TempValue).Align = _CV(_Byte, b$) - If LogFileLoad Then Print #LogFileNum, "ALIGN="; Control(TempValue).Align - Case -14 - If Not Disk Then b$ = ReadSequential$(Clip$, Len(FloatValue)) Else b$ = Space$(Len(FloatValue)): Get #BinaryFileNum, , b$ - Control(TempValue).Value = _CV(_Float, b$) - If LogFileLoad Then Print #LogFileNum, "VALUE="; Control(TempValue).Value - Case -15 - If Not Disk Then b$ = ReadSequential$(Clip$, Len(FloatValue)) Else b$ = Space$(Len(FloatValue)): Get #BinaryFileNum, , b$ - Control(TempValue).Min = _CV(_Float, b$) - If LogFileLoad Then Print #LogFileNum, "MIN="; Control(TempValue).Min - Case -16 - If Not Disk Then b$ = ReadSequential$(Clip$, Len(FloatValue)) Else b$ = Space$(Len(FloatValue)): Get #BinaryFileNum, , b$ - Control(TempValue).Max = _CV(_Float, b$) - If LogFileLoad Then Print #LogFileNum, "MAX="; Control(TempValue).Max - Case -19 + END IF + IF LogFileLoad THEN PRINT #LogFileNum, "HASBORDER" + CASE -13 + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 1) ELSE b$ = SPACE$(1): GET #BinaryFileNum, , b$ + Control(TempValue).Align = _CV(_BYTE, b$) + IF LogFileLoad THEN PRINT #LogFileNum, "ALIGN="; Control(TempValue).Align + CASE -14 + IF NOT Disk THEN b$ = ReadSequential$(Clip$, LEN(FloatValue)) ELSE b$ = SPACE$(LEN(FloatValue)): GET #BinaryFileNum, , b$ + Control(TempValue).Value = _CV(_FLOAT, b$) + IF LogFileLoad THEN PRINT #LogFileNum, "VALUE="; Control(TempValue).Value + CASE -15 + IF NOT Disk THEN b$ = ReadSequential$(Clip$, LEN(FloatValue)) ELSE b$ = SPACE$(LEN(FloatValue)): GET #BinaryFileNum, , b$ + Control(TempValue).Min = _CV(_FLOAT, b$) + IF LogFileLoad THEN PRINT #LogFileNum, "MIN="; Control(TempValue).Min + CASE -16 + IF NOT Disk THEN b$ = ReadSequential$(Clip$, LEN(FloatValue)) ELSE b$ = SPACE$(LEN(FloatValue)): GET #BinaryFileNum, , b$ + Control(TempValue).Max = _CV(_FLOAT, b$) + IF LogFileLoad THEN PRINT #LogFileNum, "MAX="; Control(TempValue).Max + CASE -19 Control(TempValue).ShowPercentage = True - If LogFileLoad Then Print #LogFileNum, "SHOWPERCENTAGE" - Case -20 + IF LogFileLoad THEN PRINT #LogFileNum, "SHOWPERCENTAGE" + CASE -20 Control(TempValue).CanHaveFocus = True - If LogFileLoad Then Print #LogFileNum, "CANHAVEFOCUS" - Case -21 + IF LogFileLoad THEN PRINT #LogFileNum, "CANHAVEFOCUS" + CASE -21 Control(TempValue).Disabled = True - If LogFileLoad Then Print #LogFileNum, "DISABLED" - Case -22 + IF LogFileLoad THEN PRINT #LogFileNum, "DISABLED" + CASE -22 Control(TempValue).Hidden = True - If LogFileLoad Then Print #LogFileNum, "HIDDEN" - Case -23 + IF LogFileLoad THEN PRINT #LogFileNum, "HIDDEN" + CASE -23 Control(TempValue).CenteredWindow = True - If LogFileLoad Then Print #LogFileNum, "CENTEREDWINDOW" - Case -24 'Tips - If Not Disk Then b$ = ReadSequential$(Clip$, 4) Else b$ = Space$(4): Get #BinaryFileNum, , b$ - If Not Disk Then b$ = ReadSequential$(Clip$, CVL(b$)) Else b$ = Space$(CVL(b$)): Get #BinaryFileNum, , b$ + IF LogFileLoad THEN PRINT #LogFileNum, "CENTEREDWINDOW" + CASE -24 'Tips + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 4) ELSE b$ = SPACE$(4): GET #BinaryFileNum, , b$ + IF NOT Disk THEN b$ = ReadSequential$(Clip$, CVL(b$)) ELSE b$ = SPACE$(CVL(b$)): GET #BinaryFileNum, , b$ ToolTip(TempValue) = b$ - If LogFileLoad Then Print #LogFileNum, "TIP: "; ToolTip(TempValue) - Case -25 - Dim ContextMenuName As String - If Not Disk Then b$ = ReadSequential$(Clip$, 2) Else b$ = Space$(2): Get #BinaryFileNum, , b$ - If Not Disk Then ContextMenuName = ReadSequential$(Clip$, CVI(b$)) Else ContextMenuName = Space$(CVI(b$)): Get #BinaryFileNum, , ContextMenuName + IF LogFileLoad THEN PRINT #LogFileNum, "TIP: "; ToolTip(TempValue) + CASE -25 + DIM ContextMenuName AS STRING + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 2) ELSE b$ = SPACE$(2): GET #BinaryFileNum, , b$ + IF NOT Disk THEN ContextMenuName = ReadSequential$(Clip$, CVI(b$)) ELSE ContextMenuName = SPACE$(CVI(b$)): GET #BinaryFileNum, , ContextMenuName Control(TempValue).ContextMenuID = __UI_GetID(ContextMenuName) - If LogFileLoad Then Print #LogFileNum, "CONTEXTMENU:"; ContextMenuName - Case -26 - If Not Disk Then b$ = ReadSequential$(Clip$, Len(FloatValue)) Else b$ = Space$(Len(FloatValue)): Get #BinaryFileNum, , b$ - Control(TempValue).Interval = _CV(_Float, b$) - If LogFileLoad Then Print #LogFileNum, "INTERVAL="; Control(TempValue).Interval - Case -27 + IF LogFileLoad THEN PRINT #LogFileNum, "CONTEXTMENU:"; ContextMenuName + CASE -26 + IF NOT Disk THEN b$ = ReadSequential$(Clip$, LEN(FloatValue)) ELSE b$ = SPACE$(LEN(FloatValue)): GET #BinaryFileNum, , b$ + Control(TempValue).Interval = _CV(_FLOAT, b$) + IF LogFileLoad THEN PRINT #LogFileNum, "INTERVAL="; Control(TempValue).Interval + CASE -27 Control(TempValue).WordWrap = True - If LogFileLoad Then Print #LogFileNum, "WORDWRAP" - Case -28 - If Not Disk Then b$ = ReadSequential$(Clip$, 4) Else b$ = Space$(4): Get #BinaryFileNum, , b$ - Control(TempValue).TransparentColor = _CV(_Unsigned Long, b$) - If LogFileLoad Then Print #LogFileNum, "TRANSPARENTCOLOR" + IF LogFileLoad THEN PRINT #LogFileNum, "WORDWRAP" + CASE -28 + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 4) ELSE b$ = SPACE$(4): GET #BinaryFileNum, , b$ + Control(TempValue).TransparentColor = _CV(_UNSIGNED LONG, b$) + IF LogFileLoad THEN PRINT #LogFileNum, "TRANSPARENTCOLOR" __UI_ClearColor Control(TempValue).HelperCanvas, Control(TempValue).TransparentColor, -1 - Case -29 + CASE -29 Control(TempValue).CanResize = True - If LogFileLoad Then Print #LogFileNum, "CANRESIZE" - Case -31 - If Not Disk Then b$ = ReadSequential$(Clip$, 2) Else b$ = Space$(2): Get #BinaryFileNum, , b$ + IF LogFileLoad THEN PRINT #LogFileNum, "CANRESIZE" + CASE -31 + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 2) ELSE b$ = SPACE$(2): GET #BinaryFileNum, , b$ Control(TempValue).Padding = CVI(b$) - If LogFileLoad Then Print #LogFileNum, "PADDING" + Str$(CVI(b$)) - Case -32 - If Not Disk Then b$ = ReadSequential$(Clip$, 1) Else b$ = Space$(1): Get #BinaryFileNum, , b$ - Control(TempValue).VAlign = _CV(_Byte, b$) - If LogFileLoad Then Print #LogFileNum, "VALIGN="; Control(TempValue).VAlign - Case -33 + IF LogFileLoad THEN PRINT #LogFileNum, "PADDING" + STR$(CVI(b$)) + CASE -32 + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 1) ELSE b$ = SPACE$(1): GET #BinaryFileNum, , b$ + Control(TempValue).VAlign = _CV(_BYTE, b$) + IF LogFileLoad THEN PRINT #LogFileNum, "VALIGN="; Control(TempValue).VAlign + CASE -33 Control(TempValue).PasswordField = True - If LogFileLoad Then Print #LogFileNum, "PASSWORDFIELD" - Case -34 - If Not Disk Then b$ = ReadSequential$(Clip$, 4) Else b$ = Space$(4): Get #BinaryFileNum, , b$ + IF LogFileLoad THEN PRINT #LogFileNum, "PASSWORDFIELD" + CASE -34 + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 4) ELSE b$ = SPACE$(4): GET #BinaryFileNum, , b$ Control(TempValue).Encoding = CVL(b$) - If LogFileLoad Then Print #LogFileNum, "ENCODING="; Control(TempValue).Encoding - Case -35 + IF LogFileLoad THEN PRINT #LogFileNum, "ENCODING="; Control(TempValue).Encoding + CASE -35 __UI_DefaultButtonID = TempValue - If LogFileLoad Then Print #LogFileNum, "DEFAULT BUTTON" - Case -36 - If Not Disk Then b$ = ReadSequential$(Clip$, 4) Else b$ = Space$(4): Get #BinaryFileNum, , b$ - If Not Disk Then b$ = ReadSequential$(Clip$, CVL(b$)) Else b$ = Space$(CVL(b$)): Get #BinaryFileNum, , b$ + IF LogFileLoad THEN PRINT #LogFileNum, "DEFAULT BUTTON" + CASE -36 + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 4) ELSE b$ = SPACE$(4): GET #BinaryFileNum, , b$ + IF NOT Disk THEN b$ = ReadSequential$(Clip$, CVL(b$)) ELSE b$ = SPACE$(CVL(b$)): GET #BinaryFileNum, , b$ Mask(TempValue) = b$ - If LogFileLoad Then Print #LogFileNum, "MASK:" + Mask(TempValue) - Case -37 - If Not Disk Then b$ = ReadSequential$(Clip$, Len(FloatValue)) Else b$ = Space$(Len(FloatValue)): Get #BinaryFileNum, , b$ - Control(TempValue).MinInterval = _CV(_Float, b$) - If LogFileLoad Then Print #LogFileNum, "MININTERVAL="; Control(TempValue).MinInterval - Case -38 + IF LogFileLoad THEN PRINT #LogFileNum, "MASK:" + Mask(TempValue) + CASE -37 + IF NOT Disk THEN b$ = ReadSequential$(Clip$, LEN(FloatValue)) ELSE b$ = SPACE$(LEN(FloatValue)): GET #BinaryFileNum, , b$ + Control(TempValue).MinInterval = _CV(_FLOAT, b$) + IF LogFileLoad THEN PRINT #LogFileNum, "MININTERVAL="; Control(TempValue).MinInterval + CASE -38 Control(TempValue).NumericOnly = True - Case -39 + CASE -39 Control(TempValue).NumericOnly = __UI_NumericWithBounds - Case -40 + CASE -40 Control(TempValue).BulletStyle = __UI_Bullet - Case -41 + CASE -41 Control(TempValue).AutoScroll = True - Case -42 + CASE -42 Control(TempValue).AutoSize = True - Case -43 - If Not Disk Then b$ = ReadSequential$(Clip$, 2) Else b$ = Space$(2): Get #BinaryFileNum, , b$ + CASE -43 + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 2) ELSE b$ = SPACE$(2): GET #BinaryFileNum, , b$ Control(TempValue).BorderSize = CVI(b$) - If LogFileLoad Then Print #LogFileNum, "BORDER SIZE" + Str$(CVI(b$)) - Case -44 - Dim RegisterResult As _Byte, Combo As String - If Not Disk Then b$ = ReadSequential$(Clip$, 2) Else b$ = Space$(2): Get #BinaryFileNum, , b$ - If Not Disk Then Combo = ReadSequential$(Clip$, CVI(b$)) Else Combo = Space$(CVI(b$)): Get #BinaryFileNum, , ContextMenuName + IF LogFileLoad THEN PRINT #LogFileNum, "BORDER SIZE" + STR$(CVI(b$)) + CASE -44 + DIM RegisterResult AS _BYTE, Combo AS STRING + IF NOT Disk THEN b$ = ReadSequential$(Clip$, 2) ELSE b$ = SPACE$(2): GET #BinaryFileNum, , b$ + IF NOT Disk THEN Combo = ReadSequential$(Clip$, CVI(b$)) ELSE Combo = SPACE$(CVI(b$)): GET #BinaryFileNum, , ContextMenuName RegisterResult = RegisterKeyCombo(Combo, TempValue) - If LogFileLoad Then Print #LogFileNum, "KEY COMBO:"; Combo - Case -46 - If TempValue <= UBound(AutoPlayGif) Then + IF LogFileLoad THEN PRINT #LogFileNum, "KEY COMBO:"; Combo + CASE -46 + IF TempValue <= UBOUND(AutoPlayGif) THEN AutoPlayGif(i) = True - End If - Case -47 + END IF + CASE -47 Control(TempValue).ControlIsSelected = True - Case -1 'new control - If LogFileLoad Then Print #LogFileNum, "READ NEW CONTROL: -1" - Exit Do - Case -1024 - If LogFileLoad Then Print #LogFileNum, "READ END OF FILE: -1024" + CASE -1 'new control + IF LogFileLoad THEN PRINT #LogFileNum, "READ NEW CONTROL: -1" + EXIT DO + CASE -1024 + IF LogFileLoad THEN PRINT #LogFileNum, "READ END OF FILE: -1024" __UI_EOF = True - Exit Do - Case Else - If LogFileLoad Then Print #LogFileNum, "UNKNOWN PROPERTY ="; CVI(b$) + EXIT DO + CASE ELSE + IF LogFileLoad THEN PRINT #LogFileNum, "UNKNOWN PROPERTY ="; CVI(b$) __UI_EOF = True 'Stop reading if corrupted data is found CorruptedData = True - Exit Do - End Select - Loop - Loop Until __UI_EOF - If Disk Then Close #BinaryFileNum - If LogFileLoad Then Close #LogFileNum - If Not Disk And Not UndoBuffer Then - If Not CorruptedData Then + EXIT DO + END SELECT + LOOP + LOOP UNTIL __UI_EOF + IF Disk THEN CLOSE #BinaryFileNum + IF LogFileLoad THEN CLOSE #LogFileNum + IF NOT Disk AND NOT UndoBuffer THEN + IF NOT CorruptedData THEN __UI_FirstSelectedID = FirstToBeSelected - Else + ELSE CloseGif TempValue __UI_DestroyControl Control(TempValue) __UI_TotalSelectedControls = __UI_TotalSelectedControls - 1 - End If + END IF __UI_ForceRedraw = True - End If + END IF __UI_AutoRefresh = True - Exit Sub + EXIT SUB LoadError: - If Disk Then - Close #BinaryFileNum - Kill "UiEditorPreview.frmbin" - End If - If LogFileLoad Then Close #LogFileNum + IF Disk THEN + CLOSE #BinaryFileNum + KILL "InForm/UiEditorPreview.frmbin" + END IF + IF LogFileLoad THEN CLOSE #LogFileNum __UI_AutoRefresh = True -End Sub +END SUB -Sub LoadPreviewText - Dim b$, i As Long, __UI_EOF As _Byte, Answer As _Byte - Dim NewType As Integer, NewWidth As Integer, NewHeight As Integer - Dim NewLeft As Integer, NewTop As Integer, NewName As String - Dim NewParentID As String, FloatValue As _Float, TempValue As Long - Dim Dummy As Long, DummyText$, TotalNewControls As Long - Dim BinaryFileNum As Integer, LogFileNum As Integer - Dim NewRed As _Unsigned _Byte, NewGreen As _Unsigned _Byte, NewBlue As _Unsigned _Byte +SUB LoadPreviewText + DIM b$, i AS LONG, __UI_EOF AS _BYTE + DIM NewType AS INTEGER, NewWidth AS INTEGER, NewHeight AS INTEGER + DIM NewLeft AS INTEGER, NewTop AS INTEGER, NewName AS STRING + DIM NewParentID AS STRING, TempValue AS LONG + DIM DummyText$ + DIM BinaryFileNum AS INTEGER, LogFileNum AS INTEGER + DIM NewRed AS _UNSIGNED _BYTE, NewGreen AS _UNSIGNED _BYTE, NewBlue AS _UNSIGNED _BYTE - Const LogFileLoad = False + CONST LogFileLoad = False - If _FileExists("UiEditorPreview.frmbin") = 0 Then - Exit Sub - Else - BinaryFileNum = FreeFile - Open "UiEditorPreview.frmbin" For Binary As #BinaryFileNum + IF _FILEEXISTS("InForm/UiEditorPreview.frmbin") = 0 THEN + EXIT SUB + ELSE + BinaryFileNum = FREEFILE + OPEN "InForm/UiEditorPreview.frmbin" FOR BINARY AS #BinaryFileNum - LogFileNum = FreeFile - If LogFileLoad Then Open "ui_log.txt" For Output As #LogFileNum - Do - If EOF(BinaryFileNum) Then GoTo LoadError - Line Input #BinaryFileNum, b$ - Loop Until b$ = "SUB __UI_LoadForm" - If LogFileLoad Then Print #LogFileNum, "FOUND SUB __UI_LOADFORM" + LogFileNum = FREEFILE + IF LogFileLoad THEN OPEN "ui_log.txt" FOR OUTPUT AS #LogFileNum + DO + IF EOF(BinaryFileNum) THEN GOTO LoadError + LINE INPUT #BinaryFileNum, b$ + LOOP UNTIL b$ = "SUB __UI_LoadForm" + IF LogFileLoad THEN PRINT #LogFileNum, "FOUND SUB __UI_LOADFORM" __UI_AutoRefresh = False - For i = UBound(Control) To 1 Step -1 - If Left$(Control(i).Name, 5) <> "__UI_" Then + FOR i = UBOUND(Control) TO 1 STEP -1 + IF LEFT$(Control(i).Name, 5) <> "__UI_" THEN CloseGif i __UI_DestroyControl Control(i) - End If - Next - If LogFileLoad Then Print #LogFileNum, "DESTROYED CONTROLS" + END IF + NEXT + IF LogFileLoad THEN PRINT #LogFileNum, "DESTROYED CONTROLS" - Do - Line Input #BinaryFileNum, b$ - Loop Until InStr(b$, "__UI_NewControl") > 0 - If LogFileLoad Then Print #LogFileNum, "READ NEW CONTROL" - Do + DO + LINE INPUT #BinaryFileNum, b$ + LOOP UNTIL INSTR(b$, "__UI_NewControl") > 0 + IF LogFileLoad THEN PRINT #LogFileNum, "READ NEW CONTROL" + DO DummyText$ = nextParameter(b$) - Select Case DummyText$ - Case "__UI_Type_Form": NewType = 1 - Case "__UI_Type_Frame": NewType = 2 - Case "__UI_Type_Button": NewType = 3 - Case "__UI_Type_Label": NewType = 4 - Case "__UI_Type_CheckBox": NewType = 5 - Case "__UI_Type_RadioButton": NewType = 6 - Case "__UI_Type_TextBox": NewType = 7 - Case "__UI_Type_ProgressBar": NewType = 8 - Case "__UI_Type_ListBox": NewType = 9 - Case "__UI_Type_DropdownList": NewType = 10 - Case "__UI_Type_MenuBar": NewType = 11 - Case "__UI_Type_MenuItem": NewType = 12 - Case "__UI_Type_MenuPanel": NewType = 13 - Case "__UI_Type_PictureBox": NewType = 14 - Case "__UI_Type_TrackBar": NewType = 15 - Case "__UI_Type_ContextMenu": NewType = 16 - Case "__UI_Type_Font": NewType = 17 - Case "__UI_Type_ToggleSwitch": NewType = 18 - End Select - If LogFileLoad Then Print #LogFileNum, "TYPE:" + DummyText$ + SELECT CASE DummyText$ + CASE "__UI_Type_Form": NewType = 1 + CASE "__UI_Type_Frame": NewType = 2 + CASE "__UI_Type_Button": NewType = 3 + CASE "__UI_Type_Label": NewType = 4 + CASE "__UI_Type_CheckBox": NewType = 5 + CASE "__UI_Type_RadioButton": NewType = 6 + CASE "__UI_Type_TextBox": NewType = 7 + CASE "__UI_Type_ProgressBar": NewType = 8 + CASE "__UI_Type_ListBox": NewType = 9 + CASE "__UI_Type_DropdownList": NewType = 10 + CASE "__UI_Type_MenuBar": NewType = 11 + CASE "__UI_Type_MenuItem": NewType = 12 + CASE "__UI_Type_MenuPanel": NewType = 13 + CASE "__UI_Type_PictureBox": NewType = 14 + CASE "__UI_Type_TrackBar": NewType = 15 + CASE "__UI_Type_ContextMenu": NewType = 16 + CASE "__UI_Type_Font": NewType = 17 + CASE "__UI_Type_ToggleSwitch": NewType = 18 + END SELECT + IF LogFileLoad THEN PRINT #LogFileNum, "TYPE:" + DummyText$ NewName = nextParameter(b$) - If LogFileLoad Then Print #LogFileNum, "NAME:" + NewName + IF LogFileLoad THEN PRINT #LogFileNum, "NAME:" + NewName - NewWidth = Val(nextParameter(b$)) - If LogFileLoad Then Print #LogFileNum, "WIDTH:" + Str$(NewWidth) + NewWidth = VAL(nextParameter(b$)) + IF LogFileLoad THEN PRINT #LogFileNum, "WIDTH:" + STR$(NewWidth) - NewHeight = Val(nextParameter(b$)) - If LogFileLoad Then Print #LogFileNum, "HEIGHT:" + Str$(NewHeight) + NewHeight = VAL(nextParameter(b$)) + IF LogFileLoad THEN PRINT #LogFileNum, "HEIGHT:" + STR$(NewHeight) - NewLeft = Val(nextParameter(b$)) - If LogFileLoad Then Print #LogFileNum, "LEFT:" + Str$(NewLeft) + NewLeft = VAL(nextParameter(b$)) + IF LogFileLoad THEN PRINT #LogFileNum, "LEFT:" + STR$(NewLeft) - NewTop = Val(nextParameter(b$)) - If LogFileLoad Then Print #LogFileNum, "TOP:" + Str$(NewTop) + NewTop = VAL(nextParameter(b$)) + IF LogFileLoad THEN PRINT #LogFileNum, "TOP:" + STR$(NewTop) DummyText$ = nextParameter(b$) - If DummyText$ = "0" Then + IF DummyText$ = "0" THEN NewParentID = "" - If LogFileLoad Then Print #LogFileNum, "PARENT: ORPHAN/CONTAINER" - Else + IF LogFileLoad THEN PRINT #LogFileNum, "PARENT: ORPHAN/CONTAINER" + ELSE NewParentID = DummyText$ - If LogFileLoad Then Print #LogFileNum, "PARENT:" + NewParentID - End If + IF LogFileLoad THEN PRINT #LogFileNum, "PARENT:" + NewParentID + END IF TempValue = __UI_NewControl(NewType, NewName, NewWidth, NewHeight, NewLeft, NewTop, __UI_GetID(NewParentID)) - If UBound(AutoPlayGif) <> UBound(Control) Then - ReDim _Preserve AutoPlayGif(UBound(Control)) As _Byte - End If + IF UBOUND(AutoPlayGif) <> UBOUND(Control) THEN + REDIM _PRESERVE AutoPlayGif(UBOUND(Control)) AS _BYTE + END IF - If NewType = __UI_Type_PictureBox Then + IF NewType = __UI_Type_PictureBox THEN Control(TempValue).HasBorder = False Control(TempValue).Stretch = False - ElseIf NewType = __UI_Type_ContextMenu Then - Control(TempValue).HelperCanvas = _CopyImage(ContextMenuIcon, 32) + ELSEIF NewType = __UI_Type_ContextMenu THEN + Control(TempValue).HelperCanvas = _COPYIMAGE(ContextMenuIcon, 32) Control(TempValue).Width = 22 Control(TempValue).Height = 22 RefreshContextMenus - End If - If NewType = __UI_Type_Label Then Control(TempValue).VAlign = __UI_Top + END IF + IF NewType = __UI_Type_Label THEN Control(TempValue).VAlign = __UI_Top - Do 'read properties - Do - Line Input #BinaryFileNum, b$ - b$ = LTrim$(RTrim$(b$)) - If Len(b$) > 0 Then Exit Do - Loop - If Left$(b$, 20) = "Control(__UI_NewID)." Then + DO 'read properties + DO + LINE INPUT #BinaryFileNum, b$ + b$ = LTRIM$(RTRIM$(b$)) + IF LEN(b$) > 0 THEN EXIT DO + LOOP + IF LEFT$(b$, 20) = "Control(__UI_NewID)." THEN 'Property - DummyText$ = Mid$(b$, InStr(21, b$, " = ") + 3) - If LogFileLoad Then Print #LogFileNum, "PROPERTY: "; Mid$(b$, 21, InStr(21, b$, " =") - 21) - Select Case Mid$(b$, 21, InStr(21, b$, " =") - 21) - Case "Stretch" + DummyText$ = MID$(b$, INSTR(21, b$, " = ") + 3) + IF LogFileLoad THEN PRINT #LogFileNum, "PROPERTY: "; MID$(b$, 21, INSTR(21, b$, " =") - 21) + SELECT CASE MID$(b$, 21, INSTR(21, b$, " =") - 21) + CASE "Stretch" Control(TempValue).Stretch = (DummyText$ = "True") - Case "Font" - Dim NewFontFile As String - Dim NewFontSize As Integer + CASE "Font" + DIM NewFontFile AS STRING + DIM NewFontSize AS INTEGER - If Left$(DummyText$, 8) = "SetFont(" Then + IF LEFT$(DummyText$, 8) = "SetFont(" THEN NewFontFile = nextParameter(DummyText$) - NewFontSize = Val(nextParameter(DummyText$)) + NewFontSize = VAL(nextParameter(DummyText$)) Control(TempValue).Font = SetFont(NewFontFile, NewFontSize) - End If - Case "ForeColor" - If Left$(DummyText$, 6) = "_RGB32" Then - NewRed = Val(nextParameter(DummyText$)) - NewGreen = Val(nextParameter(DummyText$)) - NewBlue = Val(nextParameter(DummyText$)) + END IF + CASE "ForeColor" + IF LEFT$(DummyText$, 6) = "_RGB32" THEN + NewRed = VAL(nextParameter(DummyText$)) + NewGreen = VAL(nextParameter(DummyText$)) + NewBlue = VAL(nextParameter(DummyText$)) Control(TempValue).ForeColor = _RGB32(NewRed, NewGreen, NewBlue) - ElseIf Left$(DummyText$, 2) = "&H" Then - Control(TempValue).ForeColor = Val(DummyText$) - End If - Case "BackColor" - If Left$(DummyText$, 6) = "_RGB32" Then - NewRed = Val(nextParameter(DummyText$)) - NewGreen = Val(nextParameter(DummyText$)) - NewBlue = Val(nextParameter(DummyText$)) + ELSEIF LEFT$(DummyText$, 2) = "&H" THEN + Control(TempValue).ForeColor = VAL(DummyText$) + END IF + CASE "BackColor" + IF LEFT$(DummyText$, 6) = "_RGB32" THEN + NewRed = VAL(nextParameter(DummyText$)) + NewGreen = VAL(nextParameter(DummyText$)) + NewBlue = VAL(nextParameter(DummyText$)) Control(TempValue).BackColor = _RGB32(NewRed, NewGreen, NewBlue) - ElseIf Left$(DummyText$, 2) = "&H" Then - Control(TempValue).BackColor = Val(DummyText$) - End If - Case "SelectedForeColor" - If Left$(DummyText$, 6) = "_RGB32" Then - NewRed = Val(nextParameter(DummyText$)) - NewGreen = Val(nextParameter(DummyText$)) - NewBlue = Val(nextParameter(DummyText$)) + ELSEIF LEFT$(DummyText$, 2) = "&H" THEN + Control(TempValue).BackColor = VAL(DummyText$) + END IF + CASE "SelectedForeColor" + IF LEFT$(DummyText$, 6) = "_RGB32" THEN + NewRed = VAL(nextParameter(DummyText$)) + NewGreen = VAL(nextParameter(DummyText$)) + NewBlue = VAL(nextParameter(DummyText$)) Control(TempValue).SelectedForeColor = _RGB32(NewRed, NewGreen, NewBlue) - ElseIf Left$(DummyText$, 2) = "&H" Then - Control(TempValue).SelectedForeColor = Val(DummyText$) - End If - Case "SelectedBackColor" - If Left$(DummyText$, 6) = "_RGB32" Then - NewRed = Val(nextParameter(DummyText$)) - NewGreen = Val(nextParameter(DummyText$)) - NewBlue = Val(nextParameter(DummyText$)) + ELSEIF LEFT$(DummyText$, 2) = "&H" THEN + Control(TempValue).SelectedForeColor = VAL(DummyText$) + END IF + CASE "SelectedBackColor" + IF LEFT$(DummyText$, 6) = "_RGB32" THEN + NewRed = VAL(nextParameter(DummyText$)) + NewGreen = VAL(nextParameter(DummyText$)) + NewBlue = VAL(nextParameter(DummyText$)) Control(TempValue).SelectedBackColor = _RGB32(NewRed, NewGreen, NewBlue) - ElseIf Left$(DummyText$, 2) = "&H" Then - Control(TempValue).SelectedBackColor = Val(DummyText$) - End If - Case "BorderColor" - If Left$(DummyText$, 6) = "_RGB32" Then - NewRed = Val(nextParameter(DummyText$)) - NewGreen = Val(nextParameter(DummyText$)) - NewBlue = Val(nextParameter(DummyText$)) + ELSEIF LEFT$(DummyText$, 2) = "&H" THEN + Control(TempValue).SelectedBackColor = VAL(DummyText$) + END IF + CASE "BorderColor" + IF LEFT$(DummyText$, 6) = "_RGB32" THEN + NewRed = VAL(nextParameter(DummyText$)) + NewGreen = VAL(nextParameter(DummyText$)) + NewBlue = VAL(nextParameter(DummyText$)) Control(TempValue).BorderColor = _RGB32(NewRed, NewGreen, NewBlue) - ElseIf Left$(DummyText$, 2) = "&H" Then - Control(TempValue).BorderColor = Val(DummyText$) - End If - Case "BackStyle" - If DummyText$ = "__UI_Transparent" Then + ELSEIF LEFT$(DummyText$, 2) = "&H" THEN + Control(TempValue).BorderColor = VAL(DummyText$) + END IF + CASE "BackStyle" + IF DummyText$ = "__UI_Transparent" THEN Control(TempValue).BackStyle = __UI_Transparent - End If - Case "HasBorder" - If DummyText$ = "True" Then + END IF + CASE "HasBorder" + IF DummyText$ = "True" THEN Control(TempValue).HasBorder = True - If Control(TempValue).BorderSize = 0 Then + IF Control(TempValue).BorderSize = 0 THEN Control(TempValue).BorderSize = 1 - End If - End If - Case "Align" - Select Case DummyText$ - Case "__UI_Center": Control(TempValue).Align = __UI_Center - Case "__UI_Right": Control(TempValue).Align = __UI_Right - End Select - Case "Value" - Control(TempValue).Value = Val(DummyText$) - Case "Min" - Control(TempValue).Min = Val(DummyText$) - Case "Max" - Control(TempValue).Max = Val(DummyText$) - Case "ShowPercentage" + END IF + END IF + CASE "Align" + SELECT CASE DummyText$ + CASE "__UI_Center": Control(TempValue).Align = __UI_Center + CASE "__UI_Right": Control(TempValue).Align = __UI_Right + END SELECT + CASE "Value" + Control(TempValue).Value = VAL(DummyText$) + CASE "Min" + Control(TempValue).Min = VAL(DummyText$) + CASE "Max" + Control(TempValue).Max = VAL(DummyText$) + CASE "ShowPercentage" Control(TempValue).ShowPercentage = (DummyText$ = "True") - Case "CanHaveFocus" + CASE "CanHaveFocus" Control(TempValue).CanHaveFocus = (DummyText$ = "True") - Case "Disabled" + CASE "Disabled" Control(TempValue).Disabled = (DummyText$ = "True") - Case "Hidden" + CASE "Hidden" Control(TempValue).Hidden = (DummyText$ = "True") - Case "CenteredWindow" + CASE "CenteredWindow" Control(TempValue).CenteredWindow = (DummyText$ = "True") - Case "ContextMenuID" + CASE "ContextMenuID" Control(TempValue).ContextMenuID = __UI_GetID(nextParameter(DummyText$)) - Case "Interval" - Control(TempValue).Interval = Val(DummyText$) - Case "MinInterval" - Control(TempValue).MinInterval = Val(DummyText$) - Case "WordWrap" + CASE "Interval" + Control(TempValue).Interval = VAL(DummyText$) + CASE "MinInterval" + Control(TempValue).MinInterval = VAL(DummyText$) + CASE "WordWrap" Control(TempValue).WordWrap = (DummyText$ = "True") - Case "TransparentColor" - If Left$(DummyText$, 6) = "_RGB32" Then - NewRed = Val(nextParameter(DummyText$)) - NewGreen = Val(nextParameter(DummyText$)) - NewBlue = Val(nextParameter(DummyText$)) + CASE "TransparentColor" + IF LEFT$(DummyText$, 6) = "_RGB32" THEN + NewRed = VAL(nextParameter(DummyText$)) + NewGreen = VAL(nextParameter(DummyText$)) + NewBlue = VAL(nextParameter(DummyText$)) Control(TempValue).TransparentColor = _RGB32(NewRed, NewGreen, NewBlue) __UI_ClearColor Control(TempValue).HelperCanvas, Control(TempValue).TransparentColor, -1 - ElseIf Left$(DummyText$, 2) = "&H" Then - Control(TempValue).TransparentColor = Val(DummyText$) + ELSEIF LEFT$(DummyText$, 2) = "&H" THEN + Control(TempValue).TransparentColor = VAL(DummyText$) __UI_ClearColor Control(TempValue).HelperCanvas, Control(TempValue).TransparentColor, -1 - End If - Case "CanResize" + END IF + CASE "CanResize" Control(TempValue).CanResize = (DummyText$ = "True") - Case "Padding" - Control(TempValue).Padding = Val(DummyText$) - Case "BorderSize" - Control(TempValue).BorderSize = Val(DummyText$) - Case "VAlign" - Select Case DummyText$ - Case "__UI_Middle": Control(TempValue).VAlign = __UI_Middle - Case "__UI_Bottom": Control(TempValue).VAlign = __UI_Bottom - End Select - Case "PasswordField" + CASE "Padding" + Control(TempValue).Padding = VAL(DummyText$) + CASE "BorderSize" + Control(TempValue).BorderSize = VAL(DummyText$) + CASE "VAlign" + SELECT CASE DummyText$ + CASE "__UI_Middle": Control(TempValue).VAlign = __UI_Middle + CASE "__UI_Bottom": Control(TempValue).VAlign = __UI_Bottom + END SELECT + CASE "PasswordField" Control(TempValue).PasswordField = (DummyText$ = "True") - Case "Encoding" - Control(TempValue).Encoding = Val(DummyText$) - Case "NumericOnly" - If DummyText$ = "True" Then + CASE "Encoding" + Control(TempValue).Encoding = VAL(DummyText$) + CASE "NumericOnly" + IF DummyText$ = "True" THEN Control(TempValue).NumericOnly = True - ElseIf DummyText$ = "__UI_NumericWithBounds" Then + ELSEIF DummyText$ = "__UI_NumericWithBounds" THEN Control(TempValue).NumericOnly = __UI_NumericWithBounds - End If - Case "BulletStyle" - If DummyText$ = "__UI_CheckMark" Then + END IF + CASE "BulletStyle" + IF DummyText$ = "__UI_CheckMark" THEN Control(TempValue).BulletStyle = __UI_CheckMark - ElseIf DummyText$ = "__UI_Bullet" Then + ELSEIF DummyText$ = "__UI_Bullet" THEN Control(TempValue).BulletStyle = __UI_Bullet - End If - Case "AutoScroll" + END IF + CASE "AutoScroll" Control(TempValue).AutoScroll = (DummyText$ = "True") - Case "AutoSize" + CASE "AutoSize" Control(TempValue).AutoSize = (DummyText$ = "True") - End Select - ElseIf b$ = "__UI_DefaultButtonID = __UI_NewID" Then - If LogFileLoad Then Print #LogFileNum, "DEFAULT BUTTON" + END SELECT + ELSEIF b$ = "__UI_DefaultButtonID = __UI_NewID" THEN + IF LogFileLoad THEN PRINT #LogFileNum, "DEFAULT BUTTON" __UI_DefaultButtonID = TempValue - ElseIf Left$(b$, 11) = "SetCaption " Then - If LogFileLoad Then Print #LogFileNum, "SETCAPTION" + ELSEIF LEFT$(b$, 11) = "SetCaption " THEN + IF LogFileLoad THEN PRINT #LogFileNum, "SETCAPTION" 'Caption DummyText$ = nextParameter(b$) 'discard first parameter DummyText$ = nextParameter(b$) SetCaption TempValue, DummyText$ - ElseIf Left$(b$, 8) = "AddItem " Then - If LogFileLoad Then Print #LogFileNum, "ADD ITEM" + ELSEIF LEFT$(b$, 8) = "AddItem " THEN + IF LogFileLoad THEN PRINT #LogFileNum, "ADD ITEM" 'Caption DummyText$ = nextParameter(b$) 'discard first parameter DummyText$ = nextParameter(b$) AddItem TempValue, DummyText$ - ElseIf Left$(b$, 10) = "LoadImage " Then - If LogFileLoad Then Print #LogFileNum, "LOADIMAGE" + ELSEIF LEFT$(b$, 10) = "LoadImage " THEN + IF LogFileLoad THEN PRINT #LogFileNum, "LOADIMAGE" 'Image DummyText$ = nextParameter(b$) 'discard first parameter DummyText$ = nextParameter(b$) LoadImage Control(TempValue), DummyText$ - ElseIf Left$(b$, 30) = "__UI_RegisterResult = OpenGif(" Then - If LogFileLoad Then Print #LogFileNum, "OPENGIF" + ELSEIF LEFT$(b$, 30) = "__UI_RegisterResult = OpenGif(" THEN + IF LogFileLoad THEN PRINT #LogFileNum, "OPENGIF" 'Gif extension - Dim RegisterResult As _Byte + DIM RegisterResult AS _BYTE DummyText$ = nextParameter(b$) 'discard first parameter DummyText$ = nextParameter(b$) RegisterResult = OpenGif(TempValue, DummyText$) - If RegisterResult Then - If LogFileLoad Then Print #LogFileNum, "LOAD SUCCESSFUL" + IF RegisterResult THEN + IF LogFileLoad THEN PRINT #LogFileNum, "LOAD SUCCESSFUL" Text(TempValue) = DummyText$ 'indicates image loaded successfully - If Control(TempValue).HelperCanvas < -1 Then - _FreeImage Control(TempValue).HelperCanvas - End If - Control(TempValue).HelperCanvas = _NewImage(GifWidth(TempValue), GifHeight(TempValue), 32) + IF Control(TempValue).HelperCanvas < -1 THEN + _FREEIMAGE Control(TempValue).HelperCanvas + END IF + Control(TempValue).HelperCanvas = _NEWIMAGE(GifWidth(TempValue), GifHeight(TempValue), 32) UpdateGif TempValue - End If - ElseIf b$ = "IF __UI_RegisterResult THEN PlayGif __UI_NewID" Or Left$(b$, 8) = "PlayGif " Then - If LogFileLoad Then Print #LogFileNum, "AUTOPLAY GIF" + END IF + ELSEIF b$ = "IF __UI_RegisterResult THEN PlayGif __UI_NewID" OR LEFT$(b$, 8) = "PlayGif " THEN + IF LogFileLoad THEN PRINT #LogFileNum, "AUTOPLAY GIF" 'Auto-play gif AutoPlayGif(TempValue) = True PlayGif TempValue - ElseIf Left$(b$, 22) = "ToolTip(__UI_NewID) = " Then - If LogFileLoad Then Print #LogFileNum, "TOOLTIP" + ELSEIF LEFT$(b$, 22) = "ToolTip(__UI_NewID) = " THEN + IF LogFileLoad THEN PRINT #LogFileNum, "TOOLTIP" 'Tooltip - DummyText$ = Mid$(b$, InStr(b$, " = ") + 3) + DummyText$ = MID$(b$, INSTR(b$, " = ") + 3) DummyText$ = RestoreCHR$(DummyText$) ToolTip(TempValue) = removeQuotation$(DummyText$) - ElseIf Left$(b$, 19) = "Text(__UI_NewID) = " Then - If LogFileLoad Then Print #LogFileNum, "TEXT" + ELSEIF LEFT$(b$, 19) = "Text(__UI_NewID) = " THEN + IF LogFileLoad THEN PRINT #LogFileNum, "TEXT" 'Text - DummyText$ = Mid$(b$, InStr(b$, " = ") + 3) + DummyText$ = MID$(b$, INSTR(b$, " = ") + 3) DummyText$ = RestoreCHR$(DummyText$) Text(TempValue) = removeQuotation$(DummyText$) - If Control(TempValue).Type = __UI_Type_Form Then - If ExeIcon <> 0 Then _FreeImage ExeIcon: ExeIcon = 0 + IF Control(TempValue).Type = __UI_Type_Form THEN + IF ExeIcon <> 0 THEN _FREEIMAGE ExeIcon: ExeIcon = 0 ExeIcon = IconPreview&(Text(TempValue)) - If ExeIcon < -1 Then - _Icon ExeIcon - End If - End If - ElseIf Left$(b$, 19) = "Mask(__UI_NewID) = " Then - If LogFileLoad Then Print #LogFileNum, "MASK" + IF ExeIcon < -1 THEN + _ICON ExeIcon + END IF + END IF + ELSEIF LEFT$(b$, 19) = "Mask(__UI_NewID) = " THEN + IF LogFileLoad THEN PRINT #LogFileNum, "MASK" 'Mask - DummyText$ = Mid$(b$, InStr(b$, " = ") + 3) + DummyText$ = MID$(b$, INSTR(b$, " = ") + 3) DummyText$ = RestoreCHR$(DummyText$) Mask(TempValue) = removeQuotation$(DummyText$) - ElseIf Left$(b$, 38) = "__UI_RegisterResult = RegisterKeyCombo" Then - If LogFileLoad Then Print #LogFileNum, "KEYCOMBO" + ELSEIF LEFT$(b$, 38) = "__UI_RegisterResult = RegisterKeyCombo" THEN + IF LogFileLoad THEN PRINT #LogFileNum, "KEYCOMBO" DummyText$ = nextParameter(b$) RegisterResult = RegisterKeyCombo(DummyText$, TempValue) - ElseIf InStr(b$, "__UI_NewControl") > 0 Then + ELSEIF INSTR(b$, "__UI_NewControl") > 0 THEN 'New Control - If LogFileLoad Then Print #LogFileNum, "READ NEW CONTROL" - Exit Do - ElseIf Left$(b$, 10) = "__UI_Bind " Then - Asc(b$, 10) = 40 'Changes first space into "(" for parsing - Dim SourceControl$, TargetControl$ - Dim SourceProperty$, TargetProperty$ - Dim SourceSet As _Byte, TargetSet As _Byte + IF LogFileLoad THEN PRINT #LogFileNum, "READ NEW CONTROL" + EXIT DO + ELSEIF LEFT$(b$, 10) = "__UI_Bind " THEN + ASC(b$, 10) = 40 'Changes first space into "(" for parsing + DIM SourceControl$, TargetControl$ + DIM SourceProperty$, TargetProperty$ + DIM SourceSet AS _BYTE, TargetSet AS _BYTE SourceControl$ = nextParameter$(b$) TargetControl$ = nextParameter$(b$) @@ -3124,824 +3124,824 @@ Sub LoadPreviewText TargetProperty$ = nextParameter$(b$) SourceSet = False: TargetSet = False - For i = 1 To UBound(Control) - If RTrim$(Control(i).Name) = SourceControl$ Then + FOR i = 1 TO UBOUND(Control) + IF RTRIM$(Control(i).Name) = SourceControl$ THEN Control(i).BoundTo = __UI_GetID(TargetControl$) Control(i).BoundProperty = __UI_PropertyEnum(SourceProperty$, 0) SourceSet = True - ElseIf RTrim$(Control(i).Name) = TargetControl$ Then + ELSEIF RTRIM$(Control(i).Name) = TargetControl$ THEN Control(i).BoundTo = __UI_GetID(SourceControl$) Control(i).BoundProperty = __UI_PropertyEnum(TargetProperty$, 0) TargetSet = True - End If - If SourceSet And TargetSet Then Exit For - Next - ElseIf b$ = "END SUB" Then - If LogFileLoad Then Print #LogFileNum, "END OF FILE" + END IF + IF SourceSet AND TargetSet THEN EXIT FOR + NEXT + ELSEIF b$ = "END SUB" THEN + IF LogFileLoad THEN PRINT #LogFileNum, "END OF FILE" __UI_EOF = True - Exit Do - End If - Loop - Loop Until __UI_EOF - Close #BinaryFileNum - If LogFileLoad Then Close #LogFileNum + EXIT DO + END IF + LOOP + LOOP UNTIL __UI_EOF + CLOSE #BinaryFileNum + IF LogFileLoad THEN CLOSE #LogFileNum __UI_AutoRefresh = True - Exit Sub + EXIT SUB LoadError: - Close #BinaryFileNum - Kill "UiEditorPreview.frmbin" + CLOSE #BinaryFileNum + KILL "InForm/UiEditorPreview.frmbin" __UI_AutoRefresh = True - Exit Sub - End If - Exit Sub -End Sub + EXIT SUB + END IF + EXIT SUB +END SUB -Sub PreviewLoadImage (This As __UI_ControlTYPE, fileName$) - If LCase$(Right$(fileName$, 4)) = ".gif" Then - Dim tryGif As _Byte +SUB PreviewLoadImage (This AS __UI_ControlTYPE, fileName$) + IF LCASE$(RIGHT$(fileName$, 4)) = ".gif" THEN + DIM tryGif AS _BYTE CloseGif This.ID tryGif = OpenGif(This.ID, fileName$) - If tryGif Then - If TotalFrames(This.ID) = 1 Then + IF tryGif THEN + IF TotalFrames(This.ID) = 1 THEN CloseGif This.ID - Else + ELSE Text(This.ID) = fileName$ 'indicates image loaded successfully - If This.HelperCanvas < -1 Then - _FreeImage This.HelperCanvas - End If - This.HelperCanvas = _NewImage(GifWidth(This.ID), GifHeight(This.ID), 32) + IF This.HelperCanvas < -1 THEN + _FREEIMAGE This.HelperCanvas + END IF + This.HelperCanvas = _NEWIMAGE(GifWidth(This.ID), GifHeight(This.ID), 32) AutoPlayGif(This.ID) = False UpdateGif This.ID - Exit Sub - End If - End If - End If + EXIT SUB + END IF + END IF + END IF CloseGif This.ID LoadImage This, fileName$ -End Sub +END SUB -Function nextParameter$ (__text$) - Static lastText$ - Static position1 As Long, position2 As Long - Dim text$, thisParameter$ +FUNCTION nextParameter$ (__text$) + STATIC lastText$ + STATIC position1 AS LONG, position2 AS LONG + DIM text$, thisParameter$ - text$ = LTrim$(RTrim$(__text$)) - If text$ <> lastText$ Then + text$ = LTRIM$(RTRIM$(__text$)) + IF text$ <> lastText$ THEN lastText$ = text$ - position1 = InStr(text$, "(") - If position1 > 0 Then + position1 = INSTR(text$, "(") + IF position1 > 0 THEN 'check that this bracket is outside quotation marks - Dim quote As _Byte, i As Long - For i = 1 To position1 - If Asc(text$, i) = 34 Then quote = Not quote - Next - If quote Then position1 = 0 - End If + DIM quote AS _BYTE, i AS LONG + FOR i = 1 TO position1 + IF ASC(text$, i) = 34 THEN quote = NOT quote + NEXT + IF quote THEN position1 = 0 + END IF - If position1 = 0 Then + IF position1 = 0 THEN 'no opening bracket; must be a sub call - position1 = InStr(text$, " ") - If position1 = 0 Then Exit Function + position1 = INSTR(text$, " ") + IF position1 = 0 THEN EXIT FUNCTION position1 = position1 + 1 'skip space - Else + ELSE position1 = position1 + 1 'skip bracket - End If - End If + END IF + END IF - position2 = InStr(position1, text$, ",") - If position2 = 0 Then position2 = InStr(position1, text$, ")") - If position2 > 0 Then + position2 = INSTR(position1, text$, ",") + IF position2 = 0 THEN position2 = INSTR(position1, text$, ")") + IF position2 > 0 THEN 'check that this bracket is outside quotation marks quote = False - For i = 1 To position2 - If Asc(text$, i) = 34 Then quote = Not quote - Next - If quote Then position2 = 0 - End If - If position2 = 0 Then position2 = Len(text$) + 1 - thisParameter$ = LTrim$(RTrim$(Mid$(text$, position1, position2 - position1))) + FOR i = 1 TO position2 + IF ASC(text$, i) = 34 THEN quote = NOT quote + NEXT + IF quote THEN position2 = 0 + END IF + IF position2 = 0 THEN position2 = LEN(text$) + 1 + thisParameter$ = LTRIM$(RTRIM$(MID$(text$, position1, position2 - position1))) nextParameter$ = removeQuotation$(thisParameter$) position1 = position2 + 1 -End Function +END FUNCTION -Function removeQuotation$ (__text$) - Dim text$, firstQ As Long, nextQ As Long +FUNCTION removeQuotation$ (__text$) + DIM text$, firstQ AS LONG, nextQ AS LONG text$ = __text$ - firstQ = InStr(text$, Chr$(34)) - If firstQ = 0 Then removeQuotation$ = text$: Exit Function + firstQ = INSTR(text$, CHR$(34)) + IF firstQ = 0 THEN removeQuotation$ = text$: EXIT FUNCTION - nextQ = InStr(firstQ + 1, text$, Chr$(34)) - If nextQ = 0 Then removeQuotation$ = Mid$(text$, firstQ + 1): Exit Function + nextQ = INSTR(firstQ + 1, text$, CHR$(34)) + IF nextQ = 0 THEN removeQuotation$ = MID$(text$, firstQ + 1): EXIT FUNCTION - removeQuotation$ = Mid$(text$, firstQ + 1, nextQ - firstQ - 1) -End Function + removeQuotation$ = MID$(text$, firstQ + 1, nextQ - firstQ - 1) +END FUNCTION -Sub SavePreview (Destination As _Byte) - Dim b$, i As Long, a$, FontSetup$, TempValue As Long - Dim BinFileNum As Integer, TxtFileNum As Integer - Dim Clip$, Disk As _Byte, TCP As _Byte, UndoBuffer As _Byte - Dim PreviewData$, Dummy As Long +SUB SavePreview (Destination AS _BYTE) + DIM b$, i AS LONG, a$, FontSetup$ + DIM BinFileNum AS INTEGER, TxtFileNum AS INTEGER + DIM Clip$, Disk AS _BYTE, TCP AS _BYTE, UndoBuffer AS _BYTE + DIM PreviewData$, Dummy AS LONG - Const Debug = False + CONST Debug = False - If Destination = InDisk Then + IF Destination = InDisk THEN Disk = True - BinFileNum = FreeFile - Open "UiEditorPreview.frmbin" For Binary As #BinFileNum - ElseIf Destination = ToEditor Then + BinFileNum = FREEFILE + OPEN "InForm/UiEditorPreview.frmbin" FOR BINARY AS #BinFileNum + ELSEIF Destination = ToEditor THEN TCP = True - ElseIf Destination = ToUndoBuffer Then + ELSEIF Destination = ToUndoBuffer THEN UndoBuffer = True - Else - If __UI_TotalSelectedControls = 0 Then Exit Sub + ELSE + IF __UI_TotalSelectedControls = 0 THEN EXIT SUB - Dim SelectedFrames$ - For i = 1 To UBound(Control) - If Control(i).ControlIsSelected And Control(i).Type = __UI_Type_Frame Then - SelectedFrames$ = SelectedFrames$ + ";" + RTrim$(Control(i).Name) + ";" - End If - Next - End If + DIM SelectedFrames$ + FOR i = 1 TO UBOUND(Control) + IF Control(i).ControlIsSelected AND Control(i).Type = __UI_Type_Frame THEN + SelectedFrames$ = SelectedFrames$ + ";" + RTRIM$(Control(i).Name) + ";" + END IF + NEXT + END IF - If Debug Then - TxtFileNum = FreeFile - Open "UiEditorPreview.txt" For Output As #TxtFileNum - End If + IF Debug THEN + TxtFileNum = FREEFILE + OPEN "UiEditorPreview.txt" FOR OUTPUT AS #TxtFileNum + END IF - b$ = "InForm" + Chr$(1) - If Disk Then - Put #BinFileNum, 1, b$ - b$ = MKL$(UBound(Control)) - Put #BinFileNum, , b$ - ElseIf TCP Then - PreviewData$ = "FORMDATA>" + MKL$(UBound(Control)) - ElseIf UndoBuffer Then - Clip$ = MKL$(UBound(Control)) - End If + b$ = "InForm" + CHR$(1) + IF Disk THEN + PUT #BinFileNum, 1, b$ + b$ = MKL$(UBOUND(Control)) + PUT #BinFileNum, , b$ + ELSEIF TCP THEN + PreviewData$ = "FORMDATA>" + MKL$(UBOUND(Control)) + ELSEIF UndoBuffer THEN + Clip$ = MKL$(UBOUND(Control)) + END IF - Dim ThisPass As _Byte - For ThisPass = 1 To 2 - For i = 1 To UBound(Control) - If Destination = InClipboard Then - If Control(i).Type = __UI_Type_Form Or Control(i).Type = __UI_Type_MenuBar Then _Continue - If Control(i).ControlIsSelected = False Then - If InStr(SelectedFrames$, ";" + RTrim$(Control(Control(i).ParentID).Name) + ";") = 0 Then - _Continue - End If - End If - End If + DIM ThisPass AS _BYTE + FOR ThisPass = 1 TO 2 + FOR i = 1 TO UBOUND(Control) + IF Destination = InClipboard THEN + IF Control(i).Type = __UI_Type_Form OR Control(i).Type = __UI_Type_MenuBar THEN _CONTINUE + IF Control(i).ControlIsSelected = False THEN + IF INSTR(SelectedFrames$, ";" + RTRIM$(Control(Control(i).ParentID).Name) + ";") = 0 THEN + _CONTINUE + END IF + END IF + END IF - If Control(i).ID > 0 And Control(i).Type <> __UI_Type_MenuPanel And Control(i).Type <> __UI_Type_Font And Len(RTrim$(Control(i).Name)) > 0 And Left$(RTrim$(Control(i).Name), 5) <> "__UI_" Then - If ThisPass = 1 Then + IF Control(i).ID > 0 AND Control(i).Type <> __UI_Type_MenuPanel AND Control(i).Type <> __UI_Type_Font AND LEN(RTRIM$(Control(i).Name)) > 0 AND LEFT$(RTRIM$(Control(i).Name), 5) <> "__UI_" THEN + IF ThisPass = 1 THEN IF Control(i).Type <> __UI_Type_Form AND _ Control(i).Type <> __UI_Type_Frame AND _ Control(i).Type <> __UI_Type_MenuBar THEN - _Continue - End If - ElseIf ThisPass = 2 Then + _CONTINUE + END IF + ELSEIF ThisPass = 2 THEN IF Control(i).Type = __UI_Type_Form OR _ Control(i).Type = __UI_Type_Frame OR _ Control(i).Type = __UI_Type_MenuBar THEN - _Continue - End If - End If - If Debug Then - Print #TxtFileNum, Control(i).ID, - Print #TxtFileNum, RTrim$(Control(i).Name) - End If - Dim tempList$ - tempList$ = tempList$ + RTrim$(Control(i).Name) + ";" + _CONTINUE + END IF + END IF + IF Debug THEN + PRINT #TxtFileNum, Control(i).ID, + PRINT #TxtFileNum, RTRIM$(Control(i).Name) + END IF + DIM tempList$ + tempList$ = tempList$ + RTRIM$(Control(i).Name) + ";" b$ = MKI$(-1) + MKL$(i) + MKI$(Control(i).Type) '-1 indicates a new control - b$ = b$ + MKI$(Len(RTrim$(Control(i).Name))) - b$ = b$ + RTrim$(Control(i).Name) + b$ = b$ + MKI$(LEN(RTRIM$(Control(i).Name))) + b$ = b$ + RTRIM$(Control(i).Name) b$ = b$ + MKI$(Control(i).Width) + MKI$(Control(i).Height) + MKI$(Control(i).Left) + MKI$(Control(i).Top) - If Control(i).ParentID > 0 Then - b$ = b$ + MKI$(Len(RTrim$(Control(Control(i).ParentID).Name))) + RTrim$(Control(Control(i).ParentID).Name) - Else + IF Control(i).ParentID > 0 THEN + b$ = b$ + MKI$(LEN(RTRIM$(Control(Control(i).ParentID).Name))) + RTRIM$(Control(Control(i).ParentID).Name) + ELSE b$ = b$ + MKI$(0) - End If + END IF - If Disk Then - Put #BinFileNum, , b$ - Else + IF Disk THEN + PUT #BinFileNum, , b$ + ELSE Clip$ = Clip$ + b$ - End If + END IF - If Len(Caption(i)) > 0 Then - If Control(i).HotKeyPosition > 0 Then - a$ = Left$(Caption(i), Control(i).HotKeyPosition - 1) + "&" + Mid$(Caption(i), Control(i).HotKeyPosition) - Else + IF LEN(Caption(i)) > 0 THEN + IF Control(i).HotKeyPosition > 0 THEN + a$ = LEFT$(Caption(i), Control(i).HotKeyPosition - 1) + "&" + MID$(Caption(i), Control(i).HotKeyPosition) + ELSE a$ = Caption(i) - End If - b$ = MKI$(-2) + MKL$(Len(a$)) '-2 indicates a caption - If Disk Then - Put #BinFileNum, , b$ - Put #BinFileNum, , a$ - Else + END IF + b$ = MKI$(-2) + MKL$(LEN(a$)) '-2 indicates a caption + IF Disk THEN + PUT #BinFileNum, , b$ + PUT #BinFileNum, , a$ + ELSE Clip$ = Clip$ + b$ + a$ - End If - End If + END IF + END IF - If Len(ToolTip(i)) > 0 Then - b$ = MKI$(-24) + MKL$(Len(ToolTip(i))) '-24 indicates a tip - If Disk Then - Put #BinFileNum, , b$ - Put #BinFileNum, , ToolTip(i) - Else + IF LEN(ToolTip(i)) > 0 THEN + b$ = MKI$(-24) + MKL$(LEN(ToolTip(i))) '-24 indicates a tip + IF Disk THEN + PUT #BinFileNum, , b$ + PUT #BinFileNum, , ToolTip(i) + ELSE Clip$ = Clip$ + b$ + ToolTip(i) - End If - End If + END IF + END IF - If Len(Text(i)) > 0 Then - b$ = MKI$(-3) + MKL$(Len(Text(i))) '-3 indicates a text - If Disk Then - Put #BinFileNum, , b$ - Put #BinFileNum, , Text(i) - Else + IF LEN(Text(i)) > 0 THEN + b$ = MKI$(-3) + MKL$(LEN(Text(i))) '-3 indicates a text + IF Disk THEN + PUT #BinFileNum, , b$ + PUT #BinFileNum, , Text(i) + ELSE Clip$ = Clip$ + b$ + Text(i) - End If - End If + END IF + END IF - If Len(Mask(i)) > 0 Then - b$ = MKI$(-36) + MKL$(Len(Mask(i))) '-36 indicates a mask - If Disk Then - Put #BinFileNum, , b$ - Put #BinFileNum, , Mask(i) - Else + IF LEN(Mask(i)) > 0 THEN + b$ = MKI$(-36) + MKL$(LEN(Mask(i))) '-36 indicates a mask + IF Disk THEN + PUT #BinFileNum, , b$ + PUT #BinFileNum, , Mask(i) + ELSE Clip$ = Clip$ + b$ + Mask(i) - End If - End If + END IF + END IF - If Control(i).TransparentColor > 0 Then - b$ = MKI$(-28) + _MK$(_Unsigned Long, Control(i).TransparentColor) - If Disk Then - Put #BinFileNum, , b$ - Else + IF Control(i).TransparentColor > 0 THEN + b$ = MKI$(-28) + _MK$(_UNSIGNED LONG, Control(i).TransparentColor) + IF Disk THEN + PUT #BinFileNum, , b$ + ELSE Clip$ = Clip$ + b$ - End If - End If + END IF + END IF - If Control(i).Stretch Then + IF Control(i).Stretch THEN b$ = MKI$(-4) - If Disk Then - Put #BinFileNum, , b$ - Else + IF Disk THEN + PUT #BinFileNum, , b$ + ELSE Clip$ = Clip$ + b$ - End If - End If + END IF + END IF 'Inheritable properties won't be saved if they are the same as the parent's - If Control(i).Type = __UI_Type_Form Or Destination = InClipboard Then - If Control(i).Font = 8 Or Control(i).Font = 16 Then + IF Control(i).Type = __UI_Type_Form OR Destination = InClipboard THEN + IF Control(i).Font = 8 OR Control(i).Font = 16 THEN 'Internal fonts SaveInternalFont: - FontSetup$ = "," + LTrim$(Str$(Control(__UI_GetFontID(Control(i).Font)).Max)) - b$ = MKI$(-5) + MKI$(Len(FontSetup$)) + FontSetup$ + MKI$(0) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - Else + FontSetup$ = "," + LTRIM$(STR$(Control(__UI_GetFontID(Control(i).Font)).Max)) + b$ = MKI$(-5) + MKI$(LEN(FontSetup$)) + FontSetup$ + MKI$(0) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + ELSE SaveExternalFont: - FontSetup$ = ToolTip(__UI_GetFontID(Control(i).Font)) + "," + LTrim$(Str$(Control(__UI_GetFontID(Control(i).Font)).Max)) - b$ = MKI$(-5) + MKI$(Len(FontSetup$)) + FontSetup$ - b$ = b$ + MKI$(Len(Text(__UI_GetFontID(Control(i).Font)))) + Text(__UI_GetFontID(Control(i).Font)) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - Else - If Control(i).ParentID > 0 Then - If Control(i).Font > 0 And Control(i).Font <> Control(Control(i).ParentID).Font Then - If Control(i).Font = 8 Or Control(i).Font = 16 Then - GoTo SaveInternalFont - Else - GoTo SaveExternalFont - End If - End If - Else - If Control(i).Font > 0 And Control(i).Font <> Control(__UI_FormID).Font Then - If Control(i).Font = 8 Or Control(i).Font = 16 Then - GoTo SaveInternalFont - Else - GoTo SaveExternalFont - End If - End If - End If - End If + FontSetup$ = ToolTip(__UI_GetFontID(Control(i).Font)) + "," + LTRIM$(STR$(Control(__UI_GetFontID(Control(i).Font)).Max)) + b$ = MKI$(-5) + MKI$(LEN(FontSetup$)) + FontSetup$ + b$ = b$ + MKI$(LEN(Text(__UI_GetFontID(Control(i).Font)))) + Text(__UI_GetFontID(Control(i).Font)) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + ELSE + IF Control(i).ParentID > 0 THEN + IF Control(i).Font > 0 AND Control(i).Font <> Control(Control(i).ParentID).Font THEN + IF Control(i).Font = 8 OR Control(i).Font = 16 THEN + GOTO SaveInternalFont + ELSE + GOTO SaveExternalFont + END IF + END IF + ELSE + IF Control(i).Font > 0 AND Control(i).Font <> Control(__UI_FormID).Font THEN + IF Control(i).Font = 8 OR Control(i).Font = 16 THEN + GOTO SaveInternalFont + ELSE + GOTO SaveExternalFont + END IF + END IF + END IF + END IF 'Colors are saved only if they differ from the theme's defaults - If Control(i).ForeColor <> __UI_DefaultColor(Control(i).Type, 1) Then - b$ = MKI$(-6) + _MK$(_Unsigned Long, Control(i).ForeColor) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).BackColor <> __UI_DefaultColor(Control(i).Type, 2) Then - b$ = MKI$(-7) + _MK$(_Unsigned Long, Control(i).BackColor) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).SelectedForeColor <> __UI_DefaultColor(Control(i).Type, 3) Then - b$ = MKI$(-8) + _MK$(_Unsigned Long, Control(i).SelectedForeColor) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).SelectedBackColor <> __UI_DefaultColor(Control(i).Type, 4) Then - b$ = MKI$(-9) + _MK$(_Unsigned Long, Control(i).SelectedBackColor) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).BorderColor <> __UI_DefaultColor(Control(i).Type, 5) Then - b$ = MKI$(-10) + _MK$(_Unsigned Long, Control(i).BorderColor) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).BackStyle = __UI_Transparent Then + IF Control(i).ForeColor <> __UI_DefaultColor(Control(i).Type, 1) THEN + b$ = MKI$(-6) + _MK$(_UNSIGNED LONG, Control(i).ForeColor) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).BackColor <> __UI_DefaultColor(Control(i).Type, 2) THEN + b$ = MKI$(-7) + _MK$(_UNSIGNED LONG, Control(i).BackColor) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).SelectedForeColor <> __UI_DefaultColor(Control(i).Type, 3) THEN + b$ = MKI$(-8) + _MK$(_UNSIGNED LONG, Control(i).SelectedForeColor) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).SelectedBackColor <> __UI_DefaultColor(Control(i).Type, 4) THEN + b$ = MKI$(-9) + _MK$(_UNSIGNED LONG, Control(i).SelectedBackColor) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).BorderColor <> __UI_DefaultColor(Control(i).Type, 5) THEN + b$ = MKI$(-10) + _MK$(_UNSIGNED LONG, Control(i).BorderColor) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).BackStyle = __UI_Transparent THEN b$ = MKI$(-11) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).HasBorder Then + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).HasBorder THEN b$ = MKI$(-12) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).Align = __UI_Center Then - b$ = MKI$(-13) + _MK$(_Byte, Control(i).Align) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - ElseIf Control(i).Align = __UI_Right Then - b$ = MKI$(-13) + _MK$(_Byte, Control(i).Align) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).VAlign = __UI_Middle Then - b$ = MKI$(-32) + _MK$(_Byte, Control(i).VAlign) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - ElseIf Control(i).VAlign = __UI_Bottom Then - b$ = MKI$(-32) + _MK$(_Byte, Control(i).VAlign) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).PasswordField = True Then + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).Align = __UI_Center THEN + b$ = MKI$(-13) + _MK$(_BYTE, Control(i).Align) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + ELSEIF Control(i).Align = __UI_Right THEN + b$ = MKI$(-13) + _MK$(_BYTE, Control(i).Align) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).VAlign = __UI_Middle THEN + b$ = MKI$(-32) + _MK$(_BYTE, Control(i).VAlign) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + ELSEIF Control(i).VAlign = __UI_Bottom THEN + b$ = MKI$(-32) + _MK$(_BYTE, Control(i).VAlign) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).PasswordField = True THEN b$ = MKI$(-33) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).Encoding > 0 Then + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).Encoding > 0 THEN b$ = MKI$(-34) + MKL$(Control(i).Encoding) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).Value <> 0 Then - b$ = MKI$(-14) + _MK$(_Float, Control(i).Value) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).Min <> 0 Then - b$ = MKI$(-15) + _MK$(_Float, Control(i).Min) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).Max <> 0 Then - b$ = MKI$(-16) + _MK$(_Float, Control(i).Max) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).ShowPercentage Then + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).Value <> 0 THEN + b$ = MKI$(-14) + _MK$(_FLOAT, Control(i).Value) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).Min <> 0 THEN + b$ = MKI$(-15) + _MK$(_FLOAT, Control(i).Min) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).Max <> 0 THEN + b$ = MKI$(-16) + _MK$(_FLOAT, Control(i).Max) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).ShowPercentage THEN b$ = MKI$(-19) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).CanHaveFocus Then + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).CanHaveFocus THEN b$ = MKI$(-20) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).Disabled Then + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).Disabled THEN b$ = MKI$(-21) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).Hidden Then + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).Hidden THEN b$ = MKI$(-22) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).CenteredWindow Then + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).CenteredWindow THEN b$ = MKI$(-23) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).ContextMenuID Then - If Left$(Control(Control(i).ContextMenuID).Name, 9) <> "__UI_Text" And Left$(Control(Control(i).ContextMenuID).Name, 16) <> "__UI_PreviewMenu" Then - b$ = MKI$(-25) + MKI$(Len(RTrim$(Control(Control(i).ContextMenuID).Name))) + RTrim$(Control(Control(i).ContextMenuID).Name) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - End If - If Control(i).Interval Then - b$ = MKI$(-26) + _MK$(_Float, Control(i).Interval) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).MinInterval Then - b$ = MKI$(-37) + _MK$(_Float, Control(i).MinInterval) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).WordWrap Then + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).ContextMenuID THEN + IF LEFT$(Control(Control(i).ContextMenuID).Name, 9) <> "__UI_Text" AND LEFT$(Control(Control(i).ContextMenuID).Name, 16) <> "__UI_PreviewMenu" THEN + b$ = MKI$(-25) + MKI$(LEN(RTRIM$(Control(Control(i).ContextMenuID).Name))) + RTRIM$(Control(Control(i).ContextMenuID).Name) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + END IF + IF Control(i).Interval THEN + b$ = MKI$(-26) + _MK$(_FLOAT, Control(i).Interval) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).MinInterval THEN + b$ = MKI$(-37) + _MK$(_FLOAT, Control(i).MinInterval) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).WordWrap THEN b$ = MKI$(-27) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).CanResize And Control(i).Type = __UI_Type_Form Then + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).CanResize AND Control(i).Type = __UI_Type_Form THEN b$ = MKI$(-29) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).Padding > 0 Then + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).Padding > 0 THEN b$ = MKI$(-31) + MKI$(Control(i).Padding) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).NumericOnly = True Then + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).NumericOnly = True THEN b$ = MKI$(-38) - If Disk Then - Put #BinFileNum, , b$ - Else + IF Disk THEN + PUT #BinFileNum, , b$ + ELSE Clip$ = Clip$ + b$ - End If - End If - If Control(i).NumericOnly = __UI_NumericWithBounds Then + END IF + END IF + IF Control(i).NumericOnly = __UI_NumericWithBounds THEN b$ = MKI$(-39) - If Disk Then - Put #BinFileNum, , b$ - Else + IF Disk THEN + PUT #BinFileNum, , b$ + ELSE Clip$ = Clip$ + b$ - End If - End If - If Control(i).BulletStyle = __UI_Bullet Then + END IF + END IF + IF Control(i).BulletStyle = __UI_Bullet THEN b$ = MKI$(-40) - If Disk Then - Put #BinFileNum, , b$ - Else + IF Disk THEN + PUT #BinFileNum, , b$ + ELSE Clip$ = Clip$ + b$ - End If - End If - If Control(i).AutoScroll = True Then + END IF + END IF + IF Control(i).AutoScroll = True THEN b$ = MKI$(-41) - If Disk Then - Put #BinFileNum, , b$ - Else + IF Disk THEN + PUT #BinFileNum, , b$ + ELSE Clip$ = Clip$ + b$ - End If - End If - If Control(i).AutoSize = True Then + END IF + END IF + IF Control(i).AutoSize = True THEN b$ = MKI$(-42) - If Disk Then - Put #BinFileNum, , b$ - Else + IF Disk THEN + PUT #BinFileNum, , b$ + ELSE Clip$ = Clip$ + b$ - End If - End If - If Control(i).BorderSize > 0 Then + END IF + END IF + IF Control(i).BorderSize > 0 THEN b$ = MKI$(-43) + MKI$(Control(i).BorderSize) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If Control(i).KeyCombo > 0 Then - b$ = MKI$(-44) + MKI$(Len(RTrim$(__UI_KeyCombo(Control(i).KeyCombo).FriendlyCombo))) + RTrim$(__UI_KeyCombo(Control(i).KeyCombo).FriendlyCombo) - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - If GetGifIndex&(i) > 0 Then + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF Control(i).KeyCombo > 0 THEN + b$ = MKI$(-44) + MKI$(LEN(RTRIM$(__UI_KeyCombo(Control(i).KeyCombo).FriendlyCombo))) + RTRIM$(__UI_KeyCombo(Control(i).KeyCombo).FriendlyCombo) + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + IF GetGifIndex&(i) > 0 THEN 'PictureBox has an animated GIF loaded b$ = MKI$(-45) - If Disk Then - Put #BinFileNum, , b$ - Else + IF Disk THEN + PUT #BinFileNum, , b$ + ELSE Clip$ = Clip$ + b$ - End If - End If - If i <= UBound(AutoPlayGif) Then - If AutoPlayGif(i) Then + END IF + END IF + IF i <= UBOUND(AutoPlayGif) THEN + IF AutoPlayGif(i) THEN b$ = MKI$(-46) - If Disk Then - Put #BinFileNum, , b$ - Else + IF Disk THEN + PUT #BinFileNum, , b$ + ELSE Clip$ = Clip$ + b$ - End If - End If - End If - If Control(i).ControlIsSelected Then + END IF + END IF + END IF + IF Control(i).ControlIsSelected THEN b$ = MKI$(-47) - If Disk Then - Put #BinFileNum, , b$ - Else + IF Disk THEN + PUT #BinFileNum, , b$ + ELSE Clip$ = Clip$ + b$ - End If - End If - If Control(i).BoundTo > 0 Then - b$ = MKI$(-48) + MKI$(Len(RTrim$(Control(Control(i).BoundTo).Name))) + RTrim$(Control(Control(i).BoundTo).Name) + END IF + END IF + IF Control(i).BoundTo > 0 THEN + b$ = MKI$(-48) + MKI$(LEN(RTRIM$(Control(Control(i).BoundTo).Name))) + RTRIM$(Control(Control(i).BoundTo).Name) Dummy = __UI_PropertyEnum&(a$, Control(i).BoundProperty) - b$ = b$ + MKI$(Len(a$)) + a$ - If Disk Then Put #BinFileNum, , b$ Else Clip$ = Clip$ + b$ - End If - End If - Next - Next + b$ = b$ + MKI$(LEN(a$)) + a$ + IF Disk THEN PUT #BinFileNum, , b$ ELSE Clip$ = Clip$ + b$ + END IF + END IF + NEXT + NEXT b$ = MKI$(-1024) 'end of file - If Disk Then - Put #BinFileNum, , b$ - Close #BinFileNum - ElseIf TCP Then + IF Disk THEN + PUT #BinFileNum, , b$ + CLOSE #BinFileNum + ELSEIF TCP THEN PreviewData$ = PreviewData$ + Clip$ + b$ + "<END>" - If LastPreviewDataSent$ <> PreviewData$ And __UI_IsDragging = False And __UI_IsResizing = False Then + IF LastPreviewDataSent$ <> PreviewData$ AND __UI_IsDragging = False AND __UI_IsResizing = False THEN LastPreviewDataSent$ = PreviewData$ - Put #Host, , PreviewData$ - End If - ElseIf UndoBuffer Then + PUT #Host, , PreviewData$ + END IF + ELSEIF UndoBuffer THEN Clip$ = Clip$ + b$ - If UndoPointer > 0 Then - If UndoImage(UndoPointer - 1) = Clip$ Then Exit Sub - End If + IF UndoPointer > 0 THEN + IF UndoImage(UndoPointer - 1) = Clip$ THEN EXIT SUB + END IF UndoImage(UndoPointer) = Clip$ UndoPointer = UndoPointer + 1 - If UndoPointer > TotalUndoImages Then + IF UndoPointer > TotalUndoImages THEN TotalUndoImages = TotalUndoImages + 1 - ElseIf UndoPointer < TotalUndoImages Then + ELSEIF UndoPointer < TotalUndoImages THEN TotalUndoImages = UndoPointer - End If - If TotalUndoImages > UBound(UndoImage) Then - ReDim _Preserve UndoImage(UBound(UndoImage) + 99) As String - End If - Else + END IF + IF TotalUndoImages > UBOUND(UndoImage) THEN + REDIM _PRESERVE UndoImage(UBOUND(UndoImage) + 99) AS STRING + END IF + ELSE Clip$ = Clip$ + b$ b$ = Pack$(Clip$) - If Len(b$) > 60 Then + IF LEN(b$) > 60 THEN a$ = "" - Do - a$ = a$ + Left$(b$, 60) + Chr$(10) - b$ = Mid$(b$, 61) - If Len(b$) <= 60 Then + DO + a$ = a$ + LEFT$(b$, 60) + CHR$(10) + b$ = MID$(b$, 61) + IF LEN(b$) <= 60 THEN a$ = a$ + b$ b$ = a$ - Exit Do - End If - Loop - End If + EXIT DO + END IF + LOOP + END IF Clip$ = __UI_ClipboardCheck$ - Clip$ = Clip$ + Hex$(Len(b$)) + Chr$(10) - Clip$ = Clip$ + b$ + Chr$(10) - Clip$ = Clip$ + String$(60, "-") + Chr$(10) + Clip$ = Clip$ + HEX$(LEN(b$)) + CHR$(10) + Clip$ = Clip$ + b$ + CHR$(10) + Clip$ = Clip$ + STRING$(60, "-") + CHR$(10) Clip$ = Clip$ + "END CONTROL DATA" - _Clipboard$ = Clip$ + Chr$(10) + "Controls in this block: " + tempList$ - End If - If Debug Then Close #TxtFileNum -End Sub + _CLIPBOARD$ = Clip$ + CHR$(10) + "Controls in this block: " + tempList$ + END IF + IF Debug THEN CLOSE #TxtFileNum +END SUB -Sub SendData (b$, thisCommand$) - b$ = UCase$(thisCommand$) + ">" + b$ + "<END>" - Put #Host, , b$ -End Sub +SUB SendData (b$, thisCommand$) + b$ = UCASE$(thisCommand$) + ">" + b$ + "<END>" + PUT #Host, , b$ +END SUB -Sub SendSignal (Value As Integer) - Dim b$ +SUB SendSignal (Value AS INTEGER) + DIM b$ b$ = "SIGNAL>" + MKI$(Value) + "<END>" - Put #Host, , b$ -End Sub + PUT #Host, , b$ +END SUB -Function AdaptName$ (tName$, TargetID As Long) - Dim Name$, NewName$, i As Long, c$, NextIsCapital As _Byte, CheckID As Long - Name$ = RTrim$(tName$) +FUNCTION AdaptName$ (tName$, TargetID AS LONG) + DIM Name$, NewName$, i AS LONG, c$, NextIsCapital AS _BYTE, CheckID AS LONG + Name$ = RTRIM$(tName$) '"__UI_" is reserved: - If UCase$(Left$(Name$, 5)) = "__UI_" Then Name$ = Mid$(Name$, 6) + IF UCASE$(LEFT$(Name$, 5)) = "__UI_" THEN Name$ = MID$(Name$, 6) - If Len(Name$) > 0 Then + IF LEN(Name$) > 0 THEN 'First valid character must be a letter or "_": - Do While Not Alpha(Asc(Name$, 1)) - Name$ = Mid$(Name$, 2) - If Len(Name$) = 0 Then Name$ = Control(TargetID).Name: GoTo CheckDuplicates - Loop + DO WHILE NOT Alpha(ASC(Name$, 1)) + Name$ = MID$(Name$, 2) + IF LEN(Name$) = 0 THEN Name$ = Control(TargetID).Name: GOTO CheckDuplicates + LOOP 'Single "_" to start a variable name is reserved; 'Double "_" is valid: - If Left$(Name$, 1) = "_" And Mid$(Name$, 2, 1) <> "_" Then + IF LEFT$(Name$, 1) = "_" AND MID$(Name$, 2, 1) <> "_" THEN Name$ = "_" + Name$ - End If + END IF 'Other valid characters must be alphanumeric: - For i = 1 To Len(Name$) - If AlphaNumeric(Asc(Name$, i)) Then - If NextIsCapital Then - NewName$ = NewName$ + UCase$(Mid$(Name$, i, 1)) - If Asc(Right$(NewName$, 1)) >= 65 And Asc(Right$(NewName$, 1)) <= 90 Then NextIsCapital = False - Else - NewName$ = NewName$ + Mid$(Name$, i, 1) - End If - Else - If Asc(Name$, i) = 32 Then NextIsCapital = True - End If - Next - Else + FOR i = 1 TO LEN(Name$) + IF AlphaNumeric(ASC(Name$, i)) THEN + IF NextIsCapital THEN + NewName$ = NewName$ + UCASE$(MID$(Name$, i, 1)) + IF ASC(RIGHT$(NewName$, 1)) >= 65 AND ASC(RIGHT$(NewName$, 1)) <= 90 THEN NextIsCapital = False + ELSE + NewName$ = NewName$ + MID$(Name$, i, 1) + END IF + ELSE + IF ASC(Name$, i) = 32 THEN NextIsCapital = True + END IF + NEXT + ELSE Name$ = Control(TargetID).Name - End If + END IF - If Len(NewName$) > 40 Then NewName$ = Left$(NewName$, 40) + IF LEN(NewName$) > 40 THEN NewName$ = LEFT$(NewName$, 40) Name$ = NewName$ CheckDuplicates: i = 1 - Do + DO CheckID = __UI_GetID(NewName$) - If CheckID = 0 Then Exit Do - If CheckID = TargetID Then Exit Do + IF CheckID = 0 THEN EXIT DO + IF CheckID = TargetID THEN EXIT DO i = i + 1 - c$ = LTrim$(Str$(i)) - If Len(Name$) + Len(c$) <= 40 Then + c$ = LTRIM$(STR$(i)) + IF LEN(Name$) + LEN(c$) <= 40 THEN NewName$ = Name$ + c$ - Else - Name$ = Mid$(Name$, 1, 40 - Len(c$)) + ELSE + Name$ = MID$(Name$, 1, 40 - LEN(c$)) NewName$ = Name$ + c$ - End If - Loop + END IF + LOOP - If IS_KEYWORD(NewName$) Then NewName$ = "__" + NewName$ + IF IS_KEYWORD(NewName$) THEN NewName$ = "__" + NewName$ AdaptName$ = NewName$ -End Function +END FUNCTION 'READ_KEYWORDS and IS_KEYWORD come from vWATCH64: -Sub READ_KEYWORDS - Dim ThisKeyword$, TotalKeywords As Long +SUB READ_KEYWORDS + DIM ThisKeyword$, TotalKeywords AS LONG - Restore QB64KeywordsDATA + RESTORE QB64KeywordsDATA 'Populate QB64KEYWORDS(): - Do - Read ThisKeyword$ - If ThisKeyword$ = "**END**" Then - Exit Do - End If + DO + READ ThisKeyword$ + IF ThisKeyword$ = "**END**" THEN + EXIT DO + END IF TotalKeywords = TotalKeywords + 1 - ReDim _Preserve QB64KEYWORDS(1 To TotalKeywords) As String - QB64KEYWORDS(TotalKeywords) = UCase$(ThisKeyword$) - Loop + REDIM _PRESERVE QB64KEYWORDS(1 TO TotalKeywords) AS STRING + QB64KEYWORDS(TotalKeywords) = UCASE$(ThisKeyword$) + LOOP QB64KeywordsDATA: - Data $CHECKING,$CONSOLE,$DYNAMIC,$ELSE,$ELSEIF,$END,$ENDIF,$EXEICON,$IF,$INCLUDE - Data $LET,$RESIZE,$SCREENHIDE,$SCREENSHOW,$STATIC,$VERSIONINFO,$VIRTUALKEYBOARD,ABS - Data ABSOLUTE,ACCESS,ALIAS,AND,APPEND,AS,ASC,ATN,BASE,BEEP,BINARY,BLOAD,BSAVE,BYVAL - Data CALL,CALLS,CASE,IS,CDBL,CDECL,CHAIN,CHDIR,CHR$,CINT,CIRCLE,CLEAR,CLNG,CLOSE - Data CLS,COLOR,COM,COMMAND$,COMMON,CONST,COS,CSNG,CSRLIN,CUSTOMTYPE,CVD,CVDMBF,CVI - Data CVL,CVS,CVSMBF,DATA,DATE$,DECLARE,DEF,DEFDBL,DEFINT,DEFLNG,DEFSNG,DEFSTR,DIM - Data DO,DOUBLE,DRAW,DYNAMIC,ELSE,ELSEIF,END,ENDIF,ENVIRON,ENVIRON$,EOF,EQV,ERASE - Data ERDEV,ERDEV$,ERL,ERR,ERROR,EVERYCASE,EXIT,EXP,FIELD,FILEATTR,FILES,FIX,FN,FOR - Data FRE,FREE,FREEFILE,FUNCTION,GET,GOSUB,GOTO,HEX$,IF,IMP,INKEY$,INP,INPUT,INPUT$ - Data INSTR,INT,INTEGER,INTERRUPT,INTERRUPTX,IOCTL,IOCTL$,KEY,KILL,LBOUND,LCASE$,LEFT$ - Data LEN,LET,LIBRARY,LINE,LIST,LOC,LOCATE,LOCK,LOF,LOG,LONG,LOOP,LPOS,LPRINT,LSET - Data LTRIM$,MID$,MKD$,MKDIR,MKDMBF$,MKI$,MKL$,MKS$,MKSMBF$,MOD,NAME,NEXT,NOT,OCT$ - Data OFF,ON,OPEN,OPTION,OR,OUT,OUTPUT,PAINT,PALETTE,PCOPY,PEEK,PEN,PLAY,PMAP,POINT - Data POKE,POS,PRESET,PRINT,PSET,PUT,RANDOM,RANDOMIZE,READ,REDIM,REM,RESET,RESTORE - Data RESUME,RETURN,RIGHT$,RMDIR,RND,RSET,RTRIM$,RUN,SADD,SCREEN,SEEK,SEG,SELECT,SETMEM - Data SGN,SHARED,SHELL,SIGNAL,SIN,SINGLE,SLEEP,SOUND,SPACE$,SPC,SQR,STATIC,STEP,STICK - Data STOP,STR$,STRIG,STRING,STRING$,SUB,SWAP,SYSTEM,TAB,TAN,THEN,TIME$,TIMER,TO,TROFF - Data TRON,TYPE,UBOUND,UCASE$,UEVENT,UNLOCK,UNTIL,USING,VAL,VARPTR,VARPTR$,VARSEG - Data VIEW,WAIT,WEND,WHILE,WIDTH,WINDOW,WRITE,XOR,_ACOS,_ACOSH,_ALPHA,_ALPHA32,_ARCCOT - Data _ARCCSC,_ARCSEC,_ASIN,_ASINH,_ATAN2,_ATANH,_AUTODISPLAY,_AXIS,_BACKGROUNDCOLOR - Data _BIT,_BLEND,_BLINK,_BLUE,_BLUE32,_BUTTON,_BUTTONCHANGE,_BYTE,_CEIL,_CLEARCOLOR - Data _CLIP,_CLIPBOARD$,_CLIPBOARDIMAGE,_COMMANDCOUNT,_CONNECTED,_CONNECTIONADDRESS$ - Data _CONSOLE,_CONSOLETITLE,_CONTINUE,_CONTROLCHR,_COPYIMAGE,_COPYPALETTE,_COSH,_COT - Data _COTH,_CSC,_CSCH,_CV,_CWD$,_D2G,_D2R,_DEFAULTCOLOR,_DEFINE,_DELAY,_DEPTHBUFFER - Data _DESKTOPHEIGHT,_DESKTOPWIDTH,_DEST,_DEVICE$,_DEVICEINPUT,_DEVICES,_DIR$,_DIREXISTS - Data _DISPLAY,_DISPLAYORDER,_DONTBLEND,_DONTWAIT,_ERRORLINE,_EXIT,_EXPLICIT,_FILEEXISTS - Data _FLOAT,_FONT,_FONTHEIGHT,_FONTWIDTH,_FREEFONT,_FREEIMAGE,_FREETIMER,_FULLSCREEN - Data _G2D,_G2R,_GLRENDER,_GREEN,_GREEN32,_HEIGHT,_HIDE,_HYPOT,_ICON,_INCLERRORFILE$ - Data _INCLERRORLINE,_INTEGER64,_KEYCLEAR,_KEYDOWN,_KEYHIT,_LASTAXIS,_LASTBUTTON,_LASTWHEEL - Data _LIMIT,_LOADFONT,_LOADIMAGE,_MAPTRIANGLE,_MAPUNICODE,_MEM,_MEMCOPY,_MEMELEMENT - Data _MEMEXISTS,_MEMFILL,_MEMFREE,_MEMGET,_MEMIMAGE,_MEMNEW,_MEMPUT,_MIDDLE,_MK$ - Data _MOUSEBUTTON,_MOUSEHIDE,_MOUSEINPUT,_MOUSEMOVE,_MOUSEMOVEMENTX,_MOUSEMOVEMENTY - Data _MOUSEPIPEOPEN,_MOUSESHOW,_MOUSEWHEEL,_MOUSEX,_MOUSEY,_NEWIMAGE,_OFFSET,_OPENCLIENT - Data _OPENCONNECTION,_OPENHOST,_OS$,_PALETTECOLOR,_PI,_PIXELSIZE,_PRESERVE,_PRINTIMAGE - Data _PRINTMODE,_PRINTSTRING,_PRINTWIDTH,_PUTIMAGE,_R2D,_R2G,_RED,_RED32,_RESIZE - Data _RESIZEHEIGHT,_RESIZEWIDTH,_RGB,_RGB32,_RGBA,_RGBA32,_ROUND,_SCREENCLICK,_SCREENEXISTS - Data _SCREENHIDE,_SCREENICON,_SCREENIMAGE,_SCREENMOVE,_SCREENPRINT,_SCREENSHOW,_SCREENX - Data _SCREENY,_SEC,_SECH,_SETALPHA,_SHELLHIDE,_SINH,_SNDBAL,_SNDCLOSE,_SNDCOPY,_SNDGETPOS - Data _SNDLEN,_SNDLIMIT,_SNDLOOP,_SNDOPEN,_SNDOPENRAW,_SNDPAUSE,_SNDPAUSED,_SNDPLAY - Data _SNDPLAYCOPY,_SNDPLAYFILE,_SNDPLAYING,_SNDRATE,_SNDRAW,_SNDRAWDONE,_SNDRAWLEN - Data _SNDSETPOS,_SNDSTOP,_SNDVOL,_SOURCE,_STARTDIR$,_STRCMP,_STRICMP,_TANH,_TITLE - Data _TITLE$,_UNSIGNED,_WHEEL,_WIDTH,_WINDOWHANDLE,_WINDOWHASFOCUS,_GLACCUM,_GLALPHAFUNC - Data _GLARETEXTURESRESIDENT,_GLARRAYELEMENT,_GLBEGIN,_GLBINDTEXTURE,_GLBITMAP,_GLBLENDFUNC - Data _GLCALLLIST,_GLCALLLISTS,_GLCLEAR,_GLCLEARACCUM,_GLCLEARCOLOR,_GLCLEARDEPTH - Data _GLCLEARINDEX,_GLCLEARSTENCIL,_GLCLIPPLANE,_GLCOLOR3B,_GLCOLOR3BV,_GLCOLOR3D - Data _GLCOLOR3DV,_GLCOLOR3F,_GLCOLOR3FV,_GLCOLOR3I,_GLCOLOR3IV,_GLCOLOR3S,_GLCOLOR3SV - Data _GLCOLOR3UB,_GLCOLOR3UBV,_GLCOLOR3UI,_GLCOLOR3UIV,_GLCOLOR3US,_GLCOLOR3USV,_GLCOLOR4B - Data _GLCOLOR4BV,_GLCOLOR4D,_GLCOLOR4DV,_GLCOLOR4F,_GLCOLOR4FV,_GLCOLOR4I,_GLCOLOR4IV - Data _GLCOLOR4S,_GLCOLOR4SV,_GLCOLOR4UB,_GLCOLOR4UBV,_GLCOLOR4UI,_GLCOLOR4UIV,_GLCOLOR4US - Data _GLCOLOR4USV,_GLCOLORMASK,_GLCOLORMATERIAL,_GLCOLORPOINTER,_GLCOPYPIXELS,_GLCOPYTEXIMAGE1D - Data _GLCOPYTEXIMAGE2D,_GLCOPYTEXSUBIMAGE1D,_GLCOPYTEXSUBIMAGE2D,_GLCULLFACE,_GLDELETELISTS - Data _GLDELETETEXTURES,_GLDEPTHFUNC,_GLDEPTHMASK,_GLDEPTHRANGE,_GLDISABLE,_GLDISABLECLIENTSTATE - Data _GLDRAWARRAYS,_GLDRAWBUFFER,_GLDRAWELEMENTS,_GLDRAWPIXELS,_GLEDGEFLAG,_GLEDGEFLAGPOINTER - Data _GLEDGEFLAGV,_GLENABLE,_GLENABLECLIENTSTATE,_GLEND,_GLENDLIST,_GLEVALCOORD1D - Data _GLEVALCOORD1DV,_GLEVALCOORD1F,_GLEVALCOORD1FV,_GLEVALCOORD2D,_GLEVALCOORD2DV - Data _GLEVALCOORD2F,_GLEVALCOORD2FV,_GLEVALMESH1,_GLEVALMESH2,_GLEVALPOINT1,_GLEVALPOINT2 - Data _GLFEEDBACKBUFFER,_GLFINISH,_GLFLUSH,_GLFOGF,_GLFOGFV,_GLFOGI,_GLFOGIV,_GLFRONTFACE - Data _GLFRUSTUM,_GLGENLISTS,_GLGENTEXTURES,_GLGETBOOLEANV,_GLGETCLIPPLANE,_GLGETDOUBLEV - Data _GLGETERROR,_GLGETFLOATV,_GLGETINTEGERV,_GLGETLIGHTFV,_GLGETLIGHTIV,_GLGETMAPDV - Data _GLGETMAPFV,_GLGETMAPIV,_GLGETMATERIALFV,_GLGETMATERIALIV,_GLGETPIXELMAPFV,_GLGETPIXELMAPUIV - Data _GLGETPIXELMAPUSV,_GLGETPOINTERV,_GLGETPOLYGONSTIPPLE,_GLGETSTRING,_GLGETTEXENVFV - Data _GLGETTEXENVIV,_GLGETTEXGENDV,_GLGETTEXGENFV,_GLGETTEXGENIV,_GLGETTEXIMAGE,_GLGETTEXLEVELPARAMETERFV - Data _GLGETTEXLEVELPARAMETERIV,_GLGETTEXPARAMETERFV,_GLGETTEXPARAMETERIV,_GLHINT - Data _GLINDEXMASK,_GLINDEXPOINTER,_GLINDEXD,_GLINDEXDV,_GLINDEXF,_GLINDEXFV,_GLINDEXI - Data _GLINDEXIV,_GLINDEXS,_GLINDEXSV,_GLINDEXUB,_GLINDEXUBV,_GLINITNAMES,_GLINTERLEAVEDARRAYS - Data _GLISENABLED,_GLISLIST,_GLISTEXTURE,_GLLIGHTMODELF,_GLLIGHTMODELFV,_GLLIGHTMODELI - Data _GLLIGHTMODELIV,_GLLIGHTF,_GLLIGHTFV,_GLLIGHTI,_GLLIGHTIV,_GLLINESTIPPLE,_GLLINEWIDTH - Data _GLLISTBASE,_GLLOADIDENTITY,_GLLOADMATRIXD,_GLLOADMATRIXF,_GLLOADNAME,_GLLOGICOP - Data _GLMAP1D,_GLMAP1F,_GLMAP2D,_GLMAP2F,_GLMAPGRID1D,_GLMAPGRID1F,_GLMAPGRID2D,_GLMAPGRID2F - Data _GLMATERIALF,_GLMATERIALFV,_GLMATERIALI,_GLMATERIALIV,_GLMATRIXMODE,_GLMULTMATRIXD - Data _GLMULTMATRIXF,_GLNEWLIST,_GLNORMAL3B,_GLNORMAL3BV,_GLNORMAL3D,_GLNORMAL3DV - Data _GLNORMAL3F,_GLNORMAL3FV,_GLNORMAL3I,_GLNORMAL3IV,_GLNORMAL3S,_GLNORMAL3SV,_GLNORMALPOINTER - Data _GLORTHO,_GLPASSTHROUGH,_GLPIXELMAPFV,_GLPIXELMAPUIV,_GLPIXELMAPUSV,_GLPIXELSTOREF - Data _GLPIXELSTOREI,_GLPIXELTRANSFERF,_GLPIXELTRANSFERI,_GLPIXELZOOM,_GLPOINTSIZE - Data _GLPOLYGONMODE,_GLPOLYGONOFFSET,_GLPOLYGONSTIPPLE,_GLPOPATTRIB,_GLPOPCLIENTATTRIB - Data _GLPOPMATRIX,_GLPOPNAME,_GLPRIORITIZETEXTURES,_GLPUSHATTRIB,_GLPUSHCLIENTATTRIB - Data _GLPUSHMATRIX,_GLPUSHNAME,_GLRASTERPOS2D,_GLRASTERPOS2DV,_GLRASTERPOS2F,_GLRASTERPOS2FV - Data _GLRASTERPOS2I,_GLRASTERPOS2IV,_GLRASTERPOS2S,_GLRASTERPOS2SV,_GLRASTERPOS3D - Data _GLRASTERPOS3DV,_GLRASTERPOS3F,_GLRASTERPOS3FV,_GLRASTERPOS3I,_GLRASTERPOS3IV - Data _GLRASTERPOS3S,_GLRASTERPOS3SV,_GLRASTERPOS4D,_GLRASTERPOS4DV,_GLRASTERPOS4F - Data _GLRASTERPOS4FV,_GLRASTERPOS4I,_GLRASTERPOS4IV,_GLRASTERPOS4S,_GLRASTERPOS4SV - Data _GLREADBUFFER,_GLREADPIXELS,_GLRECTD,_GLRECTDV,_GLRECTF,_GLRECTFV,_GLRECTI,_GLRECTIV - Data _GLRECTS,_GLRECTSV,_GLRENDERMODE,_GLROTATED,_GLROTATEF,_GLSCALED,_GLSCALEF,_GLSCISSOR - Data _GLSELECTBUFFER,_GLSHADEMODEL,_GLSTENCILFUNC,_GLSTENCILMASK,_GLSTENCILOP,_GLTEXCOORD1D - Data _GLTEXCOORD1DV,_GLTEXCOORD1F,_GLTEXCOORD1FV,_GLTEXCOORD1I,_GLTEXCOORD1IV,_GLTEXCOORD1S - Data _GLTEXCOORD1SV,_GLTEXCOORD2D,_GLTEXCOORD2DV,_GLTEXCOORD2F,_GLTEXCOORD2FV,_GLTEXCOORD2I - Data _GLTEXCOORD2IV,_GLTEXCOORD2S,_GLTEXCOORD2SV,_GLTEXCOORD3D,_GLTEXCOORD3DV,_GLTEXCOORD3F - Data _GLTEXCOORD3FV,_GLTEXCOORD3I,_GLTEXCOORD3IV,_GLTEXCOORD3S,_GLTEXCOORD3SV,_GLTEXCOORD4D - Data _GLTEXCOORD4DV,_GLTEXCOORD4F,_GLTEXCOORD4FV,_GLTEXCOORD4I,_GLTEXCOORD4IV,_GLTEXCOORD4S - Data _GLTEXCOORD4SV,_GLTEXCOORDPOINTER,_GLTEXENVF,_GLTEXENVFV,_GLTEXENVI,_GLTEXENVIV - Data _GLTEXGEND,_GLTEXGENDV,_GLTEXGENF,_GLTEXGENFV,_GLTEXGENI,_GLTEXGENIV,_GLTEXIMAGE1D - Data _GLTEXIMAGE2D,_GLTEXPARAMETERF,_GLTEXPARAMETERFV,_GLTEXPARAMETERI,_GLTEXPARAMETERIV - Data _GLTEXSUBIMAGE1D,_GLTEXSUBIMAGE2D,_GLTRANSLATED,_GLTRANSLATEF,_GLVERTEX2D,_GLVERTEX2DV - Data _GLVERTEX2F,_GLVERTEX2FV,_GLVERTEX2I,_GLVERTEX2IV,_GLVERTEX2S,_GLVERTEX2SV,_GLVERTEX3D - Data _GLVERTEX3DV,_GLVERTEX3F,_GLVERTEX3FV,_GLVERTEX3I,_GLVERTEX3IV,_GLVERTEX3S,_GLVERTEX3SV - Data _GLVERTEX4D,_GLVERTEX4DV,_GLVERTEX4F,_GLVERTEX4FV,_GLVERTEX4I,_GLVERTEX4IV,_GLVERTEX4S - Data _GLVERTEX4SV,_GLVERTEXPOINTER,_GLVIEWPORT,_ANTICLOCKWISE,_BEHIND,_CLEAR,_FILLBACKGROUND - Data _GLUPERSPECTIVE,_HARDWARE,_HARDWARE1,_KEEPBACKGROUND,_NONE,_OFF,_ONLY,_ONLYBACKGROUND - Data _ONTOP,_SEAMLESS,_SMOOTH,_SMOOTHSHRUNK,_SMOOTHSTRETCHED,_SOFTWARE,_SQUAREPIXELS - Data _STRETCH - Data uprint_extra,uprint,uprintwidth,uheight&,uheight,falcon_uspacing& - Data falcon_uspacing,uascension&,uascension,GetSystemMetrics& - Data GetSystemMetrics,uspacing&,uspacing,SetFrameRate,SetFocus - Data AutoSizeLabel,Darken~&,Darken,isNumber%%,isNumber,RawText$,RawText - Data SetFont&,SetFont,SetCaption,BeginDraw,EndDraw,LoadImage - Data SetRadioButtonValue,Replace$,Replace,AddItem,RemoveItem,ResetList - Data ReplaceItem,SelectItem%%,SelectItem,GetItem$,GetItem,MessageBox& - Data MessageBox,FromCP437$,FromCP437,FromCP1252$,FromCP1252,UTF8$,UTF8 - Data GetControlDrawOrder&,GetControlDrawOrder,IconPreview&,IconPreview - Data RestoreCHR$,RestoreCHR,MsgBox_OkOnly%%,MsgBox_OkOnly - Data MsgBox_OkCancel%%,MsgBox_OkCancel,MsgBox_AbortRetryIgnore%% - Data MsgBox_AbortRetryIgnore,MsgBox_YesNoCancel%%,MsgBox_YesNoCancel - Data MsgBox_YesNo%%,MsgBox_YesNo,MsgBox_RetryCancel%%,MsgBox_RetryCancel - Data MsgBox_CancelTryagainContinue%%,MsgBox_CancelTryagainContinue - Data MsgBox_Critical%,MsgBox_Critical,MsgBox_Question%,MsgBox_Question - Data MsgBox_Exclamation%,MsgBox_Exclamation,MsgBox_Information% - Data MsgBox_Information,MsgBox_DefaultButton1%,MsgBox_DefaultButton1 - Data MsgBox_DefaultButton2%,MsgBox_DefaultButton2,MsgBox_DefaultButton3% - Data MsgBox_DefaultButton3,MsgBox_Defaultbutton4%,MsgBox_Defaultbutton4 - Data MsgBox_AppModal%%,MsgBox_AppModal,MsgBox_SystemModal% - Data MsgBox_SystemModal,MsgBox_SetForeground&,MsgBox_SetForeground - Data MsgBox_Ok%%,MsgBox_Ok,MsgBox_Cancel%%,MsgBox_Cancel,MsgBox_Abort%% - Data MsgBox_Abort,MsgBox_Retry%%,MsgBox_Retry,MsgBox_Ignore%% - Data MsgBox_Ignore,MsgBox_Yes%%,MsgBox_Yes,MsgBox_No%%,MsgBox_No - Data MsgBox_Tryagain%%,MsgBox_Tryagain,MsgBox_Continue%%,MsgBox_Continue - Data **END** -End Sub + DATA $CHECKING,$CONSOLE,$DYNAMIC,$ELSE,$ELSEIF,$END,$ENDIF,$EXEICON,$IF,$INCLUDE + DATA $LET,$RESIZE,$SCREENHIDE,$SCREENSHOW,$STATIC,$VERSIONINFO,$VIRTUALKEYBOARD,ABS + DATA ABSOLUTE,ACCESS,ALIAS,AND,APPEND,AS,ASC,ATN,BASE,BEEP,BINARY,BLOAD,BSAVE,BYVAL + DATA CALL,CALLS,CASE,IS,CDBL,CDECL,CHAIN,CHDIR,CHR$,CINT,CIRCLE,CLEAR,CLNG,CLOSE + DATA CLS,COLOR,COM,COMMAND$,COMMON,CONST,COS,CSNG,CSRLIN,CUSTOMTYPE,CVD,CVDMBF,CVI + DATA CVL,CVS,CVSMBF,DATA,DATE$,DECLARE,DEF,DEFDBL,DEFINT,DEFLNG,DEFSNG,DEFSTR,DIM + DATA DO,DOUBLE,DRAW,DYNAMIC,ELSE,ELSEIF,END,ENDIF,ENVIRON,ENVIRON$,EOF,EQV,ERASE + DATA ERDEV,ERDEV$,ERL,ERR,ERROR,EVERYCASE,EXIT,EXP,FIELD,FILEATTR,FILES,FIX,FN,FOR + DATA FRE,FREE,FREEFILE,FUNCTION,GET,GOSUB,GOTO,HEX$,IF,IMP,INKEY$,INP,INPUT,INPUT$ + DATA INSTR,INT,INTEGER,INTERRUPT,INTERRUPTX,IOCTL,IOCTL$,KEY,KILL,LBOUND,LCASE$,LEFT$ + DATA LEN,LET,LIBRARY,LINE,LIST,LOC,LOCATE,LOCK,LOF,LOG,LONG,LOOP,LPOS,LPRINT,LSET + DATA LTRIM$,MID$,MKD$,MKDIR,MKDMBF$,MKI$,MKL$,MKS$,MKSMBF$,MOD,NAME,NEXT,NOT,OCT$ + DATA OFF,ON,OPEN,OPTION,OR,OUT,OUTPUT,PAINT,PALETTE,PCOPY,PEEK,PEN,PLAY,PMAP,POINT + DATA POKE,POS,PRESET,PRINT,PSET,PUT,RANDOM,RANDOMIZE,READ,REDIM,REM,RESET,RESTORE + DATA RESUME,RETURN,RIGHT$,RMDIR,RND,RSET,RTRIM$,RUN,SADD,SCREEN,SEEK,SEG,SELECT,SETMEM + DATA SGN,SHARED,SHELL,SIGNAL,SIN,SINGLE,SLEEP,SOUND,SPACE$,SPC,SQR,STATIC,STEP,STICK + DATA STOP,STR$,STRIG,STRING,STRING$,SUB,SWAP,SYSTEM,TAB,TAN,THEN,TIME$,TIMER,TO,TROFF + DATA TRON,TYPE,UBOUND,UCASE$,UEVENT,UNLOCK,UNTIL,USING,VAL,VARPTR,VARPTR$,VARSEG + DATA VIEW,WAIT,WEND,WHILE,WIDTH,WINDOW,WRITE,XOR,_ACOS,_ACOSH,_ALPHA,_ALPHA32,_ARCCOT + DATA _ARCCSC,_ARCSEC,_ASIN,_ASINH,_ATAN2,_ATANH,_AUTODISPLAY,_AXIS,_BACKGROUNDCOLOR + DATA _BIT,_BLEND,_BLINK,_BLUE,_BLUE32,_BUTTON,_BUTTONCHANGE,_BYTE,_CEIL,_CLEARCOLOR + DATA _CLIP,_CLIPBOARD$,_CLIPBOARDIMAGE,_COMMANDCOUNT,_CONNECTED,_CONNECTIONADDRESS$ + DATA _CONSOLE,_CONSOLETITLE,_CONTINUE,_CONTROLCHR,_COPYIMAGE,_COPYPALETTE,_COSH,_COT + DATA _COTH,_CSC,_CSCH,_CV,_CWD$,_D2G,_D2R,_DEFAULTCOLOR,_DEFINE,_DELAY,_DEPTHBUFFER + DATA _DESKTOPHEIGHT,_DESKTOPWIDTH,_DEST,_DEVICE$,_DEVICEINPUT,_DEVICES,_DIR$,_DIREXISTS + DATA _DISPLAY,_DISPLAYORDER,_DONTBLEND,_DONTWAIT,_ERRORLINE,_EXIT,_EXPLICIT,_FILEEXISTS + DATA _FLOAT,_FONT,_FONTHEIGHT,_FONTWIDTH,_FREEFONT,_FREEIMAGE,_FREETIMER,_FULLSCREEN + DATA _G2D,_G2R,_GLRENDER,_GREEN,_GREEN32,_HEIGHT,_HIDE,_HYPOT,_ICON,_INCLERRORFILE$ + DATA _INCLERRORLINE,_INTEGER64,_KEYCLEAR,_KEYDOWN,_KEYHIT,_LASTAXIS,_LASTBUTTON,_LASTWHEEL + DATA _LIMIT,_LOADFONT,_LOADIMAGE,_MAPTRIANGLE,_MAPUNICODE,_MEM,_MEMCOPY,_MEMELEMENT + DATA _MEMEXISTS,_MEMFILL,_MEMFREE,_MEMGET,_MEMIMAGE,_MEMNEW,_MEMPUT,_MIDDLE,_MK$ + DATA _MOUSEBUTTON,_MOUSEHIDE,_MOUSEINPUT,_MOUSEMOVE,_MOUSEMOVEMENTX,_MOUSEMOVEMENTY + DATA _MOUSEPIPEOPEN,_MOUSESHOW,_MOUSEWHEEL,_MOUSEX,_MOUSEY,_NEWIMAGE,_OFFSET,_OPENCLIENT + DATA _OPENCONNECTION,_OPENHOST,_OS$,_PALETTECOLOR,_PI,_PIXELSIZE,_PRESERVE,_PRINTIMAGE + DATA _PRINTMODE,_PRINTSTRING,_PRINTWIDTH,_PUTIMAGE,_R2D,_R2G,_RED,_RED32,_RESIZE + DATA _RESIZEHEIGHT,_RESIZEWIDTH,_RGB,_RGB32,_RGBA,_RGBA32,_ROUND,_SCREENCLICK,_SCREENEXISTS + DATA _SCREENHIDE,_SCREENICON,_SCREENIMAGE,_SCREENMOVE,_SCREENPRINT,_SCREENSHOW,_SCREENX + DATA _SCREENY,_SEC,_SECH,_SETALPHA,_SHELLHIDE,_SINH,_SNDBAL,_SNDCLOSE,_SNDCOPY,_SNDGETPOS + DATA _SNDLEN,_SNDLIMIT,_SNDLOOP,_SNDOPEN,_SNDOPENRAW,_SNDPAUSE,_SNDPAUSED,_SNDPLAY + DATA _SNDPLAYCOPY,_SNDPLAYFILE,_SNDPLAYING,_SNDRATE,_SNDRAW,_SNDRAWDONE,_SNDRAWLEN + DATA _SNDSETPOS,_SNDSTOP,_SNDVOL,_SOURCE,_STARTDIR$,_STRCMP,_STRICMP,_TANH,_TITLE + DATA _TITLE$,_UNSIGNED,_WHEEL,_WIDTH,_WINDOWHANDLE,_WINDOWHASFOCUS,_GLACCUM,_GLALPHAFUNC + DATA _GLARETEXTURESRESIDENT,_GLARRAYELEMENT,_GLBEGIN,_GLBINDTEXTURE,_GLBITMAP,_GLBLENDFUNC + DATA _GLCALLLIST,_GLCALLLISTS,_GLCLEAR,_GLCLEARACCUM,_GLCLEARCOLOR,_GLCLEARDEPTH + DATA _GLCLEARINDEX,_GLCLEARSTENCIL,_GLCLIPPLANE,_GLCOLOR3B,_GLCOLOR3BV,_GLCOLOR3D + DATA _GLCOLOR3DV,_GLCOLOR3F,_GLCOLOR3FV,_GLCOLOR3I,_GLCOLOR3IV,_GLCOLOR3S,_GLCOLOR3SV + DATA _GLCOLOR3UB,_GLCOLOR3UBV,_GLCOLOR3UI,_GLCOLOR3UIV,_GLCOLOR3US,_GLCOLOR3USV,_GLCOLOR4B + DATA _GLCOLOR4BV,_GLCOLOR4D,_GLCOLOR4DV,_GLCOLOR4F,_GLCOLOR4FV,_GLCOLOR4I,_GLCOLOR4IV + DATA _GLCOLOR4S,_GLCOLOR4SV,_GLCOLOR4UB,_GLCOLOR4UBV,_GLCOLOR4UI,_GLCOLOR4UIV,_GLCOLOR4US + DATA _GLCOLOR4USV,_GLCOLORMASK,_GLCOLORMATERIAL,_GLCOLORPOINTER,_GLCOPYPIXELS,_GLCOPYTEXIMAGE1D + DATA _GLCOPYTEXIMAGE2D,_GLCOPYTEXSUBIMAGE1D,_GLCOPYTEXSUBIMAGE2D,_GLCULLFACE,_GLDELETELISTS + DATA _GLDELETETEXTURES,_GLDEPTHFUNC,_GLDEPTHMASK,_GLDEPTHRANGE,_GLDISABLE,_GLDISABLECLIENTSTATE + DATA _GLDRAWARRAYS,_GLDRAWBUFFER,_GLDRAWELEMENTS,_GLDRAWPIXELS,_GLEDGEFLAG,_GLEDGEFLAGPOINTER + DATA _GLEDGEFLAGV,_GLENABLE,_GLENABLECLIENTSTATE,_GLEND,_GLENDLIST,_GLEVALCOORD1D + DATA _GLEVALCOORD1DV,_GLEVALCOORD1F,_GLEVALCOORD1FV,_GLEVALCOORD2D,_GLEVALCOORD2DV + DATA _GLEVALCOORD2F,_GLEVALCOORD2FV,_GLEVALMESH1,_GLEVALMESH2,_GLEVALPOINT1,_GLEVALPOINT2 + DATA _GLFEEDBACKBUFFER,_GLFINISH,_GLFLUSH,_GLFOGF,_GLFOGFV,_GLFOGI,_GLFOGIV,_GLFRONTFACE + DATA _GLFRUSTUM,_GLGENLISTS,_GLGENTEXTURES,_GLGETBOOLEANV,_GLGETCLIPPLANE,_GLGETDOUBLEV + DATA _GLGETERROR,_GLGETFLOATV,_GLGETINTEGERV,_GLGETLIGHTFV,_GLGETLIGHTIV,_GLGETMAPDV + DATA _GLGETMAPFV,_GLGETMAPIV,_GLGETMATERIALFV,_GLGETMATERIALIV,_GLGETPIXELMAPFV,_GLGETPIXELMAPUIV + DATA _GLGETPIXELMAPUSV,_GLGETPOINTERV,_GLGETPOLYGONSTIPPLE,_GLGETSTRING,_GLGETTEXENVFV + DATA _GLGETTEXENVIV,_GLGETTEXGENDV,_GLGETTEXGENFV,_GLGETTEXGENIV,_GLGETTEXIMAGE,_GLGETTEXLEVELPARAMETERFV + DATA _GLGETTEXLEVELPARAMETERIV,_GLGETTEXPARAMETERFV,_GLGETTEXPARAMETERIV,_GLHINT + DATA _GLINDEXMASK,_GLINDEXPOINTER,_GLINDEXD,_GLINDEXDV,_GLINDEXF,_GLINDEXFV,_GLINDEXI + DATA _GLINDEXIV,_GLINDEXS,_GLINDEXSV,_GLINDEXUB,_GLINDEXUBV,_GLINITNAMES,_GLINTERLEAVEDARRAYS + DATA _GLISENABLED,_GLISLIST,_GLISTEXTURE,_GLLIGHTMODELF,_GLLIGHTMODELFV,_GLLIGHTMODELI + DATA _GLLIGHTMODELIV,_GLLIGHTF,_GLLIGHTFV,_GLLIGHTI,_GLLIGHTIV,_GLLINESTIPPLE,_GLLINEWIDTH + DATA _GLLISTBASE,_GLLOADIDENTITY,_GLLOADMATRIXD,_GLLOADMATRIXF,_GLLOADNAME,_GLLOGICOP + DATA _GLMAP1D,_GLMAP1F,_GLMAP2D,_GLMAP2F,_GLMAPGRID1D,_GLMAPGRID1F,_GLMAPGRID2D,_GLMAPGRID2F + DATA _GLMATERIALF,_GLMATERIALFV,_GLMATERIALI,_GLMATERIALIV,_GLMATRIXMODE,_GLMULTMATRIXD + DATA _GLMULTMATRIXF,_GLNEWLIST,_GLNORMAL3B,_GLNORMAL3BV,_GLNORMAL3D,_GLNORMAL3DV + DATA _GLNORMAL3F,_GLNORMAL3FV,_GLNORMAL3I,_GLNORMAL3IV,_GLNORMAL3S,_GLNORMAL3SV,_GLNORMALPOINTER + DATA _GLORTHO,_GLPASSTHROUGH,_GLPIXELMAPFV,_GLPIXELMAPUIV,_GLPIXELMAPUSV,_GLPIXELSTOREF + DATA _GLPIXELSTOREI,_GLPIXELTRANSFERF,_GLPIXELTRANSFERI,_GLPIXELZOOM,_GLPOINTSIZE + DATA _GLPOLYGONMODE,_GLPOLYGONOFFSET,_GLPOLYGONSTIPPLE,_GLPOPATTRIB,_GLPOPCLIENTATTRIB + DATA _GLPOPMATRIX,_GLPOPNAME,_GLPRIORITIZETEXTURES,_GLPUSHATTRIB,_GLPUSHCLIENTATTRIB + DATA _GLPUSHMATRIX,_GLPUSHNAME,_GLRASTERPOS2D,_GLRASTERPOS2DV,_GLRASTERPOS2F,_GLRASTERPOS2FV + DATA _GLRASTERPOS2I,_GLRASTERPOS2IV,_GLRASTERPOS2S,_GLRASTERPOS2SV,_GLRASTERPOS3D + DATA _GLRASTERPOS3DV,_GLRASTERPOS3F,_GLRASTERPOS3FV,_GLRASTERPOS3I,_GLRASTERPOS3IV + DATA _GLRASTERPOS3S,_GLRASTERPOS3SV,_GLRASTERPOS4D,_GLRASTERPOS4DV,_GLRASTERPOS4F + DATA _GLRASTERPOS4FV,_GLRASTERPOS4I,_GLRASTERPOS4IV,_GLRASTERPOS4S,_GLRASTERPOS4SV + DATA _GLREADBUFFER,_GLREADPIXELS,_GLRECTD,_GLRECTDV,_GLRECTF,_GLRECTFV,_GLRECTI,_GLRECTIV + DATA _GLRECTS,_GLRECTSV,_GLRENDERMODE,_GLROTATED,_GLROTATEF,_GLSCALED,_GLSCALEF,_GLSCISSOR + DATA _GLSELECTBUFFER,_GLSHADEMODEL,_GLSTENCILFUNC,_GLSTENCILMASK,_GLSTENCILOP,_GLTEXCOORD1D + DATA _GLTEXCOORD1DV,_GLTEXCOORD1F,_GLTEXCOORD1FV,_GLTEXCOORD1I,_GLTEXCOORD1IV,_GLTEXCOORD1S + DATA _GLTEXCOORD1SV,_GLTEXCOORD2D,_GLTEXCOORD2DV,_GLTEXCOORD2F,_GLTEXCOORD2FV,_GLTEXCOORD2I + DATA _GLTEXCOORD2IV,_GLTEXCOORD2S,_GLTEXCOORD2SV,_GLTEXCOORD3D,_GLTEXCOORD3DV,_GLTEXCOORD3F + DATA _GLTEXCOORD3FV,_GLTEXCOORD3I,_GLTEXCOORD3IV,_GLTEXCOORD3S,_GLTEXCOORD3SV,_GLTEXCOORD4D + DATA _GLTEXCOORD4DV,_GLTEXCOORD4F,_GLTEXCOORD4FV,_GLTEXCOORD4I,_GLTEXCOORD4IV,_GLTEXCOORD4S + DATA _GLTEXCOORD4SV,_GLTEXCOORDPOINTER,_GLTEXENVF,_GLTEXENVFV,_GLTEXENVI,_GLTEXENVIV + DATA _GLTEXGEND,_GLTEXGENDV,_GLTEXGENF,_GLTEXGENFV,_GLTEXGENI,_GLTEXGENIV,_GLTEXIMAGE1D + DATA _GLTEXIMAGE2D,_GLTEXPARAMETERF,_GLTEXPARAMETERFV,_GLTEXPARAMETERI,_GLTEXPARAMETERIV + DATA _GLTEXSUBIMAGE1D,_GLTEXSUBIMAGE2D,_GLTRANSLATED,_GLTRANSLATEF,_GLVERTEX2D,_GLVERTEX2DV + DATA _GLVERTEX2F,_GLVERTEX2FV,_GLVERTEX2I,_GLVERTEX2IV,_GLVERTEX2S,_GLVERTEX2SV,_GLVERTEX3D + DATA _GLVERTEX3DV,_GLVERTEX3F,_GLVERTEX3FV,_GLVERTEX3I,_GLVERTEX3IV,_GLVERTEX3S,_GLVERTEX3SV + DATA _GLVERTEX4D,_GLVERTEX4DV,_GLVERTEX4F,_GLVERTEX4FV,_GLVERTEX4I,_GLVERTEX4IV,_GLVERTEX4S + DATA _GLVERTEX4SV,_GLVERTEXPOINTER,_GLVIEWPORT,_ANTICLOCKWISE,_BEHIND,_CLEAR,_FILLBACKGROUND + DATA _GLUPERSPECTIVE,_HARDWARE,_HARDWARE1,_KEEPBACKGROUND,_NONE,_OFF,_ONLY,_ONLYBACKGROUND + DATA _ONTOP,_SEAMLESS,_SMOOTH,_SMOOTHSHRUNK,_SMOOTHSTRETCHED,_SOFTWARE,_SQUAREPIXELS + DATA _STRETCH + DATA uprint_extra,uprint,uprintwidth,uheight&,uheight,falcon_uspacing& + DATA falcon_uspacing,uascension&,uascension,GetSystemMetrics& + DATA GetSystemMetrics,uspacing&,uspacing,SetFrameRate,SetFocus + DATA AutoSizeLabel,Darken~&,Darken,isNumber%%,isNumber,RawText$,RawText + DATA SetFont&,SetFont,SetCaption,BeginDraw,EndDraw,LoadImage + DATA SetRadioButtonValue,Replace$,Replace,AddItem,RemoveItem,ResetList + DATA ReplaceItem,SelectItem%%,SelectItem,GetItem$,GetItem,MessageBox& + DATA MessageBox,FromCP437$,FromCP437,FromCP1252$,FromCP1252,UTF8$,UTF8 + DATA GetControlDrawOrder&,GetControlDrawOrder,IconPreview&,IconPreview + DATA RestoreCHR$,RestoreCHR,MsgBox_OkOnly%%,MsgBox_OkOnly + DATA MsgBox_OkCancel%%,MsgBox_OkCancel,MsgBox_AbortRetryIgnore%% + DATA MsgBox_AbortRetryIgnore,MsgBox_YesNoCancel%%,MsgBox_YesNoCancel + DATA MsgBox_YesNo%%,MsgBox_YesNo,MsgBox_RetryCancel%%,MsgBox_RetryCancel + DATA MsgBox_CancelTryagainContinue%%,MsgBox_CancelTryagainContinue + DATA MsgBox_Critical%,MsgBox_Critical,MsgBox_Question%,MsgBox_Question + DATA MsgBox_Exclamation%,MsgBox_Exclamation,MsgBox_Information% + DATA MsgBox_Information,MsgBox_DefaultButton1%,MsgBox_DefaultButton1 + DATA MsgBox_DefaultButton2%,MsgBox_DefaultButton2,MsgBox_DefaultButton3% + DATA MsgBox_DefaultButton3,MsgBox_Defaultbutton4%,MsgBox_Defaultbutton4 + DATA MsgBox_AppModal%%,MsgBox_AppModal,MsgBox_SystemModal% + DATA MsgBox_SystemModal,MsgBox_SetForeground&,MsgBox_SetForeground + DATA MsgBox_Ok%%,MsgBox_Ok,MsgBox_Cancel%%,MsgBox_Cancel,MsgBox_Abort%% + DATA MsgBox_Abort,MsgBox_Retry%%,MsgBox_Retry,MsgBox_Ignore%% + DATA MsgBox_Ignore,MsgBox_Yes%%,MsgBox_Yes,MsgBox_No%%,MsgBox_No + DATA MsgBox_Tryagain%%,MsgBox_Tryagain,MsgBox_Continue%%,MsgBox_Continue + DATA **END** +END SUB -Function IS_KEYWORD (Text$) - Dim uText$, i As Long - uText$ = UCase$(RTrim$(LTrim$(Text$))) - For i = 1 To UBound(QB64KEYWORDS) - If QB64KEYWORDS(i) = uText$ Then IS_KEYWORD = True: Exit Function - Next i -End Function +FUNCTION IS_KEYWORD (Text$) + DIM uText$, i AS LONG + uText$ = UCASE$(RTRIM$(LTRIM$(Text$))) + FOR i = 1 TO UBOUND(QB64KEYWORDS) + IF QB64KEYWORDS(i) = uText$ THEN IS_KEYWORD = True: EXIT FUNCTION + NEXT i +END FUNCTION -Sub SaveUndoImage +SUB SaveUndoImage SavePreview ToUndoBuffer -End Sub +END SUB -Sub RestoreUndoImage - If UndoPointer = 0 Then Exit Sub +SUB RestoreUndoImage + IF UndoPointer = 0 THEN EXIT SUB UndoPointer = UndoPointer - 1 LoadPreview ToUndoBuffer -End Sub +END SUB -Sub RestoreRedoImage - If UndoPointer = TotalUndoImages Then Exit Sub +SUB RestoreRedoImage + IF UndoPointer = TotalUndoImages THEN EXIT SUB UndoPointer = UndoPointer + 1 LoadPreview ToUndoBuffer -End Sub +END SUB -Sub LoadDefaultFonts - If Control(__UI_FormID).Font = 8 Or Control(__UI_FormID).Font = 16 Then +SUB LoadDefaultFonts + IF Control(__UI_FormID).Font = 8 OR Control(__UI_FormID).Font = 16 THEN Control(__UI_FormID).Font = SetFont("segoeui.ttf", 12) - End If - If Control(__UI_FormID).Font = 8 Or Control(__UI_FormID).Font = 16 Then + END IF + IF Control(__UI_FormID).Font = 8 OR Control(__UI_FormID).Font = 16 THEN Control(__UI_FormID).Font = SetFont("arial.ttf", 12) - End If - If Control(__UI_FormID).Font = 8 Or Control(__UI_FormID).Font = 16 Then + END IF + IF Control(__UI_FormID).Font = 8 OR Control(__UI_FormID).Font = 16 THEN Control(__UI_FormID).Font = SetFont("cour.ttf", 12) - End If - If Control(__UI_FormID).Font = 8 Or Control(__UI_FormID).Font = 16 Then + END IF + IF Control(__UI_FormID).Font = 8 OR Control(__UI_FormID).Font = 16 THEN Control(__UI_FormID).Font = SetFont("/Library/Fonts/Arial.ttf", 12) - End If - If Control(__UI_FormID).Font = 8 Or Control(__UI_FormID).Font = 16 Then + END IF + IF Control(__UI_FormID).Font = 8 OR Control(__UI_FormID).Font = 16 THEN Control(__UI_FormID).Font = SetFont("/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf", 12) - End If - If Control(__UI_FormID).Font = 8 Or Control(__UI_FormID).Font = 16 Then + END IF + IF Control(__UI_FormID).Font = 8 OR Control(__UI_FormID).Font = 16 THEN Control(__UI_FormID).Font = SetFont("/usr/share/fonts/TTF/arial.ttf", 12) - End If - If Control(__UI_FormID).Font = 8 Or Control(__UI_FormID).Font = 16 Then + END IF + IF Control(__UI_FormID).Font = 8 OR Control(__UI_FormID).Font = 16 THEN Control(__UI_FormID).Font = SetFont("resources/NotoMono-Regular.ttf", 12) - End If -End Sub + END IF +END SUB -Function EditorImageData$ (FileName$) - Dim A$ +FUNCTION EditorImageData$ (FileName$) + DIM A$ - Select Case LCase$(FileName$) - Case "contextmenu.bmp" + SELECT CASE LCASE$(FileName$) + CASE "contextmenu.bmp" A$ = MKI$(16) + MKI$(16) A$ = A$ + "o3`ooo?0oooo0looo3`ooo?0oooo0looo3`ooo?0oooo0looo3`ooo?0oooo" A$ = A$ + "0looo3`ooo?0oooo0looo3`ooo?0oooo0looo3`ooo?0oooo0looo3`ooo?0" @@ -3966,31 +3966,31 @@ Function EditorImageData$ (FileName$) A$ = A$ + "o3`oooYY^n_UVJjoFNj[oKiYWn?XXnjoGR:ZoS9Z`n?VYVjoQVJ\oSIZYnOV" A$ = A$ + "Z6koIZZZoo?0oooo0looo3`ooo?0oooo0looo3`ooo?0oooo0looo3`ooo?0" A$ = A$ + "oooo0looo3`ooo?0oooo0looo3`ooo?0oooo0looo3`o%%o3" - End Select + END SELECT EditorImageData$ = A$ -End Function +END FUNCTION -Function LoadEditorImage& (FileName$) - Dim MemoryBlock As _MEM, TempImage As Long, NextSlot As Long - Dim NewWidth As Integer, NewHeight As Integer, A$, BASFILE$ +FUNCTION LoadEditorImage& (FileName$) + DIM MemoryBlock AS _MEM, TempImage AS LONG + DIM NewWidth AS INTEGER, NewHeight AS INTEGER, A$, BASFILE$ A$ = EditorImageData$(FileName$) - If Len(A$) = 0 Then Exit Function + IF LEN(A$) = 0 THEN EXIT FUNCTION - NewWidth = CVI(Left$(A$, 2)) - NewHeight = CVI(Mid$(A$, 3, 2)) - A$ = Mid$(A$, 5) + NewWidth = CVI(LEFT$(A$, 2)) + NewHeight = CVI(MID$(A$, 3, 2)) + A$ = MID$(A$, 5) BASFILE$ = Unpack$(A$) - TempImage = _NewImage(NewWidth, NewHeight, 32) - MemoryBlock = _MemImage(TempImage) + TempImage = _NEWIMAGE(NewWidth, NewHeight, 32) + MemoryBlock = _MEMIMAGE(TempImage) - __UI_MemCopy MemoryBlock.OFFSET, _Offset(BASFILE$), Len(BASFILE$) - _MemFree MemoryBlock + __UI_MemCopy MemoryBlock.OFFSET, _OFFSET(BASFILE$), LEN(BASFILE$) + _MEMFREE MemoryBlock LoadEditorImage& = TempImage -End Function +END FUNCTION '$include:'InForm.ui' diff --git a/InForm/extensions/download.bas b/InForm/extensions/download.bas index e46a3fc..9557a38 100644 --- a/InForm/extensions/download.bas +++ b/InForm/extensions/download.bas @@ -1,63 +1,67 @@ -Function Download$ (url$, file$, timelimit) Static - 'as seen on http://www.qb64.org/wiki/Downloading_Files - 'adapted for use with InForm +$IF DOWNLOAD_BAS = UNDEFINED THEN + $LET DOWNLOAD_BAS = TRUE + FUNCTION Download$ (url$, file$, timelimit) STATIC + 'as seen on http://www.qb64.org/wiki/Downloading_Files + 'adapted for use with InForm - Dim theClient As Long, l As Long - Dim prevUrl$, prevUrl2$, url2$, x As Long - Dim e$, url3$, x$, t!, a2$, a$, i As Long - Dim i2 As Long, i3 As Long, d$, fh As Long + DIM theClient AS LONG, l AS LONG + DIM prevUrl$, prevUrl2$, url2$, x AS LONG + DIM e$, url3$, x$, t!, a2$, a$, i AS LONG + DIM i2 AS LONG, i3 AS LONG, d$, fh AS LONG - If url$ <> prevUrl$ Or url$ = "" Then - prevUrl$ = url$ - If url$ = "" Then - If theClient Then Close theClient: theClient = 0 - Exit Function - End If - url2$ = url$ - x = InStr(url2$, "/") - If x Then url2$ = Left$(url$, x - 1) - If url2$ <> prevUrl2$ Then - prevUrl2$ = url2$ - If theClient Then Close theClient: theClient = 0 - theClient = _OpenClient("TCP/IP:80:" + url2$) - If theClient = 0 Then Download = MKI$(2): prevUrl$ = "": Exit Function - End If - e$ = Chr$(13) + Chr$(10) ' end of line characters - url3$ = Right$(url$, Len(url$) - x + 1) - x$ = "GET " + url3$ + " HTTP/1.1" + e$ - x$ = x$ + "Host: " + url2$ + e$ + e$ - Put #theClient, , x$ - t! = Timer ' start time - End If + IF url$ <> prevUrl$ OR url$ = "" THEN + prevUrl$ = url$ + IF url$ = "" THEN + IF theClient THEN CLOSE theClient: theClient = 0 + EXIT FUNCTION + END IF + url2$ = url$ + x = INSTR(url2$, "/") + IF x THEN url2$ = LEFT$(url$, x - 1) + IF url2$ <> prevUrl2$ THEN + prevUrl2$ = url2$ + IF theClient THEN CLOSE theClient: theClient = 0 + theClient = _OPENCLIENT("TCP/IP:80:" + url2$) + IF theClient = 0 THEN Download = MKI$(2): prevUrl$ = "": EXIT FUNCTION + END IF + e$ = CHR$(13) + CHR$(10) ' end of line characters + url3$ = RIGHT$(url$, LEN(url$) - x + 1) + x$ = "GET " + url3$ + " HTTP/1.1" + e$ + x$ = x$ + "Host: " + url2$ + e$ + e$ + PUT #theClient, , x$ + t! = TIMER ' start time + END IF + + GET #theClient, , a2$ + a$ = a$ + a2$ + i = INSTR(a$, "Content-Length:") + IF i THEN + i2 = INSTR(i, a$, e$) + IF i2 THEN + l = VAL(MID$(a$, i + 15, i2 - i - 14)) + i3 = INSTR(i2, a$, e$ + e$) + IF i3 THEN + i3 = i3 + 4 'move i3 to start of data + IF (LEN(a$) - i3 + 1) = l THEN + d$ = MID$(a$, i3, l) + fh = FREEFILE + OPEN file$ FOR OUTPUT AS #fh: CLOSE #fh 'Warning! Clears data from existing file + OPEN file$ FOR BINARY AS #fh + PUT #fh, , d$ + CLOSE #fh + Download = MKI$(1) + MKL$(l) 'indicates download was successful + prevUrl$ = "" + prevUrl2$ = "" + a$ = "" + CLOSE theClient + theClient = 0 + EXIT FUNCTION + END IF ' availabledata = l + END IF ' i3 + END IF ' i2 + END IF ' i + IF TIMER > t! + timelimit THEN CLOSE theClient: theClient = 0: Download = MKI$(3): prevUrl$ = "": EXIT FUNCTION + Download = MKI$(0) 'still working + END FUNCTION +$END IF - Get #theClient, , a2$ - a$ = a$ + a2$ - i = InStr(a$, "Content-Length:") - If i Then - i2 = InStr(i, a$, e$) - If i2 Then - l = Val(Mid$(a$, i + 15, i2 - i - 14)) - i3 = InStr(i2, a$, e$ + e$) - If i3 Then - i3 = i3 + 4 'move i3 to start of data - If (Len(a$) - i3 + 1) = l Then - d$ = Mid$(a$, i3, l) - fh = FreeFile - Open file$ For Output As #fh: Close #fh 'Warning! Clears data from existing file - Open file$ For Binary As #fh - Put #fh, , d$ - Close #fh - Download = MKI$(1) + MKL$(l) 'indicates download was successful - prevUrl$ = "" - prevUrl2$ = "" - a$ = "" - Close theClient - theClient = 0 - Exit Function - End If ' availabledata = l - End If ' i3 - End If ' i2 - End If ' i - If Timer > t! + timelimit Then Close theClient: theClient = 0: Download = MKI$(3): prevUrl$ = "": Exit Function - Download = MKI$(0) 'still working -End Function diff --git a/InForm/extensions/gifplay.bi b/InForm/extensions/gifplay.bi index b194663..7f2d8ba 100644 --- a/InForm/extensions/gifplay.bi +++ b/InForm/extensions/gifplay.bi @@ -6,52 +6,57 @@ '####################################################################################### 'Adapted for use with InForm's PictureBox controls by @FellippeHeitor -TYPE GIFDATA - ID AS LONG - file AS INTEGER - sigver AS STRING * 6 - width AS _UNSIGNED INTEGER - height AS _UNSIGNED INTEGER - bpp AS _UNSIGNED _BYTE - sortFlag AS _BYTE ' Unused - colorRes AS _UNSIGNED _BYTE - colorTableFlag AS _BYTE - bgColor AS _UNSIGNED _BYTE - aspect AS SINGLE ' Unused - numColors AS _UNSIGNED INTEGER - palette AS STRING * 768 - firstFrame AS LONG - totalFrames AS LONG - IsPlaying AS _BYTE - Frame AS LONG - LoadedFrames AS LONG - GifLoadComplete AS _BYTE - LastFrameServed AS LONG - LastFrameUpdate AS SINGLE - LastFrameDelay AS SINGLE - HideOverlay AS _BYTE -END TYPE +$IF GIFPLAY_BI = UNDEFINED THEN + $LET GIFPLAY_BI = TRUE -TYPE FRAMEDATA - ID AS LONG - thisFrame AS LONG - addr AS LONG - left AS _UNSIGNED INTEGER - top AS _UNSIGNED INTEGER - width AS _UNSIGNED INTEGER - height AS _UNSIGNED INTEGER - localColorTableFlag AS _BYTE - interlacedFlag AS _BYTE - sortFlag AS _BYTE ' Unused - palBPP AS _UNSIGNED _BYTE - minimumCodeSize AS _UNSIGNED _BYTE - transparentFlag AS _BYTE 'GIF89a-specific (animation) values - userInput AS _BYTE ' Unused - disposalMethod AS _UNSIGNED _BYTE - delay AS SINGLE - transColor AS _UNSIGNED _BYTE -END TYPE + TYPE GIFDATA + ID AS LONG + file AS INTEGER + sigver AS STRING * 6 + width AS _UNSIGNED INTEGER + height AS _UNSIGNED INTEGER + bpp AS _UNSIGNED _BYTE + sortFlag AS _BYTE ' Unused + colorRes AS _UNSIGNED _BYTE + colorTableFlag AS _BYTE + bgColor AS _UNSIGNED _BYTE + aspect AS SINGLE ' Unused + numColors AS _UNSIGNED INTEGER + palette AS STRING * 768 + firstFrame AS LONG + totalFrames AS LONG + IsPlaying AS _BYTE + Frame AS LONG + LoadedFrames AS LONG + GifLoadComplete AS _BYTE + LastFrameServed AS LONG + LastFrameUpdate AS SINGLE + LastFrameDelay AS SINGLE + HideOverlay AS _BYTE + END TYPE + + TYPE FRAMEDATA + ID AS LONG + thisFrame AS LONG + addr AS LONG + left AS _UNSIGNED INTEGER + top AS _UNSIGNED INTEGER + width AS _UNSIGNED INTEGER + height AS _UNSIGNED INTEGER + localColorTableFlag AS _BYTE + interlacedFlag AS _BYTE + sortFlag AS _BYTE ' Unused + palBPP AS _UNSIGNED _BYTE + minimumCodeSize AS _UNSIGNED _BYTE + transparentFlag AS _BYTE 'GIF89a-specific (animation) values + userInput AS _BYTE ' Unused + disposalMethod AS _UNSIGNED _BYTE + delay AS SINGLE + transColor AS _UNSIGNED _BYTE + END TYPE + + REDIM SHARED GifData(0) AS GIFDATA + REDIM SHARED GifFrameData(0) AS FRAMEDATA + DIM SHARED TotalGIFLoaded AS LONG, TotalGIFFrames AS LONG +$END IF -REDIM SHARED GifData(0) AS GIFDATA -REDIM SHARED GifFrameData(0) AS FRAMEDATA -DIM SHARED TotalGIFLoaded AS LONG, TotalGIFFrames AS LONG diff --git a/InForm/extensions/gifplay.bm b/InForm/extensions/gifplay.bm index 131e86b..f34625d 100644 --- a/InForm/extensions/gifplay.bm +++ b/InForm/extensions/gifplay.bm @@ -6,27 +6,31 @@ '####################################################################################### 'Adapted for use with InForm's PictureBox controls by @FellippeHeitor -SUB UpdateGif (ID AS LONG) - DIM i AS LONG, newFrame AS LONG - STATIC GifOverlay AS LONG +'$Include:'gifplay.bi' - i = GetGifIndex(ID) +$IF GIFPLAY_BM = UNDEFINED THEN + $LET GIFPLAY_BM = TRUE + SUB UpdateGif (ID AS LONG) + DIM i AS LONG, newFrame AS LONG + STATIC GifOverlay AS LONG - IF i = 0 THEN EXIT SUB + i = GetGifIndex(ID) - IF GifOverlay = 0 THEN - GifOverlay = LoadOverlayImage& - END IF + IF i = 0 THEN EXIT SUB - IF GifData(i).IsPlaying OR GifData(i).LastFrameServed = 0 THEN - IF GifData(i).LastFrameUpdate > 0 AND TIMER - GifData(i).LastFrameUpdate < GifData(i).LastFrameDelay THEN - 'Wait for the GIF's frame delay - ELSE - GifData(i).Frame = GifData(i).Frame + 1 - GifData(i).LastFrameServed = GifData(i).Frame - GifData(i).LastFrameUpdate = TIMER + IF GifOverlay = 0 THEN + GifOverlay = LoadOverlayImage& + END IF + + IF GifData(i).IsPlaying OR GifData(i).LastFrameServed = 0 THEN + IF GifData(i).LastFrameUpdate > 0 AND TIMER - GifData(i).LastFrameUpdate < GifData(i).LastFrameDelay THEN + 'Wait for the GIF's frame delay + ELSE + GifData(i).Frame = GifData(i).Frame + 1 + GifData(i).LastFrameServed = GifData(i).Frame + GifData(i).LastFrameUpdate = TIMER + END IF END IF - END IF BeginDraw ID newFrame = GetGifFrame&(i) @@ -879,3 +883,5 @@ FUNCTION gifUnpack$ (PackedData$) gifUnpack$ = btemp$ END FUNCTION '############################################################################################ +$endif + diff --git a/InForm/extensions/gifplaySample.bas b/InForm/extensions/gifplaySample.bas index bff22ab..0e98ead 100644 --- a/InForm/extensions/gifplaySample.bas +++ b/InForm/extensions/gifplaySample.bas @@ -5,10 +5,10 @@ '----------------------------------------------------------- ': Controls' IDs: ------------------------------------------------------------------ -Dim Shared gifplaySample As Long -Dim Shared PictureBox1 As Long -Dim Shared LoadBT As Long -Dim Shared PlayBT As Long +DIM SHARED gifplaySample AS LONG +DIM SHARED PictureBox1 AS LONG +DIM SHARED LoadBT AS LONG +DIM SHARED PlayBT AS LONG ': External modules: --------------------------------------------------------------- '$INCLUDE:'gifplay.bi' @@ -49,7 +49,7 @@ SUB __UI_Click (id AS LONG) Caption(LoadBT) = "globe.gif loaded" Control(LoadBT).Disabled = True ELSE - Answer = MessageBox("File 'globe.gif' could not be found.", "", MsgBox_Exclamation + MsgBox_OkOnly) + _MESSAGEBOX "GIFPlay Sample", "File 'globe.gif' could not be found.", "error" END IF CASE PlayBT IF GifIsPlaying(PictureBox1) THEN diff --git a/InForm/extensions/gifplaySample.frm b/InForm/extensions/gifplaySample.frm index 84c4885..00461c9 100644 --- a/InForm/extensions/gifplaySample.frm +++ b/InForm/extensions/gifplaySample.frm @@ -36,3 +36,4 @@ SUB __UI_AssignIDs LoadBT = __UI_GetID("LoadBT") PlayBT = __UI_GetID("PlayBT") END SUB + diff --git a/InForm/falcon.h b/InForm/falcon.h deleted file mode 100644 index 63c505e..0000000 --- a/InForm/falcon.h +++ /dev/null @@ -1,254 +0,0 @@ -#include "FreeTypeAmalgam.h" -// The following license applies to utf8decode() and associated data only -// Copyright (c) 2008-2010 Bjoern Hoehrmann <bjoern@hoehrmann.de> -// See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details. -/* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR -A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#define UTF8_ACCEPT 0 -#define UTF8_REJECT 1 -static const uint8_t utf8d[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 00..1f - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20..3f - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 40..5f - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 60..7f - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // 80..9f - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // a0..bf - 8, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // c0..df - 0xa, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x4, 0x3, 0x3, // e0..ef - 0xb, 0x6, 0x6, 0x6, 0x5, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, // f0..ff - 0x0, 0x1, 0x2, 0x3, 0x5, 0x8, 0x7, 0x1, 0x1, 0x1, 0x4, 0x6, 0x1, 0x1, 0x1, 0x1, // s0..s0 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, // s1..s2 - 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, // s3..s4 - 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, // s5..s6 - 1, 3, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // s7..s8 -}; - -uint32_t inline utf8decode(uint32_t *state, uint32_t *codep, uint32_t byte) { - uint32_t type = utf8d[byte]; - - *codep = (*state != UTF8_ACCEPT) ? (byte & 0x3fu) | (*codep << 6) : (0xff >> type) & (byte); - - *state = utf8d[256 + *state * 16 + type]; - return *state; -} -/**************************************************************/ - -struct fonts_struct { // copied from parts/video/font/ttf/src.c - uint8 in_use; - uint8 *ttf_data; - int32 default_pixel_height; - uint8 bold; - uint8 italic; - uint8 underline; - uint8 monospace; - int32 monospace_width; - uint8 unicode; - //--------------------------------- - FT_Face handle; - int32 baseline; - float default_pixel_height_scale; -}; -extern img_struct *write_page; -extern int32 *font; -extern fonts_struct *fonts; - -FT_Face get_fhandle() { return fonts[font[write_page->font]].handle; } - -int get_defheight() { return fonts[font[write_page->font]].default_pixel_height; } - -int gp2px(int gp) { return (float)gp / get_fhandle()->units_per_EM * get_defheight(); } - -int uheight() { - switch (write_page->font) { - case 8: - return 9; - case 14: - return 15; - case 16: - return 17; - } - return gp2px(get_fhandle()->ascender - get_fhandle()->descender); -} - -int uascension() { - switch (write_page->font) { - case 8: - return 9; - case 14: - return 13; - case 16: - return 14; - } - return gp2px(get_fhandle()->ascender); -} - -int uspacing() { - if (write_page->font < 32) - return write_page->font; - return gp2px(get_fhandle()->height) + 2; -} - -extern uint8 charset8x8[256][8][8]; -extern uint8 charset8x16[256][16][8]; - -#ifdef QB64_64 -void uprint_extra(int32 startx, int32 starty, int64 str_in, int64 bytelen, int32 kern_wanted, int32 do_render, int32 *txtwidth, int64 charpos, int32 *chars, - uint32 colour, int32 max_width) { -#else -void uprint_extra(int32 startx, int32 starty, int32 str_in, int64 bytelen, int32 kern_wanted, int32 do_render, int32 *txtwidth, int64 charpos, int32 *chars, - uint32 colour, int32 max_width) { -#endif - int builtin = 0; - if (write_page->font < 32) { - builtin = 1; - } - - uint8 *str = (uint8 *)str_in; - uint32 cpindex, prev_state = 0, cur_state = 0, cp; - uint8 *builtin_start; - int cur_cpindex = 0; - FT_Face fhandle; - int prev_glyph = 0, glyph_index, error, kern; - FT_Vector kern_delta; - int pen_x, pen_y, draw_x, draw_y, pixmap_x, pixmap_y; - float alpha; - unsigned int rgb; - - pen_x = startx; - pen_y = starty; - if (builtin) { - pen_y += 2; - } else { - fhandle = get_fhandle(); - pen_y += uascension(); - if (FT_HAS_KERNING(fhandle) && kern_wanted) - kern = 1; - else - kern = 0; - } - - alpha = (colour >> 24) / 255.0; - rgb = colour & 0xffffff; - - for (cpindex = 0; cpindex < bytelen; prev_state = cur_state, cpindex++) { - // if (pen_x > im->width || pen_y > im->height) break; - if (max_width && (pen_x > startx + max_width)) - break; - if (charpos) - ((int32 *)charpos)[cur_cpindex] = pen_x - startx; - - switch (utf8decode(&cur_state, &cp, str[cpindex])) { - case UTF8_ACCEPT: - // good codepoint - cur_cpindex++; - break; - case UTF8_REJECT: - // codepoint would be U+FFFD (replacement character) - cp = 0xfffd; - cur_state = UTF8_ACCEPT; - if (prev_state != UTF8_ACCEPT) - cpindex--; - cur_cpindex++; - break; - default: - // need to read continuation bytes - continue; - break; - } - - if (builtin) { - if (max_width && (pen_x + 8 > startx + max_width)) - break; - if (cp > 255) - cp = 32; - switch (write_page->font) { - case 8: - builtin_start = &charset8x8[cp][0][0]; - break; - case 14: - builtin_start = &charset8x16[cp][1][0]; - break; - case 16: - builtin_start = &charset8x16[cp][0][0]; - break; - } - if (do_render) { - for (draw_y = pen_y, pixmap_y = 0; pixmap_y < write_page->font; draw_y++, pixmap_y++) { - for (draw_x = pen_x, pixmap_x = 0; pixmap_x < 8; draw_x++, pixmap_x++) { - if (*builtin_start++) - pset_and_clip(draw_x, draw_y, colour); - } - } - } - pen_x += 8; - } else { - glyph_index = FT_Get_Char_Index(fhandle, cp); - - if (kern && prev_glyph && glyph_index) { - FT_Get_Kerning(fhandle, prev_glyph, glyph_index, FT_KERNING_DEFAULT, &kern_delta); - pen_x += gp2px(kern_delta.x); - } - - error = FT_Load_Glyph(fhandle, glyph_index, FT_LOAD_DEFAULT); - if (error) - continue; - error = FT_Render_Glyph(fhandle->glyph, FT_RENDER_MODE_NORMAL); - if (error) - continue; - - if (max_width && (pen_x + fhandle->glyph->bitmap.width > startx + max_width)) - break; - if (do_render) { - for (draw_y = pen_y - fhandle->glyph->bitmap_top, pixmap_y = 0; pixmap_y < fhandle->glyph->bitmap.rows; draw_y++, pixmap_y++) { - for (draw_x = pen_x + fhandle->glyph->bitmap_left, pixmap_x = 0; pixmap_x < fhandle->glyph->bitmap.width; draw_x++, pixmap_x++) { - if (write_page->compatible_mode == 32 && !write_page->alpha_disabled) { - pset_and_clip(draw_x, draw_y, - ((int)(fhandle->glyph->bitmap.buffer[pixmap_y * fhandle->glyph->bitmap.width + pixmap_x] * alpha) << 24) | rgb); - } else { - if (fhandle->glyph->bitmap.buffer[pixmap_y * fhandle->glyph->bitmap.width + pixmap_x] > 102) { - pset_and_clip(draw_x, draw_y, colour); - } - } - } - } - } - pen_x += fhandle->glyph->advance.x / 64; - prev_glyph = glyph_index; - } - - if (txtwidth) - *txtwidth = pen_x - startx; - if (chars) - *chars = cur_cpindex; - } - if (charpos) - ((int32 *)charpos)[cur_cpindex] = pen_x - startx; -} - -int32 uprint(int32 startx, int32 starty, char *str_in, int64 bytelen, uint32 colour, int32 max_width) { - int32 txtwidth; -#ifdef QB64_64 - uprint_extra(startx, starty, (int64)str_in, bytelen, -1, 1, &txtwidth, 0, 0, colour, max_width); -#else - uprint_extra(startx, starty, (int32)str_in, bytelen, -1, 1, &txtwidth, 0, 0, colour, max_width); -#endif - return txtwidth; -} - -int32 uprintwidth(char *str_in, int64 bytelen, int32 max_width) { - int32 txtwidth; -#ifdef QB64_64 - uprint_extra(0, 0, (int64)str_in, bytelen, -1, 0, &txtwidth, 0, 0, 0, max_width); -#else - uprint_extra(0, 0, (int32)str_in, bytelen, -1, 0, &txtwidth, 0, 0, 0, max_width); -#endif - return txtwidth; -} diff --git a/InForm/ini.bi b/InForm/ini.bi index 314568c..9b6b30b 100644 --- a/InForm/ini.bi +++ b/InForm/ini.bi @@ -4,18 +4,21 @@ 'This file isn't required to be at the top of your programs, 'unless you intend to use OPTION _EXPLICIT -'Global variables declaration -DIM currentIniFileName$ -DIM currentIniFileLOF AS _UNSIGNED LONG -DIM IniWholeFile$ -DIM IniSectionData$ -DIM IniPosition AS _UNSIGNED LONG -DIM IniNewFile$ -DIM IniLastSection$ -DIM IniLastKey$ -DIM IniLF$ -DIM IniDisableAutoCommit -DIM IniCODE -DIM IniAllowBasicComments -DIM IniForceReload +$IF INI_BI = UNDEFINED THEN + $LET INI_BI = TRUE + 'Global variables declaration + DIM currentIniFileName$ + DIM currentIniFileLOF AS _UNSIGNED LONG + DIM IniWholeFile$ + DIM IniSectionData$ + DIM IniPosition AS _UNSIGNED LONG + DIM IniNewFile$ + DIM IniLastSection$ + DIM IniLastKey$ + DIM IniLF$ + DIM IniDisableAutoCommit + DIM IniCODE + DIM IniAllowBasicComments + DIM IniForceReload +$END IF diff --git a/InForm/ini.bm b/InForm/ini.bm index 1c34613..a3164b2 100644 --- a/InForm/ini.bm +++ b/InForm/ini.bm @@ -1,192 +1,180 @@ 'INI Manager - Beta 4 'Fellippe Heitor, 2017 - fellippe@qb64.org - @fellippeheitor -SUB IniSortSection (file$, __section$) - SHARED IniCODE, IniLastKey$, IniWholeFile$ - SHARED IniDisableAutoCommit +'$Include:'ini.bi' - REDIM Keys(1 TO 100) AS STRING - DIM TotalKeys, tempValue$, i AS LONG, Backup$, CommitBackup +$IF INI_BM = UNDEFINED THEN + $LET INI_BM = TRUE + SUB IniSortSection (file$, __section$) + SHARED IniCODE, IniLastKey$, IniWholeFile$ + SHARED IniDisableAutoCommit - IF IniFormatSection$(__section$) = "[]" THEN IniCODE = 15: EXIT SUB + REDIM Keys(1 TO 100) AS STRING + DIM TotalKeys, tempValue$, i AS LONG, Backup$, CommitBackup - DO - tempValue$ = ReadSetting(file$, __section$, "") - IF LEFT$(IniINFO$, 7) = "ERROR: " THEN EXIT SUB - IF IniCODE = 10 THEN EXIT DO + IF IniFormatSection$(__section$) = "[]" THEN IniCODE = 15: EXIT SUB - TotalKeys = TotalKeys + 1 - IF TotalKeys > UBOUND(Keys) THEN - REDIM _PRESERVE Keys(1 TO UBOUND(Keys) + 100) AS STRING - END IF + DO + tempValue$ = ReadSetting(file$, __section$, "") + IF LEFT$(IniINFO$, 7) = "ERROR: " THEN EXIT SUB + IF IniCODE = 10 THEN EXIT DO - Keys(TotalKeys) = IniLastKey$ + "=" + tempValue$ - LOOP + TotalKeys = TotalKeys + 1 + IF TotalKeys > UBOUND(Keys) THEN + REDIM _PRESERVE Keys(1 TO UBOUND(Keys) + 100) AS STRING + END IF - REDIM _PRESERVE Keys(1 TO TotalKeys) AS STRING - IF IniArraySort(Keys()) = 0 THEN IniCODE = 23: EXIT SUB + Keys(TotalKeys) = IniLastKey$ + "=" + tempValue$ + LOOP - CommitBackup = IniDisableAutoCommit - IniDisableAutoCommit = -1 'Prevent every minor change from being written to disk - Backup$ = IniWholeFile$ + REDIM _PRESERVE Keys(1 TO TotalKeys) AS STRING + IF IniArraySort(Keys()) = 0 THEN IniCODE = 23: EXIT SUB - FOR i = 1 TO TotalKeys - IniDeleteKey file$, __section$, LEFT$(Keys(i), INSTR(Keys(i), "=") - 1) - IF LEFT$(IniINFO$, 7) = "ERROR: " THEN - IniDisableAutoCommit = CommitBackup - IniWholeFile$ = Backup$ - EXIT SUB - END IF - NEXT + CommitBackup = IniDisableAutoCommit + IniDisableAutoCommit = -1 'Prevent every minor change from being written to disk + Backup$ = IniWholeFile$ - FOR i = 1 TO TotalKeys - WriteSetting file$, __section$, LEFT$(Keys(i), INSTR(Keys(i), "=") - 1), MID$(Keys(i), INSTR(Keys(i), "=") + 1) - IF LEFT$(IniINFO$, 7) = "ERROR: " THEN - IniDisableAutoCommit = CommitBackup - IniWholeFile$ = Backup$ - EXIT SUB - END IF - NEXT - - IniDisableAutoCommit = CommitBackup 'Restore writing to disk (or previously set state) and - IniCommit ' commit changes. - - IniCODE = 22 -END SUB - -SUB IniDeleteSection (file$, __section$) - SHARED IniNewFile$, IniCODE, currentIniFileName$ - SHARED IniLF$, IniWholeFile$, currentIniFileLOF AS _UNSIGNED LONG - - IniLoad file$ - IF IniCODE THEN EXIT SUB - - DIM a$ - IniCODE = 0 - a$ = IniGetSection(__section$) - IF IniCODE THEN EXIT SUB - - IniNewFile$ = LEFT$(IniWholeFile$, INSTR(IniWholeFile$, a$) - 1) - IniNewFile$ = IniNewFile$ + MID$(IniWholeFile$, INSTR(IniWholeFile$, a$) + LEN(a$ + IniLF$)) - - IniCommit - IniCODE = 13 -END SUB - -SUB IniDeleteKey (file$, __section$, __key$) - SHARED IniPosition AS _UNSIGNED LONG, IniCODE - SHARED IniLF$, IniWholeFile$, IniSectionData$ - SHARED IniLastSection$, IniLastKey$, IniNewFile$ - - DIM tempValue$, fileNum AS INTEGER - DIM section$, key$, thisLine$ - DIM FoundLF AS _UNSIGNED LONG - - IniCODE = 0 - - 'prepare variables for the write operation - section$ = IniFormatSection$(__section$) - IF IniCODE THEN EXIT SUB - - key$ = LTRIM$(RTRIM$(__key$)) - IF key$ = "" THEN IniCODE = 12: EXIT SUB - IniLastKey$ = key$ - - 'Read the existing key to fill IniPosition - tempValue$ = ReadSetting$(file$, section$, key$) - IF IniCODE > 0 AND IniCODE <> 2 THEN EXIT SUB 'key not found - - 'map IniPosition (set in the section block) to the global file position - IniPosition = INSTR(IniWholeFile$, IniSectionData$) + IniPosition - 1 - - FoundLF = INSTR(IniPosition, IniWholeFile$, IniLF$) - IF FoundLF = 0 THEN FoundLF = LEN(IniWholeFile$) - - IniNewFile$ = LEFT$(IniWholeFile$, IniPosition - 1) + MID$(IniWholeFile$, FoundLF + LEN(IniLF$)) - - IniCommit - IniCODE = 19 -END SUB - -SUB IniMoveKey (file$, __section$, __key$, __newsection$) - 'A move operation is a copy operation + a delete operation - - SHARED IniCODE - - DIM tempValue$ - - tempValue$ = ReadSetting(file$, __section$, __key$) - IF IniCODE > 0 AND IniCODE <> 2 THEN EXIT SUB - - WriteSetting file$, __newsection$, __key$, tempValue$ - IF IniCODE > 0 AND IniCODE <> 2 AND IniCODE <> 7 AND IniCODE <> 9 THEN EXIT SUB - - IniDeleteKey file$, __section$, __key$ - IF IniCODE = 19 THEN IniCODE = 20 -END SUB - -SUB IniCommit - SHARED currentIniFileName$, IniWholeFile$, currentIniFileLOF AS _UNSIGNED LONG - SHARED IniNewFile$, IniDisableAutoCommit, IniCODE - - IF currentIniFileName$ = "" THEN IniCODE = 18: EXIT SUB - - IniWholeFile$ = IniNewFile$ - currentIniFileLOF = LEN(IniNewFile$) - - IF NOT IniDisableAutoCommit THEN - DIM fileNum AS INTEGER - fileNum = FREEFILE - - OPEN currentIniFileName$ FOR BINARY AS #fileNum - - IF LEN(IniWholeFile$) < LOF(fileNum) THEN - CLOSE fileNum - OPEN currentIniFileName$ FOR OUTPUT AS #fileNum: CLOSE #fileNum - OPEN currentIniFileName$ FOR BINARY AS #fileNum - END IF - - PUT #fileNum, 1, IniNewFile$ - CLOSE #fileNum - END IF -END SUB - -FUNCTION IniGetSection$ (__section$) - SHARED IniPosition AS _UNSIGNED LONG, IniCODE, currentIniFileName$ - SHARED IniLF$, IniWholeFile$, currentIniFileLOF AS _UNSIGNED LONG - - IF currentIniFileName$ = "" THEN IniCODE = 18: EXIT FUNCTION - IF currentIniFileLOF = 0 OR LEN(LTRIM$(RTRIM$(IniWholeFile$))) = 0 THEN IniCODE = 17: EXIT FUNCTION - - IniCODE = 0 - - DIM section$, foundSection AS _UNSIGNED LONG, endSection AS _UNSIGNED LONG - DIM i AS _UNSIGNED LONG, Bracket1 AS _UNSIGNED LONG, sectionStart AS _UNSIGNED LONG - DIM inQuote AS _BYTE - - section$ = IniFormatSection$(__section$) - IF IniCODE THEN EXIT FUNCTION - - IF section$ = "[]" THEN - 'fetch the "global" section, if present - sectionStart = INSTR(IniWholeFile$, "[") - IF sectionStart = 0 THEN IniGetSection$ = IniWholeFile$: EXIT FUNCTION - - FOR i = sectionStart - 1 TO 1 STEP -1 - IF ASC(IniWholeFile$, i) = 10 THEN foundSection = i + 1: EXIT FOR - IF ASC(IniWholeFile$, i) <> 32 THEN EXIT FOR + FOR i = 1 TO TotalKeys + IniDeleteKey file$, __section$, LEFT$(Keys(i), INSTR(Keys(i), "=") - 1) + IF LEFT$(IniINFO$, 7) = "ERROR: " THEN + IniDisableAutoCommit = CommitBackup + IniWholeFile$ = Backup$ + EXIT SUB + END IF NEXT - IF i = 0 THEN foundSection = 1 + FOR i = 1 TO TotalKeys + WriteSetting file$, __section$, LEFT$(Keys(i), INSTR(Keys(i), "=") - 1), MID$(Keys(i), INSTR(Keys(i), "=") + 1) + IF LEFT$(IniINFO$, 7) = "ERROR: " THEN + IniDisableAutoCommit = CommitBackup + IniWholeFile$ = Backup$ + EXIT SUB + END IF + NEXT - IniGetSection$ = LEFT$(IniWholeFile$, foundSection - 1) - ELSE - DO - sectionStart = INSTR(sectionStart + 1, LCASE$(IniWholeFile$), LCASE$(section$)) - IF sectionStart = 0 THEN IniCODE = 14: EXIT DO + IniDisableAutoCommit = CommitBackup 'Restore writing to disk (or previously set state) and + IniCommit ' commit changes. + + IniCODE = 22 + END SUB + + SUB IniDeleteSection (file$, __section$) + SHARED IniNewFile$, IniCODE, currentIniFileName$ + SHARED IniLF$, IniWholeFile$, currentIniFileLOF AS _UNSIGNED LONG + + IniLoad file$ + IF IniCODE THEN EXIT SUB + + DIM a$ + IniCODE = 0 + a$ = IniGetSection(__section$) + IF IniCODE THEN EXIT SUB + + IniNewFile$ = LEFT$(IniWholeFile$, INSTR(IniWholeFile$, a$) - 1) + IniNewFile$ = IniNewFile$ + MID$(IniWholeFile$, INSTR(IniWholeFile$, a$) + LEN(a$ + IniLF$)) + + IniCommit + IniCODE = 13 + END SUB + + SUB IniDeleteKey (file$, __section$, __key$) + SHARED IniPosition AS _UNSIGNED LONG, IniCODE + SHARED IniLF$, IniWholeFile$, IniSectionData$ + SHARED IniLastSection$, IniLastKey$, IniNewFile$ + + DIM tempValue$, section$, key$ + DIM FoundLF AS _UNSIGNED LONG + + IniCODE = 0 + + 'prepare variables for the write operation + section$ = IniFormatSection$(__section$) + IF IniCODE THEN EXIT SUB + + key$ = LTRIM$(RTRIM$(__key$)) + IF key$ = "" THEN IniCODE = 12: EXIT SUB + IniLastKey$ = key$ + + 'Read the existing key to fill IniPosition + tempValue$ = ReadSetting$(file$, section$, key$) + IF IniCODE > 0 AND IniCODE <> 2 THEN EXIT SUB 'key not found + + 'map IniPosition (set in the section block) to the global file position + IniPosition = INSTR(IniWholeFile$, IniSectionData$) + IniPosition - 1 + + FoundLF = INSTR(IniPosition, IniWholeFile$, IniLF$) + IF FoundLF = 0 THEN FoundLF = LEN(IniWholeFile$) + + IniNewFile$ = LEFT$(IniWholeFile$, IniPosition - 1) + MID$(IniWholeFile$, FoundLF + LEN(IniLF$)) + + IniCommit + IniCODE = 19 + END SUB + + SUB IniMoveKey (file$, __section$, __key$, __newsection$) + 'A move operation is a copy operation + a delete operation + + SHARED IniCODE + + DIM tempValue$ + + tempValue$ = ReadSetting(file$, __section$, __key$) + IF IniCODE > 0 AND IniCODE <> 2 THEN EXIT SUB + + WriteSetting file$, __newsection$, __key$, tempValue$ + IF IniCODE > 0 AND IniCODE <> 2 AND IniCODE <> 7 AND IniCODE <> 9 THEN EXIT SUB + + IniDeleteKey file$, __section$, __key$ + IF IniCODE = 19 THEN IniCODE = 20 + END SUB + + SUB IniCommit + SHARED currentIniFileName$, IniWholeFile$, currentIniFileLOF AS _UNSIGNED LONG + SHARED IniNewFile$, IniDisableAutoCommit, IniCODE + + IF currentIniFileName$ = "" THEN IniCODE = 18: EXIT SUB + + IniWholeFile$ = IniNewFile$ + currentIniFileLOF = LEN(IniNewFile$) + + IF NOT IniDisableAutoCommit THEN + DIM fileNum AS INTEGER + fileNum = FREEFILE + + OPEN currentIniFileName$ FOR BINARY AS #fileNum + + IF LEN(IniWholeFile$) < LOF(fileNum) THEN + CLOSE fileNum + OPEN currentIniFileName$ FOR OUTPUT AS #fileNum: CLOSE #fileNum + OPEN currentIniFileName$ FOR BINARY AS #fileNum + END IF + + PUT #fileNum, 1, IniNewFile$ + CLOSE #fileNum + END IF + END SUB + + FUNCTION IniGetSection$ (__section$) + SHARED IniPosition AS _UNSIGNED LONG, IniCODE, currentIniFileName$ + SHARED IniLF$, IniWholeFile$, currentIniFileLOF AS _UNSIGNED LONG + + IF currentIniFileName$ = "" THEN IniCODE = 18: EXIT FUNCTION + IF currentIniFileLOF = 0 OR LEN(LTRIM$(RTRIM$(IniWholeFile$))) = 0 THEN IniCODE = 17: EXIT FUNCTION + + IniCODE = 0 + + DIM section$, foundSection AS _UNSIGNED LONG, endSection AS _UNSIGNED LONG + DIM i AS _UNSIGNED LONG, Bracket1 AS _UNSIGNED LONG, sectionStart AS _UNSIGNED LONG + DIM inQuote AS _BYTE + + section$ = IniFormatSection$(__section$) + IF IniCODE THEN EXIT FUNCTION + + IF section$ = "[]" THEN + 'fetch the "global" section, if present + sectionStart = INSTR(IniWholeFile$, "[") + IF sectionStart = 0 THEN IniGetSection$ = IniWholeFile$: EXIT FUNCTION - 'make sure it's a valid section header - foundSection = 0 FOR i = sectionStart - 1 TO 1 STEP -1 IF ASC(IniWholeFile$, i) = 10 THEN foundSection = i + 1: EXIT FOR IF ASC(IniWholeFile$, i) <> 32 THEN EXIT FOR @@ -194,565 +182,581 @@ FUNCTION IniGetSection$ (__section$) IF i = 0 THEN foundSection = 1 - IF foundSection > 0 THEN - 'we found it; time to identify where this section ends - '(either another [section] or the end of the file - Bracket1 = sectionStart - checkAgain: - Bracket1 = INSTR(Bracket1 + 1, IniWholeFile$, "[") + IniGetSection$ = LEFT$(IniWholeFile$, foundSection - 1) + ELSE + DO + sectionStart = INSTR(sectionStart + 1, LCASE$(IniWholeFile$), LCASE$(section$)) + IF sectionStart = 0 THEN IniCODE = 14: EXIT DO - IF Bracket1 > 0 THEN - 'found a bracket; check if it's inside quotes - inQuote = 0 - FOR i = 1 TO Bracket1 - 1 - IF ASC(IniWholeFile$, i) = 34 THEN inQuote = NOT inQuote - NEXT - IF inQuote THEN GOTO checkAgain + 'make sure it's a valid section header + foundSection = 0 + FOR i = sectionStart - 1 TO 1 STEP -1 + IF ASC(IniWholeFile$, i) = 10 THEN foundSection = i + 1: EXIT FOR + IF ASC(IniWholeFile$, i) <> 32 THEN EXIT FOR + NEXT - FOR i = Bracket1 - 1 TO 1 STEP -1 - IF ASC(IniWholeFile$, i) = 10 THEN endSection = i + 1 - LEN(IniLF$): EXIT FOR - IF ASC(IniWholeFile$, i) = 61 THEN GOTO checkAgain 'bracket is inside a key's value - IF i <= foundSection THEN EXIT FOR - NEXT - IniGetSection$ = MID$(IniWholeFile$, foundSection, endSection - foundSection) - ELSE - IniGetSection$ = MID$(IniWholeFile$, foundSection) + IF i = 0 THEN foundSection = 1 + + IF foundSection > 0 THEN + 'we found it; time to identify where this section ends + '(either another [section] or the end of the file + Bracket1 = sectionStart + checkAgain: + Bracket1 = INSTR(Bracket1 + 1, IniWholeFile$, "[") + + IF Bracket1 > 0 THEN + 'found a bracket; check if it's inside quotes + inQuote = 0 + FOR i = 1 TO Bracket1 - 1 + IF ASC(IniWholeFile$, i) = 34 THEN inQuote = NOT inQuote + NEXT + IF inQuote THEN GOTO checkAgain + + FOR i = Bracket1 - 1 TO 1 STEP -1 + IF ASC(IniWholeFile$, i) = 10 THEN endSection = i + 1 - LEN(IniLF$): EXIT FOR + IF ASC(IniWholeFile$, i) = 61 THEN GOTO checkAgain 'bracket is inside a key's value + IF i <= foundSection THEN EXIT FOR + NEXT + IniGetSection$ = MID$(IniWholeFile$, foundSection, endSection - foundSection) + ELSE + IniGetSection$ = MID$(IniWholeFile$, foundSection) + END IF + EXIT FUNCTION END IF + LOOP + END IF + END FUNCTION + + FUNCTION IniFormatSection$ (__section$) + SHARED IniCODE + + DIM section$ + + section$ = LTRIM$(RTRIM$(__section$)) + + 'sections are in the format [section name] - add brackets if not passed + IF LEFT$(section$, 1) <> "[" THEN section$ = "[" + section$ + IF RIGHT$(section$, 1) <> "]" THEN section$ = section$ + "]" + + IF INSTR(MID$(section$, 2, LEN(section$) - 3), "[") OR INSTR(MID$(section$, 2, LEN(section$) - 3), "]") THEN + IniCODE = 15 + EXIT FUNCTION + END IF + + IniFormatSection$ = section$ + END FUNCTION + + FUNCTION ReadSetting$ (file$, __section$, __key$) + SHARED IniLastSection$, IniLastKey$, IniWholeFile$, IniLF$ + SHARED IniPosition AS _UNSIGNED LONG, IniSectionData$ + SHARED IniCODE, IniAllowBasicComments + SHARED currentIniFileLOF AS _UNSIGNED LONG + + IniLoad file$ + IF IniCODE THEN EXIT FUNCTION + + IF currentIniFileLOF = 0 OR LEN(LTRIM$(RTRIM$(IniWholeFile$))) = 0 THEN IniCODE = 17: EXIT FUNCTION + + DIM Equal AS _UNSIGNED LONG, tempValue$, key$, section$ + DIM Quote AS _UNSIGNED LONG, Comment AS _UNSIGNED LONG + DIM i AS LONG, FoundLF AS _UNSIGNED LONG + + section$ = IniFormatSection(__section$) + IF IniCODE THEN EXIT FUNCTION + + 'fetch the desired section$ + IniSectionData$ = IniGetSection(section$) + IF IniCODE > 0 AND IniCODE <> 17 THEN EXIT FUNCTION + + IF LEN(IniSectionData$) = 0 AND section$ <> "[]" THEN IniCODE = 14: EXIT FUNCTION + + IniLastSection$ = section$ + + IniPosition = 0 + + key$ = LTRIM$(RTRIM$(__key$)) + IniLastKey$ = "" + IF key$ = "" THEN + IF section$ = "[]" THEN IniSectionData$ = IniWholeFile$ + key$ = IniNextKey + IF IniCODE THEN EXIT FUNCTION + IF key$ = "" THEN + IniCODE = 10 EXIT FUNCTION END IF - LOOP - END IF -END FUNCTION - -FUNCTION IniFormatSection$ (__section$) - SHARED IniCODE - - DIM section$ - - section$ = LTRIM$(RTRIM$(__section$)) - - 'sections are in the format [section name] - add brackets if not passed - IF LEFT$(section$, 1) <> "[" THEN section$ = "[" + section$ - IF RIGHT$(section$, 1) <> "]" THEN section$ = section$ + "]" - - IF INSTR(MID$(section$, 2, LEN(section$) - 3), "[") OR INSTR(MID$(section$, 2, LEN(section$) - 3), "]") THEN - IniCODE = 15 - EXIT FUNCTION - END IF - - IniFormatSection$ = section$ -END FUNCTION - -FUNCTION ReadSetting$ (file$, __section$, __key$) - SHARED IniLastSection$, IniLastKey$, IniWholeFile$, IniLF$ - SHARED IniPosition AS _UNSIGNED LONG, IniSectionData$ - SHARED IniCODE, IniAllowBasicComments - SHARED currentIniFileLOF AS _UNSIGNED LONG - - IniLoad file$ - IF IniCODE THEN EXIT SUB - - IF currentIniFileLOF = 0 OR LEN(LTRIM$(RTRIM$(IniWholeFile$))) = 0 THEN IniCODE = 17: EXIT FUNCTION - - DIM Equal AS _UNSIGNED LONG, tempValue$, key$, section$ - DIM Quote AS _UNSIGNED LONG, Comment AS _UNSIGNED LONG - DIM i AS LONG, FoundLF AS _UNSIGNED LONG - - section$ = IniFormatSection(__section$) - IF IniCODE THEN EXIT SUB - - 'fetch the desired section$ - IniSectionData$ = IniGetSection(section$) - IF IniCODE > 0 AND IniCODE <> 17 THEN EXIT SUB - - IF LEN(IniSectionData$) = 0 AND section$ <> "[]" THEN IniCODE = 14: EXIT SUB - - IniLastSection$ = section$ - - IniPosition = 0 - - key$ = LTRIM$(RTRIM$(__key$)) - IniLastKey$ = "" - IF key$ = "" THEN - IF section$ = "[]" THEN IniSectionData$ = IniWholeFile$ - key$ = IniNextKey - IF IniCODE THEN EXIT SUB - IF key$ = "" THEN - IniCODE = 10 - EXIT SUB - END IF - END IF - - IF LEFT$(key$, 1) = ";" OR LEFT$(key$, 1) = "'" OR INSTR(key$, "[") > 0 OR INSTR(key$, "]") > 0 OR INSTR(key$, "=") > 0 THEN - IniCODE = 12 - EXIT SUB - END IF - - IniLastKey$ = key$ - - IF IniPosition > 0 THEN Equal = IniPosition: GOTO KeyFound - CheckKey: - IniPosition = INSTR(IniPosition + 1, LCASE$(IniSectionData$), LCASE$(key$)) - - IF IniPosition > 0 THEN - 'identify if this occurrence is actually a key and not part of a key name/value - FOR i = IniPosition - 1 TO 1 STEP -1 - IF ASC(IniSectionData$, i) = 10 THEN EXIT FOR - IF ASC(IniSectionData$, i) <> 10 AND ASC(IniSectionData$, i) <> 32 THEN - 'not a key - GOTO CheckKey - END IF - NEXT - - 'check if there's nothing but an equal sign ahead - FOR i = IniPosition + LEN(key$) TO LEN(IniSectionData$) - IF ASC(IniSectionData$, i) = ASC("=") THEN EXIT FOR - IF ASC(IniSectionData$, i) <> ASC("=") AND ASC(IniSectionData$, i) <> 32 THEN - 'not the key - GOTO CheckKey - END IF - NEXT - - 'so far so good; check if there is an assignment - Equal = INSTR(IniPosition, IniSectionData$, "=") - KeyFound: - FoundLF = INSTR(IniPosition, IniSectionData$, IniLF$) - - IF FoundLF > 0 THEN - IF Equal > FoundLF THEN GOTO CheckKey - ELSE - FoundLF = LEN(IniSectionData$) + 1 - IF Equal = 0 THEN GOTO CheckKey END IF - tempValue$ = LTRIM$(RTRIM$(MID$(IniSectionData$, Equal + 1, FoundLF - Equal - 1))) + IF LEFT$(key$, 1) = ";" OR LEFT$(key$, 1) = "'" OR INSTR(key$, "[") > 0 OR INSTR(key$, "]") > 0 OR INSTR(key$, "=") > 0 THEN + IniCODE = 12 + EXIT FUNCTION + END IF - IF LEN(tempValue$) > 0 THEN - IF LEFT$(tempValue$, 1) = CHR$(34) THEN - tempValue$ = MID$(tempValue$, 2) - Quote = INSTR(tempValue$, CHR$(34)) - IF Quote > 0 THEN - tempValue$ = LEFT$(tempValue$, Quote - 1) + IniLastKey$ = key$ + + IF IniPosition > 0 THEN Equal = IniPosition: GOTO KeyFound + CheckKey: + IniPosition = INSTR(IniPosition + 1, LCASE$(IniSectionData$), LCASE$(key$)) + + IF IniPosition > 0 THEN + 'identify if this occurrence is actually a key and not part of a key name/value + FOR i = IniPosition - 1 TO 1 STEP -1 + IF ASC(IniSectionData$, i) = 10 THEN EXIT FOR + IF ASC(IniSectionData$, i) <> 10 AND ASC(IniSectionData$, i) <> 32 THEN + 'not a key + GOTO CheckKey + END IF + NEXT + + 'check if there's nothing but an equal sign ahead + FOR i = IniPosition + LEN(key$) TO LEN(IniSectionData$) + IF ASC(IniSectionData$, i) = ASC("=") THEN EXIT FOR + IF ASC(IniSectionData$, i) <> ASC("=") AND ASC(IniSectionData$, i) <> 32 THEN + 'not the key + GOTO CheckKey + END IF + NEXT + + 'so far so good; check if there is an assignment + Equal = INSTR(IniPosition, IniSectionData$, "=") + KeyFound: + FoundLF = INSTR(IniPosition, IniSectionData$, IniLF$) + + IF FoundLF > 0 THEN + IF Equal > FoundLF THEN GOTO CheckKey + ELSE + FoundLF = LEN(IniSectionData$) + 1 + IF Equal = 0 THEN GOTO CheckKey + END IF + + tempValue$ = LTRIM$(RTRIM$(MID$(IniSectionData$, Equal + 1, FoundLF - Equal - 1))) + + IF LEN(tempValue$) > 0 THEN + IF LEFT$(tempValue$, 1) = CHR$(34) THEN + tempValue$ = MID$(tempValue$, 2) + Quote = INSTR(tempValue$, CHR$(34)) + IF Quote > 0 THEN + tempValue$ = LEFT$(tempValue$, Quote - 1) + END IF + ELSE + IF IniAllowBasicComments THEN Comment = INSTR(tempValue$, "'") 'BASIC style comments accepted + IF Comment = 0 THEN Comment = INSTR(tempValue$, ";") + IF Comment > 0 THEN + tempValue$ = LTRIM$(RTRIM$(LEFT$(tempValue$, Comment - 1))) + END IF END IF ELSE - IF IniAllowBasicComments THEN Comment = INSTR(tempValue$, "'") 'BASIC style comments accepted - IF Comment = 0 THEN Comment = INSTR(tempValue$, ";") - IF Comment > 0 THEN - tempValue$ = LTRIM$(RTRIM$(LEFT$(tempValue$, Comment - 1))) - END IF + IniCODE = 2 END IF ELSE - IniCODE = 2 - END IF - ELSE - IniCODE = 3 - EXIT FUNCTION - END IF - - ReadSetting$ = tempValue$ - IniLastSection$ = IniCurrentSection$ -END SUB - -FUNCTION IniCurrentSection$ - SHARED IniPosition AS _UNSIGNED LONG, IniSectionData$, IniWholeFile$ - - DIM GlobalPosition AS _UNSIGNED LONG, i AS _UNSIGNED LONG - DIM ClosingBracket AS _UNSIGNED LONG - - GlobalPosition = INSTR(IniWholeFile$, IniSectionData$) + IniPosition - 1 - - CheckSection: - FOR i = GlobalPosition - 1 TO 1 STEP -1 - IF ASC(IniWholeFile$, i) = ASC("[") THEN - GlobalPosition = i: EXIT FOR - END IF - NEXT - - IF i = 0 THEN IniCurrentSection$ = "[]": EXIT FUNCTION - - 'identify if this occurrence is actually a section header and not something else - FOR i = GlobalPosition - 1 TO 1 STEP -1 - IF ASC(IniWholeFile$, i) = 10 THEN EXIT FOR - IF ASC(IniWholeFile$, i) <> 10 AND ASC(IniWholeFile$, i) <> 32 THEN - 'not a section header - GOTO CheckSection - END IF - NEXT - - ClosingBracket = INSTR(GlobalPosition, IniWholeFile$, "]") - IF ClosingBracket > 0 THEN - IniCurrentSection$ = MID$(IniWholeFile$, GlobalPosition, ClosingBracket - GlobalPosition + 1) - END IF -END FUNCTION - -SUB WriteSetting (file$, __section$, __key$, __value$) - SHARED IniPosition AS _UNSIGNED LONG, IniCODE, currentIniFileName$ - SHARED IniLF$, IniWholeFile$, IniSectionData$ - SHARED IniLastSection$, IniLastKey$, IniNewFile$ - - DIM tempValue$, section$, key$, value$, thisLine$ - - IniCODE = 0 - - 'prepare variables for the write operation - section$ = IniFormatSection$(__section$) - IF IniCODE THEN EXIT SUB - - key$ = LTRIM$(RTRIM$(__key$)) - IF key$ = "" THEN IniCODE = 12: EXIT SUB - IniLastKey$ = key$ - - value$ = LTRIM$(RTRIM$(__value$)) - IF LTRIM$(STR$(VAL(value$))) <> value$ THEN - 'if not a numeric value and value contains spaces, add quotation marks - IF INSTR(value$, CHR$(32)) THEN value$ = CHR$(34) + value$ + CHR$(34) - END IF - - 'Read the existing key to fill IniPosition - tempValue$ = ReadSetting$(file$, section$, key$) - - 'map IniPosition (set in the section block) to the global file position - IniPosition = INSTR(IniWholeFile$, IniSectionData$) + IniPosition - 1 - - IF IniCODE = 1 OR IniCODE = 17 THEN - 'file not found or empty; create a new one - IF file$ = "" THEN file$ = currentIniFileName$ - IF file$ = "" THEN IniCODE = 21: EXIT SUB - - currentIniFileName$ = file$ - - IF section$ <> "[]" THEN - IniNewFile$ = section$ + IniLF$ + IniCODE = 3 + EXIT FUNCTION END IF - IniNewFile$ = IniNewFile$ + key$ + "=" + value$ + ReadSetting$ = tempValue$ + IniLastSection$ = IniCurrentSection$ + END FUNCTION + + FUNCTION IniCurrentSection$ + SHARED IniPosition AS _UNSIGNED LONG, IniSectionData$, IniWholeFile$ + + DIM GlobalPosition AS _UNSIGNED LONG, i AS _UNSIGNED LONG + DIM ClosingBracket AS _UNSIGNED LONG + + GlobalPosition = INSTR(IniWholeFile$, IniSectionData$) + IniPosition - 1 + + CheckSection: + FOR i = GlobalPosition - 1 TO 1 STEP -1 + IF ASC(IniWholeFile$, i) = ASC("[") THEN + GlobalPosition = i: EXIT FOR + END IF + NEXT + + IF i = 0 THEN IniCurrentSection$ = "[]": EXIT FUNCTION + + 'identify if this occurrence is actually a section header and not something else + FOR i = GlobalPosition - 1 TO 1 STEP -1 + IF ASC(IniWholeFile$, i) = 10 THEN EXIT FOR + IF ASC(IniWholeFile$, i) <> 10 AND ASC(IniWholeFile$, i) <> 32 THEN + 'not a section header + GOTO CheckSection + END IF + NEXT + + ClosingBracket = INSTR(GlobalPosition, IniWholeFile$, "]") + IF ClosingBracket > 0 THEN + IniCurrentSection$ = MID$(IniWholeFile$, GlobalPosition, ClosingBracket - GlobalPosition + 1) + END IF + END FUNCTION + + SUB WriteSetting (file$, __section$, __key$, __value$) + SHARED IniPosition AS _UNSIGNED LONG, IniCODE, currentIniFileName$ + SHARED IniLF$, IniWholeFile$, IniSectionData$ + SHARED IniLastSection$, IniLastKey$, IniNewFile$ + + DIM tempValue$, section$, key$, value$ IniCODE = 0 - IniCommit - IniLoad file$ - IF IniCODE = 0 THEN IniCODE = 11 - IniLastSection$ = section$ - EXIT SUB - END IF - IF IniCODE = 0 OR IniCODE = 2 THEN 'key found and read back; write new value$ - IF LCASE$(IniLastSection$) = LCASE$(section$) THEN - IF LTRIM$(RTRIM$(__value$)) = tempValue$ AND LEN(LTRIM$(RTRIM$(__value$))) > 0 THEN - 'identical values skip the writing routine - IniCODE = 8 + 'prepare variables for the write operation + section$ = IniFormatSection$(__section$) + IF IniCODE THEN EXIT SUB + + key$ = LTRIM$(RTRIM$(__key$)) + IF key$ = "" THEN IniCODE = 12: EXIT SUB + IniLastKey$ = key$ + + value$ = LTRIM$(RTRIM$(__value$)) + IF LTRIM$(STR$(VAL(value$))) <> value$ THEN + 'if not a numeric value and value contains spaces, add quotation marks + IF INSTR(value$, CHR$(32)) THEN value$ = CHR$(34) + value$ + CHR$(34) + END IF + + 'Read the existing key to fill IniPosition + tempValue$ = ReadSetting$(file$, section$, key$) + + 'map IniPosition (set in the section block) to the global file position + IniPosition = INSTR(IniWholeFile$, IniSectionData$) + IniPosition - 1 + + IF IniCODE = 1 OR IniCODE = 17 THEN + 'file not found or empty; create a new one + IF file$ = "" THEN file$ = currentIniFileName$ + IF file$ = "" THEN IniCODE = 21: EXIT SUB + + currentIniFileName$ = file$ + + IF section$ <> "[]" THEN + IniNewFile$ = section$ + IniLF$ + END IF + + IniNewFile$ = IniNewFile$ + key$ + "=" + value$ + + IniCODE = 0 + IniCommit + IniLoad file$ + IF IniCODE = 0 THEN IniCODE = 11 + IniLastSection$ = section$ + EXIT SUB + END IF + + IF IniCODE = 0 OR IniCODE = 2 THEN 'key found and read back; write new value$ + IF LCASE$(IniLastSection$) = LCASE$(section$) THEN + IF LTRIM$(RTRIM$(__value$)) = tempValue$ AND LEN(LTRIM$(RTRIM$(__value$))) > 0 THEN + 'identical values skip the writing routine + IniCODE = 8 + EXIT SUB + END IF + + DIM nextLine AS _UNSIGNED LONG + nextLine = INSTR(IniPosition + 1, IniWholeFile$, IniLF$) + + 'create new file contents + IniNewFile$ = LEFT$(IniWholeFile$, IniPosition - 1) + IniNewFile$ = IniNewFile$ + key$ + "=" + value$ + + IF nextLine > 0 THEN + IniNewFile$ = IniNewFile$ + MID$(IniWholeFile$, nextLine) + END IF + + IniCommit + + IniCODE = 4 + END IF + ELSEIF IniCODE = 3 OR IniCODE = 14 THEN 'Key not found, Section not found + IniCODE = 0 + IF LCASE$(IniLastSection$) = LCASE$(section$) THEN + 'find this section$ in the current ini file; + DIM Bracket1 AS _UNSIGNED LONG + DIM beginSection AS _UNSIGNED LONG, endSection AS _UNSIGNED LONG + DIM i AS _UNSIGNED LONG + + beginSection = 0 + endSection = 0 + + CheckSection: + beginSection = INSTR(beginSection + 1, LCASE$(IniWholeFile$), LCASE$(section$)) + IF beginSection = 0 THEN GOTO CreateSection + + 'identify if this occurrence is actually the section header and not something else + FOR i = beginSection - 1 TO 1 STEP -1 + IF ASC(IniWholeFile$, i) = 10 THEN EXIT FOR + IF ASC(IniWholeFile$, i) <> 10 AND ASC(IniWholeFile$, i) <> 32 THEN + 'not the section header + GOTO CheckSection + END IF + NEXT + + 'we found it; time to identify where this section ends + '(either another [section], a blank line or the end of the file + Bracket1 = INSTR(beginSection + 1, IniWholeFile$, "[") + IF Bracket1 > 0 THEN + FOR i = Bracket1 - 1 TO 1 STEP -1 + IF ASC(IniWholeFile$, i) = 10 THEN endSection = i + 1 - LEN(IniLF$): EXIT FOR + IF i <= beginSection THEN EXIT FOR + NEXT + END IF + + IF endSection > 0 THEN + 'add values to the end of the specified section$ + IniNewFile$ = LEFT$(IniWholeFile$, endSection - 1) + IniNewFile$ = IniNewFile$ + key$ + "=" + value$ + IniLF$ + IF MID$(IniWholeFile$, endSection, 2) <> IniLF$ THEN IniNewFile$ = IniNewFile$ + IniLF$ + IniNewFile$ = IniNewFile$ + MID$(IniWholeFile$, endSection) + ELSE + 'add values to the end of the file + IniNewFile$ = IniWholeFile$ + IF RIGHT$(IniNewFile$, 2) = IniLF$ THEN + IniNewFile$ = IniNewFile$ + key$ + "=" + value$ + ELSE + IniNewFile$ = IniNewFile$ + IniLF$ + key$ + "=" + value$ + END IF + END IF + + IniCommit + + IF IniCODE = 0 THEN IniCODE = 7 + EXIT SUB + ELSE + CreateSection: + IniNewFile$ = IniWholeFile$ + IF section$ = "[]" THEN GOTO WriteAtTop + + IF RIGHT$(IniNewFile$, 4) = IniLF$ + IniLF$ THEN + IniNewFile$ = IniNewFile$ + section$ + IniLF$ + key$ + "=" + value$ + IniLF$ + ELSEIF RIGHT$(IniNewFile$, 2) = IniLF$ THEN + IniNewFile$ = IniNewFile$ + IniLF$ + section$ + IniLF$ + key$ + "=" + value$ + IniLF$ + ELSE + IniNewFile$ = IniNewFile$ + IniLF$ + IniLF$ + section$ + IniLF$ + key$ + "=" + value$ + IniLF$ + END IF + + IniCommit + + IF IniCODE = 0 THEN IniCODE = 9 ELSE IniCODE = 16 EXIT SUB END IF - DIM nextLine AS _UNSIGNED LONG - nextLine = INSTR(IniPosition + 1, IniWholeFile$, IniLF$) - - 'create new file contents - IniNewFile$ = LEFT$(IniWholeFile$, IniPosition - 1) - IniNewFile$ = IniNewFile$ + key$ + "=" + value$ - - IF nextLine > 0 THEN - IniNewFile$ = IniNewFile$ + MID$(IniWholeFile$, nextLine) - END IF + 'if not found, key$=value$ is written to the beginning of the file + WriteAtTop: + IniNewFile$ = key$ + "=" + value$ + IniLF$ + IF LEFT$(LTRIM$(IniWholeFile$), 1) = "[" THEN IniNewFile$ = IniNewFile$ + IniLF$ + IniNewFile$ = IniNewFile$ + IniWholeFile$ IniCommit - IniCODE = 4 + IniCODE = 5 END IF - ELSEIF IniCODE = 3 OR IniCODE = 14 THEN 'Key not found, Section not found + END SUB + + SUB IniSetForceReload (state AS _BYTE) + SHARED IniForceReload + IF state THEN + IniForceReload = -1 + ELSE + IniForceReload = 0 + END IF + END SUB + + SUB IniClose + SHARED IniDisableAutoCommit, currentIniFileName$ + + IniDisableAutoCommit = 0 + IniCommit + + currentIniFileName$ = "" + END SUB + + SUB IniLoad (file$) + SHARED IniCODE, currentIniFileName$, IniLF$, IniWholeFile$ + SHARED currentIniFileLOF AS _UNSIGNED LONG + SHARED IniForceReload + + DIM fileNum AS INTEGER + + 'Error messages are returned with IniCODE + 'Error descriptions can be fetched with function IniINFO$ IniCODE = 0 - IF LCASE$(IniLastSection$) = LCASE$(section$) THEN - 'find this section$ in the current ini file; - DIM Bracket1 AS _UNSIGNED LONG, Bracket2 AS _UNSIGNED LONG, foundSection$ - DIM beginSection AS _UNSIGNED LONG, endSection AS _UNSIGNED LONG - DIM currentPos AS _UNSIGNED LONG, i AS _UNSIGNED LONG - beginSection = 0 - endSection = 0 + IF file$ <> "" AND currentIniFileName$ <> file$ THEN currentIniFileName$ = "" - CheckSection: - beginSection = INSTR(beginSection + 1, LCASE$(IniWholeFile$), LCASE$(section$)) - IF beginSection = 0 THEN GOTO CreateSection + IF IniForceReload AND LEN(currentIniFileName$) > 0 THEN + file$ = currentIniFileName$ + currentIniFileName$ = "" + END IF - 'identify if this occurrence is actually the section header and not something else - FOR i = beginSection - 1 TO 1 STEP -1 - IF ASC(IniWholeFile$, i) = 10 THEN EXIT FOR - IF ASC(IniWholeFile$, i) <> 10 AND ASC(IniWholeFile$, i) <> 32 THEN - 'not the section header - GOTO CheckSection - END IF - NEXT + 'Passing an empty file$ is allowed if user already + 'passed a valid file in this session. + IF currentIniFileName$ = "" THEN + 'initialization + IF _FILEEXISTS(file$) THEN + currentIniFileName$ = file$ + 'Load file into memory + fileNum = FREEFILE + OPEN currentIniFileName$ FOR BINARY AS #fileNum + currentIniFileLOF = LOF(fileNum) + IniWholeFile$ = SPACE$(currentIniFileLOF) + GET #fileNum, 1, IniWholeFile$ + CLOSE #fileNum + + 'Check if this ini file uses CRLF or LF + IF INSTR(IniWholeFile$, CHR$(13)) THEN IniLF$ = CHR$(13) + CHR$(10) ELSE IniLF$ = CHR$(10) + + 'IF RIGHT$(IniWholeFile$, 2) <> IniLF$ THEN IniWholeFile$ = IniWholeFile$ + IniLF$ + ELSE + IniFileNotFound: + IniCODE = 1 + + $IF WIN THEN + IniLF$ = CHR$(13) + CHR$(10) + $ELSE + IniLF$ = CHR$(10) + $END IF + EXIT SUB + END IF + ELSEIF NOT _FILEEXISTS(currentIniFileName$) THEN + currentIniFileName$ = "" + GOTO IniFileNotFound + END IF + END SUB + + FUNCTION IniNextKey$ + SHARED IniCODE, IniLF$, currentIniFileName$, IniSectionData$ + SHARED IniPosition AS _UNSIGNED LONG + STATIC lastDataBlock$, position AS _UNSIGNED LONG, tempLF$ + + IF currentIniFileName$ = "" THEN IniCODE = 18: EXIT FUNCTION + + IF IniSectionData$ <> lastDataBlock$ THEN + position = 0 + lastDataBlock$ = IniSectionData$ + + 'data blocks must end with a line feed for parsing purposes + IF RIGHT$(IniSectionData$, LEN(IniLF$)) <> IniLF$ THEN tempLF$ = IniLF$ ELSE tempLF$ = "" + END IF + + DIM Equal AS _UNSIGNED LONG, tempKey$ + + FindKey: + Equal = INSTR(position, IniSectionData$ + tempLF$, "=") + IF Equal = 0 THEN position = 0: EXIT FUNCTION + + tempKey$ = LTRIM$(RTRIM$(MID$(IniSectionData$ + tempLF$, position + 1, Equal - position - 1))) + + IF INSTR(tempKey$, CHR$(10)) > 0 THEN tempKey$ = MID$(tempKey$, INSTR(tempKey$, CHR$(10)) + 1) + + DO WHILE LEFT$(tempKey$, LEN(IniLF$)) = IniLF$ + tempKey$ = MID$(tempKey$, LEN(IniLF$) + 1) + position = position + LEN(IniLF$) + LOOP + + position = INSTR(position, IniSectionData$ + tempLF$, IniLF$) + 1 + + IF LEFT$(tempKey$, 1) = ";" OR LEFT$(tempKey$, 1) = "'" OR INSTR(tempKey$, "[") > 0 OR INSTR(tempKey$, "]") > 0 OR INSTR(tempKey$, "=") > 0 THEN + GOTO FindKey + END IF + + IniNextKey$ = tempKey$ + IniPosition = Equal + END FUNCTION + + FUNCTION IniNextSection$ (file$) + SHARED IniCODE, IniLF$, IniWholeFile$ + + STATIC sectionStart AS _UNSIGNED LONG + + IniLoad file$ + IF LEFT$(IniINFO$, 6) = "ERROR:" THEN EXIT FUNCTION + + IniCODE = 0 + + DIM foundSection AS _UNSIGNED LONG, endSection AS _UNSIGNED LONG + DIM i AS _UNSIGNED LONG, Bracket1 AS _UNSIGNED LONG, Bracket2 AS _UNSIGNED LONG + + FindNext: + sectionStart = INSTR(sectionStart + 1, IniWholeFile$, "[") + IF sectionStart = 0 THEN IniCODE = 24: EXIT FUNCTION + + 'make sure it's a valid section header + foundSection = 0 + FOR i = sectionStart - 1 TO 1 STEP -1 + IF ASC(IniWholeFile$, i) = 10 THEN foundSection = i + 1: EXIT FOR + IF ASC(IniWholeFile$, i) <> 32 THEN GOTO FindNext + NEXT + + IF i = 0 THEN foundSection = 1 + + IF foundSection > 0 THEN 'we found it; time to identify where this section ends - '(either another [section], a blank line or the end of the file - Bracket1 = INSTR(beginSection + 1, IniWholeFile$, "[") + '(either another [section] or the end of the file + Bracket2 = INSTR(sectionStart + 1, IniWholeFile$, "]") + IF Bracket2 = 0 THEN IniCODE = 24: EXIT FUNCTION + Bracket1 = INSTR(sectionStart + 1, IniWholeFile$, "[") IF Bracket1 > 0 THEN FOR i = Bracket1 - 1 TO 1 STEP -1 IF ASC(IniWholeFile$, i) = 10 THEN endSection = i + 1 - LEN(IniLF$): EXIT FOR - IF i <= beginSection THEN EXIT FOR + IF i <= foundSection THEN EXIT FOR NEXT - END IF - - IF endSection > 0 THEN - 'add values to the end of the specified section$ - IniNewFile$ = LEFT$(IniWholeFile$, endSection - 1) - IniNewFile$ = IniNewFile$ + key$ + "=" + value$ + IniLF$ - IF MID$(IniWholeFile$, endSection, 2) <> IniLF$ THEN IniNewFile$ = IniNewFile$ + IniLF$ - IniNewFile$ = IniNewFile$ + MID$(IniWholeFile$, endSection) + IniNextSection$ = MID$(IniWholeFile$, foundSection, Bracket2 - foundSection + 1) ELSE - 'add values to the end of the file - IniNewFile$ = IniWholeFile$ - IF RIGHT$(IniNewFile$, 2) = IniLF$ THEN - IniNewFile$ = IniNewFile$ + key$ + "=" + value$ - ELSE - IniNewFile$ = IniNewFile$ + IniLF$ + key$ + "=" + value$ - END IF + IniNextSection$ = MID$(IniWholeFile$, foundSection, Bracket2 - foundSection + 1) + IniCODE = 24 + sectionStart = 0 END IF - - IniCommit - - IF IniCODE = 0 THEN IniCODE = 7 - EXIT SUB ELSE - CreateSection: - IniNewFile$ = IniWholeFile$ - IF section$ = "[]" THEN GOTO WriteAtTop - - IF RIGHT$(IniNewFile$, 4) = IniLF$ + IniLF$ THEN - IniNewFile$ = IniNewFile$ + section$ + IniLF$ + key$ + "=" + value$ + IniLF$ - ELSEIF RIGHT$(IniNewFile$, 2) = IniLF$ THEN - IniNewFile$ = IniNewFile$ + IniLF$ + section$ + IniLF$ + key$ + "=" + value$ + IniLF$ - ELSE - IniNewFile$ = IniNewFile$ + IniLF$ + IniLF$ + section$ + IniLF$ + key$ + "=" + value$ + IniLF$ - END IF - - IniCommit - - IF IniCODE = 0 THEN IniCODE = 9 ELSE IniCODE = 16 - EXIT SUB - END IF - - 'if not found, key$=value$ is written to the beginning of the file - WriteAtTop: - IniNewFile$ = key$ + "=" + value$ + IniLF$ - IF LEFT$(LTRIM$(IniWholeFile$), 1) = "[" THEN IniNewFile$ = IniNewFile$ + IniLF$ - IniNewFile$ = IniNewFile$ + IniWholeFile$ - - IniCommit - - IniCODE = 5 - END IF -END SUB - -SUB IniSetForceReload (state AS _BYTE) - SHARED IniForceReload - IF state THEN - IniForceReload = -1 - ELSE - IniForceReload = 0 - END IF -END SUB - -SUB IniClose - SHARED IniDisableAutoCommit, currentIniFileName$ - - IniDisableAutoCommit = 0 - IniCommit - - currentIniFileName$ = "" -END SUB - -SUB IniLoad (file$) - SHARED IniCODE, currentIniFileName$, IniLF$, IniWholeFile$ - SHARED currentIniFileLOF AS _UNSIGNED LONG - SHARED IniForceReload - - DIM fileNum AS INTEGER - - 'Error messages are returned with IniCODE - 'Error descriptions can be fetched with function IniINFO$ - IniCODE = 0 - - IF file$ <> "" AND currentIniFileName$ <> file$ THEN currentIniFileName$ = "" - - IF IniForceReload AND LEN(currentIniFileName$) > 0 THEN - file$ = currentIniFileName$ - currentIniFileName$ = "" - END IF - - 'Passing an empty file$ is allowed if user already - 'passed a valid file in this session. - IF currentIniFileName$ = "" THEN - 'initialization - IF _FILEEXISTS(file$) THEN - currentIniFileName$ = file$ - - 'Load file into memory - fileNum = FREEFILE - OPEN currentIniFileName$ FOR BINARY AS #fileNum - currentIniFileLOF = LOF(fileNum) - IniWholeFile$ = SPACE$(currentIniFileLOF) - GET #fileNum, 1, IniWholeFile$ - CLOSE #fileNum - - 'Check if this ini file uses CRLF or LF - IF INSTR(IniWholeFile$, CHR$(13)) THEN IniLF$ = CHR$(13) + CHR$(10) ELSE IniLF$ = CHR$(10) - - 'IF RIGHT$(IniWholeFile$, 2) <> IniLF$ THEN IniWholeFile$ = IniWholeFile$ + IniLF$ - ELSE - IniFileNotFound: - IniCODE = 1 - - $IF WIN THEN - IniLF$ = CHR$(13) + CHR$(10) - $ELSE - IniLF$ = CHR$(10) - $END IF - EXIT SUB - END IF - ELSEIF NOT _FILEEXISTS(currentIniFileName$) THEN - currentIniFileName$ = "" - GOTO IniFileNotFound - END IF -END SUB - -FUNCTION IniNextKey$ - SHARED IniCODE, IniLF$, currentIniFileName$, IniSectionData$ - SHARED IniPosition AS _UNSIGNED LONG - STATIC lastDataBlock$, position AS _UNSIGNED LONG, tempLF$ - - IF currentIniFileName$ = "" THEN IniCODE = 18: EXIT FUNCTION - - IF IniSectionData$ <> lastDataBlock$ THEN - position = 0 - lastDataBlock$ = IniSectionData$ - - 'data blocks must end with a line feed for parsing purposes - IF RIGHT$(IniSectionData$, LEN(IniLF$)) <> IniLF$ THEN tempLF$ = IniLF$ ELSE tempLF$ = "" - END IF - - DIM Equal AS _UNSIGNED LONG, tempKey$ - - FindKey: - Equal = INSTR(position, IniSectionData$ + tempLF$, "=") - IF Equal = 0 THEN position = 0: EXIT FUNCTION - - tempKey$ = LTRIM$(RTRIM$(MID$(IniSectionData$ + tempLF$, position + 1, Equal - position - 1))) - - IF INSTR(tempKey$, CHR$(10)) > 0 THEN tempKey$ = MID$(tempKey$, INSTR(tempKey$, CHR$(10)) + 1) - - DO WHILE LEFT$(tempKey$, LEN(IniLF$)) = IniLF$ - tempKey$ = MID$(tempKey$, LEN(IniLF$) + 1) - position = position + LEN(IniLF$) - LOOP - - position = INSTR(position, IniSectionData$ + tempLF$, IniLF$) + 1 - - IF LEFT$(tempKey$, 1) = ";" OR LEFT$(tempKey$, 1) = "'" OR INSTR(tempKey$, "[") > 0 OR INSTR(tempKey$, "]") > 0 OR INSTR(tempKey$, "=") > 0 THEN - GOTO FindKey - END IF - - IniNextKey$ = tempKey$ - IniPosition = Equal -END FUNCTION - -FUNCTION IniNextSection$ (file$) - SHARED IniCODE, IniLF$, IniWholeFile$ - - STATIC sectionStart AS _UNSIGNED LONG - - IniLoad file$ - IF LEFT$(IniINFO$, 6) = "ERROR:" THEN EXIT SUB - - IniCODE = 0 - - DIM section$, foundSection AS _UNSIGNED LONG, endSection AS _UNSIGNED LONG - DIM i AS _UNSIGNED LONG, Bracket1 AS _UNSIGNED LONG, Bracket2 AS _UNSIGNED LONG - - FindNext: - sectionStart = INSTR(sectionStart + 1, IniWholeFile$, "[") - IF sectionStart = 0 THEN IniCODE = 24: EXIT FUNCTION - - 'make sure it's a valid section header - foundSection = 0 - FOR i = sectionStart - 1 TO 1 STEP -1 - IF ASC(IniWholeFile$, i) = 10 THEN foundSection = i + 1: EXIT FOR - IF ASC(IniWholeFile$, i) <> 32 THEN GOTO FindNext - NEXT - - IF i = 0 THEN foundSection = 1 - - IF foundSection > 0 THEN - 'we found it; time to identify where this section ends - '(either another [section] or the end of the file - Bracket2 = INSTR(sectionStart + 1, IniWholeFile$, "]") - IF Bracket2 = 0 THEN IniCODE = 24: EXIT FUNCTION - Bracket1 = INSTR(sectionStart + 1, IniWholeFile$, "[") - IF Bracket1 > 0 THEN - FOR i = Bracket1 - 1 TO 1 STEP -1 - IF ASC(IniWholeFile$, i) = 10 THEN endSection = i + 1 - LEN(IniLF$): EXIT FOR - IF i <= foundSection THEN EXIT FOR - NEXT - IniNextSection$ = MID$(IniWholeFile$, foundSection, Bracket2 - foundSection + 1) - ELSE - IniNextSection$ = MID$(IniWholeFile$, foundSection, Bracket2 - foundSection + 1) IniCODE = 24 - sectionStart = 0 END IF - ELSE - IniCODE = 24 - END IF -END FUNCTION + END FUNCTION -FUNCTION IniINFO$ - SHARED IniCODE - SELECT CASE IniCODE - CASE 0: IniINFO$ = "Operation successful" - CASE 1: IniINFO$ = "ERROR: File not found" - CASE 2: IniINFO$ = "Empty value" - CASE 3: IniINFO$ = "ERROR: Key not found" - CASE 4: IniINFO$ = "Key updated" - CASE 5: IniINFO$ = "Global key created" - CASE 7: IniINFO$ = "Key created in existing section" - CASE 8: IniINFO$ = "No changes applied (same value)" - CASE 9: IniINFO$ = "New section created; key created" - CASE 10: IniINFO$ = "No more keys" - CASE 11: IniINFO$ = "File created; new key added" - CASE 12: IniINFO$ = "ERROR: Invalid key" - CASE 13: IniINFO$ = "Section deleted" - CASE 14: IniINFO$ = "ERROR: Section not found" - CASE 15: IniINFO$ = "ERROR: Invalid section" - CASE 16: IniINFO$ = "New section created; existing key moved" - CASE 17: IniINFO$ = "ERROR: Empty file" - CASE 18: IniINFO$ = "ERROR: No file open" - CASE 19: IniINFO$ = "Key deleted" - CASE 20: IniINFO$ = "Key moved" - CASE 21: IniINFO$ = "ERROR: Invalid file name/path" - CASE 22: IniINFO$ = "Section sorted" - CASE 23: IniINFO$ = "No changes applied; section already sorted" - CASE 24: IniINFO$ = "No more sections" - CASE ELSE: IniINFO$ = "ERROR: <invalid error code>" - END SELECT -END FUNCTION + FUNCTION IniINFO$ + SHARED IniCODE + SELECT CASE IniCODE + CASE 0: IniINFO$ = "Operation successful" + CASE 1: IniINFO$ = "ERROR: File not found" + CASE 2: IniINFO$ = "Empty value" + CASE 3: IniINFO$ = "ERROR: Key not found" + CASE 4: IniINFO$ = "Key updated" + CASE 5: IniINFO$ = "Global key created" + CASE 7: IniINFO$ = "Key created in existing section" + CASE 8: IniINFO$ = "No changes applied (same value)" + CASE 9: IniINFO$ = "New section created; key created" + CASE 10: IniINFO$ = "No more keys" + CASE 11: IniINFO$ = "File created; new key added" + CASE 12: IniINFO$ = "ERROR: Invalid key" + CASE 13: IniINFO$ = "Section deleted" + CASE 14: IniINFO$ = "ERROR: Section not found" + CASE 15: IniINFO$ = "ERROR: Invalid section" + CASE 16: IniINFO$ = "New section created; existing key moved" + CASE 17: IniINFO$ = "ERROR: Empty file" + CASE 18: IniINFO$ = "ERROR: No file open" + CASE 19: IniINFO$ = "Key deleted" + CASE 20: IniINFO$ = "Key moved" + CASE 21: IniINFO$ = "ERROR: Invalid file name/path" + CASE 22: IniINFO$ = "Section sorted" + CASE 23: IniINFO$ = "No changes applied; section already sorted" + CASE 24: IniINFO$ = "No more sections" + CASE ELSE: IniINFO$ = "ERROR: <invalid error code>" + END SELECT + END FUNCTION -'Written in BASIC by Luke Ceddia for ide_methods.bas (QB64) -'After Cormen, Leiserson, Rivest & Stein "Introduction To Algoritms" via Wikipedia -'Adapted for use in .INI Manager -FUNCTION IniArraySort%% (arr() AS STRING) - DIM i&, x$, j&, moves& + 'Written in BASIC by Luke Ceddia for ide_methods.bas (QB64) + 'After Cormen, Leiserson, Rivest & Stein "Introduction To Algoritms" via Wikipedia + 'Adapted for use in .INI Manager + FUNCTION IniArraySort%% (arr() AS STRING) + DIM i&, x$, j&, moves& - FOR i& = LBOUND(arr) + 1 TO UBOUND(arr) - x$ = arr(i&) - j& = i& - 1 - WHILE j& >= LBOUND(arr) - IF arr(j&) <= x$ THEN EXIT WHILE - moves& = moves& + 1 - arr$(j& + 1) = arr$(j&) - j& = j& - 1 - WEND - arr$(j& + 1) = x$ - NEXT i& + FOR i& = LBOUND(arr) + 1 TO UBOUND(arr) + x$ = arr(i&) + j& = i& - 1 + WHILE j& >= LBOUND(arr) + IF arr(j&) <= x$ THEN EXIT WHILE + moves& = moves& + 1 + arr$(j& + 1) = arr$(j&) + j& = j& - 1 + WEND + arr$(j& + 1) = x$ + NEXT i& - 'Returns -1 (true) if any changes were made - IniArraySort%% = moves& > 0 -END FUNCTION + 'Returns -1 (true) if any changes were made + IniArraySort%% = moves& > 0 + END FUNCTION +$END IF diff --git a/InForm/vbdos2inform.bas b/InForm/vbdos2inform.bas index a6e641c..81ea6d8 100644 --- a/InForm/vbdos2inform.bas +++ b/InForm/vbdos2inform.bas @@ -1,3 +1,5 @@ +OPTION _EXPLICIT + '$INCLUDE:'InFormVersion.bas' PRINT "InForm - GUI system for QB64 - "; __UI_Version @@ -5,8 +7,11 @@ PRINT "VBDOS to InForm form conversion utility" PRINT "-------------------------------------------------" DIM lf AS STRING * 1, q AS STRING * 1 +DIM theFile$ + lf = CHR$(10) q = CHR$(34) + IF LEN(COMMAND$) > 0 THEN IF _FILEEXISTS(COMMAND$) = 0 THEN PRINT "File not found.": END theFile$ = COMMAND$ @@ -18,8 +23,11 @@ ELSE IF _FILEEXISTS(theFile$) = 0 THEN PRINT "File "; theFile$; " not found." ELSE EXIT DO LOOP END IF + OPEN theFile$ FOR BINARY AS #1 +DIM a$ + LINE INPUT #1, a$ IF a$ <> "Version 1.00" THEN PRINT "Expected VBDOS text form file. Exiting." @@ -32,9 +40,9 @@ IF LEFT$(a$, 11) <> "BEGIN Form " THEN END END IF -FormName$ = MID$(a$, 12) +DIM FormName$: FormName$ = MID$(a$, 12) -o$ = "'InForm - GUI system for QB64 - " + __UI_Version +DIM o$: o$ = "'InForm - GUI system for QB64 - " + __UI_Version o$ = o$ + lf + "'Fellippe Heitor, " + __UI_CopyrightSpan + " - fellippe@qb64.org - @FellippeHeitor" o$ = o$ + lf + "'-----------------------------------------------------------" o$ = o$ + lf + "SUB __UI_LoadForm" @@ -43,7 +51,13 @@ o$ = o$ + lf + " DIM __UI_NewID AS LONG" o$ = o$ + lf o$ = o$ + lf + " __UI_NewID = __UI_NewControl(__UI_Type_Form, " + q + FormName$ + q + ", " -row = CSRLIN +DIM row AS LONG: row = CSRLIN + +DIM percentage%, eq AS LONG, i AS LONG +DIM property$, value$, width$, height$, backColor$, foreColor$, caption$, text$ +DIM leftSide$, top$, disabled$, hidden$, controlType$, control$, controlName$, i$ +DIM controlList$, caseAll$, caseFocus$, caseList$, caseTextBox$, assignIDs$ +DIM controlIDsDIM$, Frame$ DO IF EOF(1) THEN EXIT DO @@ -171,13 +185,13 @@ o$ = o$ + lf + "SUB __UI_AssignIDs" o$ = o$ + assignIDs$ o$ = o$ + lf + "END SUB" -newFile$ = LEFT$(theFile$, INSTR(theFile$, ".") - 1) + "_InForm.frm" +DIM newFile$: newFile$ = LEFT$(theFile$, INSTR(theFile$, ".") - 1) + "_InForm.frm" CLOSE OPEN newFile$ FOR BINARY AS #1 PUT #1, , o$ CLOSE -TextFileNum = FREEFILE -newTextFile$ = LEFT$(theFile$, INSTR(theFile$, ".") - 1) + "_InForm.bas" +DIM TextFileNum AS LONG: TextFileNum = FREEFILE +DIM newTextFile$: newTextFile$ = LEFT$(theFile$, INSTR(theFile$, ".") - 1) + "_InForm.bas" OPEN newTextFile$ FOR OUTPUT AS #TextFileNum PRINT #TextFileNum, "': This program was generated by" PRINT #TextFileNum, "': InForm - GUI system for QB64 - "; __UI_Version @@ -248,6 +262,7 @@ END AddProperties: IF LEN(caption$) THEN o$ = o$ + lf + " SetCaption __UI_NewID, " + caption$: caption$ = "" +DIM formBackColor$, formForeColor$ IF LEN(FormName$) = 0 THEN IF backColor$ = formBackColor$ THEN backColor$ = "" IF foreColor$ = formForeColor$ THEN foreColor$ = "" @@ -263,3 +278,4 @@ RETURN FUNCTION QBColor2QB64$ (index AS _BYTE) QBColor2QB64$ = "_RGB32(" + LTRIM$(STR$(_RED(index))) + ", " + LTRIM$(STR$(_GREEN(index))) + ", " + LTRIM$(STR$(_BLUE(index))) + ")" END FUNCTION + diff --git a/LICENSE.md b/LICENSE.md index 1f9188c..b23502f 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 Samuel Gomes +Copyright (c) 2023 Samuel Gomes Copyright (c) 2016-2019 Fellippe Heitor Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/README.md b/README.md index fc8dd0a..432dc88 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# InForm +# InForm-PE ![InForm logo](InForm/resources/Application-icon-128.png) @@ -8,14 +8,14 @@ Wiki: <https://github.com/a740g/InForm/wiki> ## Event-driven QB64 programs -InForm's main goal is to generate event-driven QB64 applications. This means that you design a graphical user interface with interactive controls and then write the code to respond to such controls once they are manipulated. +InForm-PE's main goal is to generate event-driven QB64-PE applications. This means that you design a graphical user interface with interactive controls and then write the code to respond to such controls once they are manipulated. ## Workflow -After your form looks the way you want it to, click File -> Save to export its contents and generate a .bas source file. Two files are output: +After your form looks the way you want it to, click **File > Save** to export its contents and generate a **.bas** source file. Two files are output: * **.frm** -the generated form in QB64 code. This can be loaded back into InForm's designer or manually edited in QB64 or any text editor later, if you want to adjust fine details. +the generated form in QB64-PE code. This can be loaded back into InForm-PE's designer or manually edited in QB64-PE or any text editor later, if you want to adjust fine details. * **.bas** the actual program you will add your code to. diff --git a/makefile.inform b/makefile.inform index bf635d7..81f63cf 100644 --- a/makefile.inform +++ b/makefile.inform @@ -1,68 +1,49 @@ # Makefile for InForm -# Copyright (c) 2022 Samuel Gomes - -#MAKEFLAGS += --no-builtin-rules ifndef OS - $(error "OS must be set to 'lnx', 'win', or 'osx'") +$(error "OS must be set to 'lnx', 'win', or 'osx'") +endif + +ifndef QB64PE_PATH +$(error "QB64PE_PATH must be path where QB64PE is installed") endif ifeq ($(OS),lnx) RM := rm -fr EXTENSION := - DIR_SLASH := / endif ifeq ($(OS),win) RM := del /Q EXTENSION := .exe - DIR_SLASH := / endif ifeq ($(OS),osx) RM := rm -fr EXTENSION := - DIR_SLASH := \\ endif # This should point to your QB64 installation -FILE1 := qb64 -FILE2 := qb64pe -ROOT_DIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))) - -ifeq (,$(wildcard $(FILE1)$(EXTENSION))) - QB64 := $(FILE2) -else ifeq (,$(wildcard $(FILE2)$(EXTENSION))) - QB64 := $(FILE1) -endif - -QB64PE_FLAGS := -x -p -ROOT_PATH := $(ROOT_DIR)$(DIR_SLASH) -INFORM_PATH := InForm$(DIR_SLASH) -UiEditorSRC := UiEditor.bas -UiEditorEXE := UiEditor$(EXTENSION) -UiEditorPreviewSRC := UiEditorPreview.bas -UiEditorPreviewEXE := UiEditorPreview$(EXTENSION) - +QB64PE := qb64pe +QB64PE_FLAGS := -x -w -e .PHONY: all clean -all: $(UiEditorEXE) $(UiEditorPreviewEXE) +all: UiEditor$(EXTENSION) InForm/UiEditorPreview$(EXTENSION) InForm/vbdos2inform$(EXTENSION) -$(UiEditorEXE) : $(INFORM_PATH)$(UiEditorSRC) - $(ROOT_PATH)$(QB64)$(EXTENSION) $(QB64PE_FLAGS) -o $(INFORM_PATH)$(UiEditorEXE) $(INFORM_PATH)$(UiEditorSRC) - strip $(INFORM_PATH)$(UiEditorEXE) +UiEditor$(EXTENSION) : InForm/UiEditor.bas + $(QB64PE_PATH)$(QB64PE)$(EXTENSION) $(QB64PE_FLAGS) $< -o $@ -$(UiEditorPreviewEXE): $(INFORM_PATH)$(UiEditorPreviewSRC) - $(ROOT_PATH)$(QB64)$(EXTENSION) $(QB64PE_FLAGS) -s:exewithsource=true -o $(INFORM_PATH)$(UiEditorPreviewEXE) $(INFORM_PATH)$(UiEditorPreviewSRC) - strip $(INFORM_PATH)$(UiEditorPreviewEXE) +InForm/UiEditorPreview$(EXTENSION) : InForm/UiEditorPreview.bas + $(QB64PE_PATH)$(QB64PE)$(EXTENSION) $(QB64PE_FLAGS) $< -o $@ + +InForm/vbdos2inform$(EXTENSION) : InForm/vbdos2inform.bas + $(QB64PE_PATH)$(QB64PE)$(EXTENSION) $(QB64PE_FLAGS) $< -o $@ clean: ifeq ($(OS),win) - $(RM) InForm\UiEditor$(EXTENSION) InForm\UiEditorPreview$(EXTENSION) InForm\vbdos2inform$(EXTENSION) + $(RM) UiEditor$(EXTENSION) InForm\UiEditorPreview$(EXTENSION) InForm\vbdos2inform$(EXTENSION) else - $(RM) InForm/UiEditor$(EXTENSION) InForm/UiEditorPreview$(EXTENSION) InForm/vbdos2inform$(EXTENSION) + $(RM) UiEditor$(EXTENSION) InForm/UiEditorPreview$(EXTENSION) InForm/vbdos2inform$(EXTENSION) endif - - diff --git a/setup_inform_lnx.sh b/setup_inform_lnx.sh index 3ad195c..e8a9033 100755 --- a/setup_inform_lnx.sh +++ b/setup_inform_lnx.sh @@ -4,28 +4,5 @@ cd "$(dirname "$0")" echo "Compiling InForm..." -make -f makefile.inform clean OS=lnx -make -f makefile.inform OS=lnx - -if [ -e "./InForm/UiEditor" ]; then - echo "Adding InForm menu entry..." - cat > ~/.local/share/applications/qb64-inform.desktop <<EOF -[Desktop Entry] -Name=QB64 InForm GUI Designer -GenericName=QB64 InForm GUI Designer -Exec=$_pwd/InForm/UiEditor -Icon=$_pwd/InForm/resources/InForm.ico -Terminal=false -Type=Application -Categories=Development;IDE;GUI -Path=$_pwd -StartupNotify=false -EOF - echo "Running InForm Designer..." - cd InForm - ./UiEditor & -else - echo "Compilation failed." - echo "Make sure you unpacked all files in QB64's folder, preserving the directory structure and also that you have the latest version of QB64 to use InForm." -fi - +make -f makefile.inform clean OS=lnx QB64PE_PATH=../QB64pe/ +make -f makefile.inform OS=lnx QB64PE_PATH=../QB64pe/ diff --git a/setup_inform_osx.command b/setup_inform_osx.command index bf2166f..a5595ef 100755 --- a/setup_inform_osx.command +++ b/setup_inform_osx.command @@ -1,55 +1,7 @@ +# InForm for QB64-PE Setup script + cd "$(dirname "$0")" -# InForm for QB64/QB64PE - Setup script -### Perform CLEAN function -rm -fr InForm/UiEditor InForm/UiEditor_start.command InForm/UiEditorPreview InForm/UiEditorPreview_start.command - - -### Install if QB64 is found -if [ -e "./qb64" ]; then - echo "Compiling InForm..." - ./qb64 -x -p ./InForm/UiEditor.bas -o ./InForm/UiEditor - ./qb64 -x -p ./InForm/UiEditorPreview.bas -s:exewithsource=true -o ./InForm/UiEditorPreview - cd InForm - if [ -e "./UiEditor" ]; then - echo "Running InForm Designer..." - ./UiEditor & - echo - echo "Thank you for choosing InForm for QB64." - osascript -e 'tell application "Terminal" to close (every window whose name contains "UiEditor_start.command")' & - osascript -e 'if (count the windows of application "Terminal") is 0 then tell application "Terminal" to quit' & - exit 0 - else - echo "Compilation failed." - echo "Make sure you unpacked all files in QB64's folder, preserving the directory structure, and also that you have QB64 to use InForm." - exit 1 - fi - -### Install if Q64PE is found -elif [ -e "./qb64pe" ]; then - echo "Compiling InForm..." - ./qb64pe -x -p ./InForm/UiEditor.bas -o ./InForm/UiEditor - ./qb64pe -x -p ./InForm/UiEditorPreview.bas -s:exewithsource=true -o ./InForm/UiEditorPreview - cd InForm - if [ -e "./UiEditor" ]; then - echo "Running InForm Designer..." - ./UiEditor & - echo - echo "Thank you for choosing InForm for QB64PE." - osascript -e 'tell application "Terminal" to close (every window whose name contains "UiEditor_start.command")' & - osascript -e 'if (count the windows of application "Terminal") is 0 then tell application "Terminal" to quit' & - exit 0 - else - echo "Compilation failed." - echo "Make sure you unpacked all files in QB64PE's folder, preserving the directory structure, and also that you have QB64PE to use InForm." - exit 1 - fi - -### If neither QB64 or QB64PE is found, message and error out. -else - echo "Compilation failed." - echo "Make sure you have either QB64 or QB64PE installed to use InForm." - exit 1 -fi - -exit 0 +echo "Compiling InForm..." +make -f makefile.inform clean OS=osx QB64PE_PATH=../QB64pe/ +make -f makefile.inform OS=osx QB64PE_PATH=../QB64pe/ diff --git a/setup_inform_win.cmd b/setup_inform_win.cmd index 5f1f6f2..4a8ad2c 100644 --- a/setup_inform_win.cmd +++ b/setup_inform_win.cmd @@ -4,27 +4,7 @@ %~d0 cd %~dp0 -rem Clean old .exe files from InForm -del /Q InForm\UiEditor.exe InForm\UiEditorPreview.exe - -rem Check for which compiler for use in your QB64/QB64pe installation +rem Adjust the path below to point to mingw32-make.exe in your QB64 installation echo Compiling InForm... - -if exist qb64.exe ( - qb64 -x -p -o InForm/UiEditor.exe InForm/UiEditor.bas - qb64 -x -p -s:exewithsource=true -o InForm/UiEditorPreview.exe InForm/UiEditorPreview.bas - cd InForm - UiEditor - goto end) - -if exist qb64pe.exe ( - qb64pe -x -p -o InForm/UiEditor.exe InForm/UiEditor.bas - qb64pe -x -p -s:exewithsource=true -o InForm/UiEditorPreview.exe InForm/UiEditorPreview.bas - cd InForm - UiEditor - goto end) - -echo qb64 or qb64pe not found. Setup Terminated. - -:end -endlocal +..\QB64pe\internal\c\c_compiler\bin\mingw32-make.exe -f makefile.inform clean OS=win QB64PE_PATH=../QB64pe/ +..\QB64pe\internal\c\c_compiler\bin\mingw32-make.exe -f makefile.inform OS=win QB64PE_PATH=../QB64pe/