OSDN Git Service

Surface preview
authornaru <bottle@mikage.to>
Sat, 5 Apr 2003 15:44:10 +0000 (15:44 +0000)
committernaru <bottle@mikage.to>
Sat, 5 Apr 2003 15:44:10 +0000 (15:44 +0000)
bottleclient/BottleDef.pas
bottleclient/MainForm.pas
bottleclient/SettingForm.dfm
bottleclient/SettingForm.pas

index 9a52dd0..7ad0b80 100755 (executable)
@@ -76,6 +76,7 @@ type
     FShowRuler: boolean;
     FHideGhosts: boolean;
     FVisibleGhostsList: TStringList;
+    FSurfacePreviewOnHint: boolean;
     procedure SetDblClkInsert(const Value: boolean);
     procedure SetDefaultScript(const Value: String);
     procedure SetIgnoreTimeCritical(const Value: boolean);
@@ -127,6 +128,7 @@ type
     procedure SetShowRuler(const Value: boolean);
     procedure SetHideGhosts(const Value: boolean);
     procedure SetVisibleGhostsList(const Value: TStringList);
+    procedure SetSurfacePreviewOnHint(const Value: boolean);
   public
     property NoSendGhostList: boolean read FNoSendGhostList write SetNoSendGhostList;
     property ConfirmOnExit: boolean read FConfirmOnExit write SetConfirmOnExit;
@@ -194,6 +196,8 @@ type
     property FMOName: TStrings read FFMOName write SetFMOName;
     property HideGhosts: boolean read FHideGhosts write SetHideGhosts;
     property VisibleGhostsList: TStringList read FVisibleGhostsList write SetVisibleGhostsList;
+    //\83T\81[\83t\83B\83X\83v\83\8c\83r\83\85\81[
+    property SurfacePreviewOnHint: boolean read FSurfacePreviewOnHint write SetSurfacePreviewOnHint;
     //\83R\83\93\83X\83g\83\89\83N\83^\81E\83f\83X\83g\83\89\83N\83^\81E\95Û\91
     constructor Create;
     destructor Destroy; override;
@@ -385,6 +389,8 @@ begin
     FMOName.CommaText := FIni.ReadString('System', 'FMOName', 'Sakura');
     HideGhosts := FIni.ReadBool('System', 'HideGhosts', false);
     VisibleGhostsList.CommaText := FIni.ReadString('System', 'VisibleGhostsList', '');
+    //\83T\81[\83t\83B\83X\83v\83\8c\83r\83\85\81[
+    SurfacePreviewOnHint := FIni.ReadBool('System', 'SurfacePreviewOnHint', false);
   except
     ShowMessage('INI\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý\83G\83\89\81[');
     Application.Terminate;
@@ -685,6 +691,8 @@ begin
   FIni.WriteString('System', 'FMOName', FFMOName.CommaText);
   FIni.WriteBool('System', 'HideGhosts', HideGhosts);
   FIni.WriteString('System', 'VisibleGhostsList', VisibleGhostsList.CommaText);
+  //
+  FIni.WriteBool('System', 'SurfacePreviewOnHint', SurfacePreviewOnHint);
 end;
 
 function TBottlePrefs.GetDefaultScript: String;
@@ -728,6 +736,11 @@ begin
   FVisibleGhostsList.Assign(Value);
 end;
 
+procedure TBottlePrefs.SetSurfacePreviewOnHint(const Value: boolean);
+begin
+  FSurfacePreviewOnHint := Value;
+end;
+
 { TChannelListItem }
 
 procedure TChannelListItem.SetGhost(const Value: String);
index 9d1c4d4..63260df 100755 (executable)
@@ -237,6 +237,7 @@ type
     FOriginalCaption: String;
     FAutoAddAfterGetChannel: boolean;
     FConstDir: String;
+    FSppDir: String;
     //
     FMutex: THandle; //Mutex\83I\83u\83W\83F\83N\83g\81c\93ñ\8fd\8bN\93®\96h\8e~\97p
     //
@@ -391,6 +392,8 @@ begin
   SakuraSeeker.OnDetectResultChanged := SakuraSeekerDetectResultChanged;
   FConstDir := ExtractFileDir(Application.ExeName)+'\consts';
   ScriptConstList.LoadFromDir(FConstDir);
+  FSppDir := ExtractFileDir(Application.ExeName)+'\spp';
+  Spps.LoadFromDirectory(FSppDir);
   ConstructMenu(false);
 
   Str := TStringList.Create;
@@ -794,6 +797,7 @@ begin
   FAutoAddAfterGetChannel := Pref.AutoStart;
   FBooted := true;
   frmLog.Show;
+  frmSurfacePreview.Show;
   Self.Show;
   SakuraSeekerDetectResultChanged(Self);
 end;
@@ -949,6 +953,7 @@ procedure TfrmSender.ApplicationEventsHint(Sender: TObject);
 var id: integer;
     ghost: String;
     Bmp: TBitmap;
+    CPos: TPoint;
 begin
   if Length(Application.Hint) > 0 then
   begin
@@ -961,21 +966,23 @@ begin
       Application.HintColor := clYellow;
       Application.ActivateHint(Mouse.CursorPos);
     end;
-  end else if IsSurfaceTag(Application.Hint, id) then
-  begin
-    // \83T\81[\83t\83B\83X\83v\83\8c\83r\83\85\81[
-    if cbxTargetGhost.ItemIndex > 0 then
-      ghost := cbxTargetGhost.Text
-    else if FNowChannel <> '' then
-      ghost := ChannelList.Channel[FNowChannel].Ghost;
-    if ghost <> '' then
+    if IsSurfaceTag(Application.Hint, id) and Pref.SurfacePreviewOnHint then
     begin
-      Bmp := TBitmap.Create;
-      try
-        if Spps.TryGetImage(ghost, id, Bmp) then
-          frmSurfacePreview.ShowPreview(Bmp, 10, 10);
-      finally
-        Bmp.Free;
+      // \83T\81[\83t\83B\83X\83v\83\8c\83r\83\85\81[
+      if cbxTargetGhost.ItemIndex > 0 then
+        ghost := cbxTargetGhost.Text
+      else if FNowChannel <> '' then
+        ghost := ChannelList.Channel[FNowChannel].Ghost;
+      if ghost <> '' then
+      begin
+        Bmp := TBitmap.Create;
+        try
+          if Spps.TryGetImage(ghost, id, Bmp) then
+            GetCursorPos(CPos);
+            frmSurfacePreview.ShowPreview(Bmp, Self.Left-Bmp.Width, CPos.Y);
+        finally
+          Bmp.Free;
+        end;
       end;
     end;
   end else
@@ -2256,8 +2263,9 @@ begin
         Menu2 := TMenuItem.Create(Root);
         Menu2.Caption := ConstData.Caption;
         Menu2.Hint := ConstData.ConstText;
-        if ConstData.ShortCut <> 0 then Menu2.Hint := Menu2.Hint
-          + ' (' + ShortCutToText(ConstData.ShortCut) + ')';
+        // if ConstData.ShortCut <> 0 then Menu2.Hint := Menu2.Hint
+        //   + ' (' + ShortCutToText(ConstData.ShortCut) + ')';
+        // \83T\81[\83t\83B\83X\83v\83\8c\83r\83\85\81[\8eÀ\8c»\82Ì\82½\82ß\8fã\8dí\8f\9c
         Menu2.ShortCut := ConstData.ShortCut;
         Menu2.OnClick := Event;
         Menu2.AutoHotkeys := maManual;
@@ -2422,7 +2430,7 @@ begin
   else if SsParser.Match(Script, '\s[%D]') = Length(Script) then
   begin
     Result := true;
-    ID := StrToIntDef(SsParser.GetParam(Script, 0), 0);
+    ID := StrToIntDef(SsParser.GetParam(Script, 1), 0);
   end;
 end;
 
index 2688986..06652ac 100755 (executable)
@@ -27,7 +27,7 @@ object frmSetting: TfrmSetting
     Top = 8
     Width = 439
     Height = 306
-    ActivePage = tstColor
+    ActivePage = tstSurfacePreview
     Anchors = [akLeft, akTop, akRight, akBottom]
     TabOrder = 0
     object tstGeneral: TTabSheet
@@ -483,19 +483,45 @@ object frmSetting: TfrmSetting
       ImageIndex = 7
       object lblSurfacePreview: TLabel
         Left = 16
-        Top = 24
-        Width = 199
+        Top = 16
+        Width = 252
         Height = 12
-        Caption = #8251#12503#12524#12499#12517#12540#12395#12399#12503#12521#12464#12452#12531#12364#24517#35201#12391#12377
+        Caption = #8251#12469#12540#12501#12451#12473#12503#12524#12499#12517#12540#12395#12399#12503#12521#12464#12452#12531#12364#24517#35201#12391#12377
       end
-      object cbxDoSurfacePreview: TCheckBox
+      object lblPluginList: TLabel
         Left = 16
-        Top = 56
+        Top = 136
+        Width = 170
+        Height = 12
+        Caption = #12452#12531#12473#12488#12540#12523#12373#12428#12390#12356#12427#12503#12521#12464#12452#12531':'
+      end
+      object cbxSurfacePreviewOnHint: TCheckBox
+        Left = 16
+        Top = 48
         Width = 289
         Height = 17
+        Hint = #23450#22411#21477#25407#20837#12513#12491#12517#12540#12434#12503#12523#12480#12454#12531#12375#12383#12392#12365#12395#12503#12524#12499#12517#12540#12434#34920#31034
         Caption = #23450#22411#21477#25407#20837#26178#12395#12503#12524#12499#12517#12540#12434#34892#12358'(&E)'
         TabOrder = 0
       end
+      object lvwPluginList: TListView
+        Left = 16
+        Top = 152
+        Width = 401
+        Height = 113
+        Hint = #29694#22312#12452#12531#12473#12488#12540#12523#12373#12428#12390#12356#12427#12503#12521#12464#12452#12531#12364#19968#35239#34920#31034#12373#12428#12414#12377#12290#19978#12363#12425#38918#12395#12469#12540#12501#12451#12473#12487#12540#12479#12434#26908#32034#12375#12414#12377
+        Columns = <
+          item
+            Caption = #12501#12449#12452#12523
+            Width = 100
+          end
+          item
+            Caption = #21517#21069
+            Width = 280
+          end>
+        TabOrder = 1
+        ViewStyle = vsReport
+      end
     end
   end
   object btnClose: TButton
index 865dc00..3794262 100755 (executable)
@@ -6,7 +6,7 @@ uses
   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
   ComCtrls, StdCtrls, ExtCtrls, BottleDef, Spin,
   CPCConfigTreeView, ColorSettingFrame, BottleChainListFrame, SakuraSeekerInstance,
-  ImgList, StrListEditor;
+  ImgList, StrListEditor, SppList, SppTypes;
 
 type
   TfrmSetting = class(TForm)
@@ -56,8 +56,10 @@ type
     cbxHideGhosts: TCheckBox;
     btnVisibleGhosts: TButton;
     tstSurfacePreview: TTabSheet;
-    cbxDoSurfacePreview: TCheckBox;
+    cbxSurfacePreviewOnHint: TCheckBox;
     lblSurfacePreview: TLabel;
+    lvwPluginList: TListView;
+    lblPluginList: TLabel;
     procedure FormClose(Sender: TObject; var Action: TCloseAction);
     procedure edtProxyPortKeyPress(Sender: TObject; var Key: Char);
     procedure ctvBottleNodeChecked(Sender: TObject;
@@ -88,6 +90,7 @@ implementation
 {$R *.DFM}
 
 procedure TfrmSetting.Execute;
+var i: integer;
 begin
   PageControl.ActivePage := tstGeneral;
   memDefaultScript.Text := Pref.DefaultScript;
@@ -145,6 +148,16 @@ begin
   cbxHideGhosts.Checked := Pref.HideGhosts;
   memAutoJoinChannels.Lines := Pref.AutoJoinChannels;
   //
+  cbxSurfacePreviewOnHint.Checked := Pref.SurfacePreviewOnHint;
+  for i := 0 to Spps.Count-1 do
+  begin
+    with lvwPluginList.Items.Add do
+    begin
+      Caption := ExtractFileName(Spps.SppItem[i].ModuleName);
+      SubItems.Add(Spps.SppItem[i].DLLName);
+    end;
+  end;
+  //
   ShowModal;
 end;