New interface documentation for TC7 plugins

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

kenchis
Junior Member
Junior Member
Posts: 53
Joined: 2006-02-04, 11:44 UTC
Location: Berlin
Contact:

WDX plugin interface

Post by *kenchis »

Dear Mr. Ghisler,

Do you have a test plugin (source code) that uses the new possibilities of the WDX interface?
I have some trouble with ContentGetSupportedFlags. I cannot use a custom field editor.
Somehow the arrow sign is missing, whether i return contflags_fieldedit or not for ma FT_STRING field type.
In my opinion the help file does not make clear enough, which flag must be set for fieldIndex -1 and fieldIndex>=0
Gruß,
Kenchi
User avatar
Motorocker
Member
Member
Posts: 105
Joined: 2006-07-19, 10:52 UTC
Location: Perm, Russia
Contact:

Post by *Motorocker »

WCX Writer's Reference
PackSetDefaultParams
dps ... Make sure to use a unique header when storing data in this file, because it is shared by other file system plugins! ...
Maybe packer plugins?
Graphics Converter – images conversion
KillOK – Cease to press OK!
NSCopy – copy unreadable
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48097
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2kenchis

Unfortunately I don't have a sample plugin source for a text editor right now.

Do you return a combination of all possible field flags when FieldIndex is set to -1 in ContentGetSupportedFieldFlags?

If contflags_fieldedit isn't part of the flags in this case, then Total Commander will not even check the individual fields whether they support editing or not...
Author of Total Commander
https://www.ghisler.com
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2kenchis
You need to return

Code: Select all

contflags_edit | contflags_fieldedit
for -1 and all fields who supports a field editor. This is what I do successfully in my Shortcut and Summary content plug-ins.
kenchis
Junior Member
Junior Member
Posts: 53
Joined: 2006-02-04, 11:44 UTC
Location: Berlin
Contact:

contentGetSupportedFieldFlags

Post by *kenchis »

2Lefteous:

You say, i must set
contflags_edit | contflags_fieldedit
for fieldIndex -1 and each fieldIndex, that has a custom editor.
Two things i dont understand yet:
1.
when and for which fieldIndex must i set contflags_substmask additionally?
2.
why it is needed to call contentGetSupportedFieldFlags with -1?
is that a summary of all flags (inclusive contflags_substmask and contflags_edit)?

It should be made clear, which combinations make sense for a certain fieldIndex (especially -1)

Thanx for you support!
Gruß,
Kenchi
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2kenchis
when and for which fieldIndex must i set contflags_substmask additionally?
sdk docu wrote:contflags_substmask A combination of all above substituion flags. Should be returned for index -1 if the content plugin contains ANY of the substituted fields.
contflags_substmask is actually the ORed value of all other substitution flags.
why it is needed to call contentGetSupportedFieldFlags with -1?
is that a summary of all flags (inclusive contflags_substmask and contflags_edit)?
Yes it informs TC if the plug-in has any fields that supports one of the possible features.

I also think it could be somehow explained in a better way than in the current sdk docu.
kenchis
Junior Member
Junior Member
Posts: 53
Joined: 2006-02-04, 11:44 UTC
Location: Berlin
Contact:

Post by *kenchis »

2Lefteous:
// for ContentGetSupportedFieldFlags
#define contflags_edit 1
#define contflags_substsize 2

#define contflags_substdatetime 4
#define contflags_substdate 6
#define contflags_substtime 8
#define contflags_substattributes 10
#define contflags_substattributestr 12
#define contflags_passthrough_size_float 14
#define contflags_substmask 14
#define contflags_fieldedit 16
This is from SDK, so contflags_substmask is incorrect and must be
ORed value:
contflags_substmask = contflags_edit | contflag_substsize | ... | contflags_passthrough_size_float | contflags_fieldedit

I cannot download source code of your content plugins,
summary and shortcut.
So i must ask :? silly questions.
Gruß,
Kenchi
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

i must ask silly questions.
I cannot follow your calculation. What exactly is your question?

My calculation is:
1110b = 10b | 110b | 100b | 1010b
kenchis
Junior Member
Junior Member
Posts: 53
Joined: 2006-02-04, 11:44 UTC
Location: Berlin
Contact:

Ok, now i understand

Post by *kenchis »

You answered my question: which fiels are logically ORed?
You say:
contflags_substmask=
contflags_substsize(10b) |
contflags_substdatetime(100b) |
contflags_substdate(110b) |
contflags_substtime(1000b) |
contflags_substattributes(1010b)
= 1110b
= 14

I was unsure, which of the defined flags you meant and thought to combine all flags (contflags_edit and contflags_fieldedit inclusive).

Now it is clear.
contflags_fieldedit is a special flag for customized editors (contentEditValue)

and

contflags_edit must be set together with contflags_subst* flag to support to edit a field.

Seems it must be well documented, since the rest of the SDK was clear to me.
Gruß,
Kenchi
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

contflags_edit must be set together with contflags_subst* flag to support to edit a field
No you don't have to set have to set one of the subst flags to edit a field. :shock: The subst flags have nothing to do with write support.

Here is an example for a plug-in that could make use of substituation. A field of a content plug-in displays the file attributes in a very nice way. The user uses this field in a custom column view. It works fine in the normal file system. Now the user connects to an FTP server. The nice displayed attribute field is now displayed empty because TC doesn't ask the plug-in for values when displaying an FTP path. This is were the substituation comes into play. When the field has enabled substituation (in this case propably contflags_substattributestr) TC just displays the internal attribute value using tc.attributestr when displaying a non file system location.

A sample code for a plug-in having only this field could look like this:

Code: Select all

int __stdcall ContentGetSupportedFieldFlags (int fieldIndex)
{
	int result = 0;
	if (fieldIndex == -1)
	{
		result = contflags_substmask;
	}
	else if (fieldIndex == 0)
	{
		result = contflags_substattributestr;
	}
	return result;
}


In a second more complex version of this plug-in a second field is introduced. This field supports editing a field and provides a custom content editor.

Code: Select all

int __stdcall ContentGetSupportedFieldFlags (int fieldIndex)
{
   int result = 0;
   if (fieldIndex == -1)
   {
      result = contflags_substmask | contflags_edit | contflags_fieldedit;
   }
   else if (fieldIndex == 0)
   {
      result = contflags_substattributestr;
   }
   else if (fieldIndex == 1)
   {
	   result = contflags_edit | contflags_fieldedit;
   }
   return result;
}
When TC asks for fieldIndex -1 the plug-in has to combine the abilities of all fields. I hope this helps :-)
kenchis
Junior Member
Junior Member
Posts: 53
Joined: 2006-02-04, 11:44 UTC
Location: Berlin
Contact:

Post by *kenchis »

Ok, the FTP problem was not in my mind, when testing the content plugin interface.
What i found out is the following:
Menu: Files/Change Attributes.../Change plugin attributes...
Now i load my configuration "test":
Result is this one:
http://java.totalcmd.net/V1.5SP1/ContentDemo16_.bmp

To get this result i must return the following flags:
field index -1: CONTFLAGS_SUBSTMASK | CONTFLAGS_EDIT | CONTFLAGS_FIELDEDIT

field index 0,1: CONTFLAGS_EDIT | CONTFLAGS_SUBSTATTRIBUTES

without CONTFLAGS_EDIT the field is not displayed in the dialog. :?

If you want, you can check the plugin source here:
http://java.totalcmd.net/V1.5SP1/ContentDemo16.tar

it is in the file:
haendel.ken.wlx.contentdemo-1.0-SNAPSHOT.jar

Something must be wrong?
Gruß,
Kenchi
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

Sorry I guess I have to give up :roll: My explanations seem to be as helpful as the plug-in SDK for you.
kenchis
Junior Member
Junior Member
Posts: 53
Joined: 2006-02-04, 11:44 UTC
Location: Berlin
Contact:

Post by *kenchis »

No Problem,
seems i have to find out by myself, but
in my opinion this feature is hard to understand.

Thank you for helping :D
Gruß,
Kenchi
User avatar
tbeu
Power Member
Power Member
Posts: 1336
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

Typo in contentplugin.hlp->ContentGetSupportedFieldFlags

contflags_substmask A combination of all above substitution flags.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
Alextp
Power Member
Power Member
Posts: 2321
Joined: 2004-08-16, 22:35 UTC
Location: Russian Federation
Contact:

Post by *Alextp »

2Ghisler
I suggest to name WCX header not as "2.12" but as "2.2".
Next version after "2.12" will be "2.2"?-- but "2" sounds like less than "12" so it will be confusing.
Post Reply