OSDN Git Service

Use Plugins.pas instead of SppTypes.pas
authornaru <bottle@mikage.to>
Sat, 28 Jun 2003 07:06:42 +0000 (07:06 +0000)
committernaru <bottle@mikage.to>
Sat, 28 Jun 2003 07:06:42 +0000 (07:06 +0000)
bottleclient/SppTypes.pas [deleted file]
bottleclient/SstpBottle.dpr

diff --git a/bottleclient/SppTypes.pas b/bottleclient/SppTypes.pas
deleted file mode 100644 (file)
index 2efcd27..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-{
-
-SPP (Surface Preview Plugin) \83v\83\89\83O\83C\83\93\82ð\88µ\82¤\83N\83\89\83X
-
-}
-
-unit SppTypes;
-
-interface
-
-uses
-  Windows, Forms, SysUtils, Graphics;
-
-type
-  TSppLoadProc = procedure(Path: PChar); cdecl;
-
-  TSppUnloadProc = procedure; cdecl;
-
-  TSppGetVersionFunc = function(Name: PChar; NameLen: integer;
-    var Version: integer; var CanConfigure: boolean): integer; cdecl;
-
-  TSppGetImageFunc = function(Ghost: PChar; Surface: integer;
-    H: HBITMAP): integer; cdecl;
-
-  TSppGetImageSizeFunc = function(Ghost: PChar; Surface: integer;
-    var w, h: integer): integer; cdecl;
-
-  TSppConfigureProc = procedure; cdecl;
-
-  TSurfacePreviewPlugin = class(TObject)
-  private
-    FModuleName: String;
-    FHandle: THandle;
-    // \8aÖ\90\94\81E\8eè\91±\82«\95Ï\90\94
-    FSppLoad: TSppLoadProc;
-    FSppUnload: TSppUnloadProc;
-    FSppGetVersion: TSppGetVersionFunc;
-    FSppGetImage: TSppGetImageFunc;
-    FSppGetImageSize: TSppGetImageSizeFunc;
-    FSppConfigure: TSppConfigureProc;
-    // 
-    FDLLName: String;
-    FVersion: integer;
-    FCanConfigure: boolean;
-  protected
-    procedure InitProcs;
-    procedure Load;
-  public
-    constructor Create(ModuleName: String);
-    destructor Destroy; override;
-    property ModuleName: String read FModuleName;
-    property SppVersion: integer read FVersion;
-    property CanConfigure: boolean read FCanConfigure;
-    property DLLName: String read FDLLName;
-    function GetImageSize(const Ghost: String; const Surface: integer;
-      var Width, Height: integer): boolean;
-    function GetImage(const Ghost: String; const Surface: integer;
-      Bitmap: TBitmap): boolean;
-    function SetSizeAndGetImage(const Ghost: String; const Surface: integer;
-      Bitmap: TBitmap): boolean;
-    procedure Configure;
-  end;
-
-  ESppException = class(Exception);
-
-const
-  SSppLoad = 'Load';
-  SSppUnload = 'Unload';
-  SSppGetVersion = 'GetVersion';
-  SSppGetImage = 'GetImage';
-  SSppGetImageSize = 'GetImageSize';
-  SSppConfigure = 'Configure';
-
-
-implementation
-
-{ TSurfacePreviewPlugin }
-
-procedure TSurfacePreviewPlugin.Configure;
-begin
-  FSppConfigure;
-end;
-
-constructor TSurfacePreviewPlugin.Create(ModuleName: String);
-begin
-  FModuleName := ModuleName;
-  FHandle := LoadLibrary(PChar(FModuleName));
-  if FHandle = 0 then
-    raise ESppException.CreateFmt('Error loading %s', [FModuleName])
-  else
-  begin
-    InitProcs;
-    Load;
-  end;
-end;
-
-destructor TSurfacePreviewPlugin.Destroy;
-begin
-  FSppUnload;
-  if not FreeLibrary(FHandle) then
-    raise ESppException.CreateFmt('Error unloading %s', [FModuleName]); 
-  inherited;
-end;
-
-function TSurfacePreviewPlugin.GetImage(const Ghost: String;
-  const Surface: integer; Bitmap: TBitmap): boolean;
-var H: HBITMAP;
-begin
-  H := Bitmap.ReleaseHandle;
-  Result := FSppGetImage(PChar(Ghost), Surface, H) = 0;
-  Bitmap.Handle := H;
-end;
-
-function TSurfacePreviewPlugin.GetImageSize(const Ghost: String;
-  const Surface: integer; var Width, Height: integer): boolean;
-begin
-  Width  := 0;
-  Height := 0;
-  // 0\82È\82ç\90³\8fí\8fI\97¹
-  Result :=  FSppGetImageSize(PChar(Ghost), Surface, Width, Height) = 0;
-end;
-
-procedure TSurfacePreviewPlugin.InitProcs;
-var DLLName: array [0..255] of char;
-begin
-  FSppGetVersion := GetProcAddress(FHandle, SSppGetVersion);
-  if (@FSppGetVersion = nil) then
-    raise ESppException.CreateFmt('%s is not a valid SPP module', [FModuleName]);
-
-  FSppGetVersion(@DLLName, sizeof(DLLName), FVersion, FCanConfigure);
-  if FVersion <> 1 then
-    raise ESppException.CreateFmt('Module %s returned '+
-      'unsupported version number', [FModuleName]);
-  FDLLName := DLLName;
-
-  // Load other procedures
-  FSppLoad := GetProcAddress(FHandle, SSppLoad);
-  FSppUnload := GetProcAddress(FHandle, SSppUnload);
-  FSppGetImage := GetProcAddress(FHandle, SSppGetImage);
-  FSppGetImageSize := GetProcAddress(FHandle, SSppGetImageSize);
-  FSppConfigure := GetProcAddress(FHandle, SSppConfigure);
-
-  if (@FSppLoad = nil) or (@FSppUnload = nil) or (@FSppGetImage = nil) or
-     (@FSppGetImageSize = nil) or (@FSppConfigure = nil) then
-  begin
-    raise ESppException.Create('Error Getting Procedure Address');
-  end;
-end;
-
-procedure TSurfacePreviewPlugin.Load;
-begin
-  FSppLoad(PChar(ExtractFilePath(FModuleName)));
-end;
-
-function TSurfacePreviewPlugin.SetSizeAndGetImage(const Ghost: String;
-  const Surface: integer; Bitmap: TBitmap): boolean;
-var Width, Height: integer;
-begin
-  Width  := 0;
-  Height := 0;
-  Result := false;
-  if Surface < 0 then Exit;
-  if not GetImageSize(Ghost, Surface, Width, Height) then
-    Exit;
-  Bitmap.Width := Width;
-  Bitmap.Height := Height;
-  Result := GetImage(Ghost, Surface, Bitmap);
-end;
-
-end.
index 4f35164..b2ce7d1 100755 (executable)
@@ -21,6 +21,7 @@ program SstpBottle;
 {%ToDo 'SstpBottle.todo'}
 
 uses
+  // MemCheck,
   Forms,
   MainForm in 'MainForm.pas' {frmSender},
   BRegExp in 'BRegExp.pas',
@@ -50,10 +51,10 @@ uses
   BottleSstp in 'BottleSstp.pas',
   SurfacePreview in 'SurfacePreview.pas' {frmSurfacePreview},
   SppList in 'SppList.pas',
-  SppTypes in 'SppTypes.pas',
   TalkShowFrame in 'TalkShowFrame.pas' {frmTalkShow: TFrame},
   EditorTalkShow in 'EditorTalkShow.pas' {frmEditorTalkShow},
-  ProgressWindow in 'ProgressWindow.pas' {frmProgressWindow};
+  ProgressWindow in 'ProgressWindow.pas' {frmProgressWindow},
+  Plugins in 'Plugins.pas';
 
 // \8c^\95t\82«\92è\90\94\82ð\95Ï\8dX\82Å\82«\82é\82æ\82¤\82É\82·\82é\83R\83\93\83p\83C\83\89\83I\83v\83V\83\87\83\93
 // \88ê\95\94\82Ì\83R\83\93\83|\81[\83l\83\93\83g\82É\82±\82ê\82ª\95K\97v