From 82ddb5e2e27bef9f7e6e48ede6482b989fb3efc6 Mon Sep 17 00:00:00 2001 From: yoffy Date: Fri, 4 Jun 2004 08:06:56 +0000 Subject: [PATCH] =?utf8?q?=E3=83=AC=E3=82=B9=E3=81=AE=E6=9B=B8=E3=81=8D?= =?utf8?q?=E8=BE=BC=E3=81=BF=E6=99=82=E3=81=AB=20tab=20=E3=82=84=E5=8D=8A?= =?utf8?q?=E8=A7=92=E3=82=B9=E3=83=9A=E3=83=BC=E3=82=B9=E3=82=92=20 ?= =?utf8?q?=20=E3=81=AB=E7=BD=AE=E6=8F=9B=E3=81=99=E3=82=8B=E3=82=88?= =?utf8?q?=E3=81=86=E3=81=AB=E3=81=AA=E3=81=A3=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Editor.dfm | 4 ++-- Editor.pas | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- Option.dfm | 8 ++++++-- Option.pas | 1 + Setting.pas | 16 ++++++++++++++-- 5 files changed, 76 insertions(+), 11 deletions(-) diff --git a/Editor.dfm b/Editor.dfm index 5660e8e..1b6334e 100644 --- a/Editor.dfm +++ b/Editor.dfm @@ -57,10 +57,10 @@ object EditorForm: TEditorForm Top = 30 Width = 632 Height = 297 - ActivePage = EditorTab + ActivePage = PreviewTab Align = alClient MultiLine = True - TabIndex = 0 + TabIndex = 1 TabOrder = 0 OnChange = EditorPageChange object EditorTab: TTabSheet diff --git a/Editor.pas b/Editor.pas index 619285f..1e78591 100644 --- a/Editor.pas +++ b/Editor.pas @@ -14,7 +14,7 @@ uses GikoSystem, GikoUtil, ImgList, Clipbrd, BoardGroup, IdAntiFreezeBase, IdAntiFreeze, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, ActnList, StdActns, IdIntercept, - IdLogBase, IdLogDebug, IdException, DateUtils; + IdLogBase, IdLogDebug, IdException, DateUtils, MojuUtils, bmRegExp; type // TSetLayeredWindowAttributes = function(wnd: HWND; crKey: DWORD; bAlpha: BYTE; dwFlag: DWORD): Boolean; stdcall; @@ -371,6 +371,7 @@ var posTrip : Integer; tripOrigin : string; + regexp : TAWKStr; begin if FThreadItem = nil then begin No := '1'; @@ -380,9 +381,23 @@ begin Title := RepHtml(FThreadItem.Title); end; + body := BodyEdit.Text; + if GikoSys.Setting.SpaceToNBSP then begin + body := CustomStringReplace( body, #09, '    ' ); + body := CustomStringReplace( body, ' ', '  ' ); + body := CustomStringReplace( body, '  ', '  ' ); + regexp := TAWKStr.Create( nil ); + try + regexp.RegExp := '^ '; + regexp.GSub( '\ ', body ); + finally + regexp.Free; + end; + end; + Namae := RepHtml(NameComboBox.Text); Mail := RepHtml(MailComboBox.Text); - Body := RepHtml(BodyEdit.Text); + Body := RepHtml(body); Body := StringReplace(Body, #13#10, '
', [rfReplaceAll]); DateTime := FormatDateTime('yyyy/mm/dd(aaa) hh:nn', now); @@ -780,6 +795,8 @@ var SendTime: Integer; Adjust: Integer; Board: TBoard; + body : string; + regexp : TAWKStr; begin if FThreadItem = nil then Board := FBoard @@ -798,6 +815,21 @@ begin else SendTime := GikoSys.DateTimeToInt(Board.LastGetTime); end; + + body := BodyEdit.Text; + if GikoSys.Setting.SpaceToNBSP then begin + body := CustomStringReplace( body, #09, '    ' ); + body := CustomStringReplace( body, ' ', '  ' ); + body := CustomStringReplace( body, '  ', '  ' ); + regexp := TAWKStr.Create( nil ); + try + regexp.RegExp := '^ '; + regexp.GSub( '\ ', body ); + finally + regexp.Free; + end; + end; + SessionID := GikoSys.Dolib.SessionID; if SessionID <> '' then s := 'sid=' + HttpEncode(SessionID) + '&' @@ -806,7 +838,7 @@ begin s := s + 'subject=&' + 'FROM=' + HttpEncode(NameComboBox.Text) + '&' + 'mail=' + HttpEncode(MailComboBox.Text) + '&' - + 'MESSAGE=' + HttpEncode(BodyEdit.Text) + '&' + + 'MESSAGE=' + HttpEncode(body) + '&' + 'bbs=' + Board.BBSID + '&' + 'time=' + IntToStr(SendTime) + '&'; if FThreadItem = nil then begin @@ -854,6 +886,8 @@ var Board: TBoard; rc: Integer; state : TGikoDownloadState; + body : string; + regexp : TAWKStr; begin if FWork then Exit; @@ -887,10 +921,24 @@ begin end; if Board.IsBoardPlugInAvailable then begin + body := BodyEdit.Text; + if GikoSys.Setting.SpaceToNBSP then begin + body := CustomStringReplace( body, #09, '    ' ); + body := CustomStringReplace( body, ' ', '  ' ); + body := CustomStringReplace( body, '  ', '  ' ); + regexp := TAWKStr.Create( nil ); + try + regexp.RegExp := '^ '; + regexp.GSub( '\ ', body ); + finally + regexp.Free; + end; + end; + if FThreadItem = nil then begin // ƒXƒŒ—§‚Ä state := TGikoDownloadState( Board.BoardPlugIn.CreateThread( - DWORD( Board ), TitleEdit.Text, NameComboBox.Text, MailComboBox.Text, BodyEdit.Text ) ); + DWORD( Board ), TitleEdit.Text, NameComboBox.Text, MailComboBox.Text, body ) ); if state = gdsComplete then begin GikoForm.PlaySound('ResEnd'); @@ -906,7 +954,7 @@ begin end else begin // ƒŒƒX state := TGikoDownloadState( FThreadItem.BoardPlugIn.WriteThread( - DWORD( FThreadItem ), NameComboBox.Text, MailComboBox.Text, BodyEdit.Text ) ); + DWORD( FThreadItem ), NameComboBox.Text, MailComboBox.Text, body ) ); if state = gdsComplete then begin GikoForm.PlaySound('ResEnd'); diff --git a/Option.dfm b/Option.dfm index 36faeb6..f4467bb 100644 --- a/Option.dfm +++ b/Option.dfm @@ -51,9 +51,9 @@ object OptionDialog: TOptionDialog Top = 4 Width = 509 Height = 389 - ActivePage = ThreadSheet + ActivePage = TabSheet5 MultiLine = True - TabIndex = 5 + TabIndex = 13 TabOrder = 0 OnChange = OptionTabChange object ConnectSheet: TTabSheet @@ -1432,6 +1432,10 @@ object OptionDialog: TOptionDialog end end end + object TabSheet5: TTabSheet + Caption = #12456#12487#12451#12479 + ImageIndex = 13 + end end object ApplyButton: TButton Left = 424 diff --git a/Option.pas b/Option.pas index da29059..a7f75ae 100644 --- a/Option.pas +++ b/Option.pas @@ -183,6 +183,7 @@ type GroupBox5: TGroupBox; BrowserMaxLabel: TLabel; BrowserMaxCombo: TComboBox; + TabSheet5: TTabSheet; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure ApplyButtonClick(Sender: TObject); diff --git a/Setting.pas b/Setting.pas index d50a3e3..15595f5 100644 --- a/Setting.pas +++ b/Setting.pas @@ -302,6 +302,9 @@ type //ƒŒƒXƒAƒ“ƒJ[‚ðƒNƒŠƒbƒN‚µ‚ăWƒƒƒ“ƒv‚·‚é‚© FResAnchorJamp: Boolean; + // ƒGƒfƒBƒ^ + FSpaceToNBSP : Boolean; + function GetMainCoolSet(Index: Integer): TCoolSet; function GetBoardCoolSet(Index: Integer): TCoolSet; function GetBrowserCoolSet(Index: Integer): TCoolSet; @@ -561,7 +564,10 @@ type property OddColor: TColor read FOddColor write FOddColor; property UseSamba: Boolean read FUseSamba write FUseSamba; property ResAnchorJamp: Boolean read FResAnchorJamp write FResAnchorJamp; - end; + + // ƒGƒfƒBƒ^ + property SpaceToNBSP : Boolean read FSpaceToNBSP write FSpaceToNBSP; +end; @@ -950,6 +956,9 @@ begin FShowNGLinesNum := ini.ReadBool('Abon','ShowNGLines',false); FAddResAnchor := ini.ReadBool('Abon','AddResAnchor',false); FDeleteSyria := ini.ReadBool('Abon','DeleteSyria',false); + + // ƒGƒfƒBƒ^ + FSpaceToNBSP := ini.ReadBool( 'Editor', 'SpaceToNBSP', True ); finally ini.Free; end; @@ -1225,7 +1234,10 @@ begin ini.WriteBool('Abon','Popup',FPopUpAbon); ini.WriteBool('Abon','ShowNGLines',FShowNGLinesNum); ini.WriteBool('Abon','AddResAnchor',FAddResAnchor); - ini.WriteBool('Abon','DeleteSyria',FDeleteSyria); + ini.WriteBool('Abon','DeleteSyria',FDeleteSyria); + + // ƒGƒfƒBƒ^ + ini.WriteBool( 'Editor', 'SpaceToNBSP', FSpaceToNBSP ); ini.UpdateFile; finally -- 2.11.0