Package plugins.wdx

This Package contains the Total Commander Java Content Plugin Interface.

See:
          Description

Interface Summary
WDXPluginInterface This is the interface for Total Commander WDX plugins.
 

Class Summary
FieldValue FieldValue is used by contentGetValue.
LocalDate LocalDate can be used for setting the date value in ContentGetValue.
LocalTime LocalTime can be used for setting the time value in ContentGetValue.
WDXPluginAdapter  
 

Package plugins.wdx Description

This Package contains the Total Commander Java Content Plugin Interface. Created by Ken Händel

Original Content used from contentplugin.hlp:
Writing content plugins (version 1.5) for Total Commander by Copyright (C) 2002 Christian Ghisler, C. Ghisler & Co. All Rights Reserved

Overview

This help file is about writing content plugins for Total Commander. Content plugins are used for several purposes: For showing custom columns in the file lists, for searching, and in the multi-rename tool.
The minimum functions needed for a Content plugin are: The following are optional functions:

How it works:

When installing the plugin, Total Commander calls ContentGetDetectString (if implemented) to find out what file types are supported by the plugin. The content string may be modified manually by the user to include/exclude certain file types. It's recommended not to use detect strings which check the file by contents, because ContentGetDetectString cannot be called delayed, so it would slow down file list display quite a lot. When Total Commander needs information about a specific file, it first parses the detect string to determine whether the plugin needs to be called for that file or not. If yes, it then calls ContentGetSupportedField in a loop, to enumerate all available fields. This info is then cached, so TC doesn't have to call the function for each file separately. If a language file with the same name as the plugin but with extension .lng is present, Total Commander will automatically translate the returned field names. To request the contents of a field for a specific file, the function ContentGetValue will be called.
When installing the plugin, Total Commander calls ContentGetDetectString (if implemented) to find out what file types are supported by the plugin. The content string may be modified manually by the user to include/exclude certain file types. It's recommended not to use detect strings which check the file by contents, because ContentGetDetectString cannot be called delayed, so it would slow down file list display quite a lot.

Notes:
  1. It's quite important to create a good detection string, especially if calling of your plugin is slow! If you cannot make a good detection string, then make sure that your plugin doesn't have any static objects defined as global variables! These would be loaded with the DLL! Only create such objects in the called functions, where needed!
  2. If the parsing of a file is very slow compared to the extraction of a field, it may be reasonable to cache all fields for a given file until the next file name is requested. This would make it faster to request multiple fields from the same file. Such a cache could be implemented with two fields, a name field storing the last name for which the cached information was stored, and a structure containing the extracted information. Please note that if your plugin returns ft_delayed, you have to take measures so the cache is protected from multiple simultaneous calls to ContentGetValue. This can be done using a semaphore.
  3. ContentSetValue should only be implemented where it makes sense! For example, a plugin which shows the file's size in various forms does not need to offer this function, because it makes no sense to change a file's size via the attributes dialog.

Lng files for content plugins

Translation of content plugins is quite easy: Just create a text file with the same name as the content plugin, but with extension lng. Example: contentplug.wdx -> contentplug.lng.
These translations will be shown to the end user in all Total Commander dialogs, but the English strings will be stored in wincmd.ini (e.g. for saved searches, custom columns or in the multi-rename tool). Therefore it's very important to use English for the main content plugin!
This lng file contains a separate section for each language, with the same name as the language part of the main Total Commander translation files. Example wcmd_deu.lng -> section [deu] for German (called "Deutsch" in German).
In these sections, each string is translated like this:
original=translated

Example:


[deu]
kbytes=kbytes
name=Name
size=Grösse
creationdate=Erstelldatum
creationtime=Erstellzeit
writedate=Aenderungsdatum
writetime=Aenderungszeit
accessdate=Zugriffsdatum
accesstime=Zugriffszeit
attributes=Attribute
archive=Archiv
read only=Nur lesen
hidden=versteckt
system=System
compressed=komprimiert
encrypted=verschlüsselt
sparse=mager
versionstring=Versionsstring
versionnr=Versionsnr
file type=Dateityp
file=Datei
folder=Ordner
reparse point=symbolischer Link
[fra]
name=Nom
size=Taille
creationdate=date de création
creationtime=temps de création
writedate=date d'écriture
writetime=temps d'écriture
accessdate=date d'accès
accesstime=temps d'accès
attributes=attributs
archive=archive
read only=lecture seule
hidden=caché
system=système
compressed=compressé
encrypted=crypté
sparse=maigre
versionstring=version(texte)
versionnr=N° version
file type=type fichier