OSDN Git Service

Added Hide and VisibleGhosts properties
authornaru <bottle@mikage.to>
Wed, 2 Apr 2003 18:08:04 +0000 (18:08 +0000)
committernaru <bottle@mikage.to>
Wed, 2 Apr 2003 18:08:04 +0000 (18:08 +0000)
bottleclient/BottleDef.pas
bottleclient/MainForm.pas
bottleclient/SettingForm.dfm
bottleclient/SettingForm.pas

index b6f33d2..d775c1a 100755 (executable)
@@ -74,6 +74,8 @@ type
     FWarnScopeChangeInSynchronize: boolean;
     FNeedConfirmBeforeSend: boolean;
     FShowRuler: boolean;
+    FHideGhosts: boolean;
+    FVisibleGhostsList: TStringList;
     procedure SetDblClkInsert(const Value: boolean);
     procedure SetDefaultScript(const Value: String);
     procedure SetIgnoreTimeCritical(const Value: boolean);
@@ -123,6 +125,8 @@ type
     procedure SetWarnYenTNotExist(const Value: boolean);
     procedure SetNeedConfirmBeforeSend(const Value: boolean);
     procedure SetShowRuler(const Value: boolean);
+    procedure SetHideGhosts(const Value: boolean);
+    procedure SetVisibleGhostsList(const Value: TStringList);
   public
     property NoSendGhostList: boolean read FNoSendGhostList write SetNoSendGhostList;
     property ConfirmOnExit: boolean read FConfirmOnExit write SetConfirmOnExit;
@@ -188,6 +192,8 @@ type
     property LogWindowPreviewStyle: TLogWindowPreviewStyle read FLogWindowPreviewStyle write SetLogWindowPreviewStyle;
     //\8fÚ\8d×\90Ý\92è
     property FMOName: TStrings read FFMOName write SetFMOName;
+    property HideGhosts: boolean read FHideGhosts write SetHideGhosts;
+    property VisibleGhostsList: TStringList read FVisibleGhostsList write SetVisibleGhostsList;
     //\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;
@@ -284,6 +290,7 @@ begin
   FAutoJoinChannels := TStringList.Create;
   FDefaultScript := TStringList.Create;
   FFMOName := TStringList.Create;
+  FVisibleGhostsList := TStringList.Create;
   try
     FIni := TIniFile.Create(ChangeFileExt(Application.ExeName, '.ini'));
     //
@@ -376,6 +383,8 @@ begin
     LogWindowPreviewStyle := TLogWindowPreviewStyle(FIni.ReadInteger('System', 'LogWindowPreviewStyle', 0));
     //\8fÚ\8d×
     FMOName.CommaText := FIni.ReadString('System', 'FMOName', 'Sakura');
+    HideGhosts := FIni.ReadBool('System', 'HideGhosts', false);
+    VisibleGhostsList.CommaText := FIni.ReadString('System', 'VisibleGhostsList', '');
   except
     ShowMessage('INI\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý\83G\83\89\81[');
     Application.Terminate;
@@ -386,10 +395,16 @@ destructor TBottlePrefs.Destroy;
 begin
   inherited;
   SaveSettings;
-  FIni.Free;
-  FAutoJoinChannels.Free;
-  FDefaultScript.Free;
-  FFMOName.Free;
+  if FIni <> nil then
+    FIni.Free;
+  if FAutoJoinChannels <> nil then
+    FAutoJoinChannels.Free;
+  if FDefaultScript <> nil then
+    FDefaultScript.Free;
+  if FFMOName <> nil then
+    FFMOName.Free;
+  if FVisibleGhostsList <> nil then
+    FVisibleGhostsList.Free;
 end;
 
 procedure TBottlePrefs.SetAutoStart(const Value: boolean);
@@ -668,6 +683,8 @@ begin
   //
   FIni.WriteInteger('System', 'LogWindowPreviewStyle', Ord(LogWindowPreviewStyle));
   FIni.WriteString('System', 'FMOName', FFMOName.CommaText);
+  FIni.WriteBool('System', 'HideGhosts', HideGhosts);
+  FIni.WriteString('System', 'VisibleGhostsList', VisibleGhostsList.CommaText);
 end;
 
 function TBottlePrefs.GetDefaultScript: String;
@@ -701,6 +718,16 @@ begin
   FShowRuler := Value;
 end;
 
+procedure TBottlePrefs.SetHideGhosts(const Value: boolean);
+begin
+  FHideGhosts := Value;
+end;
+
+procedure TBottlePrefs.SetVisibleGhostsList(const Value: TStringList);
+begin
+  FVisibleGhostsList.Assign(Value);
+end;
+
 { TChannelListItem }
 
 procedure TChannelListItem.SetGhost(const Value: String);
index 90408d7..ed1bdc8 100755 (executable)
@@ -1979,7 +1979,7 @@ end;
 procedure TfrmSender.UpdateIfGhostBox;
 var
   Selected: String;
-  i: integer;
+  i, dum: integer;
 begin
   cbxTargetGhost.DropDownCount := Pref.GhostDropDownCount;
   Selected := cbxTargetGhost.Text;
@@ -1990,6 +1990,9 @@ begin
     for i := 0 to SakuraSeeker.Count-1 do begin
       // \94j\91¹FMO\91Î\8dô\81BHWND\82Ì\92f\95Ð\82ª\8ec\82Á\82Ä\82¢\82é\82ªName\82ª\8fÁ\82¦\82Ä\82¢\82é\8fê\8d\87\82ª\82 \82é
       if Length(SakuraSeeker[i].Name) = 0 then Continue;
+      if Pref.HideGhosts then
+        if Pref.VisibleGhostsList.IndexOf(SakuraSeeker[i].Name) < 0 then
+          Continue;
       if cbxTargetGhost.Items.IndexOf(SakuraSeeker[i].Name) < 0 then
         cbxTargetGhost.Items.Add(SakuraSeeker[i].Name);
     end;
index 99a81ab..953a68b 100755 (executable)
@@ -27,7 +27,7 @@ object frmSetting: TfrmSetting
     Top = 8
     Width = 379
     Height = 306
-    ActivePage = tstGeneral
+    ActivePage = tstDetailed
     Anchors = [akLeft, akTop, akRight, akBottom]
     TabOrder = 0
     object tstGeneral: TTabSheet
@@ -390,14 +390,14 @@ object frmSetting: TfrmSetting
       end
       object grpProxy: TGroupBox
         Left = 8
-        Top = 120
+        Top = 160
         Width = 353
-        Height = 137
+        Height = 113
         Caption = 'HTTP Proxy'#35373#23450
         TabOrder = 1
         object lblProxyAddress: TLabel
           Left = 16
-          Top = 84
+          Top = 68
           Width = 56
           Height = 12
           Caption = #12450#12489#12524#12473'(&D)'
@@ -405,7 +405,7 @@ object frmSetting: TfrmSetting
         end
         object lblProxyPort: TLabel
           Left = 16
-          Top = 108
+          Top = 92
           Width = 47
           Height = 12
           Caption = #12509#12540#12488'(&O)'
@@ -426,7 +426,7 @@ object frmSetting: TfrmSetting
         end
         object edtProxyAddress: TEdit
           Left = 80
-          Top = 80
+          Top = 64
           Width = 257
           Height = 20
           Hint = 'Proxy'#12469#12540#12496#12398#12450#12489#12524#12473
@@ -434,7 +434,7 @@ object frmSetting: TfrmSetting
         end
         object edtProxyPort: TEdit
           Left = 80
-          Top = 104
+          Top = 88
           Width = 81
           Height = 20
           Hint = 'Proxy'#12469#12540#12496#12398#12509#12540#12488#30058#21495
@@ -443,7 +443,7 @@ object frmSetting: TfrmSetting
         end
         object cbxUseHttpProxy: TCheckBox
           Left = 16
-          Top = 48
+          Top = 40
           Width = 153
           Height = 17
           Hint = 'HTTP Proxy'#12434#36890#12376#12390#12508#12488#12523#12469#12540#12496#12395#25509#32154#12375#12414#12377
@@ -451,6 +451,24 @@ object frmSetting: TfrmSetting
           TabOrder = 0
         end
       end
+      object cbxHideGhosts: TCheckBox
+        Left = 8
+        Top = 128
+        Width = 249
+        Height = 17
+        Hint = 'IfGhost'#36984#25246#12508#12483#12463#12473#12395#25351#23450#12375#12383#12468#12540#12473#12488#12364#29694#12428#12394#12356#12424#12358#12395#12375#12414#12377#12290#21463#20449#23554#29992#12468#12540#12473#12488#12398#25351#23450#12364#21487#33021
+        Caption = #25351#23450#12468#12540#12473#12488#20197#22806#12434#36984#25246#12508#12483#12463#12473#12363#12425#38560#12377'(&H)'
+        TabOrder = 2
+      end
+      object btnVisibleGhosts: TButton
+        Left = 264
+        Top = 124
+        Width = 99
+        Height = 25
+        Caption = #12468#12540#12473#12488#25351#23450'(&G)...'
+        TabOrder = 3
+        OnClick = btnVisibleGhostsClick
+      end
     end
   end
   object btnClose: TButton
index cf1e701..8028315 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;
+  ImgList, StrListEditor;
 
 type
   TfrmSetting = class(TForm)
@@ -53,6 +53,8 @@ type
     Label6: TLabel;
     ImageList: TImageList;
     cbxShowRuler: TCheckBox;
+    cbxHideGhosts: TCheckBox;
+    btnVisibleGhosts: TButton;
     procedure FormClose(Sender: TObject; var Action: TCloseAction);
     procedure edtProxyPortKeyPress(Sender: TObject; var Key: Char);
     procedure ctvBottleNodeChecked(Sender: TObject;
@@ -61,6 +63,7 @@ type
       Node: TCPCConfigItemNode; var Allow: Boolean);
     procedure tstRuleShow(Sender: TObject);
     procedure btnUseCurrentJoinChannelsClick(Sender: TObject);
+    procedure btnVisibleGhostsClick(Sender: TObject);
   private
     { Private \90é\8c¾ }
   public
@@ -136,6 +139,7 @@ begin
   edtProxyPort.Text := IntToStr(Pref.ProxyPort);
   //
   memFMOName.Lines := Pref.FMOName;
+  cbxHideGhosts.Checked := Pref.HideGhosts;
   memAutoJoinChannels.Lines := Pref.AutoJoinChannels;
   //
   ShowModal;
@@ -193,6 +197,7 @@ begin
   //
   Pref.FMOName := memFMOName.Lines;
   SakuraSeeker.FileMappingTarget := Pref.FMOName;
+  Pref.HideGhosts := cbxHideGhosts.Checked;
   //
   Pref.AutoJoinChannels := memAutoJoinChannels.Lines;
 end;
@@ -227,4 +232,19 @@ begin
   memAutoJoinChannels.Lines := JoinChannels;
 end;
 
+procedure TfrmSetting.btnVisibleGhostsClick(Sender: TObject);
+var i: integer;
+    FullGhosts: TStringList;
+begin
+  FullGhosts := TStringList.Create;
+  SakuraSeeker.BeginDetect;
+  try
+    for i := 0 to SakuraSeeker.Count-1 do
+      FullGhosts.Add(SakuraSeeker[i].Name);
+    StrListEdit(Pref.VisibleGhostsList, '\83S\81[\83X\83g\82ð\8ew\92è', true, FullGhosts);
+  finally
+    FullGhosts.Free;
+  end;
+end;
+
 end.