OSDN Git Service

・スレタイの特定ワードを非表示にする機能に「©bbspink.com」も追加
authorzako <zako@users.sourceforge.jp>
Thu, 30 Oct 2014 21:40:00 +0000 (06:40 +0900)
committerzako <zako@users.sourceforge.jp>
Thu, 30 Oct 2014 21:40:00 +0000 (06:40 +0900)
・スレタイにタブ文字が含まれている場合「IDをNGワードに追加」が正しく機能しない問題を修正

Giko.dfm
Giko.pas
GikoSystem.pas
ListViewUtils.pas
Option.dfm

index 93aa95c..fa9cd1a 100644 (file)
--- a/Giko.dfm
+++ b/Giko.dfm
@@ -649,6 +649,7 @@ object GikoForm: TGikoForm
                 Font.Name = #65325#65331' '#65328#12468#12471#12483#12463
                 Font.Style = [fsBold]
                 ParentFont = False
+                ShowAccelChar = False
                 Transparent = True
                 Layout = tlCenter
               end
index 401b11d..d601fa0 100644 (file)
--- a/Giko.pas
+++ b/Giko.pas
@@ -713,8 +713,6 @@ type
         procedure LoadIcon();
         //! \83|\83b\83v\83A\83b\83v\83\81\83j\83\85\81[\93Ç\82Ý\8d\9e\82Ý
         procedure LoadPopupMenu();
-        //! \83X\83\8c\83^\83C\8eæ\93¾
-        function GetThreadTitle(OrgTitle: String): String;
        protected
                procedure CreateParams(var Params: TCreateParams); override;
                procedure WndProc(var Message: TMessage); override;
@@ -3072,7 +3070,7 @@ begin
                if (Thread <> nil) and (ThreadItem <>nil) then begin
                        BrowserBoardNameLabel.Caption := ThreadPTitle;
                        ItemIcon16.GetBitmap(4, ItemBoardImage.Picture.Bitmap);
-            BrowserNameLabel.Caption := GetThreadTitle(ThreadTitle);
+            BrowserNameLabel.Caption := GikoSys.TrimThreadTitle(ThreadTitle);
                        ItemImage.Picture := nil;
                        if ThreadIsLog then
                                if ThreadNewArraical then
@@ -3105,7 +3103,7 @@ begin
                                
                        end;
                end else begin
-                       Self.Caption := GikoDataModule.CAPTION_NAME + ' - [' + GetThreadTitle(ThreadTitle) + ']';
+                       Self.Caption := GikoDataModule.CAPTION_NAME + ' - [' + GikoSys.TrimThreadTitle(ThreadTitle) + ']';
                        //\83X\83e\81[\83^\83X\83o\81[\82É\95\\8e¦\82µ\82Ä\82¢\82é\83X\83\8c\82Ì\97e\97Ê\82ð\95\\8e¦
                        StatusBar.Panels[THREADSIZE_PANEL].Text := Format('%6.2f kB', [ThreadItem.Size / 1024]);
                        StatusBar.Panels[THREADSIZE_PANEL].Width :=
@@ -3168,7 +3166,7 @@ begin
                if (FActiveContent <> nil) and (FActiveContent.Thread <> nil)
                        and (FActiveContent.Thread.IsLogFile) then begin
                        try
-                               Self.Caption := GikoDataModule.CAPTION_NAME + ' - [' + GetThreadTitle(FActiveContent.Thread.Title) + ']'
+                               Self.Caption := GikoDataModule.CAPTION_NAME + ' - [' + GikoSys.TrimThreadTitle(FActiveContent.Thread.Title) + ']'
                        except
                                on E: Exception do begin
                                        //\83X\83\8c\88ê\97\97DL\8cã\82È\82Ç\82ÉFActiveContent\82Ì\8e\9d\82ÂThread\82ª
@@ -7443,6 +7441,8 @@ var
        wordCount               : TWordCount;
 {$ENDIF}
     id, dateStr: String;
+    ThreadTitle: String;
+    Idx: Integer;
 begin
        No := KokoPopupMenu.Tag;
        if No = 0 then Exit;
@@ -7451,9 +7451,16 @@ begin
 
     id := GikoSys.GetResID(No, ThreadItem);
     if (id <> '') and (not IsNoValidID(id)) then begin
+        ThreadTitle := ThreadItem.Title;
+        while (True) do begin
+            Idx := Pos(#9, ThreadTitle);
+            if (Idx < 1) then
+                Break;
+            Delete(ThreadTitle, Idx, 1);
+        end;
         // \83R\83\81\83\93\83g\82Æ\82µ\82Ä\81A\83X\83\8c\83b\83h\96¼\82Æ\8d¡\93ú\82Ì\93ú\95t\82ð\92Ç\89Á
         DateTimeToString(dateStr, 'yyyymmdd', Now);
-        id := id + #9'>>add ' + dateStr + ',' + ThreadItem.Title;
+        id := id + #9'>>add ' + dateStr + ',' + ThreadTitle;
         if (GikoSys.FAbon.AddToken(id, invisible)) then begin
             GikoSys.FAbon.ReLoadFromNGwordFile;
             FActiveContent.Repaint := True;
@@ -8183,38 +8190,12 @@ begin
     BrowserTab.Tabs.EndUpdate;
 
     if (FActiveContent <> nil) and (FActiveContent.Thread <> nil) then begin
-        DspTitle := GetThreadTitle(FActiveContent.Thread.Title);
+        DspTitle := GikoSys.TrimThreadTitle(FActiveContent.Thread.Title);
         BrowserNameLabel.Caption := DspTitle;
         Self.Caption := GikoDataModule.CAPTION_NAME + ' - [' + DspTitle + ']';
     end;
 end;
 
-//! \83X\83\8c\83^\83C\8eæ\93¾
-function TGikoForm.GetThreadTitle(OrgTitle: String): String;
-var
-    Idx: Integer;
-    ResTitle: String;
-begin
-    if (GikoSys.Setting.ThreadTitleTrim = False) then begin
-        Result := OrgTitle;
-    end else begin
-        ResTitle := OrgTitle;
-        while (True) do begin
-            Idx := Pos('[\93]\8dÚ\8bÖ\8e~]', ResTitle);
-            if (Idx < 1) then
-                Break;
-            Delete(ResTitle, Idx, 10);
-        end;
-        while (True) do begin
-            Idx := Pos('&copy;2ch.net', ResTitle);
-            if (Idx < 1) then
-                Break;
-            Delete(ResTitle, Idx, 13);
-        end;
-        Result := Trim(ResTitle);
-    end;
-end;
-
 //! \83|\83b\83v\83A\83b\83v\83\81\83j\83\85\81[\93Ç\82Ý\8d\9e\82Ý
 procedure TGikoForm.LoadPopupMenu();
 begin
index d009d91..827e109 100644 (file)
@@ -188,6 +188,7 @@ type
                function GetTokenIndex(s: string; delimiter: string; index: Integer): string;
 
                function GetShortName(const LongName: string; ALength: integer): string;
+               function TrimThreadTitle(const SrcTitle: string): string;
                function BoolToInt(b: Boolean): Integer;
                function IntToBool(i: Integer): Boolean;
                function GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
@@ -1445,24 +1446,8 @@ var
        Chr : array [0..255]    of      char;
        S : string;
        i : integer;
-    Idx: Integer;
 begin
-       s := Trim(LongName);
-    if (Setting.ThreadTitleTrim = True) then begin
-        while (True) do begin
-            Idx := Pos('[\93]\8dÚ\8bÖ\8e~]', s);
-            if (Idx < 1) then
-                Break;
-            Delete(s, Idx, 10);
-        end;
-        while (True) do begin
-            Idx := Pos('&copy;2ch.net', s);
-            if (Idx < 1) then
-                Break;
-            Delete(s, Idx, 13);
-        end;
-        s := Trim(s);
-    end;
+    s := TrimThreadTitle(Trim(LongName));
        if (Length(s) <= ALength) then begin
                Result := s;
        end else begin
@@ -1495,6 +1480,33 @@ begin
        end;
 end;
 
+function TGikoSys.TrimThreadTitle(const SrcTitle: string): string;
+const
+    TRIM_STRING: array [1..4] of String =
+        ('[\93]\8dÚ\8bÖ\8e~]', '&copy;2ch.net', '&copy;bbspink.com', #9);
+var
+    i: Integer;
+    Idx: Integer;
+    Len: Integer;
+    DstTitle: String;
+begin
+    if (Setting.ThreadTitleTrim = True) then begin
+        DstTitle := SrcTitle;
+               for i := Low(TRIM_STRING) to High(TRIM_STRING) do begin
+            Len := Length(TRIM_STRING[i]);
+            while (True) do begin
+                Idx := Pos(TRIM_STRING[i], DstTitle);
+                if (Idx < 1) then
+                    Break;
+                Delete(DstTitle, Idx, Len);
+            end;
+        end;
+        Result := Trim(DstTitle);
+    end else begin
+        Result := SrcTitle;
+    end;
+end;
+
 {!
 \brief Boolean \82ð Integer \82É\95Ï\8a·
 \return False..0, True..1
index 1aa9301..07f8bbd 100644 (file)
@@ -553,7 +553,6 @@ var
        BoardCnt: Integer;
        RepStr: String;
        i: Integer;
-    Idx: Integer;
 begin
        //===== \83X\83\8c\83\8a\83X\83g =====
        if GikoSys.Setting.ListIconVisible then
@@ -597,23 +596,10 @@ begin
        RepStr := CustomStringReplace(RepStr, '&amp;', '&' );
        //RepStr := StringReplace(RepStr, '\81\97\81M', ',', [rfReplaceAll]);
 
-    if (ThreadNgList.IsNG(RepStr) = True) then begin
+    if (ThreadNgList.IsNG(RepStr) = True) then
         RepStr := '\81\83\82 \82Ú\81`\82ñ\81\84'
-    end else if (GikoSys.Setting.ThreadTitleTrim = True) then begin
-        while (True) do begin
-            Idx := Pos('[\93]\8dÚ\8bÖ\8e~]', RepStr);
-            if (Idx < 1) then
-                Break;
-            Delete(RepStr, Idx, 10);
-        end;
-        while (True) do begin
-            Idx := Pos('&copy;2ch.net', RepStr);
-            if (Idx < 1) then
-                Break;
-            Delete(RepStr, Idx, 13);
-        end;
-        RepStr := Trim(RepStr);
-    end;
+    else if (GikoSys.Setting.ThreadTitleTrim = True) then
+        RepStr := GikoSys.TrimThreadTitle(RepStr);
 
        if Item.SubItems.Count <> ListView.Columns.Count then begin
                Item.SubItems.Clear;
index 0a6e4b0..92a1609 100644 (file)
@@ -251,7 +251,7 @@ object OptionDialog: TOptionDialog
           Top = 43
           Width = 417
           Height = 20
-          ItemHeight = 12
+          ItemHeight = 0
           TabOrder = 0
           Text = 'BoardURLComboBox'
         end
@@ -1258,9 +1258,9 @@ object OptionDialog: TOptionDialog
         object ThreadTitleTrimCheckBox: TCheckBox
           Left = 12
           Top = 18
-          Width = 341
+          Width = 453
           Height = 17
-          Caption = #12473#12524#12479#12452#12398'['#36578#36617#31105#27490']'#12392#12300'&&copy;2ch.net'#12301#12434#34920#31034#12375#12394#12356
+          Caption = #12473#12524#12479#12452#12398'['#36578#36617#31105#27490']'#12392#12300'&&copy;2ch.net'#12301#12289#12300'&&copy;bbspink.com'#12301#12434#34920#31034#12375#12394#12356
           TabOrder = 0
         end
       end
@@ -1748,7 +1748,7 @@ object OptionDialog: TOptionDialog
           Top = 20
           Width = 140
           Height = 20
-          ItemHeight = 12
+          ItemHeight = 0
           TabOrder = 0
           Text = 'BoukenComboBox'
           OnChange = BoukenComboBoxChange