IdeIntf: Support multi-line text in property editors also in Carbon. Issue #27867, patch from Hans Luijten.

git-svn-id: trunk@52234 -
This commit is contained in:
juha 2016-04-22 11:34:44 +00:00
parent c8432ee164
commit 618bfe6da9
3 changed files with 23 additions and 0 deletions

View File

@ -1566,6 +1566,9 @@ begin
if not GridIsUpdating and IsCurrentEditorAvailable then begin if not GridIsUpdating and IsCurrentEditorAvailable then begin
CurRow:=Rows[FItemIndex]; CurRow:=Rows[FItemIndex];
NewValue:=CurRow.Editor.GetVisualValue; NewValue:=CurRow.Editor.GetVisualValue;
{$IFDEF LCLCarbon}
NewValue:=StringReplace(NewValue,LineEnding,LineFeedSymbolUTF8,[rfReplaceAll]);
{$ENDIF}
SetCurrentEditValue(NewValue); SetCurrentEditValue(NewValue);
end; end;
end; end;
@ -3116,7 +3119,11 @@ end;
function TOICustomPropertyGrid.GetCurrentEditValue: string; function TOICustomPropertyGrid.GetCurrentEditValue: string;
begin begin
if FCurrentEdit=ValueEdit then if FCurrentEdit=ValueEdit then
{$IFDEF LCLCarbon}
Result:=StringReplace(ValueEdit.Text,LineFeedSymbolUTF8,LineEnding,[rfReplaceAll])
{$ELSE}
Result:=ValueEdit.Text Result:=ValueEdit.Text
{$ENDIF}
else if FCurrentEdit=ValueComboBox then else if FCurrentEdit=ValueComboBox then
Result:=ValueComboBox.Text Result:=ValueComboBox.Text
else if FCurrentEdit=ValueCheckBox then else if FCurrentEdit=ValueCheckBox then
@ -3146,7 +3153,11 @@ end;
procedure TOICustomPropertyGrid.SetCurrentEditValue(const NewValue: string); procedure TOICustomPropertyGrid.SetCurrentEditValue(const NewValue: string);
begin begin
if FCurrentEdit=ValueEdit then if FCurrentEdit=ValueEdit then
{$IFDEF LCLCarbon}
ValueEdit.Text:=StringReplace(StringReplace(NewValue,#13,LineEnding,[rfReplaceAll]),LineEnding,LineFeedSymbolUTF8,[rfReplaceAll])
{$ELSE}
ValueEdit.Text:=NewValue ValueEdit.Text:=NewValue
{$ENDIF}
else if FCurrentEdit=ValueComboBox then else if FCurrentEdit=ValueComboBox then
begin begin
ValueComboBox.Text:=NewValue; ValueComboBox.Text:=NewValue;

View File

@ -41,6 +41,13 @@ uses
const const
MaxIdentLength: Byte = 63; MaxIdentLength: Byte = 63;
{$IFDEF LCLCarbon}
// LineFeed symbol (UTF8) to maintain linefeeds in multiline text for Carbon TEdit.
// In Carbon, linefeeds get stripped from TEdit text, so we replace it temporary with
// this symbol which displays correctly a LF symbol in the Object Inspector as well.
LineFeedSymbolUTF8 = #226#144#138;
{$ENDIF}
type type
TPersistentSelectionList = PropEditUtils.TPersistentSelectionList; TPersistentSelectionList = PropEditUtils.TPersistentSelectionList;
@ -2721,7 +2728,11 @@ end;
function TPropertyEditor.GetVisualValue: ansistring; function TPropertyEditor.GetVisualValue: ansistring;
begin begin
if AllEqual then if AllEqual then
{$IFDEF LCLCarbon}
Result:=StringReplace(GetValue,LineEnding,LineFeedSymbolUTF8,[rfReplaceAll])
{$ELSE}
Result:=GetValue Result:=GetValue
{$ENDIF}
else else
Result:=''; Result:='';
end; end;

View File

@ -83,6 +83,7 @@ GongYu
Graeme Geldenhuys Graeme Geldenhuys
Grzegorz Zakrzewski Grzegorz Zakrzewski
Hakan Kizilhan Hakan Kizilhan
Hans Luijten
Hans-Joachim Ott Hans-Joachim Ott
Hans-Peter Diettrich Hans-Peter Diettrich
Haruyuki Fujimaki Haruyuki Fujimaki