OSDN Git Service

no message master trunk
authornaru <bottle@mikage.to>
Sun, 20 Apr 2003 13:46:38 +0000 (13:46 +0000)
committernaru <bottle@mikage.to>
Sun, 20 Apr 2003 13:46:38 +0000 (13:46 +0000)
LICENSE_BUILD.txt [new file with mode: 0644]
TSG.dll.txt [new file with mode: 0644]
TSG.dpr [new file with mode: 0644]
TSG.res [new file with mode: 0644]

diff --git a/LICENSE_BUILD.txt b/LICENSE_BUILD.txt
new file mode 100644 (file)
index 0000000..e3d7b2b
--- /dev/null
@@ -0,0 +1,10 @@
+\81\9f\83\89\83C\83Z\83\93\83X
+\81@\90§\8cÀ\82È\82­\81A\8e©\97R\82É\94z\95z\81E\89ü\91¢\81E\93]\8dÚ\82µ\82Ä\82­\82¾\82³\82¢\81B
+
+\81\9f\83r\83\8b\83h\95û\96@
+\81@Delphi 7 Professional\90\84\8f§\81B
+\81@Delphi 6 Personal\82Æ\82©\82Ì\8fê\8d\87\82Íjpeg\83\86\83j\83b\83g\82ð
+\81@\82Í\82¸\82¹\82ÎJPEG\94ñ\91Î\89\9e\82Å\83R\83\93\83p\83C\83\8b\82Í\89Â\94\\82Ì\82Í\82¸\81B
+\81@PngImage\83\86\83j\83b\83g\82Í
+\81@http://pngdelphi.sourceforge.net/
+\81@\82©\82ç\8eè\82É\93ü\82ê\82Ä\82­\82¾\82³\82¢\81B
\ No newline at end of file
diff --git a/TSG.dll.txt b/TSG.dll.txt
new file mode 100644 (file)
index 0000000..1b2d555
--- /dev/null
@@ -0,0 +1,20 @@
+\82±\82ÌDLL\82Í\81ASSTP Bottle\83T\81[\83t\83B\83X\83v\83\8c\83r\83\85\81[\97p\83v\83\89\83O\83C\83\93\82Å\82·\81B
+
+TalkShow\97p\82Ì\83T\81[\83t\83B\83X\89æ\91\9c\83t\83@\83C\83\8b(TSG)\82ð\81A
+\83T\81[\83t\83B\83X\83T\83\80\83l\83C\83\8b\82Æ\82µ\82Ä\93Ç\82Ý\8d\9e\82Ý\81ASSTP Bottle Client\82É
+\92ñ\8b\9f\82µ\82Ü\82·\81B
+
+\81\9c\83C\83\93\83X\83g\81[\83\8b
+\81@1)\83{\83g\83\8b\83N\83\89\83C\83A\83\93\83g\82Ì2.51\88È\8fã\82ð\8f\80\94õ
+\81@2)SstpBottle.exe\82Ì\83t\83H\83\8b\83_\82É\8dì\82ç\82ê\82Ä\82¢\82é\82Í\82¸\82Ì spp \83t\83H\83\8b\83_\82Ì\92\86\82É
+\81@\81@TSG.DLL\82ð\93ü\82ê\82é
+\81@3)\83{\83g\83\8b\83N\83\89\83C\83A\83\93\83g\82ð\8bN\93®\82µ\82Ä\81A\90Ý\92è\89æ\96Ê\82Ì\81u\83v\83\8c\83r\83\85\81[\81v\82©\82ç
+\81@\81@TSG.DLL\82ð\83_\83u\83\8b\83N\83\8a\83b\83N\81ATalkShow.exe\82Ì\8fê\8f\8a\82ð\8ew\92è\82·\82é
+
+\81\9c\97\9a\97ð
+\81@1.0 \8f\89\8cö\8aJ
+
+
+TPngImage \82Í Gustavo Huffenbacher Daud \8e\81\82Ì\92\98\8dì\95¨\82Å\82·\81B
+Gustavo Huffenbacher Daud
+http://pngdelphi.sourceforge.net
\ No newline at end of file
diff --git a/TSG.dpr b/TSG.dpr
new file mode 100644 (file)
index 0000000..65d30c0
--- /dev/null
+++ b/TSG.dpr
@@ -0,0 +1,230 @@
+{
+SSTP Bottle Surface Preview Plug-In for "SVG"
+(C)2003 naru, Mikage Sawatari / SSTP Bottle
+}
+
+library TSG;
+
+{$R *.res}
+
+uses
+  Windows, Classes, SysUtils, Graphics, IniFiles, Dialogs, PngImage;
+
+const
+  ConfigFile = 'TSG.ini';
+
+var
+  MyPath: String;
+  TalkShow: String;
+  Ghost2File: TStringList;
+
+  Pic: TPicture;       // \93Ç\82Ý\8eæ\82Á\82½\89æ\91\9c(*.png)
+  PicFileName: String; // \82»\82Ì\83t\83@\83C\83\8b\96¼
+
+
+procedure LoadGhosts(GhostDir: String);
+var F: TSearchRec;
+    i: integer;
+    Ini: TIniFile;
+    Ghost: String;
+    IniFileName: String;
+begin
+  Ghost2File.Clear;
+  i := FindFirst(GhostDir + '\*', FaDirectory, F);
+  if i = 0 then begin
+    repeat
+      if (F.Name <> '..') and (F.Name <> '.') then
+      begin
+        try
+          IniFileName := GhostDir + '\' + F.Name + '\ghost.ini';
+          if FileExists(IniFileName) then
+          begin
+            Ini := TIniFIle.Create(IniFileName);
+            Ghost := Ini.ReadString('General', 'SakuraName', '');
+            if Ghost <> '' then
+            begin
+              Ghost2File.Values[Ghost] := F.Name;
+            end;
+          end;
+        except
+          ;
+        end;
+      end;
+      i := FindNext(F);
+    until i <> 0;
+  end;
+  FindClose(F);
+end;
+
+procedure Load(Path: PChar); cdecl;
+var Ini: TIniFile;
+begin
+  MyPath := Path;
+  Ini := TIniFile.Create(MyPath + ConfigFile);
+  try
+    TalkShow := Ini.ReadString('TSG', 'TalkShow', '');
+  finally
+    Ini.Free;
+  end;
+
+  Ghost2File := TStringList.Create;
+
+  if not FileExists(TalkShow) then
+    ShowMessage('TSG.dll Warning: Ghost file is not specified')
+  else
+    LoadGhosts(ExtractFileDir(TalkShow) + '\Ghost');
+
+  Pic := TPicture.Create;
+  PicFileName := '';
+end;
+
+procedure Unload; cdecl;
+begin
+  Ghost2File.Free;
+  Pic.Free;
+end;
+
+function GetVersion(DLLName: PChar; NameLen: integer;
+  var Version: integer; var CanConfigure: boolean): integer; cdecl;
+const ThisDLL = 'TSG Surface Loader Ver. 1.0';
+begin
+  Version := 1;
+  CanConfigure := true;
+  StrLCopy(DLLName, ThisDLL, NameLen);
+  Result := Length(ThisDLL) + 1;
+end;
+
+function FetchBmpFile(Ghost: String; Surface: integer): String;
+var FileName: String;
+begin
+  Result := '';
+  if Ghost2File.Values[Ghost] = '' then
+    Exit
+  else
+  begin
+    FileName := ExtractFilePath(TalkShow) + '\Ghost\' +
+      Ghost2File.Values[Ghost] + '\' + IntToStr(Surface) + '.png';
+    if FileExists(FileName) then
+    begin
+      Result := FileName;
+    end;
+  end;
+end;
+
+// Ghost\82Å\8ew\92è\82³\82ê\82é\83S\81[\83X\83g\82ÌSurface\94Ô\82Ì\83T\81[\83t\83B\83X\83C\83\81\81[\83W\82ð\8eÀ\8dÛ\82É\93Ç\82Ý\8fo\82·\81B
+// H\82Å\8ew\92è\82³\82ê\82Ä\82¢\82é\83r\83b\83g\83}\83b\83v\82É\8f\91\82«\8fo\82·\82±\82Æ\81B
+function GetImage(Ghost: PChar; Surface: integer; H: HBITMAP): integer; cdecl;
+var Bmp: TBitmap;
+    BmpFile: String;
+begin
+  try
+    BmpFile := FetchBmpFile(Ghost, Surface);
+    if BmpFile = '' then // \82»\82Ì\82æ\82¤\82È\83S\81[\83X\83g\82Ì\82»\82Ì\82æ\82¤\82È\83T\81[\83t\83B\83X\82Í\8c©\82Â\82©\82ç\82È\82¢
+    begin
+      Result := 1;
+      Exit;
+    end;
+    Bmp := TBitmap.Create;
+    try
+      Bmp.Handle := H;
+      if PicFileName <> BmpFile then
+      begin
+        try
+          Pic.LoadFromFile(BmpFile);
+          PicFileName := BmpFile;
+        except
+          // \8dì\82è\92¼\82µ
+          FreeAndNil(Pic);
+          Pic := TPicture.Create;
+          PicFileName := '';
+          raise;
+        end;
+      end;
+      Bmp.Canvas.Draw(0, 0, Pic.Graphic);
+    finally
+      Bmp.ReleaseHandle;
+      Bmp.Free;
+    end;
+    Result := 0;
+  except
+    Result := 1;
+  end;
+end;
+
+function GetImageSize(Ghost: PChar; Surface: integer;
+  var w, h: integer): integer; cdecl;
+var BmpFile: String;
+begin
+  try
+    BmpFile := FetchBmpFile(Ghost, Surface);
+    if BmpFile = '' then // \82»\82Ì\82æ\82¤\82È\83S\81[\83X\83g\82Ì\82»\82Ì\82æ\82¤\82È\83T\81[\83t\83B\83X\82Í\8c©\82Â\82©\82ç\82È\82¢
+    begin
+      Result := 1;
+      Exit;
+    end;
+    if PicFileName <> BmpFile then
+    begin
+      try
+        Pic.LoadFromFile(BmpFile);
+        PicFileName := BmpFile;
+      except
+        // \8dì\82è\92¼\82µ
+        FreeAndNil(Pic);
+        Pic := TPicture.Create;
+        PicFileName := '';
+        raise;
+      end;
+    end;
+    w := Pic.Width;
+    h := Pic.Height;
+    Result := 0;
+  except
+    Result := 1;
+  end;
+end;
+
+// DLL\8cÅ\97L\82Ì\90Ý\92è\82ð\8ds\82¤\81B
+//
+procedure Configure; cdecl;
+var OpenDialog: TOpenDialog;
+    Ini: TIniFile;
+begin
+  try
+    ShowMessage('Specify the loaction of TalkShow.exe.');
+    OpenDialog := TOpenDialog.Create(nil);
+    try
+      OpenDialog.Filter := 'TalkShow Application(TalkShow.exe)|TalkShow.exe|' +
+       'All Files(*.*)|*.*';
+      OpenDialog.FileName := TalkShow;
+      if OpenDialog.Execute then
+      begin
+        TalkShow := OpenDialog.FileName;
+        Ini := TIniFile.Create(MyPath + ConfigFile);
+        try
+          Ini.WriteString('TSG', 'TalkShow', TalkShow);
+        finally
+          Ini.Free;
+        end;
+        Ghost2File.Clear;
+        LoadGhosts(ExtractFileDir(TalkShow) + '\Ghost');
+      end;
+    finally
+      OpenDialog.Free;
+    end;
+  except
+    on E: Exception do
+      ShowMessage(E.Message);
+  end;
+end;
+
+exports
+  Load,
+  Unload,
+  GetVersion,
+  Configure,
+  GetImage,
+  GetImageSize;
+
+begin
+
+end.
diff --git a/TSG.res b/TSG.res
new file mode 100644 (file)
index 0000000..5ac562e
Binary files /dev/null and b/TSG.res differ