+
+procedure TOptionDialog.CSSBackColorCheckBoxClick(Sender: TObject);
+begin
+
+ CSSBackColorButton.Enabled := CSSBackColorCheckBox.Checked;
+ CSSPreview;
+
+end;
+
+procedure TOptionDialog.CSSSetContent(Content: string);
+var
+ doc : OleVariant;
+begin
+ if CSSBrowser.Document <> nil then begin
+ doc := CSSBrowser.OleObject.Document;
+ doc.open;
+ doc.Clear;
+ doc.charset := 'Shift_JIS';
+ doc.Write(Content);
+ doc.Close;
+ end;
+end;
+
+procedure TOptionDialog.CSSPreview;
+var
+ Board: TBoard;
+ ThreadItem: TThreadItem;
+ html: string;
+ Res: array [0..1] of TResRec;
+ fileName: string;
+begin
+
+ fileName := GikoSys.Setting.CSSFileName;
+
+ GikoSys.Setting.CSSFileName := DEFAULT_CSS_FILENAME;
+ if CSSListView.Items.Count > 0 then begin
+ try
+ if CSSListView.ItemIndex >= 0 then begin
+ if CSSListView.Items[CSSListView.ItemIndex].Data <> nil then
+ GikoSys.Setting.CSSFileName := string( CSSListView.Items[CSSListView.ItemIndex].data )
+ else
+ GikoSys.Setting.CSSFileName := CSSListView.Items[CSSListView.ItemIndex].Caption + '.css';
+ end;
+ except
+ end;
+ end;
+
+ Board := TBoard.Create( nil, 'about://sample/' );
+ ThreadItem := TThreadItem.Create( nil, Board, 'about://sample/test/read.cgi/sample/' );
+
+ try
+ Board.Title := '\83T\83\93\83v\83\8b\94Â';
+ ThreadItem.ParentBoard := Board;
+ ThreadItem.AllResCount := High( Res );
+ ThreadItem.NewResCount := 1;
+ ThreadItem.NewReceive := 2;
+ ThreadItem.Title := '\83T\83\93\83v\83\8b\83v\83\8c\83r\83\85\81[';
+
+ Res[0].FName := '\96¼\96³\82µ\82³\82ñ';
+ Res[0].FMailTo := 'sage';
+ Res[0].FDateTime := 'ID:Sample';
+ Res[0].FBody := 'CSS \82Æ\83X\83L\83\93\82Ì\83T\83\93\83v\83\8b';
+ Res[1].FName := '\96¼\96³\82µ\82³\82ñ';
+ Res[1].FMailTo := 'age';
+ Res[1].FDateTime := 'ID:Sample';
+ Res[1].FBody := '\83I\83}\83G\83\82\83i\81[';
+
+
+ if FileExists( GikoSys.GetSkinHeaderFileName ) then begin
+ html :=
+ HTMLCreater.LoadFromSkin( GikoSys.GetSkinHeaderFileName, ThreadItem, 0 ) +
+ '<a name="top"></a>' +
+ HTMLCreater.SkinedRes( HTMLCreater.LoadFromSkin( GikoSys.GetSkinResFileName, ThreadItem, 0 ), @Res[0], '1' ) +
+ HTMLCreater.SkinedRes( HTMLCreater.LoadFromSkin( GikoSys.GetSkinNewResFileName, ThreadItem, 0 ), @Res[1], '2' ) +
+ '<a name="bottom"></a>' +
+ HTMLCreater.LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, 0 );
+
+ html := StringReplace( html, '</head>',
+ '<style type="text/css">body {' + GetPreviewUserStyle + '}</style></head>', [rfReplaceAll] );
+ end else begin
+ html :=
+ '<html><head><meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">' +
+ '<title>' + ThreadItem.Title + '</title>' +
+ '<link rel="stylesheet" href="' + GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName + '" type="text/css">' +
+ '<style type="text/css">body {' + GetPreviewUserStyle + '}</style>' +
+ '</head><body><div class="title">' + ThreadItem.Title + '</div>';
+
+ html := html + CreatePreviewBody(Res) + '</body></html>';
+ end;
+
+ try
+ CSSSetContent( html );
+ except
+ end;
+
+ finally
+ ThreadItem.Free;
+ Board.Free;
+ GikoSys.Setting.CSSFileName := fileName;
+ end;
+
+end;
+function TOptionDialog.CreatePreviewBody(Res: array of TResRec): string;
+var
+ i : Integer;
+begin
+ Result := '';
+ for i := 0 to High( Res ) do
+ begin
+ Result := Result +
+ '<div class="header"><span class="no">' + IntToStr( i + 1 ) + '</span>' +
+ '<span class="name_label"> \96¼\91O\81F </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"> \93\8a\8de\93ú\81F</span>' +
+ '<span class="date"> ' + Res[i].FDateTime+ '</span></div>' +
+ '<div class="mes">' + Res[i].FBody + ' </div>';
+ end;
+end;
+
+function TOptionDialog.GetPreviewUserStyle(): string;
+var
+ i : Integer;
+
+begin
+ Result := '';
+ // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
+ if CSSFontCheckBox.Checked then begin
+ i := ColorToRGB( FCSSFont.Color );
+ i := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
+
+ Result := Result +
+ 'font-family:"' + FCSSFont.Name + '";' +
+ 'font-size:' + IntToStr( FCSSFont.Size ) + 'pt;' +
+ 'color:#' + IntToHex( i, 6 ) + ';';
+ if fsBold in FCSSFont.Style then
+ Result := Result + 'font-weight:bold;'
+ else
+ Result := Result + 'font-weight:normal;';
+ if fsItalic in FCSSFont.Style then
+ Result := Result + 'font-style:italic;'
+ else
+ Result := Result + '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);
+
+ Result := Result +
+ 'background-color:#' + IntToHex( i, 6 ) + ';';
+ end;
+
+end;
+procedure TOptionDialog.CSSListViewChange(Sender: TObject; Item: TListItem;
+ Change: TItemChange);
+begin
+
+ if OptionTab.ActivePage = CSSTabSheet then
+ CSSPreview;
+
+end;
+
+procedure TOptionDialog.AddURLButtonClick(Sender: TObject);
+begin
+ BoardURLComboBox.Items.Append(BoardURLComboBox.Text);
+ BoardURLComboBox.ItemIndex := BoardURLComboBox.Items.Count - 1;
+end;
+
+procedure TOptionDialog.RemoveURLButtonClick(Sender: TObject);
+begin
+ BoardURLComboBox.DeleteSelected;
+end;
+
+procedure TOptionDialog.OddResNumCheckBoxClick(Sender: TObject);
+begin
+ OddResNumColorBox.Enabled := OddResNumCheckBox.Checked;
+ UnFocusedBoldCheckBox.Enabled := OddResNumCheckBox.Checked;
+end;
+
+procedure TOptionDialog.ResRangeHoldCheckBoxClick(Sender: TObject);
+begin
+ ResRangeHoldComboBox.Enabled := ResRangeHoldCheckBox.Checked;
+end;
+
+procedure TOptionDialog.CroutOptionClick(Sender: TObject);
+var
+ KuroutOption: TKuroutOption;
+begin
+ KuroutOption := TKuroutOption.Create(Self);
+ try
+ KuroutOption.ShowModal;
+ finally
+ KuroutOption.Release;
+ end;
+end;
+
+procedure TOptionDialog.MaxRecordCountEditExit(Sender: TObject);
+begin
+ if not GikoSys.IsNumeric(MaxRecordCountEdit.Text) then
+ MaxRecordCountEdit.Text := '100'
+ else if StrToIntDef(MaxRecordCountEdit.Text, 100) <= 0 then
+ 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;
+