mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 02:19:32 +02:00
MUI WIdget: bugfix for reading Window size, AROS special properties for AROS
This commit is contained in:
parent
5fdb03fb78
commit
df2ee9de4f
@ -1666,7 +1666,7 @@ begin
|
|||||||
MUIB.FMUICanvas.DrawRect := Rect(0, 0, PaintW, PaintH);
|
MUIB.FMUICanvas.DrawRect := Rect(0, 0, PaintW, PaintH);
|
||||||
MUIB.FMUICanvas.RastPort := CreateRastPortA;
|
MUIB.FMUICanvas.RastPort := CreateRastPortA;
|
||||||
li := NewLayerInfo();
|
li := NewLayerInfo();
|
||||||
MUIB.FMUICanvas.RastPort^.Bitmap := AllocBitMap(PaintW, PaintH, rp^.Bitmap^.Depth, BMF_MINPLANES or BMF_DISPLAYABLE, rp^.Bitmap);
|
MUIB.FMUICanvas.RastPort^.Bitmap := AllocBitMap(PaintW, PaintH, rp^.Bitmap^.Depth, {$ifdef AROS}0{$else}BMF_MINPLANES{$endif}, rp^.Bitmap);
|
||||||
MUIB.FMUICanvas.RastPort^.Layer := CreateUpFrontHookLayer(li, MUIB.FMUICanvas.RastPort^.Bitmap, 0, 0, PaintW - 1, PaintH - 1, LAYERSIMPLE, nil, nil);
|
MUIB.FMUICanvas.RastPort^.Layer := CreateUpFrontHookLayer(li, MUIB.FMUICanvas.RastPort^.Bitmap, 0, 0, PaintW - 1, PaintH - 1, LAYERSIMPLE, nil, nil);
|
||||||
ClipBlit(rp, PaintX, PaintY, MUIB.FMUICanvas.RastPort, 0, 0, PaintW, PaintH, $00C0);
|
ClipBlit(rp, PaintX, PaintY, MUIB.FMUICanvas.RastPort, 0, 0, PaintW, PaintH, $00C0);
|
||||||
end else
|
end else
|
||||||
@ -1697,8 +1697,8 @@ begin
|
|||||||
MUIB.FMUICanvas.RastPort^.layer := nil;
|
MUIB.FMUICanvas.RastPort^.layer := nil;
|
||||||
FreeBitmap(MUIB.FMUICanvas.RastPort^.Bitmap);
|
FreeBitmap(MUIB.FMUICanvas.RastPort^.Bitmap);
|
||||||
FreeRastPortA(MUIB.FMUICanvas.RastPort);
|
FreeRastPortA(MUIB.FMUICanvas.RastPort);
|
||||||
MUIB.FMUICanvas.RastPort := nil;
|
|
||||||
end;
|
end;
|
||||||
|
MUIB.FMUICanvas.RastPort := nil;
|
||||||
//writeln('<--Draw ', muib.classname);
|
//writeln('<--Draw ', muib.classname);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
|
@ -130,16 +130,21 @@ type
|
|||||||
{ TMUIBitmap }
|
{ TMUIBitmap }
|
||||||
|
|
||||||
TMUIBitmap = class(TMUIWinAPIObject)
|
TMUIBitmap = class(TMUIWinAPIObject)
|
||||||
|
private
|
||||||
|
FMUICanvas: TMUICanvas;
|
||||||
|
procedure SetMUICanvas(AValue: TMUICanvas);
|
||||||
public
|
public
|
||||||
FImage: Pointer;
|
FImage: Pointer;
|
||||||
FWidth: Integer;
|
FWidth: Integer;
|
||||||
FHeight: Integer;
|
FHeight: Integer;
|
||||||
FDepth: Integer;
|
FDepth: Integer;
|
||||||
MUICanvas: TMUICanvas;
|
|
||||||
constructor Create(Width, Height, Depth: Integer); virtual; overload;
|
constructor Create(Width, Height, Depth: Integer); virtual; overload;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
procedure GetFromCanvas;
|
procedure GetFromCanvas;
|
||||||
|
|
||||||
|
property MUICanvas: TMUICanvas read FMUICanvas write SetMUICanvas;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TMUIFontObj }
|
{ TMUIFontObj }
|
||||||
@ -451,6 +456,7 @@ procedure TMUIBitmap.GetFromCanvas;
|
|||||||
var
|
var
|
||||||
T: TPoint;
|
T: TPoint;
|
||||||
begin
|
begin
|
||||||
|
//writeln('TMUICanvas.GetFromCanvas ', HexStr(Self), ' MuiCanvas ', Assigned(MUICanvas));
|
||||||
if Assigned(MUICanvas) and Assigned(FImage) and Assigned(MUICanvas.RastPort) then
|
if Assigned(MUICanvas) and Assigned(FImage) and Assigned(MUICanvas.RastPort) then
|
||||||
begin
|
begin
|
||||||
T := MUICanvas.GetOffset;
|
T := MUICanvas.GetOffset;
|
||||||
@ -459,6 +465,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMUIBitmap.SetMUICanvas(AValue: TMUICanvas);
|
||||||
|
begin
|
||||||
|
FMUICanvas := AValue;
|
||||||
|
//writeln('TMUICanvas.SetMUICanvas ', HexStr(Self), ' MuiCanvas ', Assigned(AValue));
|
||||||
|
end;
|
||||||
|
|
||||||
{ TMUIFontObj }
|
{ TMUIFontObj }
|
||||||
|
|
||||||
procedure TMUIFontObj.OpenFontHandle;
|
procedure TMUIFontObj.OpenFontHandle;
|
||||||
@ -1825,10 +1837,12 @@ begin
|
|||||||
if not Assigned(MUIObject) then
|
if not Assigned(MUIObject) then
|
||||||
begin
|
begin
|
||||||
Drawn := False;
|
Drawn := False;
|
||||||
if Bitmap.MUICanvas = nil then
|
// deactiaved for now or Bitmap.Assign(Bitmap) does not work when the
|
||||||
Bitmap.MUICanvas := Self;
|
//if Bitmap.MUICanvas = nil then
|
||||||
|
// Bitmap.MUICanvas := Self;
|
||||||
FreeBitmap(RastPort^.Bitmap);
|
FreeBitmap(RastPort^.Bitmap);
|
||||||
RastPort^.Bitmap := AllocBitMap(Bitmap.FWidth, Bitmap.FHeight, 32, BMF_CLEAR or BMF_MINPLANES or BMF_DISPLAYABLE, IntuitionBase^.ActiveScreen^.RastPort.Bitmap);
|
//writeln('set size to ',Bitmap.FWidth,' x ', Bitmap.FHeight);
|
||||||
|
RastPort^.Bitmap := AllocBitMap(Bitmap.FWidth + 1, Bitmap.FHeight + 1, 32, BMF_CLEAR or {$ifdef AROS}0{$else}BMF_MINPLANES{$endif}, IntuitionBase^.ActiveScreen^.RastPort.Bitmap);
|
||||||
DrawRect := Rect(0, 0, Bitmap.FWidth, Bitmap.FHeight);
|
DrawRect := Rect(0, 0, Bitmap.FWidth, Bitmap.FHeight);
|
||||||
if Assigned(CyberGfxBase) then
|
if Assigned(CyberGfxBase) then
|
||||||
Cybergraphics.WritePixelArray(Bitmap.FImage, 0, 0, Bitmap.FWidth * SizeOf(LongWord), RastPort, 0, 0, Bitmap.FWidth, Bitmap.FHeight, RECTFMT_ARGB);
|
Cybergraphics.WritePixelArray(Bitmap.FImage, 0, 0, Bitmap.FWidth * SizeOf(LongWord), RastPort, 0, 0, Bitmap.FWidth, Bitmap.FHeight, RECTFMT_ARGB);
|
||||||
|
@ -128,6 +128,8 @@ type
|
|||||||
procedure RemoveChild(ChildObj: PObject_); override;
|
procedure RemoveChild(ChildObj: PObject_); override;
|
||||||
procedure SetLeft(ALeft: LongInt); override;
|
procedure SetLeft(ALeft: LongInt); override;
|
||||||
procedure SetTop(ATop: LongInt); override;
|
procedure SetTop(ATop: LongInt); override;
|
||||||
|
procedure SetWidth(AWidth: integer); override;
|
||||||
|
procedure SetHeight(AHeight: integer); override;
|
||||||
function GetTop(): Integer; override;
|
function GetTop(): Integer; override;
|
||||||
function GetLeft(): Integer; override;
|
function GetLeft(): Integer; override;
|
||||||
function GetWidth(): Integer; override;
|
function GetWidth(): Integer; override;
|
||||||
@ -662,30 +664,58 @@ begin
|
|||||||
FBlockMove := False;
|
FBlockMove := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMuiWindow.SetWidth(AWidth: integer);
|
||||||
|
begin
|
||||||
|
FWidth := AWidth;
|
||||||
|
//SetAttribute(MUIA_Window_Width, AWidth);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMuiWindow.SetHeight(AHeight: integer);
|
||||||
|
begin
|
||||||
|
FHeight := AHeight;
|
||||||
|
//SetAttribute(MUIA_Window_Height, AHeight);
|
||||||
|
end;
|
||||||
|
|
||||||
function TMuiWindow.GetTop(): Integer;
|
function TMuiWindow.GetTop(): Integer;
|
||||||
begin
|
begin
|
||||||
Result := GetAttribute(MUIA_Window_TopEdge);
|
if Assigned(Obj) then
|
||||||
|
Result := GetAttribute(MUIA_Window_TopEdge)
|
||||||
|
else
|
||||||
|
Result := FTop;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMuiWindow.GetLeft(): Integer;
|
function TMuiWindow.GetLeft(): Integer;
|
||||||
begin
|
begin
|
||||||
Result := GetAttribute(MUIA_Window_LeftEdge);
|
if Assigned(Obj) then
|
||||||
|
Result := GetAttribute(MUIA_Window_LeftEdge)
|
||||||
|
else
|
||||||
|
Result := FLeft;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMuiWindow.GetWidth(): Integer;
|
function TMuiWindow.GetWidth(): Integer;
|
||||||
begin
|
begin
|
||||||
if Sizeable then
|
if Assigned(Obj) and Visible then
|
||||||
Result := GetAttribute(MUIA_Window_Width)
|
begin
|
||||||
|
if Sizeable then
|
||||||
|
Result := GetAttribute(MUIA_Window_Width)
|
||||||
|
else
|
||||||
|
Result := PasObject.Width;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
Result := PasObject.Width;
|
Result := FWidth;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMuiWindow.GetHeight(): Integer;
|
function TMuiWindow.GetHeight(): Integer;
|
||||||
begin
|
begin
|
||||||
if Sizeable then
|
if Assigned(Obj) and Visible then
|
||||||
Result := GetAttribute(MUIA_Window_Height)
|
begin
|
||||||
|
if Sizeable then
|
||||||
|
Result := GetAttribute(MUIA_Window_Height)
|
||||||
|
else
|
||||||
|
Result := PasObject.Height;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
Result := PasObject.Height;
|
Result := FHeight;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMuiWindow.GetCaption: string;
|
function TMuiWindow.GetCaption: string;
|
||||||
|
@ -242,7 +242,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
NewDC.RastPort := CreateRastPortA;
|
NewDC.RastPort := CreateRastPortA;
|
||||||
NewDC.RastPort^.Layer := nil;
|
NewDC.RastPort^.Layer := nil;
|
||||||
NewDC.RastPort^.Bitmap := AllocBitMap(IntuitionBase^.ActiveScreen^.Width, IntuitionBase^.ActiveScreen^.Height, 32, BMF_CLEAR or BMF_MINPLANES or BMF_DISPLAYABLE, IntuitionBase^.ActiveScreen^.RastPort.Bitmap);
|
NewDC.RastPort^.Bitmap := AllocBitMap(IntuitionBase^.ActiveScreen^.Width, IntuitionBase^.ActiveScreen^.Height, 32, BMF_CLEAR or {$ifdef AROS}0{$else}BMF_MINPLANES{$endif}, IntuitionBase^.ActiveScreen^.RastPort.Bitmap);
|
||||||
NewDC.DrawRect := Rect(0, 0, IntuitionBase^.ActiveScreen^.Width, IntuitionBase^.ActiveScreen^.Height);
|
NewDC.DrawRect := Rect(0, 0, IntuitionBase^.ActiveScreen^.Width, IntuitionBase^.ActiveScreen^.Height);
|
||||||
end;
|
end;
|
||||||
NewDC.InitCanvas;
|
NewDC.InitCanvas;
|
||||||
@ -628,7 +628,7 @@ begin
|
|||||||
ARect.Right := Widget.Left + Widget.Width;
|
ARect.Right := Widget.Left + Widget.Width;
|
||||||
ARect.Top := Widget.Top;
|
ARect.Top := Widget.Top;
|
||||||
ARect.Bottom := Widget.Top + Widget.Height;
|
ARect.Bottom := Widget.Top + Widget.Height;
|
||||||
//writeln(Widget.classname, '################Get Clientbounds ', ARect.Left, ', ', ARect.Right);
|
//writeln(Widget.classname, '################Get Clientbounds ', ARect.Left, ', ', ARect.Top);
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -954,17 +954,45 @@ function TMUIWidgetSet.GetSystemMetrics(nIndex: Integer): Integer;
|
|||||||
var
|
var
|
||||||
Sc: PScreen;
|
Sc: PScreen;
|
||||||
begin
|
begin
|
||||||
//writeln('get system metrics ', nIndex);
|
|
||||||
Sc := LockPubscreen('Workbench');
|
Sc := LockPubscreen('Workbench');
|
||||||
|
Result := 0;
|
||||||
if Assigned(Sc) then
|
if Assigned(Sc) then
|
||||||
begin
|
begin
|
||||||
case nIndex of
|
case nIndex of
|
||||||
//Current screen size
|
//Current screen size
|
||||||
SM_CXSCREEN: Result:= Sc^.Width;
|
SM_CXSCREEN,
|
||||||
SM_CYSCREEN: Result:= Sc^.Height;
|
SM_CXVIRTUALSCREEN,
|
||||||
//Desktop size
|
SM_CXFULLSCREEN:
|
||||||
SM_CXVIRTUALSCREEN: Result:=Sc^.Width;
|
begin
|
||||||
SM_CYVIRTUALSCREEN: Result:=Sc^.Height;
|
Result := Sc^.Width;
|
||||||
|
//writeln('get system metrics width ', nIndex, ' Result ', Result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
SM_CYSCREEN,
|
||||||
|
SM_CYVIRTUALSCREEN,
|
||||||
|
SM_CYFULLSCREEN:
|
||||||
|
begin
|
||||||
|
Result:= Sc^.Height;
|
||||||
|
//writeln('get system metrics Height ', nIndex, ' Result ', Result);
|
||||||
|
end;
|
||||||
|
//
|
||||||
|
// from cocoawinapi
|
||||||
|
SM_CXSMICON,
|
||||||
|
SM_CYSMICON:
|
||||||
|
Result := 16;
|
||||||
|
SM_CXICON,
|
||||||
|
SM_CYICON:
|
||||||
|
Result := 128;
|
||||||
|
SM_CXCURSOR,
|
||||||
|
SM_CYCURSOR:
|
||||||
|
Result := 16;
|
||||||
|
SM_CXDRAG,
|
||||||
|
SM_CYDRAG:
|
||||||
|
Result := 5;
|
||||||
|
SM_CXHTHUMB,
|
||||||
|
SM_CYVTHUMB:
|
||||||
|
Result := 5;
|
||||||
end;
|
end;
|
||||||
UnlockPubScreen('Workbench', Sc);
|
UnlockPubScreen('Workbench', Sc);
|
||||||
end;
|
end;
|
||||||
@ -1766,7 +1794,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
if Src.Drawn then
|
if Src.Drawn then
|
||||||
begin
|
begin
|
||||||
ScaledBitmap := AllocBitMap(Width, Height, 32, BMF_MINPLANES or BMF_DISPLAYABLE, IntuitionBase^.ActiveScreen^.RastPort.Bitmap);
|
ScaledBitmap := AllocBitMap(Width, Height, 32, {$ifdef AROS}0{$else}BMF_MINPLANES{$endif}, IntuitionBase^.ActiveScreen^.RastPort.Bitmap);
|
||||||
with bsa do
|
with bsa do
|
||||||
begin
|
begin
|
||||||
bsa_SrcX := XSrc;
|
bsa_SrcX := XSrc;
|
||||||
@ -1910,7 +1938,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
if Src.Drawn then
|
if Src.Drawn then
|
||||||
begin
|
begin
|
||||||
ScaledBitmap := AllocBitMap(Width, Height, 32, BMF_MINPLANES or BMF_DISPLAYABLE, IntuitionBase^.ActiveScreen^.RastPort.Bitmap);
|
ScaledBitmap := AllocBitMap(Width, Height, 32, {$ifdef AROS}0{$else}BMF_MINPLANES{$endif}, IntuitionBase^.ActiveScreen^.RastPort.Bitmap);
|
||||||
with bsa do
|
with bsa do
|
||||||
begin
|
begin
|
||||||
bsa_SrcX := XSrc;
|
bsa_SrcX := XSrc;
|
||||||
|
Loading…
Reference in New Issue
Block a user