procedure SetAbonpropertys;
procedure CSSSetContent(Content: string);
procedure CSSPreview;
+ //! CSS\83v\83\8c\83r\83\85\81[\97pHTMLBody\90¶\90¬
+ function CreatePreviewBody(Res: array of TResRec): string;
+ //! CSS/SKIN\83v\83\8c\83r\83\85\81[\97pStyle\95¶\8e\9a\97ñ\8eæ\93¾
+ function GetPreviewUserStyle(): string;
public
{ Public \90é\8c¾ }
end;
DEFAULT_TABFONT_NAME: string = '\82l\82r \82o\83S\83V\83b\83N';
DEFAULT_TABFONT_SIZE: Integer = 9;
URL_TORA3: WideString = 'http://2ch.tora3.net/';
+ DEFAULT_CSS_FILENAME = 'default.css';
{$R *.DFM}
FileList.Sort;
for i := 0 to FileList.Count - 1 do begin
//s := ExtractFileName(FileList[i]);
- if LowerCase(FileList[i]) = 'default.css' then
+ if LowerCase(FileList[i]) = DEFAULT_CSS_FILENAME then
Item := CSSListView.Items.Insert(0)
else
Item := CSSListView.Items.Add;
GikoSys.Setting.UseKatjushaType := UseKatjuTypeSkinCheckBox.Checked;
//CSS\83t\83@\83C\83\8b\96¼
tmp := GikoSys.Setting.CSSFileName;
- GikoSys.Setting.CSSFileName := 'default.css';
+ GikoSys.Setting.CSSFileName := DEFAULT_CSS_FILENAME;
if CSSListView.Items.Count > 0 then begin
try
if CSSListView.Items[CSSListView.ItemIndex].Data <> nil then
ThreadItem: TThreadItem;
html: string;
Res: array [0..1] of TResRec;
- UserOptionalStyle: string;
- i: Integer;
fileName: string;
begin
fileName := GikoSys.Setting.CSSFileName;
- GikoSys.Setting.CSSFileName := 'default.css';
+ GikoSys.Setting.CSSFileName := DEFAULT_CSS_FILENAME;
if CSSListView.Items.Count > 0 then begin
try
if CSSListView.ItemIndex >= 0 then begin
GikoSys.Setting.CSSFileName := string( CSSListView.Items[CSSListView.ItemIndex].data )
else
GikoSys.Setting.CSSFileName := CSSListView.Items[CSSListView.ItemIndex].Caption + '.css';
- end;
+ end;
except
end;
end;
Res[1].FDateTime := 'ID:Sample';
Res[1].FBody := '\83I\83}\83G\83\82\83i\81[';
- // \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);
-
- 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;
if FileExists( GikoSys.GetSkinHeaderFileName ) then begin
html :=
HTMLCreater.LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, 0 );
html := StringReplace( html, '</head>',
- '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>', [rfReplaceAll] );
+ '<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">' +
+ '<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 {' + UserOptionalStyle + '}</style>' +
- '</head><body>' +
- '<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"> \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;
-
- html := html + '</body></html>';
+ '<style type="text/css">body {' + GetPreviewUserStyle + '}</style>' +
+ '</head><body><div class="title">' + ThreadItem.Title + '</div>';
+
+ html := html + CreatePreviewBody(Res) + '</body></html>';
end;
try
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