[UPDATE] @Karl-Heinz - http://kh-rademacher.de/4d/OnArticleListPaint_1.html

11/01/2009 - 16:56 von Hermann Hippen | Report spam
Moin Moin :-),

Betrifft: http://kh-rademacher.de/4d/OnArticl...int_1.html

| - Code optimiert

8<--[ OnArticleListPaint ]-->8
Program OnArticleListPaint;
{$I ChangeNameInArticleList_include.ds}
// Version : 1.4.4
// Date : 22.06.2005
// Dialog : 2.0.15.1 beta 38
//
// 1.2 Amended for 2.0.13.1 beta 36
// 1.3 += doesn't fail if '(' in subject (by Dirk Straka)

// 1.4 += format date string (by Dirk Straka)
// 1.4.1 += Subject_was_only() (by Dirk Straka)
// 1.4.2 += TODAYSTR <none> (by Dirk Straka)
// 1.4.3 -= bug (failed with '(<anything>)' in author's name)
// += correct subject changes without 'was: ' will be shown, too
// 1.4.4 += format date string with 'Yesterday' (by Maik Prinz)
//
// Remark: Set subject column to "%subjectnamechange%"
// and name column to "%threadindent%%fromname%"
// Subject_was_only() does not need any From column.
//
// --< adjust column indexes and date format below ... >--
//
Const
//
// - configure column number of columns here.
// - if you don't have a <from> column,
// just set it's index to zero (0).
//
n_subject_column = 3; // <-- set subject column here!
n_from_column = 0; // <-- set from column here!
n_date_column = 4; // <-- set date column here!
//
// If you like to use dialog's default thread view (i. e. show
// '<subject> (<from>)' on subject changes), but want to see subjects
// of "correct" subject changes only (i. e. containing "was: "),
// then set this value to true; normal FUp's display <from> only.
// BTW: Subjects containing "Re: " _and_ "was: " will be suppressed,
// too (as they seem to be incorrect replies):
//
// If set to false, only <from> will be shown.
//
SHOW_SUBJECT_ON_CHANGE = true; // set to true or false
//
// In DATEFMT you can define how to display the date.
// Hint: If you want to add normal text, use double quotes like this:
// DATEFMT = '"Date:" dd.mm.yy ("Time:" hh:nn)';
// If you want to see a single quote ('), use two, like this:
// DATEFMT = '"Date:" dd.mm.yy ("Time:" hh:nn "o''clock")';
//
DATEFMT = 'dd.mm.yy (hh:nn)'; // <-- set preferred date format
//
// TODAYSTR and TODAYFMT:
// If TODAYSTR is filled with a string,
// todays date will be replaced by the string and
// todays time will be formatted foll. TODAYFMT
// If TODAYSTR is set to '<none>',
// there will be no string for TODAY at all and
// todays time will be formatted foll. TODAYFMT
// If TODAYSTR is empty (''),
// todays date & time displays as defined in DATEFMT
//
// You can add normal text to these constants, too. For
// instructions, see "DATEFMT".
//
TODAYFMT = '(hh:nn)'; // <-- set time format for today's msgs
TODAYSTR = 'Heute '; // <-- will result in 'Today (14:23)'
// TODAYSTR = '<none>'; // <-- will result in '(14:23) '
YESTERDAYSTR = 'Gestern'; // <-- will result in 'Yesterday (14:23)'
THEDAYBEFOREYESTERDAYSTR = 'Vorgestern'; // <-- will result in 'THEDAYBEFOREYesterday (14:23)'
// - //
// -- No user maintainable parts below this line -- //
// - //
//
// Is the line indented?
// Indented lines start with a space
//
Function IsIndented( PaintString : WideString ) : Boolean;
Begin
result := (Copy( PaintString, 1, 1 ) = ' ');
End;
//
// Is this a correctly changed subject (i. e. contains "(was: "
//
Function IsSubjectChange( PaintString : WideString ) : Boolean;
Begin
Result := True;
If Not SHOW_SUBJECT_ON_CHANGE Then Result := False Else
If IsIndented( PaintString ) Then
Begin
If ( (Pos(' (was: ', PaintString) = 0) // ... there's no regular subject change ...
and (Pos(' (war: ', PaintString) = 0) // ... possibly in german ...
and (Pos(', was: ', PaintString) = 0) // ... or with comma ...
and (Pos(', war: ', PaintString) = 0))// ... or with german comma. ;o)
Then Result:=False; // no (correct) subject change found
// thus suppress subject
// suppress incorrect Re's
If Result and (Pos('Re: ', Trim(PaintString)) = 1) Then Result := False;
// No "^Re: " - seems to be new (or a name), thus show it
If Not (Pos('Re: ', Trim(PaintString)) = 1) Then Result := True;
End;
End;
//
// - Prerequisite: set Subject column to '%subjectnamechange%'
// - Check if there is a subject change, i. e. if there's a "(was: "
// in the subject (and no "^Re: "),
// - If so, display "<subject> (<from>)", otherwise just "<from>".
// - Strip (<from>) from "<subject> (<from>) if there's an extra
// from column (n_from_column > 0)
//
// - Will _NOT_ fail if subject has ' (', now. ;o)
//
Function Subject( PaintString : WideString ) : WideString;
Var
bpos, // pos of opening bracket
pbpos, // pos of previous opening bracket
flen, // length of <from> field
ilvl, // identation level (i. e. number of leading blanks)
i : Integer; // counter
s : WideString; // copy of 2 PaintString chars
Begin
bpos := 0; pbpos := 0;
Result := Copy( PaintString, 1, Length(PaintString) );
For i := 1 to Length( PaintString ) - 1 do // get start of <from> field
Begin
s := Copy( PaintString, i, 2 );
If s = ' (' Then
Begin
pbpos := bpos; // remember last bracket
bpos := i; // no break, to get the last '('
End;
If s = ' ' Then ilvl := ilvl + 1; // indentation levels
End;
If s = '))' Then bpos := pbpos; // Author with bracket in name
flen := Length( PaintString ) - bpos-2; // length of <from>
If IsIndented( PaintString ) Then // FollowUp -> strip subject if ...
If IsSubjectChange( PaintString) Then // ... there's no subject change
Result := Copy( PaintString, 1, Length(PaintString)) // show complete subject
Else Begin // print <from> only
Result := '';
For i:=0 to ilvl do Result := Result + ' ';
If bpos > 0 Then Result := Result + Copy( PaintString, bpos+2, flen )
Else Result := Copy( PaintString, 1, Length(PaintString) );
End;
// have to strip from
If (n_from_column>0) and (bpos>0) and IsSubjectChange(PaintString) and Not IsIndented(PaintString)
Then Result := Copy( PaintString, 1, bpos-1 );
End;
//
// From column = %threadindent%%fromname%
// Blank the column if it has a threadindent char at start
//
Function From( PaintString : WideString ) : WideString;
Begin
If IsIndented( PaintString ) Then Result := '' Else Result := PaintString;
End;
//
// Format date column following const DATEFMT (resp. TODAYSTR + TODAYFMT)
//
Function Date( Const PaintString : WideString ) : WideString;
Begin
If (FormatDateTime('dd.mm.YY', StrToDateTime(PaintString)) = FormatDateTime('dd.mm.YY', Now))
and (Not (TODAYSTR = '')) Then
If TODAYSTR = '<none>'
Then Result := FormatDateTime( TODAYFMT, StrToDateTime(PaintString) )
Else Result := TODAYSTR + ' ' + FormatDateTime( TODAYFMT, StrToDateTime(PaintString) ) Else
If (FormatDateTime('dd.mm.YY', StrToDateTime(PaintString)) = FormatDateTime('dd.mm.YY', Now-1))
and (not (YESTERDAYSTR = ''))
Then Result := YESTERDAYSTR + FormatDateTime( TODAYFMT, StrToDateTime(PaintString) ) Else
If (FormatDateTime('dd.mm.YY', StrToDateTime(PaintString)) = FormatDateTime('dd.mm.YY', Now-2))
and (not (THEDAYBEFOREYESTERDAYSTR = ''))
Then Result := THEDAYBEFOREYESTERDAYSTR + ' ' + FormatDateTime( TODAYFMT, StrToDateTime(PaintString) )
Else Result := FormatDateTime( DATEFMT, StrToDateTime(PaintString) );
End;
Function OnArticleListPaint( PaintString : WideString; ColumnIndex : Integer): Widestring;
Begin
PaintString := Change_Name_In_ArticleList (PaintString);
Result := PaintString;
Case ColumnIndex of
n_subject_column: Result := Subject( PaintString );
n_from_column: Result := From( PaintString );
n_date_column: Result := Date( PaintString );
Else Result := PaintString;
End;
End;
Begin
End.
8<-->8

Cu,
Hermann Hippen.
ž' š°º€ø?žžžžž?ø€º°š 'ž
ø€º° '<http://4ds.siteboard.eu>' °º€ø
'ž '40tude-Dialog Scriptwerkstatt' ž'
ø€º°' ž ž ø€º°ššššššš°º€øšž ž '°º€ø
 

Lesen sie die antworten

#1 Karl-Heinz Rademacher
11/01/2009 - 17:06 | Warnen spam
Hallo Hermann,

Hermann Hippen schrieb:
Betrifft: http://kh-rademacher.de/4d/OnArticl...int_1.html

| - Code optimiert



Das ist die Version 1.4.4

Und hier
http://kh-rademacher.de/4d/OnArticl...int_2.html
gibt's die Version 1.5 :-)

Mit freundlichen Gruß
Karl-Heinz Rademacher
,--[ Die 40tude Dialog - Seiten! ]
Š http://kh-rademacher.de/4d
Š http://kh-rademacher.de/face
`-

Ähnliche fragen