Prototype for UserFileType objects
function UserFileType (document_type)
To create a file type:
document_type. Document Type string.
file_types Array in OptionsSet object.
A UserFileType object represent a file type as defined in the user interface. A document type is associated to it during construction and cannot change anymore. This document type is used to specify how to edit and compare files of that type.
If the document type has properties which can be defined per file type, the 'options' member contains them.
|edition.default_encoding||Encoding string. If empty, platform default encoding is used. Encoding used when loading files if nothing else could indicate the encoding of a file|
|edition.default_saving_encoding||EncodingProperties object. Indicates how to save text files by default.|
|edition.tab_inserts_spaces||Boolean. True if pressing TAB will insert the right number of spaces to reach next tabulation column.|
|edition.tabs_into_spaces||Integer. Space between two tabulations columns.|
|edition.wrap_lines||Boolean. True if long lines should be wrapped.|
|filters.loading||Filters List. List of filters which may be applied when loading. Currently only XML built-in filters can be used here.|
|filters.saving||Filters List. List of filters which may be applied when saving. Currently only XML built-in filters can be used here.|
|ignorable.lines_covered_by_multiline_pattern||String. Lines covered by that pattern can be ignored|
|ignorable.lines_matching||String. Lines matching that pattern can be ignored|
Found inside UserFileType 'options' member
|dynamic_fields_script||String. If not empty, the script is executed each
time the file is reloaded. The script
must be the body of a function taking two parameters
|fields||Array of BinaryDocument.Field objects. These fields can be ignored when comparing binary files.|
|signature.end||Integer. Offset in bytes before which the signature must be found|
|signature.mask||Hexadecimal String. If not empty, the signature will be compared to the array of bytes starting at searched position combined with a binary AND operation with this array of bytes coded as hexdecimal digits (e.g. FF00FF makes second byte unimportant is the signature)|
|signature.signature||Hexadecimal String. If not empty, the file type is recognized only if the signature is found bewteen signature.start and signature.end positions.|
|signature.start||Integer. Offset in bytes from which the signature is searched|
Creates a text file type and adds it to the file types used
by a document:
var ft = new UserFileType ("texts");
ft.label = "C++ files";
ft.patterns = "*.cpp";
var params = mydoc.parameters.clone( );
mydoc.parameters = param;