OSDN Git Service

板更新で無視するカテゴリーを編集できるようにした。
authorh677 <h677>
Mon, 3 May 2004 14:13:58 +0000 (14:13 +0000)
committerh677 <h677>
Mon, 3 May 2004 14:13:58 +0000 (14:13 +0000)
NewBoard.dfm
NewBoard.pas
Setting.pas

index 05a1914..dcda993 100644 (file)
@@ -1,6 +1,6 @@
 object NewBoardDialog: TNewBoardDialog
-  Left = 420
-  Top = 362
+  Left = 276
+  Top = 325
   BorderStyle = bsDialog
   Caption = #26495#19968#35239#26356#26032
   ClientHeight = 329
@@ -13,6 +13,7 @@ object NewBoardDialog: TNewBoardDialog
   Font.Style = []
   OldCreateOrder = False
   Position = poOwnerFormCenter
+  OnClose = FormClose
   OnCreate = FormCreate
   PixelsPerInch = 96
   TextHeight = 12
@@ -82,6 +83,15 @@ object NewBoardDialog: TNewBoardDialog
     TabOrder = 4
     Text = 'BoardURLComboBox'
   end
+  object EditIgnoreListsButton: TButton
+    Left = 8
+    Top = 299
+    Width = 113
+    Height = 21
+    Caption = #38500#22806#12459#12486#12468#12522#12540#32232#38598
+    TabOrder = 5
+    OnClick = EditIgnoreListsButtonClick
+  end
   object Indy: TIdHTTP
     MaxLineAction = maException
     RecvBufferSize = 4096
index ecbe493..503b347 100644 (file)
@@ -18,22 +18,29 @@ type
                Label1: TLabel;
                MessageMemo: TMemo;
                UpdateButton: TButton;
-    CloseButton: TButton;
+       CloseButton: TButton;
                Indy: TIdHTTP;
                IdAntiFreeze: TIdAntiFreeze;
                StopButton: TButton;
                Label2: TLabel;
-    BoardURLComboBox: TComboBox;
-    Label13: TLabel;
+       BoardURLComboBox: TComboBox;
+       Label13: TLabel;
+       EditIgnoreListsButton: TButton;
                procedure UpdateButtonClick(Sender: TObject);
                procedure StopButtonClick(Sender: TObject);
                procedure CloseButtonClick(Sender: TObject);
                procedure FormCreate(Sender: TObject);
+       procedure EditIgnoreListsButtonClick(Sender: TObject);
+    procedure FormClose(Sender: TObject; var Action: TCloseAction);
        private
                { Private \90é\8c¾ }
+               IgnoreLists : TStringList;
                FAbort: Boolean;
                function BoardDownload: TNewBoardItem;
                procedure UpdateURL(s: string);
+               procedure SetIgnoreCategory(b: boolean);
+               procedure EditIgnoreList(Sender: TObject);
+               procedure UpdateIgnoreList(Sender: TObject);
        public
                { Public \90é\8c¾ }
        end;
@@ -41,6 +48,7 @@ type
 var
        NewBoardDialog: TNewBoardDialog;
 
+
 implementation
 
 uses Giko, IdHeaderList;
@@ -170,6 +178,7 @@ end;
 procedure TNewBoardDialog.UpdateURL(s: string);
 var
        i: Integer;
+       j: Integer;
        idx: Integer;
        idx1: Integer;
        idx2: Integer;
@@ -179,9 +188,10 @@ var
        cate: string;
        Board: TBoard;
        Change: Boolean;
+       Ignore: Boolean;
        ini: TMemIniFile;
-    oldURLs : TStringList;
-    newURLs : TStringList;
+       oldURLs : TStringList;
+       newURLs : TStringList;
 begin
        Change := False;
        MessageMemo.Lines.Add('\90V\94Â\81A\94ÂURL\95Ï\8dX\83`\83F\83b\83N\82ð\8aJ\8en\82µ\82Ü\82·');
@@ -193,8 +203,8 @@ begin
        s := CustomStringReplace(s, '</A', '</a', true);
        cate := '';
 
-    oldURLs := TStringList.Create;
-    newURLs := TStringList.Create;
+       oldURLs := TStringList.Create;
+       newURLs := TStringList.Create;
 
        try
 
@@ -221,7 +231,18 @@ begin
                                        tmp := Copy(s, idx1, (idx - idx1) + 4);
                                        tmp := CustomStringReplace(tmp, '<b>', '');
                                        tmp := CustomStringReplace(tmp, '</b>', '');
-
+                                       Ignore := false;
+                                       for i := 0 to IgnoreLists.Count - 1 do begin
+                                               if tmp = Trim(IgnoreLists[i]) then begin
+                                                       cate := '';
+                                                       s := Copy(s, idx + 5, Length(s));
+                                                       Ignore := True;
+                                                       break;
+                                               end;
+                                       end;
+                                       if Ignore then
+                                               Continue;
+                                       {
                                        if (tmp = '\82¨\82·\82·\82ß') or
                                                 (tmp = '\93Á\95Ê\8aé\89æ') or
                                                 (tmp = '\82Ü\82¿\82a\82a\82r') or
@@ -234,6 +255,7 @@ begin
                                                s := Copy(s, idx + 5, Length(s));
                                                Continue;
                                        end;
+                                       }
                                        s := Copy(s, idx + 5, Length(s));
                                        cate := tmp;
                                end else begin
@@ -290,19 +312,84 @@ begin
     finally
        oldURLs.Free;
        newURLs.Free;
-    end;
+       end;
 end;
 
 procedure TNewBoardDialog.FormCreate(Sender: TObject);
 begin
        StopButton.Enabled := False;
-    BoardURLComboBox.Clear;
-    BoardURLComboBox.Items.AddStrings(GikoSys.Setting.BoardURLs);
-    try
-       BoardURLComboBox.ItemIndex := GikoSys.Setting.BoardURLSelected - 1;
-    except
-        BoardURLComboBox.ItemIndex := 0;
-    end;
+       BoardURLComboBox.Clear;
+       BoardURLComboBox.Items.AddStrings(GikoSys.Setting.BoardURLs);
+       try
+               BoardURLComboBox.ItemIndex := GikoSys.Setting.BoardURLSelected - 1;
+       except
+               BoardURLComboBox.ItemIndex := 0;
+       end;
+       SetIgnoreCategory(false);
+end;
+//\94Â\8dX\90V\82Ì\8f\9c\8aO\83J\83e\83S\83\8a\83\8a\83X\83g\82Ì\93o\98^
+{['\82¨\82·\82·\82ß', '\93Á\95Ê\8aé\89æ', '\82Ü\82¿\82a\82a\82r', '\83`\83\83\83b\83g', '\82¨\8aG\82©\82«', '\89^\89c\88Ä\93à', '\83c\81[\83\8b\97Þ', '\91¼\82Ì\83T\83C\83g']}
+procedure TNewBoardDialog.SetIgnoreCategory(b: boolean);
+begin
+       IgnoreLists := TStringList.Create;
+       if not( FileExists(GikoSys.Setting.GetIgnoreFileName) ) or ( b )then begin
+               IgnoreLists.Add('\82¨\82·\82·\82ß');
+               IgnoreLists.Add('\93Á\95Ê\8aé\89æ');
+               IgnoreLists.Add('\82Ü\82¿\82a\82a\82r');
+               IgnoreLists.Add('\83`\83\83\83b\83g');
+               IgnoreLists.Add('\82¨\8aG\82©\82«');
+               IgnoreLists.Add('\89^\89c\88Ä\93à');
+               IgnoreLists.Add('\83c\81[\83\8b\97Þ');
+               IgnoreLists.Add('\91¼\82Ì\83T\83C\83g');
+       end else begin
+               try
+                       IgnoreLists.LoadFromFile(GikoSys.Setting.GetIgnoreFileName);
+               except
+                       IgnoreLists.Free;
+                       SetIgnoreCategory(true);
+               end;
+       end;
+end;
+
+procedure TNewBoardDialog.EditIgnoreListsButtonClick(Sender: TObject);
+begin
+       EditIgnoreList(Sender);
+       EditIgnoreListsButton.OnClick := UpdateIgnoreList;
+end;
+procedure TNewBoardDialog.EditIgnoreList(Sender: TObject);
+var
+       i: Integer;
+begin
+       EditIgnoreListsButton.Caption := '\8f\9c\8aO\83J\83e\83S\83\8a\81[\8dX\90V';
+       Label2.Caption := '\8ae\82P\8ds\82É\83J\83e\83S\83\8a\96¼\82ð\8bL\93ü\82µ\82Ä\82­\82¾\82³\82¢\81B\81i\89ü\8ds\82ÍCtrl+Enter\81j';
+       UpdateButton.Enabled := false;
+       //MessageMemo.ReadOnly := false;
+       MessageMemo.Clear;
+       for i := 0 to IgnoreLists.Count - 1 do
+               MessageMemo.Lines.Add(IgnoreLists[i]);
+end;
+procedure TNewBoardDialog.UpdateIgnoreList(Sender: TObject);
+var
+       i: Integer;
+begin
+       Label2.Caption := '\81¦\8c»\8dÝ\81A\8aJ\82¢\82Ä\82¢\82é\83^\83u\82â\83q\83X\83g\83\8a\82È\82Ç\82Í\94Â\8dX\90V\8e\9e\82É\83N\83\8a\83A\82³\82ê\82Ü\82·';
+    UpdateButton.Enabled := true;
+       EditIgnoreListsButton.Caption := '\8f\9c\8aO\83J\83e\83S\83\8a\81[\95Ò\8fW';
+       IgnoreLists.Clear;
+       for i := 0 to MessageMemo.Lines.Count - 1 do
+               IgnoreLists.Add(MessageMemo.Lines[i]);
+       IgnoreLists.SaveToFile(GikoSys.Setting.GetIgnoreFileName);
+       IgnoreLists.Free;
+       SetIgnoreCategory(false);
+       //MessageMemo.ReadOnly := true;
+       MessageMemo.Clear;
+       EditIgnoreListsButton.OnClick := EditIgnoreListsButtonClick;
+end;
+
+procedure TNewBoardDialog.FormClose(Sender: TObject;
+  var Action: TCloseAction);
+begin
+       IgnoreLists.Free;
 end;
 
 end.
index e60d562..76fd989 100644 (file)
@@ -31,6 +31,7 @@ const
        NGWORDs_DIR_NAME : String               = 'NGwords';
        BOARD_PLUGIN_DIR_NAME                                   = 'BoardPlugin';
        SAMBATIME_FILE_NAME : String    = 'Samba.ini';
+       IGNORE_FILE_NAME : String               = 'Ignore.txt';
 type
        TGikoTabPosition = (gtpTop, gtpBottom);                                                         // \83^\83u\88Ê\92u
        TGikoTabAppend = (gtaFirst, gtpLast);                                                                   // \83^\83u\92Ç\89Á\88Ê\92u
@@ -349,7 +350,8 @@ type
                function GetOutBoxFileName: string;
                function GetNGWordsDir: string;
                function GetBoardPlugInDir: string;
-        function GetSambaFileName: string;
+               function GetSambaFileName: string;
+               function GetIgnoreFileName: string;
 
                //\8eó\90M\83o\83b\83t\83@\83T\83C\83Y
                property RecvBufferSize: Integer read FRecvBufferSize write FRecvBufferSize;
@@ -1624,5 +1626,12 @@ function TSetting.GetSambaFileName: string;
 begin
        Result := GetAppDir + SAMBATIME_FILE_NAME;
 end;
+//\94Â\8dX\90V\8f\9c\8aO\83J\83e\83S\83\8a\83\8a\83X\83g\95Û\91\83t\83@\83C\83\8b
+function TSetting.GetIgnoreFileName: string;
+begin
+       Result := GetConfigDir + IGNORE_FILE_NAME;
+end;
+
 end.
 
+