Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/Option.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.78.2.1 by h677, Sun Oct 30 04:39:04 2005 UTC revision 1.96 by h677, Sun Feb 27 01:30:50 2011 UTC
# Line 13  uses Line 13  uses
13          SHDocVw_TLB,          SHDocVw_TLB,
14          MSHTML_TLB,          MSHTML_TLB,
15  {$IFEND}  {$IFEND}
16          BoardGroup;          BoardGroup, BrowserRecord;
17    
18  type  type
19          TOptionDialog = class(TForm)          TOptionDialog = class(TForm)
# Line 44  type Line 44  type
44                  WriteProxyCheck: TCheckBox;                  WriteProxyCheck: TCheckBox;
45                  WriteProxyAddressEdit: TEdit;                  WriteProxyAddressEdit: TEdit;
46                  WritePortEdit: TEdit;                  WritePortEdit: TEdit;
47                  WriteProxyUserIDEdit: TEdit;                                  WriteProxyUserIDEdit: TEdit;
48                  WriteProxyPasswordEdit: TEdit;                                  WriteProxyPasswordEdit: TEdit;
49                  Font1Sheet: TTabSheet;                  Font1Sheet: TTabSheet;
50                  Bevel1: TBevel;                  Bevel1: TBevel;
51                  Bevel2: TBevel;                  Bevel2: TBevel;
52                  Label19: TLabel;                  Label19: TLabel;
53                  Bevel5: TBevel;                                  Bevel5: TBevel;
54                  Label20: TLabel;                  Label20: TLabel;
55                  Label21: TLabel;                  Label21: TLabel;
56                  Label22: TLabel;                  Label22: TLabel;
# Line 116  type Line 116  type
116                  OpenMailerCheckBox: TCheckBox;                  OpenMailerCheckBox: TCheckBox;
117                  GroupBox6: TGroupBox;                  GroupBox6: TGroupBox;
118                  LogDeleteMessageCheckBox: TCheckBox;                  LogDeleteMessageCheckBox: TCheckBox;
                 ResAnchorGroupBox: TGroupBox;  
                 ResAnchorCheckBox: TCheckBox;  
119                  TabSheet1: TTabSheet;                  TabSheet1: TTabSheet;
                 PopupPositionRadioGroup: TRadioGroup;  
120                  TabAddRadioGroup: TRadioGroup;                  TabAddRadioGroup: TRadioGroup;
121                  GroupBox8: TGroupBox;                  GroupBox8: TGroupBox;
122                  Label14: TLabel;                  Label14: TLabel;
# Line 202  type Line 199  type
199      UnFocusedBoldCheckBox: TCheckBox;      UnFocusedBoldCheckBox: TCheckBox;
200      IgnoreKanaCheckBox: TCheckBox;      IgnoreKanaCheckBox: TCheckBox;
201      UseKatjuTypeSkinCheckBox: TCheckBox;      UseKatjuTypeSkinCheckBox: TCheckBox;
202        GroupBox20: TGroupBox;
203        AutoSortCheckBox: TCheckBox;
204        Label24: TLabel;
205        GroupBox21: TGroupBox;
206        StoredTaskTrayCB: TCheckBox;
207        GroupBox22: TGroupBox;
208        LoopBrowserTabsCB: TCheckBox;
209        GroupBox23: TGroupBox;
210        IgnoreContextCheckBox: TCheckBox;
211        GroupBox24: TGroupBox;
212        gppRightTopRB: TRadioButton;
213        gppTopRB: TRadioButton;
214        gppLeftTopRB: TRadioButton;
215        gppLeftRB: TRadioButton;
216        gppRightRB: TRadioButton;
217        gppLeftBottomRB: TRadioButton;
218        gppBottomRB: TRadioButton;
219        gppRighBottomRB: TRadioButton;
220        ResAnchorCheckBox: TCheckBox;
221        IgnoreLimitResCountCheckBox: TCheckBox;
222        GroupBox25: TGroupBox;
223        Label25: TLabel;
224        BoukenComboBox: TComboBox;
225        BoukenModButton: TButton;
226        BoukenDelButton: TButton;
227        BoukenEdit: TEdit;
228                  procedure FormCreate(Sender: TObject);                  procedure FormCreate(Sender: TObject);
229                  procedure FormDestroy(Sender: TObject);                  procedure FormDestroy(Sender: TObject);
230                  procedure ApplyButtonClick(Sender: TObject);                  procedure ApplyButtonClick(Sender: TObject);
# Line 251  type Line 274  type
274                  procedure ResRangeHoldCheckBoxClick(Sender: TObject);                  procedure ResRangeHoldCheckBoxClick(Sender: TObject);
275                  procedure CroutOptionClick(Sender: TObject);                  procedure CroutOptionClick(Sender: TObject);
276      procedure MaxRecordCountEditExit(Sender: TObject);      procedure MaxRecordCountEditExit(Sender: TObject);
277        procedure BoukenDelButtonClick(Sender: TObject);
278        procedure BoukenComboBoxChange(Sender: TObject);
279        procedure BoukenModButtonClick(Sender: TObject);
280          private          private
281                  { Private 宣言 }                  { Private 宣言 }
282                  FClose: Boolean;                  FClose: Boolean;
# Line 268  type Line 294  type
294                  procedure SetAbonpropertys;                  procedure SetAbonpropertys;
295                  procedure CSSSetContent(Content: string);                  procedure CSSSetContent(Content: string);
296                  procedure CSSPreview;                  procedure CSSPreview;
297                    //! CSSプレビュー用HTMLBody生成
298                    function CreatePreviewBody(Res: array of TResRec): string;
299                    //! CSS/SKINプレビュー用Style文字列取得
300                    function GetPreviewUserStyle(): string;
301          public          public
302                  { Public 宣言 }                  { Public 宣言 }
303          end;          end;
# Line 292  const Line 322  const
322          DEFAULT_TABFONT_NAME: string = 'MS Pゴシック';          DEFAULT_TABFONT_NAME: string = 'MS Pゴシック';
323          DEFAULT_TABFONT_SIZE: Integer = 9;          DEFAULT_TABFONT_SIZE: Integer = 9;
324          URL_TORA3: WideString = 'http://2ch.tora3.net/';          URL_TORA3: WideString = 'http://2ch.tora3.net/';
325            DEFAULT_CSS_FILENAME = 'default.css';
326    
327  {$R *.DFM}  {$R *.DFM}
328    
# Line 353  begin Line 384  begin
384                  FClose := False;                  FClose := False;
385                  Exit;                  Exit;
386          end;          end;
387          SetAbonpropertys;                  SetAbonpropertys;
388          SaveSetting;          SaveSetting;
389          SettingApply;          SettingApply;
390    
# Line 550  var Line 581  var
581          Item: TListItem;          Item: TListItem;
582  //      s: string;  //      s: string;
583          idx: Integer;          idx: Integer;
584          FileList: TStringList;          FileList : TStringList;
585        DomainList : TStringList;
586  begin  begin
587    
588          //読み込み用プロキシ          //読み込み用プロキシ
# Line 618  begin Line 650  begin
650          CSSCheckBox.Checked := GikoSys.Setting.UseCSS;          CSSCheckBox.Checked := GikoSys.Setting.UseCSS;
651          //かちゅスキン使用          //かちゅスキン使用
652          UseKatjuTypeSkinCheckBox.Checked := GikoSys.Setting.UseKatjushaType;          UseKatjuTypeSkinCheckBox.Checked := GikoSys.Setting.UseKatjushaType;
           
653          if FCSSFont <> nil then          if FCSSFont <> nil then
654                  FCSSFont.Free;                  FCSSFont.Free;
655          FCSSFont := TFont.Create;          FCSSFont := TFont.Create;
# Line 659  begin Line 690  begin
690                  FileList.Sort;                  FileList.Sort;
691                  for i := 0 to FileList.Count - 1 do begin                  for i := 0 to FileList.Count - 1 do begin
692                          //s := ExtractFileName(FileList[i]);                          //s := ExtractFileName(FileList[i]);
693                          if LowerCase(FileList[i]) = 'default.css' then                          if LowerCase(FileList[i]) = DEFAULT_CSS_FILENAME then
694                                  Item := CSSListView.Items.Insert(0)                                  Item := CSSListView.Items.Insert(0)
695                          else                          else
696                                  Item := CSSListView.Items.Add;                                  Item := CSSListView.Items.Add;
# Line 702  begin Line 733  begin
733          Ord( grrAll ):  ResRangeHoldComboBox.ItemIndex := 0;          Ord( grrAll ):  ResRangeHoldComboBox.ItemIndex := 0;
734          Ord( grrKoko ): ResRangeHoldComboBox.ItemIndex := 2;          Ord( grrKoko ): ResRangeHoldComboBox.ItemIndex := 2;
735          Ord( grrNew ):  ResRangeHoldComboBox.ItemIndex := 3;          Ord( grrNew ):  ResRangeHoldComboBox.ItemIndex := 3;
736          100:                                            ResRangeHoldComboBox.ItemIndex := 1;          10..65535:                                              ResRangeHoldComboBox.ItemIndex := 1;
737          end;          end;
738          ResRangeHoldComboBox.Enabled := GikoSys.Setting.ResRangeHold;          ResRangeHoldComboBox.Enabled := GikoSys.Setting.ResRangeHold;
739          //タブ追加位置          //タブ追加位置
# Line 745  begin Line 776  begin
776    
777          //ログ削除時メッセージ          //ログ削除時メッセージ
778          LogDeleteMessageCheckBox.Checked := GikoSys.Setting.DeleteMsg;          LogDeleteMessageCheckBox.Checked := GikoSys.Setting.DeleteMsg;
779        //同IDレスアンカー表示の制限数越えメッセージ
780        IgnoreLimitResCountCheckBox.Checked := GikoSys.Setting.LimitResCountMessage;
781    
782          //終了時確認ダイアログ          //終了時確認ダイアログ
783          ShowDialogForEndCheckBox.Checked := GikoSys.Setting.ShowDialogForEnd;          ShowDialogForEndCheckBox.Checked := GikoSys.Setting.ShowDialogForEnd;
# Line 757  begin Line 790  begin
790          BrowserMaxCombo.ItemIndex := Ord( GikoSys.Setting.BrowserAutoMaximize );          BrowserMaxCombo.ItemIndex := Ord( GikoSys.Setting.BrowserAutoMaximize );
791          //ポップアップ位置          //ポップアップ位置
792          case GikoSys.Setting.PopupPosition of          case GikoSys.Setting.PopupPosition of
793                  gppRightTop:            PopupPositionRadioGroup.ItemIndex := 0;                  gppRightTop:            gppRightTopRB.Checked := True;
794                  gppRight:                       PopupPositionRadioGroup.ItemIndex := 1;                  gppRight:                       gppRightRB.Checked := True;
795                  gppRightBottom: PopupPositionRadioGroup.ItemIndex := 2;                  gppRightBottom:     gppRighBottomRB.Checked := True;
796                  gppTop:                                 PopupPositionRadioGroup.ItemIndex := 3;                  gppTop:                         gppTopRB.Checked := True;
797                  gppCenter:                      PopupPositionRadioGroup.ItemIndex := 4;                  gppCenter:                      gppTopRB.Checked := True; // 読み込みで変換してるはず
798                  gppBottom:                      PopupPositionRadioGroup.ItemIndex := 5;                  gppBottom:                      gppBottomRB.Checked := True;
799                  gppLeftTop:             PopupPositionRadioGroup.ItemIndex := 6;                  gppLeftTop:             gppLeftTopRB.Checked := True;
800                  gppLeft:                                PopupPositionRadioGroup.ItemIndex := 7;                  gppLeft:                        gppLeftRB.Checked := True;
801                  gppLeftBottom:  PopupPositionRadioGroup.ItemIndex := 8;                  gppLeftBottom:      gppLeftBottomRB.Checked := True;
802          end;          end;
803    
804          //非アクティブ時ポップアップ表示          //非アクティブ時ポップアップ表示
# Line 822  begin Line 855  begin
855          else          else
856                  DatOchiSortCombo.ItemIndex := 0;                  DatOchiSortCombo.ItemIndex := 0;
857          end;          end;
858            AutoSortCheckBox.Checked := GikoSys.Setting.AutoSortThreadList;
859            
860          //あぼ〜ん          //あぼ〜ん
861          RloCheckBox.Checked := GikoSys.Setting.AbonDeleterlo;          RloCheckBox.Checked := GikoSys.Setting.AbonDeleterlo;
862          ReplaceulCheckBox.Checked := GikoSys.Setting.AbonReplaceul;          ReplaceulCheckBox.Checked := GikoSys.Setting.AbonReplaceul;
# Line 852  begin Line 886  begin
886    
887          //Be2ch認証          //Be2ch認証
888          BeUserIDEdit.Text := GikoSys.Setting.BeUserID;          BeUserIDEdit.Text := GikoSys.Setting.BeUserID;
889          BeCodeEdit.Text := GikoSys.Setting.BeCode;          BeCodeEdit.Text := GikoSys.Setting.BePassword;
890          BeAutoLoginCheckBox.Checked := GikoSys.Setting.BeAutoLogin;          BeAutoLoginCheckBox.Checked := GikoSys.Setting.BeAutoLogin;
891          //履歴の最大保存数          //履歴の最大保存数
892          MaxRecordCountEdit.Text := IntToStr(GikoSys.Setting.MaxRecordCount);          MaxRecordCountEdit.Text := IntToStr(GikoSys.Setting.MaxRecordCount);
893        // 最小化時にタスクトレイに格納するか
894        StoredTaskTrayCB.Checked := GikoSys.Setting.StoredTaskTray;
895        // ブラウザタブの移動でループを許可するか
896        LoopBrowserTabsCB.Checked := GikoSys.Setting.LoopBrowserTabs;
897        //
898        IgnoreContextCheckBox.Checked := GikoSys.Setting.GestureIgnoreContext;
899    
900        // 冒険の書ドメイン一覧取得
901        BoukenComboBox.Text := '';
902        BoukenComboBox.Items.Clear;
903        DomainList := TStringList.Create;
904        GikoSys.GetBoukenDomain(DomainList);
905        for i := 0 to DomainList.Count - 1 do begin
906            BoukenComboBox.Items.Add( DomainList[i] ) ;
907        end;
908        DomainList.Free;
909        BoukenComboBox.ItemIndex := 0;
910        BoukenComboBox.OnChange(nil);
911  end;  end;
912    
913  procedure TOptionDialog.SaveSetting;  procedure TOptionDialog.SaveSetting;
# Line 919  begin Line 971  begin
971          GikoSys.Setting.UseKatjushaType := UseKatjuTypeSkinCheckBox.Checked;          GikoSys.Setting.UseKatjushaType := UseKatjuTypeSkinCheckBox.Checked;
972          //CSSファイル名          //CSSファイル名
973          tmp := GikoSys.Setting.CSSFileName;          tmp := GikoSys.Setting.CSSFileName;
974          GikoSys.Setting.CSSFileName := 'default.css';          GikoSys.Setting.CSSFileName := DEFAULT_CSS_FILENAME;
975          if CSSListView.Items.Count > 0 then begin          if CSSListView.Items.Count > 0 then begin
976                  try                  try
977                          if CSSListView.Items[CSSListView.ItemIndex].Data <> nil then                          if CSSListView.Items[CSSListView.ItemIndex].Data <> nil then
# Line 983  begin Line 1035  begin
1035          GikoSys.Setting.ResRangeHold := ResRangeHoldCheckBox.Checked;          GikoSys.Setting.ResRangeHold := ResRangeHoldCheckBox.Checked;
1036          case ResRangeHoldComboBox.ItemIndex of          case ResRangeHoldComboBox.ItemIndex of
1037                  0: GikoSys.Setting.ResRange := Ord( grrAll );                  0: GikoSys.Setting.ResRange := Ord( grrAll );
1038                  1: GikoSys.Setting.ResRange := 100;                  1: GikoSys.Setting.ResRange := GikoSys.Setting.ResRangeExCount;
1039                  2: GikoSys.Setting.ResRange := Ord( grrKoko );                  2: GikoSys.Setting.ResRange := Ord( grrKoko );
1040                  3: GikoSys.Setting.ResRange := Ord( grrNew );                  3: GikoSys.Setting.ResRange := Ord( grrNew );
1041          end;          end;
# Line 1003  begin Line 1055  begin
1055    
1056          GikoSys.Setting.OpenMailer := OpenMailerCheckBox.Checked;          GikoSys.Setting.OpenMailer := OpenMailerCheckBox.Checked;
1057          GikoSys.Setting.DeleteMsg := LogDeleteMessageCheckBox.Checked;          GikoSys.Setting.DeleteMsg := LogDeleteMessageCheckBox.Checked;
1058        GikoSys.Setting.LimitResCountMessage := IgnoreLimitResCountCheckBox.Checked;
1059    
1060          //終了時確認ダイアログ          //終了時確認ダイアログ
1061          GikoSys.Setting.ShowDialogForEnd := ShowDialogForEndCheckBox.Checked;          GikoSys.Setting.ShowDialogForEnd := ShowDialogForEndCheckBox.Checked;
1062          //AllTabClose          //AllTabClose
# Line 1013  begin Line 1067  begin
1067          // ブラウザ最大化          // ブラウザ最大化
1068          GikoSys.Setting.BrowserAutoMaximize := TGikoBrowserAutoMaximize( BrowserMaxCombo.ItemIndex );          GikoSys.Setting.BrowserAutoMaximize := TGikoBrowserAutoMaximize( BrowserMaxCombo.ItemIndex );
1069          //ポップアップ位置          //ポップアップ位置
1070          case PopupPositionRadioGroup.ItemIndex of      if (gppRightTopRB.Checked) then GikoSys.Setting.PopupPosition := gppRightTop;
1071                  0: GikoSys.Setting.PopupPosition := gppRightTop;      if (gppRightRB.Checked) then GikoSys.Setting.PopupPosition := gppRight;
1072                  1: GikoSys.Setting.PopupPosition := gppRight;      if (gppRighBottomRB.Checked) then GikoSys.Setting.PopupPosition := gppRightBottom;
1073                  2: GikoSys.Setting.PopupPosition := gppRightBottom;      if (gppTopRB.Checked) then GikoSys.Setting.PopupPosition := gppTop;
1074                  3: GikoSys.Setting.PopupPosition := gppTop;      if (gppBottomRB.Checked) then GikoSys.Setting.PopupPosition := gppBottom;
1075                  4: GikoSys.Setting.PopupPosition := gppCenter;      if (gppLeftTopRB.Checked) then GikoSys.Setting.PopupPosition := gppLeftTop;
1076                  5: GikoSys.Setting.PopupPosition := gppBottom;      if (gppLeftRB.Checked) then GikoSys.Setting.PopupPosition := gppLeft;
1077                  6: GikoSys.Setting.PopupPosition := gppLeftTop;      if (gppLeftBottomRB.Checked) then GikoSys.Setting.PopupPosition := gppLeftBottom;
                 7: GikoSys.Setting.PopupPosition := gppLeft;  
                 8: GikoSys.Setting.PopupPosition := gppLeftBottom;  
         end;  
   
1078          //非アクティブ時ポップアップ表示          //非アクティブ時ポップアップ表示
1079          GikoSys.Setting.UnActivePopup := UnActivePopupCheckBox.Checked;          GikoSys.Setting.UnActivePopup := UnActivePopupCheckBox.Checked;
1080          //レスポップアップボールド表示          //レスポップアップボールド表示
# Line 1099  begin Line 1149  begin
1149                          GikoSys.Setting.DatOchiSortIndex := Ord( gbcLastModified );{gbcLastModified}                          GikoSys.Setting.DatOchiSortIndex := Ord( gbcLastModified );{gbcLastModified}
1150                          end;                          end;
1151          end;          end;
1152            GikoSys.Setting.AutoSortThreadList := AutoSortCheckBox.Checked;
1153    
1154          GikoSys.Setting.WriteSystemSettingFile;          GikoSys.Setting.WriteSystemSettingFile;
1155          GikoSys.Setting.WriteBoardURLSettingFile;          GikoSys.Setting.WriteBoardURLSettingFile;
# Line 1138  begin Line 1189  begin
1189          GikoSys.Setting.UseUndecided := UseUndecidedCheckBox.Checked;          GikoSys.Setting.UseUndecided := UseUndecidedCheckBox.Checked;
1190          //Be2ch          //Be2ch
1191          GikoSys.Setting.BeUserID := BeUserIDEdit.Text;          GikoSys.Setting.BeUserID := BeUserIDEdit.Text;
1192          GikoSys.Setting.BeCode := BeCodeEdit.Text;          GikoSys.Setting.BePassword := BeCodeEdit.Text;
1193                  GikoSys.Setting.BeAutoLogin := BeAutoLoginCheckBox.Checked;                  GikoSys.Setting.BeAutoLogin := BeAutoLoginCheckBox.Checked;
1194          //履歴の最大保存数          //履歴の最大保存数
1195          GikoSys.Setting.MaxRecordCount := Max(StrToInt64Def(MaxRecordCountEdit.Text,100),1);          GikoSys.Setting.MaxRecordCount := Max(StrToInt64Def(MaxRecordCountEdit.Text,100),1);
1196        GikoSys.Setting.StoredTaskTray := StoredTaskTrayCB.Checked;
1197        GikoSys.Setting.LoopBrowserTabs := LoopBrowserTabsCB.Checked;
1198    
1199        GikoSys.Setting.GestureIgnoreContext := IgnoreContextCheckBox.Checked;
1200    
1201  end;  end;
1202    
1203  procedure TOptionDialog.SettingApply;  procedure TOptionDialog.SettingApply;
# Line 1254  end; Line 1310  end;
1310  function TOptionDialog.CheckFolder: Boolean;  function TOptionDialog.CheckFolder: Boolean;
1311  begin  begin
1312          if Trim(LogFolderEdit.Text) = '' then          if Trim(LogFolderEdit.Text) = '' then
1313                  LogFolderEdit.Text := ExtractFilePath(Application.ExeName) + 'Log';                  LogFolderEdit.Text := GikoSys.GetAppDir + 'Log';
1314    
1315          if DirectoryExists(LogFolderEdit.Text) then begin          if DirectoryExists(LogFolderEdit.Text) then begin
1316                  Result := True;                  Result := True;
# Line 1288  begin Line 1344  begin
1344          sndPlaySound(nil, SND_ASYNC);          sndPlaySound(nil, SND_ASYNC);
1345          if OpenDialog.Execute then begin          if OpenDialog.Execute then begin
1346                  SoundFileEdit.Text := OpenDialog.FileName;                  SoundFileEdit.Text := OpenDialog.FileName;
1347            // アプリ配下のファイルの場合相対パスに変換する。
1348            if (AnsiPos(GikoSys.Setting.GetAppDir,SoundFileEdit.Text) = 1) then begin
1349                // .\ がつかないので、.\を追加
1350                SoundFileEdit.Text := '.\' + ExtractRelativePath(
1351                                          GikoSys.Setting.GetAppDir,
1352                                          SoundFileEdit.Text);
1353    
1354            end;
1355          end;          end;
1356  end;  end;
1357    
1358  procedure TOptionDialog.SoundPlayButtonClick(Sender: TObject);  procedure TOptionDialog.SoundPlayButtonClick(Sender: TObject);
1359    var
1360        s : String;
1361  begin  begin
1362          if not FileExists(SoundFileEdit.Text) then begin      SetCurrentDir(GikoSys.Setting.GetAppDir);
1363        s := ExpandFileName(SoundFileEdit.Text);
1364            if not FileExists(s) then begin
1365                  MsgBox(Handle, '存在しないファイルです', 'エラー', MB_ICONSTOP or MB_OK);                  MsgBox(Handle, '存在しないファイルです', 'エラー', MB_ICONSTOP or MB_OK);
1366                  SoundFileEdit.Text := '';                  SoundFileEdit.Text := '';
1367                  Exit;                  Exit;
1368          end;          end;
1369          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
1370                  sndPlaySound(nil, SND_ASYNC);                  sndPlaySound(nil, SND_ASYNC);
1371          end;          end;
1372  end;  end;
# Line 1318  begin Line 1386  begin
1386          Item := SoundListView.Selected;          Item := SoundListView.Selected;
1387          if Item = nil then Exit;          if Item = nil then Exit;
1388    
1389          if FileExists(SoundFileEdit.Text) then      SetCurrentDir(GikoSys.Setting.GetAppDir);
1390            if FileExists(ExpandFileName(SoundFileEdit.Text)) then
1391                  Item.SubItems[0] := SoundFileEdit.Text;                  Item.SubItems[0] := SoundFileEdit.Text;
1392          if Trim(SoundFileEdit.Text) = '' then          if Trim(SoundFileEdit.Text) = '' then
1393                  Item.SubItems[0] := '';                  Item.SubItems[0] := '';
# Line 1459  end; Line 1528  end;
1528    
1529  procedure TOptionDialog.CSSSetContent(Content: string);  procedure TOptionDialog.CSSSetContent(Content: string);
1530  var  var
1531          doc : Variant;          doc : OleVariant;
1532  begin  begin
1533          if CSSBrowser.Document <> nil then begin          if CSSBrowser.Document <> nil then begin
1534                  doc := CSSBrowser.Document;                  doc := CSSBrowser.OleObject.Document;
1535                  doc.open;                  doc.open;
1536                                  doc.Clear;          doc.Clear;
1537                  doc.charset := 'Shift_JIS';                  doc.charset := 'Shift_JIS';
1538                  doc.Write(Content);                  doc.Write(Content);
1539                  doc.Close;                  doc.Close;
# Line 1477  var Line 1546  var
1546          ThreadItem: TThreadItem;          ThreadItem: TThreadItem;
1547          html: string;          html: string;
1548          Res: array [0..1] of TResRec;          Res: array [0..1] of TResRec;
         UserOptionalStyle: string;  
         i: Integer;  
1549          fileName: string;          fileName: string;
1550  begin  begin
1551    
1552          fileName := GikoSys.Setting.CSSFileName;          fileName := GikoSys.Setting.CSSFileName;
1553    
1554          GikoSys.Setting.CSSFileName := 'default.css';          GikoSys.Setting.CSSFileName := DEFAULT_CSS_FILENAME;
1555          if CSSListView.Items.Count > 0 then begin          if CSSListView.Items.Count > 0 then begin
1556                  try                  try
1557                          if CSSListView.ItemIndex >= 0 then begin                          if CSSListView.ItemIndex >= 0 then begin
# Line 1492  begin Line 1559  begin
1559                                          GikoSys.Setting.CSSFileName := string( CSSListView.Items[CSSListView.ItemIndex].data )                                          GikoSys.Setting.CSSFileName := string( CSSListView.Items[CSSListView.ItemIndex].data )
1560                                  else                                  else
1561                                          GikoSys.Setting.CSSFileName := CSSListView.Items[CSSListView.ItemIndex].Caption + '.css';                                          GikoSys.Setting.CSSFileName := CSSListView.Items[CSSListView.ItemIndex].Caption + '.css';
1562                          end;                                                  end;
1563                  except                  except
1564                  end;                  end;
1565          end;          end;
# Line 1517  begin Line 1584  begin
1584                  Res[1].FDateTime := 'ID:Sample';                  Res[1].FDateTime := 'ID:Sample';
1585                  Res[1].FBody := 'オマエモナー';                  Res[1].FBody := 'オマエモナー';
1586    
                 // フォントやサイズの設定  
                 if CSSFontCheckBox.Checked then begin  
                         i := ColorToRGB( FCSSFont.Color );  
                         i := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);  
   
                         UserOptionalStyle := UserOptionalStyle +  
                                 'font-family:"' + FCSSFont.Name + '";' +  
                                 'font-size:' + IntToStr( FCSSFont.Size ) + 'pt;' +  
                                 'color:#' + IntToHex( i, 6 ) + ';';  
                         if fsBold in FCSSFont.Style then  
                                 UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;'  
                         else  
                                 UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';  
                         if fsItalic in FCSSFont.Style then  
                                 UserOptionalStyle := UserOptionalStyle + 'font-style:italic;'  
                         else  
                                 UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';  
                 end;  
                 if CSSBackColorCheckBox.Checked then begin  
                         i := ColorToRGB( FCSSBackColor );  
                         i := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);  
   
                         UserOptionalStyle := UserOptionalStyle +  
                                 'background-color:#' + IntToHex( i, 6 ) + ';';  
                 end;  
1587    
1588                  if FileExists( GikoSys.GetSkinHeaderFileName ) then begin                  if FileExists( GikoSys.GetSkinHeaderFileName ) then begin
1589                          html :=                          html :=
1590                                  HTMLCreater.LoadFromSkin( GikoSys.GetSkinHeaderFileName, ThreadItem, 0 ) +                                  HTMLCreater.LoadFromSkin( GikoSys.GetSkinHeaderFileName, ThreadItem, 0 ) +
1591                                  '<a name="top"></a>' +                                  '<a name="top"></a>' +
1592                                  HTMLCreater.SkinedRes( HTMLCreater.LoadFromSkin( GikoSys.GetSkinResFileName, ThreadItem, 0 ), Res[0], '1' ) +                                  HTMLCreater.SkinedRes( HTMLCreater.LoadFromSkin( GikoSys.GetSkinResFileName, ThreadItem, 0 ), @Res[0], '1' ) +
1593                                  HTMLCreater.SkinedRes( HTMLCreater.LoadFromSkin( GikoSys.GetSkinNewResFileName, ThreadItem, 0 ), Res[1], '2' ) +                                  HTMLCreater.SkinedRes( HTMLCreater.LoadFromSkin( GikoSys.GetSkinNewResFileName, ThreadItem, 0 ), @Res[1], '2' ) +
1594                                  '<a name="bottom"></a>' +                                  '<a name="bottom"></a>' +
1595                                  HTMLCreater.LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, 0 );                                  HTMLCreater.LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, 0 );
1596    
1597                          html := StringReplace( html, '</head>',                          html := StringReplace( html, '</head>',
1598                                  '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>', [rfReplaceAll] );                                  '<style type="text/css">body {' + GetPreviewUserStyle + '}</style></head>', [rfReplaceAll] );
1599                  end else begin                  end else begin
1600                          html :=                          html :=
1601                                  '<html><head>' +                                  '<html><head><meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">' +
                                 '<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">' +  
1602                                  '<title>' + ThreadItem.Title + '</title>' +                                  '<title>' + ThreadItem.Title + '</title>' +
1603                                  '<link rel="stylesheet" href="' + GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName + '" type="text/css">' +                                  '<link rel="stylesheet" href="' + GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName + '" type="text/css">' +
1604                                  '<style type="text/css">body {' + UserOptionalStyle + '}</style>' +                                  '<style type="text/css">body {' + GetPreviewUserStyle + '}</style>' +
1605                                  '</head><body>' +                                  '</head><body><div class="title">' + ThreadItem.Title + '</div>';
                                 '<div class="title">' + ThreadItem.Title + '</div>';  
   
                                 for i := 0 to High( Res ) do  
                                 begin  
                                         html := html +  
                                                 '<div class="header"><span class="no">' + IntToStr( i + 1 ) + '</span>' +  
                                                 '<span class="name_label"> 名前: </span>' +  
                                                 '<a class="name_mail" href="mailto:' + Res[i].FMailTo + '">' +  
                                                 '<b>' + Res[i].FName + '</b></a><span class="mail"> [' + Res[i].FMailTo + ']</span>' +  
                                                 '<span class="date_label"> 投稿日:</span>' +  
                                                 '<span class="date"> ' + Res[i].FDateTime+ '</span></div>' +  
                                                 '<div class="mes">' + Res[i].FBody + ' </div>';  
                                 end;  
1606    
1607                                  html := html + '</body></html>';                          html := html + CreatePreviewBody(Res) + '</body></html>';
1608                  end;                  end;
1609    
1610                  try                  try
# Line 1591  begin Line 1619  begin
1619          end;          end;
1620    
1621  end;  end;
1622    function TOptionDialog.CreatePreviewBody(Res: array of TResRec): string;
1623    var
1624            i : Integer;
1625    begin
1626            Result := '';
1627            for i := 0 to High( Res ) do
1628            begin
1629                    Result := Result +
1630                            '<div class="header"><span class="no">' + IntToStr( i + 1 ) + '</span>' +
1631                            '<span class="name_label"> 名前: </span>' +
1632                            '<a class="name_mail" href="mailto:' + Res[i].FMailTo + '">' +
1633                            '<b>' + Res[i].FName + '</b></a><span class="mail"> [' + Res[i].FMailTo + ']</span>' +
1634                            '<span class="date_label"> 投稿日:</span>' +
1635                            '<span class="date"> ' + Res[i].FDateTime+ '</span></div>' +
1636                            '<div class="mes">' + Res[i].FBody + ' </div>';
1637            end;
1638    end;
1639    
1640    function TOptionDialog.GetPreviewUserStyle(): string;
1641    var
1642            i : Integer;
1643    
1644    begin
1645            Result := '';
1646            // フォントやサイズの設定
1647            if CSSFontCheckBox.Checked then begin
1648                    i := ColorToRGB( FCSSFont.Color );
1649                    i := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
1650    
1651                    Result := Result +
1652                            'font-family:"' + FCSSFont.Name + '";' +
1653                            'font-size:' + IntToStr( FCSSFont.Size ) + 'pt;' +
1654                            'color:#' + IntToHex( i, 6 ) + ';';
1655                    if fsBold in FCSSFont.Style then
1656                            Result := Result + 'font-weight:bold;'
1657                    else
1658                            Result := Result + 'font-weight:normal;';
1659                    if fsItalic in FCSSFont.Style then
1660                            Result := Result + 'font-style:italic;'
1661                    else
1662                            Result := Result + 'font-style:normal;';
1663            end;
1664            if CSSBackColorCheckBox.Checked then begin
1665                    i := ColorToRGB( FCSSBackColor );
1666                    i := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
1667    
1668                    Result := Result +
1669                            'background-color:#' + IntToHex( i, 6 ) + ';';
1670            end;
1671    
1672    end;
1673  procedure TOptionDialog.CSSListViewChange(Sender: TObject; Item: TListItem;  procedure TOptionDialog.CSSListViewChange(Sender: TObject; Item: TListItem;
1674          Change: TItemChange);          Change: TItemChange);
1675  begin  begin
# Line 1643  begin Line 1721  begin
1721          MaxRecordCountEdit.Text := '1';          MaxRecordCountEdit.Text := '1';
1722  end;  end;
1723    
1724    procedure TOptionDialog.BoukenDelButtonClick(Sender: TObject);
1725    begin
1726        if ( BoukenComboBox.Items.IndexOf( BoukenComboBox.Text ) <> -1 ) then begin
1727            if MsgBox(Self.Handle, BoukenComboBox.Text + ' を削除します。'#13#10 +
1728                '削除すると復元できません。よろしいですか?', '忍法帖 ドメイン削除', MB_YESNO or MB_ICONQUESTION) = IDYES  then begin
1729                GikoSys.DelBoukenCookie(BoukenComboBox.Text);
1730                GikoSys.Setting.WriteBoukenSettingFile;
1731                BoukenComboBox.Items.Delete(BoukenComboBox.ItemIndex);
1732                if ( BoukenComboBox.Items.Count = 0 ) then begin
1733                     BoukenComboBox.Text := '';
1734                end;
1735                BoukenComboBox.OnChange(nil);
1736            end
1737        end else begin
1738            BoukenComboBox.Text := '';
1739        end;
1740    end;
1741    
1742    procedure TOptionDialog.BoukenComboBoxChange(Sender: TObject);
1743    begin
1744        BoukenEdit.Text := GikoSys.GetBoukenCookie('http://*' +BoukenComboBox.Text);
1745    end;
1746    
1747    procedure TOptionDialog.BoukenModButtonClick(Sender: TObject);
1748    var
1749        DomainList : TStringList;
1750        i : Integer;
1751        s : String;
1752    begin
1753        if ( Length(BoukenComboBox.Text) > 0 ) then begin
1754            s := BoukenComboBox.Text;
1755            GikoSys.SetBoukenCookie(BoukenEdit.Text, s);
1756            GikoSys.Setting.WriteBoukenSettingFile;
1757            // 冒険の書ドメイン一覧取得
1758            BoukenComboBox.Text := '';
1759            BoukenComboBox.Items.Clear;
1760            DomainList := TStringList.Create;
1761            GikoSys.GetBoukenDomain(DomainList);
1762            for i := 0 to DomainList.Count - 1 do begin
1763                BoukenComboBox.Items.Add( DomainList[i] ) ;
1764            end;
1765            DomainList.Free;
1766            BoukenComboBox.ItemIndex := 0;
1767            for i := 0 to BoukenComboBox.Items.Count - 1 do begin
1768                if ( BoukenComboBox.Items[i] = s) then begin
1769                    BoukenComboBox.ItemIndex := i;
1770                    Break;
1771                end;
1772            end;
1773            BoukenComboBox.OnChange(nil);
1774        end;
1775    end;
1776    
1777  end.  end.
1778    

Legend:
Removed from v.1.78.2.1  
changed lines
  Added in v.1.96

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26