MODULE Config; (* J. Templ

    This module provides a BlackBox configuration appropriate for comparing two text documents.
    It tiles the screen vertically and then it invokes 'Compare Texts'.
    The two documents to be compared are supposed to be provided as command line arguments
    when starting BlackBox.
    Note that due to BlackBox's startup strategy, the setup must be delayed.

    This module is intended to be used in conjunction with a file diff script such as
    diff-odc.js for TortoiseSVN.
   
   OLE data converters are registered in order to make the Windows clipboard work.

    *)
   
   IMPORT Converters, HostMenus, Services, DevSearch, OleData, HostTextConv;

   TYPE TileAction = POINTER TO RECORD (Services.Action) END ;
   
   PROCEDURE
(this: TileAction ) Do-;
   BEGIN
      HostMenus.TileVertical;
      DevSearch.Compare;

   END Do;

   PROCEDURE Setup *;
      VAR tileAction: TileAction;
   BEGIN
      
(* option Converters.importAll results in using this converter for files without a file type as well. *)
      Converters.Register("Documents.
ImportDocument ", "Documents. ExportDocument ", "", "odc", {Converters.importAll});
      
(* register OLE data converters; required for the Windows clipboard *)
      OleData.Register("OleData.ImportInfo", "OleData.ExportInfo", "BlackBox Info", "", {OleData.info});
      OleData.Register("OleData.ImportNative", "OleData.ExportNative", "BlackBox Data", "", {});
      OleData.Register("", "HostTextConv.ExportDRichText", "Rich Text Format", "TextViews.View", {});
      OleData.Register("OleClient.ImportInfo", "OleClient.ExportInfo", "Object Descriptor", "", {OleData.info});
      OleData.Register("", "OleClient.Export", "Embedded Object", "OleClient.View", {OleData.storage});
      OleData.Register("OleClient.Import", "OleServer.Export", "Embed Source", "", {OleData.storage});
      OleData.Register("OleClient.Import", "", "Embedded Object", "", {OleData.storage});
      OleData.Register("HostTextConv.ImportDRichText", "", "Rich Text Format", "TextViews.View", {});
      OleData.Register("HostTextConv.ImportDUnicode", "HostTextConv.ExportDUnicode", "UNICODETEXT", "TextViews.View", {});
      OleData.Register("HostTextConv.ImportDText", "HostTextConv.ExportDText", "TEXT", "TextViews.View", {});
      OleData.Register("HostPictures.ImportDPict", "HostPictures.ExportDPict", "METAFILEPICT", "HostPictures.View", {});
      OleData.Register("HostBitmaps.ImportDBitmap", "HostBitmaps.ExportDBitmap", "BITMAP", "HostBitmaps.View", {});
      OleData.Register("HostBitmaps.ImportDPictAsBitmap", "", "METAFILEPICT", "HostBitmaps.View", {});
      OleData.Register("", "OleData.ExportPicture", "METAFILEPICT", "", {});
      
(* tile window must be delayed *)
      NEW(tileAction);
      Services.DoLater(tileAction, Services.now);
   END Setup;

BEGIN
END Config.