From: Laurent Ganier Date: Wed, 29 Oct 2003 23:05:42 +0000 (+0000) Subject: Initial checkin of plugins X-Git-Tag: 2.16.5~7590 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=1618e181460628c18db4dbd6bbaa0df686aa9aed;p=winmerge-jp%2Fwinmerge-jp.git Initial checkin of plugins --- diff --git a/Plugins/dlls/editor addin.sct b/Plugins/dlls/editor addin.sct new file mode 100644 index 000000000..afb2235ff --- /dev/null +++ b/Plugins/dlls/editor addin.sct @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + diff --git a/Plugins/dlls/insert datetime.sct b/Plugins/dlls/insert datetime.sct new file mode 100644 index 000000000..cd6e277b5 --- /dev/null +++ b/Plugins/dlls/insert datetime.sct @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + diff --git a/Plugins/dlls/list.txt b/Plugins/dlls/list.txt new file mode 100644 index 000000000..a0a8a7b97 --- /dev/null +++ b/Plugins/dlls/list.txt @@ -0,0 +1,17 @@ +editor addin +Add two functions to the context menu : MakeUpper and MakeLower. +Use : Select a piece of text, right-click and select one function. + +insert datetime +Add two functions to the context menu : InsertDate and InsertTime. +Use : Put the cursor where you want the date/time to be inserted, right-click +and select one function. + +RCLocalizationHelper +Preprocessing plugin for files .rc. +Use this plugin to compare two files localized in different languages. +It hides most differences concerning the localization (strings with localized +text, layout of controls in dialog). Missing strings/controls/menus +are displayed as differences. +TODO : localized strings tiled on two lines are displayed as different even +if present in both files. Should be displayed as ignored. diff --git a/Plugins/readme.txt b/Plugins/readme.txt new file mode 100644 index 000000000..fdc5f064a --- /dev/null +++ b/Plugins/readme.txt @@ -0,0 +1,72 @@ +There are actually 4 API, and 3 different uses. +Each API is designed by its event name : FILE_PACK_UNPACK, BUFFER_PACK_UNPACK, PREDIFFING, CONTEXT_MENU. + +FILE_PACK_UNPACK Handle a given file type, + for example, unzip a file before loading + Called when load (open) the file, and when saving + The unpacker plugin is memorized, and its packing function is used when saving. + One integer value may be passed from the unpacker to the packer (subcode). +BUFFER_PACK_UNPACK As FILE_PACK_UNPACK, but different interface + +PREDIFFING preprocess the text before diffing, + As now : you may delete one column, change one variable name + you may not add/delete/move lines + Called before comparing files + Either comparing files in directory : the original file is preprocessed + Or compare files being merged : th23:24 29/10/2003e modified text is preprocessed + +CONTEXT_MENU For WinMerge editor, apply a function to the selection or at the cursor point + Right-click in the editor to access a list of functions + + + +For some events (FILE_PACK_UNPACK, BUFFER_PACK_UNPACK, PREDIFFING), plugins are automatically applied +or chosen by the user : + +automatic mode : WinMerge looks for the right plugin. The allowed plugins must be automatic, +and must recognize the file extension (see below for properties). +For PACK_UNPACK, WinMerge applies the first plugin which matches these conditions. +For PREDIFFING, WinMerge applies all the plugins that match these conditions (a first plugin +may delete the first column, and a second one may transform some variable names). + +manual mode : open two files, and select the plugin in the open dialog. Or compare two directories, +select one file and in the menu 'Plugins'->'Edit with unpacker'. + +TODO : Prediffing plugins may not yet be selected in manual mode. + + + + + +A plugin must expose properties : + +property name mandatory ? events + +PluginEvent yes all +PluginDescription no all +PluginFileFilters no FILE_PACK_UNPACK, BUFFER_PACK_UNPACK, PREDIFFING +PluginIsAutomatic if PluginFileFilters is defined FILE_PACK_UNPACK, BUFFER_PACK_UNPACK, PREDIFFING + + + +and methods : + +events method name mandatory ? + +CONTEXT_MENU Free function name At least one + +PREDIFFING DiffingPreprocessW Mandatory (for VB, this one is easy to program) + DiffingPreprocessA Optional (allow to rescan faster for non-unicode files) + +FILE_PACK_UNPACK UnpackFile Optional + PackFile Optional + +BUFFER_PACK_UNPACK UnpackBufferA Optional + PackBufferA Optional + + + + + + + diff --git a/Plugins/syntax.txt b/Plugins/syntax.txt new file mode 100644 index 000000000..5658e6015 --- /dev/null +++ b/Plugins/syntax.txt @@ -0,0 +1,62 @@ +Properties syntax : + +PluginEvent +C++ STDMETHODIMP CWinMergeScript::get_PluginEvent(BSTR * pVal) +VB Public Property Get PluginEvent() As String +VBS Function get_PluginEvent() + +PluginDescription +C++ STDMETHODIMP CWinMergeScript::get_PluginDescription(BSTR * pVal) +VB Public Property Get PluginDescription() As String +VBS Function get_PluginDescription() + +PluginFileFilters +String formed of fileFilters, separated with ";" +C++ STDMETHODIMP CWinMergeScript::get_PluginFileFilters(BSTR * pVal) +VB Public Property Get PluginFileFilters() As String + +PluginIsAutomatic +C++ STDMETHODIMP CWinMergeScript::get_PluginIsAutomatic(VARIANT_BOOL * pVal) +VB Public Property Get PluginIsAutomatic() As Boolean + + + +Methods syntax : + +CONTEXT_MENU Functions parameters (name is free) : + C++ STDMETHOD(MakeUpperVB)([in] BSTR inputText, [out, retval] BSTR * outputText); + VB Public Function MakeUpperVB(text As String) + VBS Function MakeUpperVBS(Text) + +PREDIFFING Mandatory Function name and parameters : + C++ STDMETHOD(DiffingPreprocessW)([in] BSTR * pText, [in] INT * pSize, [in] VARIANT_BOOL * pbChanged, [out, retval] VARIANT_BOOL * pbHandled); + VB Public Function DiffingPreprocessW(ByRef text As String, ByRef size As Long, ByRef bChanged As Boolean) As Boolean + + Optional Function, name and parameters : + C++ STDMETHOD(DiffingPreprocessA)([in] SAFEARRAY ** pBuffer, [in] INT * pSize, [in] VARIANT_BOOL * pbChanged, [out, retval] VARIANT_BOOL * pbHandled); + VB Public Function DiffingPreprocessA(ByRef buffer() As Byte, ByRef size As Long, ByRef bChanged As Boolean) As Boolean + +FILE_PACK_UNPACK Functions names (mandatory) and parameters : + VC++ STDMETHOD(UnpackFile) ([in] BSTR fileSrc, [in] BSTR fileDst, VARIANT_BOOL * pbChanged, INT * pSubcode, [out, retval] VARIANT_BOOL * pbSuccess) + STDMETHOD(PackFile) ([in] BSTR fileSrc, [in] BSTR fileDst, VARIANT_BOOL * pbChanged, INT pSubcode, [out, retval] VARIANT_BOOL * pbSuccess) + VB Public Function UnpackFile (BSTR fileSrc, BSTR fileDst, ByRef bChanged As Boolean, ByRef subcode As Long) As Boolean + Public Function PackFile (BSTR fileSrc, BSTR fileDst, ByRef bChanged As Boolean, subcode As Long) As Boolean + VBS Not supported + +BUFFER_PACK_UNPACK Functions names (mandatory) and parameters : + VC++ STDMETHOD(UnpackBufferA) ([in] SAFEARRAY ** pBuffer, [in] INT * pSize, [in] VARIANT_BOOL * pbChanged, [in] INT * pSubcode, [out, retval] VARIANT_BOOL * pbSuccess) + STDMETHOD(PackBufferA) ([in] SAFEARRAY ** pBuffer, [in] INT * pSize, [in] VARIANT_BOOL * pbChanged, [in] INT subcode, [out, retval] VARIANT_BOOL * pbSuccess) + VB Public Function UnpackBufferA (ByRef buffer() As Byte, ByRef size As Long, ByRef bChanged As Boolean, ByRef subcode As Long) As Boolean + Public Function PackBufferA (ByRef buffer() As Byte, ByRef size As Long, ByRef bChanged As Boolean, subcode As Long) As Boolean + VBS Not supported + + +Additionnal to write a C++ plugin : + +* do not register the dll : delete everything in 'settings'->'custom build' +* do not register the dll : delete the file .rgs, and the registry section in the file .rc +* do not register the dll : add typeinfoex.h + and make 3 changes in WinMergeScript.h (see commented lines) +* SAFEARRAY : replace the interface in .idl : + SAFEARRAY * SAFEARRAY(unsigned char) + SAFEARRAY ** SAFEARRAY(unsigned char) * +