OSDN Git Service

・何を寝ぼけてたのかスタイルの色が 4 桁になっていたので修正。
authoryoffy <yoffy>
Fri, 26 Sep 2003 07:44:35 +0000 (07:44 +0000)
committeryoffy <yoffy>
Fri, 26 Sep 2003 07:44:35 +0000 (07:44 +0000)
GikoSystem.pas
Option.dfm
Option.pas

index 4a8fe53..317da99 100644 (file)
@@ -944,10 +944,10 @@ begin
           'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
       if GikoSys.Setting.BrowserFontColor <> -1 then
         UserOptionalStyle := UserOptionalStyle +
-          'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 4 ) + ';';
+          'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
       if GikoSys.Setting.BrowserBackColor <> -1 then
         UserOptionalStyle := UserOptionalStyle +
-          'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 4 ) + ';';
+          'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
                        case GikoSys.Setting.BrowserFontBold of
       -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
       1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
index 8276599..956dd2b 100644 (file)
@@ -524,7 +524,7 @@ object OptionDialog: TOptionDialog
       end
     end
     object TabSheet4: TTabSheet
-      Caption = 'CSS'#12392#12473#12461#12531
+      Caption = 'CSS '#12392#12473#12461#12531
       ImageIndex = 10
       object GroupBox12: TGroupBox
         Left = 12
@@ -566,7 +566,7 @@ object OptionDialog: TOptionDialog
           TabOrder = 1
           ViewStyle = vsReport
         end
-        object CSSWebBrowser: TWebBrowser
+        object CSSBrowser: TWebBrowser
           Left = 16
           Top = 208
           Width = 281
index 1245aa9..25f7643 100644 (file)
@@ -6,7 +6,7 @@ uses
        Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
        ComCtrls, StdCtrls, ExtCtrls, Dialogs, FileCtrl, MMSystem,
        GikoSystem, GikoUtil, Buttons, UrlMon, Menus, ImgList, OleCtrls,
-  SHDocVw_TLB;
+  SHDocVw_TLB, BoardGroup;
 
 type
        TOptionDialog = class(TForm)
@@ -163,7 +163,7 @@ type
     RloCheckBox: TCheckBox;
     ReplaceulCheckBox: TCheckBox;
     PopUpAbonCheckBox: TCheckBox;
-    CSSWebBrowser: TWebBrowser;
+    CSSBrowser: TWebBrowser;
     CSSFontCheckBox: TCheckBox;
     CSSBackColorCheckBox: TCheckBox;
     CSSFontButton: TButton;
@@ -216,13 +216,17 @@ type
        private
                { Private \90é\8c¾ }
                FClose: Boolean;
+    FCSSFont: TFont;
+    FCSSBackColor: TColor;
                function GetMemoText(font: TFont; text: string): string;
 //             function GetFontText(Font: TFont; Text: string): string;
                procedure SetValue;
                procedure SaveSetting;
                procedure SettingApply;
                function CheckFolder: Boolean;
-        procedure SetAbonpropertys;
+               procedure SetAbonpropertys;
+               procedure CSSSetContent(Content: string);
+    procedure CSSPreview;
        public
                { Public \90é\8c¾ }
        end;
@@ -266,9 +270,12 @@ begin
        Tora3URLLabel.Cursor := 5;
        lblSFont.Caption := '\81\9a\8fd\97v\81\9a'#13#10#13#10
                                                                                + '\83X\83\8c\83b\83h\95\\8e¦\83G\83\8a\83A\82Ì\83t\83H\83\93\83g\95Ï\8dX\82Í\81A'#13#10
-                                                                               + '\81u\83X\83^\83C\83\8b\83V\81[\83g\81v\83^\83u\82Å\90Ý\92è\8fo\97\88\82Ü\82·';
+                                                                               + '\81uCSS \82Æ\83X\83L\83\93\81v\83^\83u\82Å\90Ý\92è\8fo\97\88\82Ü\82·';
        CSSCheckBoxClick(Sender);
        PostTimeCheckBoxClick(Sender);
+
+       CSSBrowser.Navigate('about:blank');
+  CSSPreview;
 end;
 
 procedure TOptionDialog.FormDestroy(Sender: TObject);
@@ -540,6 +547,32 @@ begin
        EditorMemo.Color := GikoSys.Setting.EditorBackColor;
        //CSS\95\\8e¦
        CSSCheckBox.Checked := GikoSys.Setting.UseCSS;
+  FCSSFont := TFont.Create;
+  if (GikoSys.Setting.BrowserFontName <> '') or
+        (GikoSys.Setting.BrowserFontSize <> 0) or
+     (GikoSys.Setting.BrowserFontBold <> 0) or
+     (GikoSys.Setting.BrowserFontItalic <> 0) or
+     (GikoSys.Setting.BrowserFontColor <> -1 ) then begin
+       CSSFontCheckBox.Checked := True;
+
+       FCSSFont.Name := GikoSys.Setting.BrowserFontName;
+    FCSSFont.Size := GikoSys.Setting.BrowserFontSize;
+    FCSSFont.Style := [];
+    if GikoSys.Setting.BrowserFontBold = 1 then
+       FCSSFont.Style := FCSSFont.Style + [fsBold];
+    if GikoSys.Setting.BrowserFontItalic = 1 then
+       FCSSFont.Style := FCSSFont.Style + [fsItalic];
+       i := GikoSys.Setting.BrowserFontColor;
+       i := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
+    FCSSFont.Color := i;
+  end;
+  if GikoSys.Setting.BrowserBackColor <> -1 then begin
+    CSSBackColorCheckBox.Checked := True;
+
+       i := GikoSys.Setting.BrowserBackColor;
+       i := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
+       FCSSBackColor := i;
+  end;
        //
        //\83X\83^\83C\83\8b\83V\81[\83g\83t\83@\83C\83\8b\96¼\88ê\97\97
        FileList := TStringList.Create;
@@ -733,6 +766,33 @@ begin
                except
                end;
        end;
+  // CSS \82Ì\83t\83H\83\93\83g\8ew\92è
+  if CSSFontCheckBox.Checked then begin
+       GikoSys.Setting.BrowserFontName := FCSSFont.Name;
+    GikoSys.Setting.BrowserFontSize := FCSSFont.Size;
+    if fsBold in FCSSFont.Style then
+       GikoSys.Setting.BrowserFontBold := 1
+    else
+       GikoSys.Setting.BrowserFontBold := -1;
+    if fsItalic in FCSSFont.Style then
+       GikoSys.Setting.BrowserFontItalic := 1
+    else
+       GikoSys.Setting.BrowserFontItalic := -1;
+       i := ColorToRGB( FCSSFont.Color );
+       GikoSys.Setting.BrowserFontColor := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
+  end else begin
+       GikoSys.Setting.BrowserFontName := '';
+    GikoSys.Setting.BrowserFontSize := 0;
+    GikoSys.Setting.BrowserFontBold := 0;
+    GikoSys.Setting.BrowserFontItalic := 0;
+    GikoSys.Setting.BrowserFontColor := -1;
+  end;
+  if CSSBackColorCheckBox.Checked then begin
+       i := ColorToRGB( FCSSBackColor );
+       GikoSys.Setting.BrowserBackColor := (i shr 16) or (i and $ff00) or ((i and $ff) shl 16);
+  end else begin
+       GikoSys.Setting.BrowserBackColor := -1;
+  end;
 
        //Mail\97\93\95\\8e¦
        GikoSys.Setting.ShowMail := ShowMailCheckBox.Checked;
@@ -1080,14 +1140,10 @@ procedure TOptionDialog.CSSFontButtonClick(Sender: TObject);
 begin
 
        FontDialog.Options := [fdAnsiOnly, fdEffects];
-       FontDialog.Font.Assign(CabinetMemo.Font);
+       FontDialog.Font.Assign(FCSSFont);
        if FontDialog.Execute then begin
                FontDialog.Font.Style := FontDialog.Font.Style - [fsUnderline] - [fsStrikeout];
-    {
-               CabinetMemo.Font.Assign(FontDialog.Font);
-               CabinetMemo.Text := GetMemoText(CabinetMemo.Font, MEMO_CABINET);
-               CabinetMemo.Font.Charset := SHIFTJIS_CHARSET;
-    }
+    FCSSFont := FontDialog.Font;
        end;
 
 end;
@@ -1095,9 +1151,9 @@ end;
 procedure TOptionDialog.CSSBackColorButtonClick(Sender: TObject);
 begin
 
-       ColorDialog.Color := CabinetMemo.Color;
+       ColorDialog.Color := FCSSBackColor;
        if ColorDialog.Execute then begin
-               //CabinetMemo.Color := ColorDialog.Color;
+       FCSSBackColor := ColorDialog.Color;
        end;
 
 end;
@@ -1116,5 +1172,40 @@ begin
 
 end;
 
+procedure TOptionDialog.CSSSetContent(Content: string);
+var
+       doc : Variant;
+begin
+       doc := CSSBrowser.Document;
+       doc.Clear;
+       doc.open;
+       doc.charset := 'Shift_JIS';
+       doc.Write(Content);
+       doc.Close;
+end;
+
+procedure TOptionDialog.CSSPreview;
+var
+       ThreadItem: TThreadItem;
+       doc: Variant;
+       html: string;
+  sTitle: string;
+begin
+
+       {
+       ThreadItem := TThreadItem.Create;
+  ThreadItem.FileName := GikoSys.GetAppDir + 'Sample.dat';
+  ThreadItem.AllResCount := 5;
+
+  sTitle := '\83T\83\93\83v\83\8b\83v\83\8c\83r\83\85\81[';
+
+       doc := CSSBrowser.Document;
+       doc.Clear;
+
+  GikoSys.CreateHTML2( doc, ThreadItem, sTitle );
+  }
+
+end;
+
 end.