OSDN Git Service

  置換コードの整理。
authoryoffy <yoffy>
Fri, 4 Jun 2004 08:27:46 +0000 (08:27 +0000)
committeryoffy <yoffy>
Fri, 4 Jun 2004 08:27:46 +0000 (08:27 +0000)
Editor.pas

index 1e78591..7a8155f 100644 (file)
@@ -161,8 +161,10 @@ type
         function ReadSettingTime(const AHost: string): Integer;
         function CheckSambaTime(const AHost: string; ATime: TDateTime): Boolean;
                                procedure SetSamba24(AURL: string);
-               // \88ø\97p\95\84\82Ì\8eæ\93¾
+               /// \88ø\97p\95\84\82Ì\8eæ\93¾
                function GetOEIndentChar : string;
+               /// \96{\95\82Ì\8eæ\93¾
+               function GetBody : string;
        protected
                procedure CreateParams(var Params: TCreateParams); override;
        public
@@ -351,6 +353,30 @@ begin
     SetSamba24(FThreadItem.ParentBoard.URL);
 end;
 
+function TEditorForm.GetBody : string;
+var
+       body            : string;
+       regexp  : TAWKStr;
+begin
+
+       body := BodyEdit.Text;
+       if GikoSys.Setting.SpaceToNBSP then begin
+               body := CustomStringReplace( body, #09, '&nbsp;&nbsp;&nbsp;&nbsp;' );
+               body := CustomStringReplace( body, '  ', '&nbsp;&nbsp;' );
+               body := CustomStringReplace( body, '&nbsp; ', '&nbsp;&nbsp;' );
+               regexp := TAWKStr.Create( nil );
+               try
+                       regexp.RegExp := '^ ';
+                       regexp.GSub( '\&nbsp;', body );
+               finally
+                       regexp.Free;
+               end;
+       end;
+
+       Result  := body;
+
+end;
+
 procedure TEditorForm.SetFont;
 begin
        BodyEdit.Font.Name := GikoSys.Setting.EditorFontName;
@@ -371,7 +397,6 @@ var
 
                                posTrip : Integer;
                                tripOrigin : string;
-       regexp  : TAWKStr;
 begin
        if FThreadItem = nil then begin
                No := '1';
@@ -381,19 +406,7 @@ begin
                Title := RepHtml(FThreadItem.Title);
        end;
 
-       body := BodyEdit.Text;
-       if GikoSys.Setting.SpaceToNBSP then begin
-               body := CustomStringReplace( body, #09, '&nbsp;&nbsp;&nbsp;&nbsp;' );
-               body := CustomStringReplace( body, '  ', '&nbsp;&nbsp;' );
-               body := CustomStringReplace( body, '&nbsp; ', '&nbsp;&nbsp;' );
-               regexp := TAWKStr.Create( nil );
-               try
-                       regexp.RegExp := '^ ';
-                       regexp.GSub( '\&nbsp;', body );
-               finally
-                       regexp.Free;
-               end;
-       end;
+       body := GetBody;
 
        Namae := RepHtml(NameComboBox.Text);
        Mail := RepHtml(MailComboBox.Text);
@@ -796,7 +809,6 @@ var
        Adjust: Integer;
        Board: TBoard;
        body            : string;
-       regexp  : TAWKStr;
 begin
        if FThreadItem = nil then
                Board := FBoard
@@ -816,19 +828,7 @@ begin
                        SendTime := GikoSys.DateTimeToInt(Board.LastGetTime);
        end;
 
-       body := BodyEdit.Text;
-       if GikoSys.Setting.SpaceToNBSP then begin
-               body := CustomStringReplace( body, #09, '&nbsp;&nbsp;&nbsp;&nbsp;' );
-               body := CustomStringReplace( body, '  ', '&nbsp;&nbsp;' );
-               body := CustomStringReplace( body, '&nbsp; ', '&nbsp;&nbsp;' );
-               regexp := TAWKStr.Create( nil );
-               try
-                       regexp.RegExp := '^ ';
-                       regexp.GSub( '\&nbsp;', body );
-               finally
-                       regexp.Free;
-               end;
-       end;
+       body := GetBody;
 
        SessionID := GikoSys.Dolib.SessionID;
        if SessionID <> '' then
@@ -887,7 +887,6 @@ var
        rc: Integer;
        state : TGikoDownloadState;
        body            : string;
-       regexp  : TAWKStr;
 begin
        if FWork then
                Exit;
@@ -921,19 +920,7 @@ begin
                end;
 
                if Board.IsBoardPlugInAvailable then begin
-                       body := BodyEdit.Text;
-                       if GikoSys.Setting.SpaceToNBSP then begin
-                               body := CustomStringReplace( body, #09, '&nbsp;&nbsp;&nbsp;&nbsp;' );
-                               body := CustomStringReplace( body, '  ', '&nbsp;&nbsp;' );
-                               body := CustomStringReplace( body, '&nbsp; ', '&nbsp;&nbsp;' );
-                               regexp := TAWKStr.Create( nil );
-                               try
-                                       regexp.RegExp := '^ ';
-                                       regexp.GSub( '\&nbsp;', body );
-                               finally
-                                       regexp.Free;
-                               end;
-                       end;
+                       body := GetBody;
 
                        if FThreadItem = nil then begin
                                // \83X\83\8c\97§\82Ä