mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 08:19:27 +02:00
+ unicode fixes for the window title
git-svn-id: branches/unicodekvm@48778 -
This commit is contained in:
parent
2ecca003dd
commit
d4be82e879
@ -103,7 +103,7 @@ begin
|
|||||||
{ Create a basic dialog box. In it are buttons, }
|
{ Create a basic dialog box. In it are buttons, }
|
||||||
{ list boxes, scrollbars, inputlines, checkboxes }
|
{ list boxes, scrollbars, inputlines, checkboxes }
|
||||||
R.Assign(32, 2, 77, 18); { Assign screen area }
|
R.Assign(32, 2, 77, 18); { Assign screen area }
|
||||||
P := New(PDialog, Init(R, 'TEST DIALOG')); { Create dialog }
|
P := New(PDialog, Init(R, '테스트 대화 상자')); { Create dialog }
|
||||||
If (P <> Nil) Then Begin { Dialog valid }
|
If (P <> Nil) Then Begin { Dialog valid }
|
||||||
R.Assign(5, 5, 20, 7); { Allocate area }
|
R.Assign(5, 5, 20, 7); { Allocate area }
|
||||||
//P^.Insert(New(PCheckBoxes, Init(R,
|
//P^.Insert(New(PCheckBoxes, Init(R,
|
||||||
|
@ -375,7 +375,8 @@ Sw_Words in Dest. The high bytes of the Sw_Words in Dest are set to Attr,
|
|||||||
or remain unchanged if Attr is zero.
|
or remain unchanged if Attr is zero.
|
||||||
25May96 LdB
|
25May96 LdB
|
||||||
---------------------------------------------------------------------}
|
---------------------------------------------------------------------}
|
||||||
PROCEDURE MoveBuf (Var Dest, Source; Attr: Byte; Count: Sw_Word);
|
PROCEDURE MoveBuf (Var Dest, Source; Attr: Byte; Count: Sw_Word); deprecated;
|
||||||
|
PROCEDURE MoveBuf (Var Dest, Source; Attr: Byte; DestWidth, SourceCount: SizeInt);
|
||||||
|
|
||||||
{-MoveChar------------------------------------------------------------
|
{-MoveChar------------------------------------------------------------
|
||||||
Moves characters into a buffer for use with a view's WriteBuf or
|
Moves characters into a buffer for use with a view's WriteBuf or
|
||||||
@ -1054,7 +1055,7 @@ END;
|
|||||||
{ MoveBuf -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 10Jul99 LdB }
|
{ MoveBuf -> Platforms DOS/DPMI/WIN/NT/OS2 - Updated 10Jul99 LdB }
|
||||||
{---------------------------------------------------------------------------}
|
{---------------------------------------------------------------------------}
|
||||||
{$ifdef FV_UNICODE}
|
{$ifdef FV_UNICODE}
|
||||||
PROCEDURE MoveBuf (Var Dest, Source; Attr: Byte; Count: Sw_Word);
|
PROCEDURE MoveBuf (Var Dest, Source; Attr: Byte; Count: Sw_Word); deprecated;
|
||||||
VAR I: Word; P: PEnhancedVideoCell;
|
VAR I: Word; P: PEnhancedVideoCell;
|
||||||
BEGIN
|
BEGIN
|
||||||
{ todo: split string into extended grapheme clusters properly, handle non-BMP characters,
|
{ todo: split string into extended grapheme clusters properly, handle non-BMP characters,
|
||||||
@ -1065,8 +1066,32 @@ BEGIN
|
|||||||
P^.ExtendedGraphemeCluster := WideChar(TWordArray(Source)[I-1]); { Copy source data }
|
P^.ExtendedGraphemeCluster := WideChar(TWordArray(Source)[I-1]); { Copy source data }
|
||||||
End;
|
End;
|
||||||
END;
|
END;
|
||||||
|
PROCEDURE MoveBuf (Var Dest, Source; Attr: Byte; DestWidth, SourceCount: SizeInt);
|
||||||
|
VAR
|
||||||
|
S, EGC: UnicodeString;
|
||||||
|
P: PEnhancedVideoCell;
|
||||||
|
BEGIN
|
||||||
|
SetLength(S, SourceCount);
|
||||||
|
Move(Source, S[1], SourceCount * SizeOf(WideChar));
|
||||||
|
P := PEnhancedVideoCell(@Dest); { Pointer to TEnhancedVideoCell }
|
||||||
|
for EGC in TUnicodeStringExtendedGraphemeClustersEnumerator.Create(S) do
|
||||||
|
begin
|
||||||
|
if DestWidth <= 0 then
|
||||||
|
exit;
|
||||||
|
Dec(DestWidth, Video.ExtendedGraphemeClusterDisplayWidth(EGC));
|
||||||
|
if DestWidth < 0 then
|
||||||
|
begin
|
||||||
|
If (Attr <> 0) Then P^.Attribute := Attr;
|
||||||
|
P^.ExtendedGraphemeCluster := ' ';
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
If (Attr <> 0) Then P^.Attribute := Attr; { Copy attribute }
|
||||||
|
P^.ExtendedGraphemeCluster := EGC; { Copy string char }
|
||||||
|
Inc(P, Video.ExtendedGraphemeClusterDisplayWidth(EGC));
|
||||||
|
end;
|
||||||
|
END;
|
||||||
{$else FV_UNICODE}
|
{$else FV_UNICODE}
|
||||||
PROCEDURE MoveBuf (Var Dest, Source; Attr: Byte; Count: Sw_Word);
|
PROCEDURE MoveBuf (Var Dest, Source; Attr: Byte; Count: Sw_Word); deprecated;
|
||||||
VAR I: Word; P: PWord;
|
VAR I: Word; P: PWord;
|
||||||
BEGIN
|
BEGIN
|
||||||
For I := 1 To Count Do Begin
|
For I := 1 To Count Do Begin
|
||||||
@ -1075,6 +1100,10 @@ BEGIN
|
|||||||
WordRec(P^).Lo := TByteArray(Source)[I-1]; { Copy source data }
|
WordRec(P^).Lo := TByteArray(Source)[I-1]; { Copy source data }
|
||||||
End;
|
End;
|
||||||
END;
|
END;
|
||||||
|
PROCEDURE MoveBuf (Var Dest, Source; Attr: Byte; DestWidth, SourceCount: SizeInt);
|
||||||
|
BEGIN
|
||||||
|
MoveBuf(Dest, Source, Attr, DestWidth);
|
||||||
|
END;
|
||||||
{$endif FV_UNICODE}
|
{$endif FV_UNICODE}
|
||||||
|
|
||||||
{---------------------------------------------------------------------------}
|
{---------------------------------------------------------------------------}
|
||||||
|
@ -2900,14 +2900,14 @@ begin
|
|||||||
Title := '';
|
Title := '';
|
||||||
if Title <> '' then
|
if Title <> '' then
|
||||||
begin
|
begin
|
||||||
L := Length(Title);
|
L := StrWidth(Title);
|
||||||
if L > Width - 10 then
|
if L > Width - 10 then
|
||||||
L := Width - 10;
|
L := Width - 10;
|
||||||
if L < 0 then
|
if L < 0 then
|
||||||
L := 0;
|
L := 0;
|
||||||
I := (Width - L) shr 1;
|
I := (Width - L) shr 1;
|
||||||
MoveChar(B[I - 1], ' ', CTitle, 1);
|
MoveChar(B[I - 1], ' ', CTitle, 1);
|
||||||
MoveBuf(B[I], Title[1], CTitle, L);
|
MoveBuf(B[I], Title[1], CTitle, L, Length(Title));
|
||||||
MoveChar(B[I + L], ' ', CTitle, 1);
|
MoveChar(B[I + L], ' ', CTitle, 1);
|
||||||
end;
|
end;
|
||||||
if State and sfActive <> 0 then
|
if State and sfActive <> 0 then
|
||||||
|
Loading…
Reference in New Issue
Block a user