* Add ContentToText and ContentToUnicode for backward compatibility
* Advanced demo: fix compilation and add ability to save as UTF-8 git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1044 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
f5021d5d6a
commit
00fcff257a
@ -3392,6 +3392,8 @@ type
|
|||||||
function ContentToHTML(Source: TVSTTextSourceType; const Caption: String = ''): String;
|
function ContentToHTML(Source: TVSTTextSourceType; const Caption: String = ''): String;
|
||||||
function ContentToRTF(Source: TVSTTextSourceType): AnsiString;
|
function ContentToRTF(Source: TVSTTextSourceType): AnsiString;
|
||||||
function ContentToAnsi(Source: TVSTTextSourceType; const Separator: String): AnsiString;
|
function ContentToAnsi(Source: TVSTTextSourceType; const Separator: String): AnsiString;
|
||||||
|
function ContentToText(Source: TVSTTextSourceType; const Separator: String): AnsiString; inline;
|
||||||
|
function ContentToUnicode(Source: TVSTTextSourceType; const Separator: String): WideString; inline;
|
||||||
function ContentToUTF16(Source: TVSTTextSourceType; const Separator: String): WideString;
|
function ContentToUTF16(Source: TVSTTextSourceType; const Separator: String): WideString;
|
||||||
function ContentToUTF8(Source: TVSTTextSourceType; const Separator: String): String;
|
function ContentToUTF8(Source: TVSTTextSourceType; const Separator: String): String;
|
||||||
procedure GetTextInfo(Node: PVirtualNode; Column: TColumnIndex; const AFont: TFont; var R: TRect;
|
procedure GetTextInfo(Node: PVirtualNode; Column: TColumnIndex; const AFont: TFont; var R: TRect;
|
||||||
@ -33248,6 +33250,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomVirtualStringTree.ContentToText(Source: TVSTTextSourceType;
|
||||||
|
const Separator: String): AnsiString;
|
||||||
|
begin
|
||||||
|
Result := ContentToAnsi(Source, Separator);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCustomVirtualStringTree.ContentToUnicode(Source: TVSTTextSourceType;
|
||||||
|
const Separator: String): WideString;
|
||||||
|
begin
|
||||||
|
Result := ContentToUTF16(Source, Separator);
|
||||||
|
end;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure TCustomVirtualStringTree.AddContentToBuffer(Buffer: TBufferedUTF8String; Source: TVSTTextSourceType; const Separator: String);
|
procedure TCustomVirtualStringTree.AddContentToBuffer(Buffer: TBufferedUTF8String; Source: TVSTTextSourceType; const Separator: String);
|
||||||
|
@ -12,7 +12,7 @@ object GeneralForm: TGeneralForm
|
|||||||
KeyPreview = True
|
KeyPreview = True
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
ShowHint = True
|
ShowHint = True
|
||||||
LCLVersion = '0.9.27'
|
LCLVersion = '0.9.29'
|
||||||
object Label18: TLabel
|
object Label18: TLabel
|
||||||
Left = 502
|
Left = 502
|
||||||
Height = 14
|
Height = 14
|
||||||
@ -85,6 +85,7 @@ object GeneralForm: TGeneralForm
|
|||||||
Hint = 'Image only column.'
|
Hint = 'Image only column.'
|
||||||
MaxWidth = 22
|
MaxWidth = 22
|
||||||
Options = [coEnabled, coParentBidiMode, coVisible]
|
Options = [coEnabled, coParentBidiMode, coVisible]
|
||||||
|
Position = 0
|
||||||
Spacing = 0
|
Spacing = 0
|
||||||
Width = 22
|
Width = 22
|
||||||
end
|
end
|
||||||
@ -97,8 +98,7 @@ object GeneralForm: TGeneralForm
|
|||||||
Text = 'Language column'
|
Text = 'Language column'
|
||||||
Width = 300
|
Width = 300
|
||||||
end>
|
end>
|
||||||
Header.Font.Height = -11
|
Header.DefaultHeight = 17
|
||||||
Header.Font.Name = 'Lucida Sans Unicode'
|
|
||||||
Header.Height = 20
|
Header.Height = 20
|
||||||
Header.Options = [hoColumnResize, hoDblClickResize, hoDrag, hoHotTrack, hoShowHint, hoVisible]
|
Header.Options = [hoColumnResize, hoDblClickResize, hoDrag, hoHotTrack, hoShowHint, hoVisible]
|
||||||
Header.ParentFont = True
|
Header.ParentFont = True
|
||||||
@ -158,6 +158,7 @@ object GeneralForm: TGeneralForm
|
|||||||
Top = 455
|
Top = 455
|
||||||
Width = 37
|
Width = 37
|
||||||
Anchors = [akRight, akBottom]
|
Anchors = [akRight, akBottom]
|
||||||
|
Min = 0
|
||||||
Max = 2
|
Max = 2
|
||||||
Increment = 2
|
Increment = 2
|
||||||
Orientation = udHorizontal
|
Orientation = udHorizontal
|
||||||
@ -867,6 +868,8 @@ object GeneralForm: TGeneralForm
|
|||||||
object FontDialog1: TFontDialog
|
object FontDialog1: TFontDialog
|
||||||
Font.Height = -11
|
Font.Height = -11
|
||||||
Font.Name = 'MS Sans Serif'
|
Font.Name = 'MS Sans Serif'
|
||||||
|
MinFontSize = 0
|
||||||
|
MaxFontSize = 0
|
||||||
left = 84
|
left = 84
|
||||||
top = 148
|
top = 148
|
||||||
end
|
end
|
||||||
@ -884,8 +887,7 @@ object GeneralForm: TGeneralForm
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
object SaveDialog: TSaveDialog
|
object SaveDialog: TSaveDialog
|
||||||
Filter = 'HTML file in UTF-8 (*.htm; *.html)|*.htm;*.html|Unicode UTF-16 text file (*.uni)|*.uni|Rich text UTF-16 file (*.rtf)|*.rtf|Comma separated values ANSI text file (*.csv)|*.csv|Plain ANSI text file (*.txt)|*.txt'
|
Filter = 'HTML file in UTF-8 (*.htm; *.html)|*.htm;*.html|Unicode UTF-16 text file (*.uni)|*.uni|Rich text UTF-16 file (*.rtf)|*.rtf|Comma separated values ANSI text file (*.csv)|*.csv|Unicode UTF-8 text file (*.txt)|*.txt|Plain ANSI text file (*.txt)|*.txt'
|
||||||
FilterIndex = 0
|
|
||||||
Options = [ofOverwritePrompt, ofHideReadOnly, ofExtensionDifferent, ofEnableSizing]
|
Options = [ofOverwritePrompt, ofHideReadOnly, ofExtensionDifferent, ofEnableSizing]
|
||||||
left = 148
|
left = 148
|
||||||
top = 148
|
top = 148
|
||||||
|
@ -489,7 +489,7 @@ const
|
|||||||
|
|
||||||
var
|
var
|
||||||
S: string;
|
S: string;
|
||||||
WS: UTF8String;
|
WS: WideString;
|
||||||
Data: Pointer;
|
Data: Pointer;
|
||||||
DataSize: Cardinal;
|
DataSize: Cardinal;
|
||||||
TargetName: string;
|
TargetName: string;
|
||||||
@ -500,6 +500,7 @@ begin
|
|||||||
if Execute then
|
if Execute then
|
||||||
begin
|
begin
|
||||||
TargetName := FileName;
|
TargetName := FileName;
|
||||||
|
writeln('Filter Index: ', FilterIndex);
|
||||||
case FilterIndex of
|
case FilterIndex of
|
||||||
1: // HTML
|
1: // HTML
|
||||||
begin
|
begin
|
||||||
@ -530,6 +531,13 @@ begin
|
|||||||
Data := PChar(S);
|
Data := PChar(S);
|
||||||
DataSize := Length(S);
|
DataSize := Length(S);
|
||||||
end;
|
end;
|
||||||
|
5: // Unicode UTF-8 text file
|
||||||
|
begin
|
||||||
|
TargetName := ChangeFileExt(TargetName, '.txt');
|
||||||
|
S := VST2.ContentToUTF8(tstVisible, #9);
|
||||||
|
Data := PChar(S);
|
||||||
|
DataSize := Length(S);
|
||||||
|
end;
|
||||||
else
|
else
|
||||||
// Plain text file
|
// Plain text file
|
||||||
TargetName := ChangeFileExt(TargetName, '.txt');
|
TargetName := ChangeFileExt(TargetName, '.txt');
|
||||||
|
Loading…
Reference in New Issue
Block a user