OSDN Git Service

Initial checkin of plugins
authorLaurent Ganier <laoran@users.sourceforge.net>
Wed, 29 Oct 2003 23:05:42 +0000 (23:05 +0000)
committerLaurent Ganier <laoran@users.sourceforge.net>
Wed, 29 Oct 2003 23:05:42 +0000 (23:05 +0000)
Plugins/dlls/editor addin.sct [new file with mode: 0644]
Plugins/dlls/insert datetime.sct [new file with mode: 0644]
Plugins/dlls/list.txt [new file with mode: 0644]
Plugins/readme.txt [new file with mode: 0644]
Plugins/syntax.txt [new file with mode: 0644]

diff --git a/Plugins/dlls/editor addin.sct b/Plugins/dlls/editor addin.sct
new file mode 100644 (file)
index 0000000..afb2235
--- /dev/null
@@ -0,0 +1,36 @@
+<scriptlet>
+
+<implements type="Automation" id="dispatcher">
+       <property name="PluginEvent">
+                 <get/>
+        </property>
+       <property name="PluginDescription">
+                 <get/>
+        </property>
+       <method name="MakeUpper"/>
+       <method name="MakeLower"/>
+</implements>
+
+<script language="VBS">
+Option Explicit
+
+Function get_PluginEvent()
+         get_PluginEvent = "CONTEXT_MENU"
+End Function
+
+Function get_PluginDescription()
+         get_PluginDescription = "Basic text functions for the context menu"
+End Function
+
+
+' transformation functions
+Function MakeUpper(Text)
+       MakeUpper = UCase(Text)
+End Function
+
+Function MakeLower(Text)
+       MakeLower = LCase(Text)
+End Function
+
+</script>
+</scriptlet>
diff --git a/Plugins/dlls/insert datetime.sct b/Plugins/dlls/insert datetime.sct
new file mode 100644 (file)
index 0000000..cd6e277
--- /dev/null
@@ -0,0 +1,36 @@
+<scriptlet>
+
+<implements type="Automation" id="dispatcher">
+       <property name="PluginEvent">
+                 <get/>
+        </property>
+       <property name="PluginDescription">
+                 <get/>
+        </property>
+       <method name="InsertDate"/>
+       <method name="InsertTime"/>
+</implements>
+
+<script language="VBS">
+Option Explicit
+
+Function get_PluginEvent()
+         get_PluginEvent = "CONTEXT_MENU"
+End Function
+
+Function get_PluginDescription()
+         get_PluginDescription = "Basic text functions for the context menu"
+End Function
+
+
+' transformation functions
+Function InsertDate(Text)
+       InsertDate = Text + FormatDateTime(Date, 1)
+End Function
+
+Function InsertTime(Text)
+       InsertTime = Text + FormatDateTime(Time, 4)
+End Function
+
+</script>
+</scriptlet>
diff --git a/Plugins/dlls/list.txt b/Plugins/dlls/list.txt
new file mode 100644 (file)
index 0000000..a0a8a7b
--- /dev/null
@@ -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 (file)
index 0000000..fdc5f06
--- /dev/null
@@ -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 (file)
index 0000000..5658e60
--- /dev/null
@@ -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) *
+