Article View: news.software.readers
Article #127670Re: [Dialog] Customising Posts
From: Alain GUERIN
Date: Fri, 04 Jul 2003 14:01
Date: Fri, 04 Jul 2003 14:01
187 lines
8377 bytes
8377 bytes
Hello,
On Fri, 4 Jul 2003 12:30:16 +0200, Alain GUERIN wrote:
> Hello,
>
OK, as usual (for me ;) there where at least two bugs in the procedure.
Here is the corrected one, and, as a compensation for those who tried the
false version, the new one add left justified box to the center justified
box already proposed.
To left justify, put a '[' in place of a '|' as custom quote charcacter.
procedure Buildquotedbox(VAR MessageQB : TStringlist);
var
firstline : integer;
lastline : integer;
LineIndex : integer;
BoxIndex : integer;
linelength : integer;
maxlength : integer;
spaces : integer;
newline : string;
CenterCustomQuoteChar : CHAR;
LeftAlignCustomQuoteChar : CHAR;
HorizontalborderChar : CHAR;
VerticalBorderChar : CHAR;
LeftTopBottomRightChar : CHAR;
RightTopBottomLeftChar : CHAR;
Proceed : boolean;
BEGIN
LineIndex:=0;
CenterCustomQuoteChar := '|';
HorizontalborderChar := '*';
VerticalBorderChar := '*';
LeftTopBottomRightChar := '*';
RightTopBottomLeftChar := '*';
WHILE LineIndex < MessageQB.count DO
BEGIN
IF pos(CenterCustomQuoteChar, MessageQB.Strings[LineIndex])=1 THEN
BEGIN
firstline:=LineIndex;
maxlength :=length(MessageQB.Strings[LineIndex]);
LineIndex:=LineIndex+1;
Proceed := LineIndex < MessageQB.count;
IF Proceed THEN
Proceed := (pos(CenterCustomQuoteChar,
MessageQB.Strings[LineIndex])=1);
WHILE Proceed DO
BEGIN
IF length(MessageQB.Strings[LineIndex]) > maxlength THEN
maxlength :=length(MessageQB.Strings[LineIndex]);
LineIndex:=LineIndex+1;
Proceed := LineIndex < MessageQB.count;
IF Proceed THEN
Proceed := (pos(CenterCustomQuoteChar,
MessageQB.Strings[LineIndex])=1)
END;
lastline := LineIndex-1;
spaces := (maxlength+1) div 2;
{proceed title}
newline := MessageQB.Strings[firstline];
{delete custom char}
delete(newline,1,1);
linelength := length(newline);
IF Odd(linelength) THEN
newline :=
LeftTopBottomRightChar+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2)+
newline+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2 +2)+RightTopBottomLeftChar
ELSE
newline :=
LeftTopBottomRightChar+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2)+
newline+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2+1)+RightTopBottomLeftChar;
MessageQB.delete(firstline);
MessageQB.insert(firstline,newline);
{procrrd box}
FOR BoxIndex := firstline+1 to lastline DO
BEGIN
newline := MessageQB.Strings[BoxIndex];
delete(newline,1,1);
linelength := length(newline);
IF Odd(linelength) THEN
newline := padr(newline,linelength+(spaces-(linelength div
2)))
ELSE
newline := padr(newline,linelength+spaces-(linelength div
2)+1);
newline := VerticalBorderChar+padl(newline, spaces-(linelength
div 2))+VerticalBorderChar;
MessageQB.delete(BoxIndex);
MessageQB.insert(BoxIndex,newline);
END;
{proceed last box line}
IF Odd(maxlength) THEN
newline :=
RightTopBottomLeftChar+Stringofchar(HorizontalborderChar,maxlength+2)+LeftTo
pBottomRightChar
ELSE
newline :=
RightTopBottomLeftChar+Stringofchar(HorizontalborderChar,maxlength+1)+LeftTo
pBottomRightChar;
MessageQB.insert(lastline+1,newline);
END;
LineIndex := LineIndex+1;
END;
LeftAlignCustomQuoteChar := '[';
LineIndex:=0;
WHILE LineIndex < MessageQB.count DO
BEGIN
IF pos(LeftAlignCustomQuoteChar, MessageQB.Strings[LineIndex])=1 THEN
BEGIN
firstline:=LineIndex;
maxlength :=length(MessageQB.Strings[LineIndex]);
LineIndex:=LineIndex+1;
Proceed := LineIndex < MessageQB.count;
IF Proceed THEN
Proceed := (pos(LeftAlignCustomQuoteChar,
MessageQB.Strings[LineIndex])=1);
WHILE Proceed DO
BEGIN
IF length(MessageQB.Strings[LineIndex]) > maxlength THEN
maxlength :=length(MessageQB.Strings[LineIndex]);
LineIndex:=LineIndex+1;
Proceed := LineIndex < MessageQB.count;
IF Proceed THEN
Proceed := (pos(LeftAlignCustomQuoteChar,
MessageQB.Strings[LineIndex])=1)
END;
lastline := LineIndex-1;
{proceed title}
newline := MessageQB.Strings[firstline];
{delete custom char}
delete(newline,1,1);
linelength := length(newline);
IF Odd(linelength) THEN
newline :=
LeftTopBottomRightChar+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2)+
newline+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2)+RightTopBottomLeftChar
ELSE
newline :=
LeftTopBottomRightChar+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2)+
newline+StringOfChar(HorizontalborderChar,
(Spaces*2-length(newline))DIV 2-1)+RightTopBottomLeftChar;
MessageQB.delete(firstline);
MessageQB.insert(firstline,newline);
{procrrd box}
FOR BoxIndex := firstline+1 to lastline DO
BEGIN
newline := MessageQB.Strings[BoxIndex];
delete(newline,1,1);
linelength := length(newline);
newline :=
VerticalBorderChar+padr(newline,linelength+spaces*2-linelength-1)+VerticalBo
rderChar;
MessageQB.delete(BoxIndex);
MessageQB.insert(BoxIndex,newline);
END;
{proceed last box line}
IF Odd(maxlength) THEN
newline :=
RightTopBottomLeftChar+Stringofchar(HorizontalborderChar,maxlength)+LeftTopB
ottomRightChar
ELSE
newline :=
RightTopBottomLeftChar+Stringofchar(HorizontalborderChar,maxlength+1)+LeftTo
pBottomRightChar;
MessageQB.insert(lastline+1,newline);
END;
LineIndex := LineIndex+1;
END;
END;
I hope I do no more error or I will have to build the rigth justified boxes
;-)
--
A.G.
Technical Details
Message-ID:
<3f0588dd$0$5248$626a54ce@news.free.fr>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!news5.aus1.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!mephistopheles.news.clara.net!news.clara.net!proxad.net!feeder2-1.proxad.net!news1-1.free.fr!not-for-mailReferences:
<3f03353e$0$5400$626a54ce@news.free.fr> <3f03484e$0$5442$626a54ce@news.free.fr> <6tudnRrDCvmRMJ6iU-KYuQ@giganews.com> <3f03c01d$0$12435$626a54ce@news.free.fr> <QwSdnS7w_MKaep6iXTWJkQ@giganews.com> <3f05573c$0$5262$626a54ce@news.free.fr>Show Full Headers
Complete Article Headers
Message-ID: <3f0588dd$0$5248$626a54ce@news.free.fr>
Subject: Re: [Dialog] Customising Posts
Date: Fri, 4 Jul 2003 16:01:55 +0200
From: Alain GUERIN <news40@spamout-alain-guerin.com.invalid>
References: <3f03353e$0$5400$626a54ce@news.free.fr> <3f03484e$0$5442$626a54ce@news.free.fr> <6tudnRrDCvmRMJ6iU-KYuQ@giganews.com> <3f03c01d$0$12435$626a54ce@news.free.fr> <QwSdnS7w_MKaep6iXTWJkQ@giganews.com> <3f05573c$0$5262$626a54ce@news.free.fr>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!news5.aus1.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!mephistopheles.news.clara.net!news.clara.net!proxad.net!feeder2-1.proxad.net!news1-1.free.fr!not-for-mail
Newsgroups: news.software.readers
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Reply-To: news40@alain-guerin.com
Organization: NA
X-Face: GOI#J$,onz-'Uz6us^h!d&!=/wSO@@FxWc?}1i_p@/E%ViONg.TD9>V7VA4(S/j%&mb%4uD
,=8(bmy`{t`AM[~^Y#8*]ZJ;
{y2%EU,B'%$9[qEDa)B{/P4+eTD5E4{Un+XE$|RWd(=aNN%(,yP,cG
=k=7dqQ"euLbBTVKLCV-Ql@aFEdzF1F6GU4b}qG%JPDjL'~T2;
-03s=7s5[QUH@>GQ!CLJ@S{%K[m1
$j`EsD+M&'5>>&-'tfiB0p',<4e0SN,4NDZ:f._qI9vVW0[r\~yk7{.GmY^cN*&/=5qjcH&Q; $
User-Agent: 40tude_Dialog/2.0.5.1
Lines: 187
NNTP-Posting-Date: 04 Jul 2003 16:02:08 MEST
NNTP-Posting-Host: 62.147.176.179
X-Trace: 1057327328 news1-1.free.fr 5248 62.147.176.179:1238
X-Complaints-To: abuse@proxad.net