OSDN Git Service

・スレタイの特定ワードを非表示にする機能に「©bbspink.com」も追加
[gikonavigoeson/gikonavi.git] / Option.pas
index 54f5fad..dd70f62 100644 (file)
@@ -116,10 +116,7 @@ type
                 OpenMailerCheckBox: TCheckBox;
                 GroupBox6: TGroupBox;
                 LogDeleteMessageCheckBox: TCheckBox;
-                ResAnchorGroupBox: TGroupBox;
-                ResAnchorCheckBox: TCheckBox;
                 TabSheet1: TTabSheet;
-                PopupPositionRadioGroup: TRadioGroup;
                TabAddRadioGroup: TRadioGroup;
                 GroupBox8: TGroupBox;
                 Label14: TLabel;
@@ -211,6 +208,29 @@ type
     LoopBrowserTabsCB: TCheckBox;
     GroupBox23: TGroupBox;
     IgnoreContextCheckBox: TCheckBox;
+    GroupBox24: TGroupBox;
+    gppRightTopRB: TRadioButton;
+    gppTopRB: TRadioButton;
+    gppLeftTopRB: TRadioButton;
+    gppLeftRB: TRadioButton;
+    gppRightRB: TRadioButton;
+    gppLeftBottomRB: TRadioButton;
+    gppBottomRB: TRadioButton;
+    gppRighBottomRB: TRadioButton;
+    ResAnchorCheckBox: TCheckBox;
+    IgnoreLimitResCountCheckBox: TCheckBox;
+    GroupBox25: TGroupBox;
+    Label25: TLabel;
+    BoukenComboBox: TComboBox;
+    BoukenModButton: TButton;
+    BoukenDelButton: TButton;
+    BoukenEdit: TEdit;
+    GroupBox26: TGroupBox;
+    UseUnicodeCB: TCheckBox;
+    Label27: TLabel;
+    DispImageCheckBox: TCheckBox;
+    GroupBox27: TGroupBox;
+    ThreadTitleTrimCheckBox: TCheckBox;
                procedure FormCreate(Sender: TObject);
                procedure FormDestroy(Sender: TObject);
                procedure ApplyButtonClick(Sender: TObject);
@@ -260,6 +280,9 @@ type
                 procedure ResRangeHoldCheckBoxClick(Sender: TObject);
                 procedure CroutOptionClick(Sender: TObject);
     procedure MaxRecordCountEditExit(Sender: TObject);
+    procedure BoukenDelButtonClick(Sender: TObject);
+    procedure BoukenComboBoxChange(Sender: TObject);
+    procedure BoukenModButtonClick(Sender: TObject);
        private
                { Private \90é\8c¾ }
                FClose: Boolean;
@@ -304,13 +327,24 @@ const
        DEFAULT_FONT_SIZE: Integer = 9;
        DEFAULT_TABFONT_NAME: string = '\82l\82\82o\83S\83V\83b\83N';
        DEFAULT_TABFONT_SIZE: Integer = 9;
-       URL_TORA3: WideString = 'http://2ch.tora3.net/';
+//     URL_TORA3: WideString = 'http://2ch.tora3.net/';
+       URL_TORA3: WideString = 'http://ronin.bbspink.com/';
        DEFAULT_CSS_FILENAME = 'default.css';
 
 {$R *.DFM}
 
 procedure TOptionDialog.FormCreate(Sender: TObject);
+var
+    CenterForm: TCustomForm;
 begin
+    CenterForm := TCustomForm(Owner);
+    if Assigned(CenterForm) then begin
+        Left := ((CenterForm.Width - Width) div 2) + CenterForm.Left;
+        Top := ((CenterForm.Height - Height) div 2) + CenterForm.Top;
+    end else begin
+        Left := (Screen.Width - Width) div 2;
+        Top := (Screen.Height - Height) div 2;
+    end;
 
        CSSBrowser.Navigate('about:blank');
        FClose := True;
@@ -564,7 +598,8 @@ var
        Item: TListItem;
 //     s: string;
        idx: Integer;
-       FileList: TStringList;
+       FileList : TStringList;
+    DomainList : TStringList;
 begin
 
        //\93Ç\82Ý\8d\9e\82Ý\97p\83v\83\8d\83L\83V
@@ -708,6 +743,8 @@ begin
 
        //Mail\97\93\95\\8e¦
        ShowMailCheckBox.Checked := GikoSys.Setting.ShowMail;
+    //BE2.0\83A\83C\83R\83\93\81EEmoticons\82ð\89æ\91\9c\95\\8e¦\82·\82é
+    DispImageCheckBox.Checked := GikoSys.Setting.IconImageDisplay;
 
        // \8bN\93®\8e\9e\83\8c\83X\95\\8e¦\94Í\88Í\82Ì\8cÅ\92è
        ResRangeHoldCheckBox.Checked := GikoSys.Setting.ResRangeHold;
@@ -715,7 +752,7 @@ begin
        Ord( grrAll ):  ResRangeHoldComboBox.ItemIndex := 0;
        Ord( grrKoko ): ResRangeHoldComboBox.ItemIndex := 2;
        Ord( grrNew ):  ResRangeHoldComboBox.ItemIndex := 3;
-       100:                                            ResRangeHoldComboBox.ItemIndex := 1;
+       10..65535:                                              ResRangeHoldComboBox.ItemIndex := 1;
        end;
        ResRangeHoldComboBox.Enabled := GikoSys.Setting.ResRangeHold;
        //\83^\83u\92Ç\89Á\88Ê\92u
@@ -758,6 +795,8 @@ begin
 
        //\83\8d\83O\8dí\8f\9c\8e\9e\83\81\83b\83Z\81[\83W
        LogDeleteMessageCheckBox.Checked := GikoSys.Setting.DeleteMsg;
+    //\93¯ID\83\8c\83X\83A\83\93\83J\81[\95\\8e¦\82Ì\90§\8cÀ\90\94\89z\82¦\83\81\83b\83Z\81[\83W
+    IgnoreLimitResCountCheckBox.Checked := GikoSys.Setting.LimitResCountMessage;
 
        //\8fI\97¹\8e\9e\8am\94F\83_\83C\83A\83\8d\83O
        ShowDialogForEndCheckBox.Checked := GikoSys.Setting.ShowDialogForEnd;
@@ -770,15 +809,15 @@ begin
        BrowserMaxCombo.ItemIndex := Ord( GikoSys.Setting.BrowserAutoMaximize );
        //\83|\83b\83v\83A\83b\83v\88Ê\92u
        case GikoSys.Setting.PopupPosition of
-               gppRightTop:            PopupPositionRadioGroup.ItemIndex := 0;
-               gppRight:                       PopupPositionRadioGroup.ItemIndex := 1;
-               gppRightBottom: PopupPositionRadioGroup.ItemIndex := 2;
-               gppTop:                                 PopupPositionRadioGroup.ItemIndex := 3;
-               gppCenter:                      PopupPositionRadioGroup.ItemIndex := 4;
-               gppBottom:                      PopupPositionRadioGroup.ItemIndex := 5;
-               gppLeftTop:             PopupPositionRadioGroup.ItemIndex := 6;
-               gppLeft:                                PopupPositionRadioGroup.ItemIndex := 7;
-               gppLeftBottom:  PopupPositionRadioGroup.ItemIndex := 8;
+               gppRightTop:            gppRightTopRB.Checked := True;
+               gppRight:                       gppRightRB.Checked := True;
+               gppRightBottom:     gppRighBottomRB.Checked := True;
+               gppTop:                         gppTopRB.Checked := True;
+               gppCenter:                      gppTopRB.Checked := True; // \93Ç\82Ý\8d\9e\82Ý\82Å\95Ï\8a·\82µ\82Ä\82é\82Í\82¸
+               gppBottom:                      gppBottomRB.Checked := True;
+               gppLeftTop:             gppLeftTopRB.Checked := True;
+               gppLeft:                        gppLeftRB.Checked := True;
+               gppLeftBottom:      gppLeftBottomRB.Checked := True;
        end;
 
        //\94ñ\83A\83N\83e\83B\83u\8e\9e\83|\83b\83v\83A\83b\83v\95\\8e¦
@@ -864,9 +903,14 @@ begin
        TabLoadSave.Checked := Gikosys.Setting.TabAutoLoadSave;
        UseUndecidedCheckBox.Checked := GikoSys.Setting.UseUndecided;
 
+    // \83\8c\83X\83G\83f\83B\83^Unicode\93ü\97Í
+    UseUnicodeCB.Checked := Gikosys.Setting.UseUnicode;
+    // \83X\83\8c\83^\83C\93Á\92è\95\8e\9a\97ñ\8f\9c\8b\8e
+    ThreadTitleTrimCheckBox.Checked := GikoSys.Setting.ThreadTitleTrim;
+
        //Be2ch\94F\8fØ
        BeUserIDEdit.Text := GikoSys.Setting.BeUserID;
-       BeCodeEdit.Text := GikoSys.Setting.BeCode;
+       BeCodeEdit.Text := GikoSys.Setting.BePassword;
        BeAutoLoginCheckBox.Checked := GikoSys.Setting.BeAutoLogin;
        //\97\9a\97ð\82Ì\8dÅ\91å\95Û\91\90\94
        MaxRecordCountEdit.Text := IntToStr(GikoSys.Setting.MaxRecordCount);
@@ -876,6 +920,18 @@ begin
     LoopBrowserTabsCB.Checked := GikoSys.Setting.LoopBrowserTabs;
     //
     IgnoreContextCheckBox.Checked := GikoSys.Setting.GestureIgnoreContext;
+
+    // \96`\8c¯\82Ì\8f\91\83h\83\81\83C\83\93\88ê\97\97\8eæ\93¾
+    BoukenComboBox.Text := '';
+    BoukenComboBox.Items.Clear;
+    DomainList := TStringList.Create;
+    GikoSys.GetBoukenDomain(DomainList);
+    for i := 0 to DomainList.Count - 1 do begin
+        BoukenComboBox.Items.Add( DomainList[i] ) ;
+    end;
+    DomainList.Free;
+    BoukenComboBox.ItemIndex := 0;
+    BoukenComboBox.OnChange(nil);
 end;
 
 procedure TOptionDialog.SaveSetting;
@@ -999,11 +1055,13 @@ begin
        //Mail\97\93\95\\8e¦
        if GikoSys.Setting.ShowMail <> ShowMailCheckBox.Checked then FRepaintThread := true;
        GikoSys.Setting.ShowMail := ShowMailCheckBox.Checked;
+    //BE2.0\83A\83C\83R\83\93\81EEmoticons\82ð\89æ\91\9c\95\\8e¦\82·\82é
+    GikoSys.Setting.IconImageDisplay := DispImageCheckBox.Checked;
        // \8bN\93®\8e\9e\83\8c\83X\95\\8e¦\94Í\88Í\82Ì\8cÅ\92è
        GikoSys.Setting.ResRangeHold := ResRangeHoldCheckBox.Checked;
        case ResRangeHoldComboBox.ItemIndex of
                0: GikoSys.Setting.ResRange := Ord( grrAll );
-               1: GikoSys.Setting.ResRange := 100;
+               1: GikoSys.Setting.ResRange := GikoSys.Setting.ResRangeExCount;
                2: GikoSys.Setting.ResRange := Ord( grrKoko );
                3: GikoSys.Setting.ResRange := Ord( grrNew );
        end;
@@ -1023,6 +1081,8 @@ begin
 
        GikoSys.Setting.OpenMailer := OpenMailerCheckBox.Checked;
        GikoSys.Setting.DeleteMsg := LogDeleteMessageCheckBox.Checked;
+    GikoSys.Setting.LimitResCountMessage := IgnoreLimitResCountCheckBox.Checked;
+
        //\8fI\97¹\8e\9e\8am\94F\83_\83C\83A\83\8d\83O
        GikoSys.Setting.ShowDialogForEnd := ShowDialogForEndCheckBox.Checked;
        //AllTabClose
@@ -1033,18 +1093,14 @@ begin
        // \83u\83\89\83E\83U\8dÅ\91å\89»
        GikoSys.Setting.BrowserAutoMaximize := TGikoBrowserAutoMaximize( BrowserMaxCombo.ItemIndex );
        //\83|\83b\83v\83A\83b\83v\88Ê\92u
-       case PopupPositionRadioGroup.ItemIndex of
-               0: GikoSys.Setting.PopupPosition := gppRightTop;
-               1: GikoSys.Setting.PopupPosition := gppRight;
-               2: GikoSys.Setting.PopupPosition := gppRightBottom;
-               3: GikoSys.Setting.PopupPosition := gppTop;
-               4: GikoSys.Setting.PopupPosition := gppCenter;
-               5: GikoSys.Setting.PopupPosition := gppBottom;
-               6: GikoSys.Setting.PopupPosition := gppLeftTop;
-               7: GikoSys.Setting.PopupPosition := gppLeft;
-               8: GikoSys.Setting.PopupPosition := gppLeftBottom;
-       end;
-
+    if (gppRightTopRB.Checked) then GikoSys.Setting.PopupPosition := gppRightTop;
+    if (gppRightRB.Checked) then GikoSys.Setting.PopupPosition := gppRight;
+    if (gppRighBottomRB.Checked) then GikoSys.Setting.PopupPosition := gppRightBottom;
+    if (gppTopRB.Checked) then GikoSys.Setting.PopupPosition := gppTop;
+    if (gppBottomRB.Checked) then GikoSys.Setting.PopupPosition := gppBottom;
+    if (gppLeftTopRB.Checked) then GikoSys.Setting.PopupPosition := gppLeftTop;
+    if (gppLeftRB.Checked) then GikoSys.Setting.PopupPosition := gppLeft;
+    if (gppLeftBottomRB.Checked) then GikoSys.Setting.PopupPosition := gppLeftBottom;
        //\94ñ\83A\83N\83e\83B\83u\8e\9e\83|\83b\83v\83A\83b\83v\95\\8e¦
        GikoSys.Setting.UnActivePopup := UnActivePopupCheckBox.Checked;
        //\83\8c\83X\83|\83b\83v\83A\83b\83v\83{\81[\83\8b\83h\95\\8e¦
@@ -1159,7 +1215,7 @@ begin
        GikoSys.Setting.UseUndecided := UseUndecidedCheckBox.Checked;
         //Be2ch
         GikoSys.Setting.BeUserID := BeUserIDEdit.Text;
-        GikoSys.Setting.BeCode := BeCodeEdit.Text;
+        GikoSys.Setting.BePassword := BeCodeEdit.Text;
                GikoSys.Setting.BeAutoLogin := BeAutoLoginCheckBox.Checked;
        //\97\9a\97ð\82Ì\8dÅ\91å\95Û\91\90\94
        GikoSys.Setting.MaxRecordCount := Max(StrToInt64Def(MaxRecordCountEdit.Text,100),1);
@@ -1167,6 +1223,12 @@ begin
     GikoSys.Setting.LoopBrowserTabs := LoopBrowserTabsCB.Checked;
 
     GikoSys.Setting.GestureIgnoreContext := IgnoreContextCheckBox.Checked;
+
+    // \83\8c\83X\83G\83f\83B\83^Unicode\93ü\97Í
+    Gikosys.Setting.UseUnicode := UseUnicodeCB.Checked;
+    // \83X\83\8c\83^\83C\93Á\92è\95\8e\9a\97ñ\8f\9c\8b\8e
+    GikoSys.Setting.ThreadTitleTrim := ThreadTitleTrimCheckBox.Checked;
+
 end;
 
 procedure TOptionDialog.SettingApply;
@@ -1244,6 +1306,9 @@ begin
                end;
                GikoForm.BrowserTab.OnChange(nil);
        end;
+
+    // \83^\83u\82Ì\83X\83\8c\83^\83C\8dX\90V
+    GikoForm.UpdateThreadTitle;
 end;
 
 procedure TOptionDialog.ReadProxyCheckClick(Sender: TObject);
@@ -1279,7 +1344,7 @@ end;
 function TOptionDialog.CheckFolder: Boolean;
 begin
        if Trim(LogFolderEdit.Text) = '' then
-               LogFolderEdit.Text := ExtractFilePath(Application.ExeName) + 'Log';
+               LogFolderEdit.Text := GikoSys.GetAppDir + 'Log';
 
        if DirectoryExists(LogFolderEdit.Text) then begin
                Result := True;
@@ -1313,17 +1378,29 @@ begin
        sndPlaySound(nil, SND_ASYNC);
        if OpenDialog.Execute then begin
                SoundFileEdit.Text := OpenDialog.FileName;
+        // \83A\83v\83\8a\94z\89º\82Ì\83t\83@\83C\83\8b\82Ì\8fê\8d\87\91\8a\91Î\83p\83X\82É\95Ï\8a·\82·\82é\81B
+        if (AnsiPos(GikoSys.Setting.GetAppDir,SoundFileEdit.Text) = 1) then begin
+            // .\ \82ª\82Â\82©\82È\82¢\82Ì\82Å\81A.\\82ð\92Ç\89Á
+            SoundFileEdit.Text := '.\' + ExtractRelativePath(
+                                      GikoSys.Setting.GetAppDir,
+                                      SoundFileEdit.Text);
+
+        end;
        end;
 end;
 
 procedure TOptionDialog.SoundPlayButtonClick(Sender: TObject);
+var
+    s : String;
 begin
-       if not FileExists(SoundFileEdit.Text) then begin
+    SetCurrentDir(GikoSys.Setting.GetAppDir);
+    s := ExpandFileName(SoundFileEdit.Text);
+       if not FileExists(s) then begin
                MsgBox(Handle, '\91\8dÝ\82µ\82È\82¢\83t\83@\83C\83\8b\82Å\82·', '\83G\83\89\81[', MB_ICONSTOP or MB_OK);
                SoundFileEdit.Text := '';
                Exit;
        end;
-       if not sndPlaySound(PChar(SoundFileEdit.Text), SND_ASYNC or SND_NOSTOP) then begin
+       if not sndPlaySound(PChar(s), SND_ASYNC or SND_NOSTOP) then begin
                sndPlaySound(nil, SND_ASYNC);
        end;
 end;
@@ -1343,7 +1420,8 @@ begin
        Item := SoundListView.Selected;
        if Item = nil then Exit;
 
-       if FileExists(SoundFileEdit.Text) then
+    SetCurrentDir(GikoSys.Setting.GetAppDir);
+       if FileExists(ExpandFileName(SoundFileEdit.Text)) then
                Item.SubItems[0] := SoundFileEdit.Text;
        if Trim(SoundFileEdit.Text) = '' then
                Item.SubItems[0] := '';
@@ -1484,12 +1562,12 @@ end;
 
 procedure TOptionDialog.CSSSetContent(Content: string);
 var
-       doc : Variant;
+       doc : OleVariant;
 begin
        if CSSBrowser.Document <> nil then begin
-               doc := CSSBrowser.Document;
+               doc := CSSBrowser.OleObject.Document;
                doc.open;
-                               doc.Clear;
+        doc.Clear;
                doc.charset := 'Shift_JIS';
                doc.Write(Content);
                doc.Close;
@@ -1677,5 +1755,58 @@ begin
         MaxRecordCountEdit.Text := '1';
 end;
 
+procedure TOptionDialog.BoukenDelButtonClick(Sender: TObject);
+begin
+    if ( BoukenComboBox.Items.IndexOf( BoukenComboBox.Text ) <> -1 ) then begin
+        if MsgBox(Self.Handle, BoukenComboBox.Text + ' \82ð\8dí\8f\9c\82µ\82Ü\82·\81B'#13#10 +
+            '\8dí\8f\9c\82·\82é\82Æ\95\9c\8c³\82Å\82«\82Ü\82¹\82ñ\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H', '\94E\96@\92\9f\81@\83h\83\81\83C\83\93\8dí\8f\9c', MB_YESNO or MB_ICONQUESTION) = IDYES then begin
+            GikoSys.DelBoukenCookie(BoukenComboBox.Text);
+            GikoSys.Setting.WriteBoukenSettingFile;
+            BoukenComboBox.Items.Delete(BoukenComboBox.ItemIndex);
+            if ( BoukenComboBox.Items.Count = 0 ) then begin
+                 BoukenComboBox.Text := '';
+            end;
+            BoukenComboBox.OnChange(nil);
+        end
+    end else begin
+        BoukenComboBox.Text := '';
+    end;
+end;
+
+procedure TOptionDialog.BoukenComboBoxChange(Sender: TObject);
+begin
+    BoukenEdit.Text := GikoSys.GetBoukenCookie('http://*' +BoukenComboBox.Text);
+end;
+
+procedure TOptionDialog.BoukenModButtonClick(Sender: TObject);
+var
+    DomainList : TStringList;
+    i : Integer;
+    s : String;
+begin
+    if ( Length(BoukenComboBox.Text) > 0 ) then begin
+        s := BoukenComboBox.Text;
+        GikoSys.SetBoukenCookie(BoukenEdit.Text, s);
+        GikoSys.Setting.WriteBoukenSettingFile;
+        // \96`\8c¯\82Ì\8f\91\83h\83\81\83C\83\93\88ê\97\97\8eæ\93¾
+        BoukenComboBox.Text := '';
+        BoukenComboBox.Items.Clear;
+        DomainList := TStringList.Create;
+        GikoSys.GetBoukenDomain(DomainList);
+        for i := 0 to DomainList.Count - 1 do begin
+            BoukenComboBox.Items.Add( DomainList[i] ) ;
+        end;
+        DomainList.Free;
+        BoukenComboBox.ItemIndex := 0;
+        for i := 0 to BoukenComboBox.Items.Count - 1 do begin
+            if ( BoukenComboBox.Items[i] = s) then begin
+                BoukenComboBox.ItemIndex := i;
+                Break;
+            end;
+        end;
+        BoukenComboBox.OnChange(nil);
+    end;
+end;
+
 end.