mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-07 19:17:52 +01:00
LCL-Win32: Initialize variables based on compiler warnings. Contains ToDo items.
git-svn-id: trunk@48479 -
This commit is contained in:
parent
4e16799fd7
commit
653207f24f
@ -522,7 +522,7 @@ var
|
||||
nSize, BytesCount: DWORD;
|
||||
RgnData: PRgnData;
|
||||
WindowOrg: Windows.POINT;
|
||||
XFORM: TXFORM;
|
||||
XFRM: TXFORM;
|
||||
MirroredPaintRgn: HRGN;
|
||||
begin
|
||||
// winnt returns in screen coordinates
|
||||
@ -549,11 +549,12 @@ begin
|
||||
//Method 2 - Create a mirrored region based on the one we have
|
||||
nSize := GetRegionData(PaintRegion, 0, nil);
|
||||
RgnData := GetMem(nSize);
|
||||
XForm.eDx:=0; XForm.eDy:=0;
|
||||
XForm.eM11:=-1; XForm.eM12:=0;
|
||||
XForm.eM21:=0; XForm.eM22:=1;
|
||||
XFRM.eDx:=0; XFRM.eDy:=0;
|
||||
XFRM.eM11:=-1; XFRM.eM12:=0;
|
||||
XFRM.eM21:=0; XFRM.eM22:=1;
|
||||
|
||||
MirroredPaintRgn := ExtCreateRegion(@XForm, BytesCount, RgnData^);
|
||||
// ToDo: BytesCount is not initialized.
|
||||
MirroredPaintRgn := ExtCreateRegion(@XFRM, BytesCount, RgnData^);
|
||||
Windows.SelectClipRgn(CurDoubleBuffer.DC, MirroredPaintRgn);
|
||||
Windows.DeleteObject(MirroredPaintRgn);
|
||||
Freemem(RgnData);
|
||||
@ -2353,7 +2354,7 @@ begin
|
||||
|
||||
case Msg of
|
||||
WM_ACTIVATEAPP: DoMsgActivateApp;
|
||||
WM_MOVE: if DoMsgMove then Exit;
|
||||
WM_MOVE: if DoMsgMove then Exit(0);
|
||||
WM_SIZE: DoMsgSize;
|
||||
BM_SETCHECK:
|
||||
begin
|
||||
@ -2686,6 +2687,7 @@ begin
|
||||
begin
|
||||
// free our own data associated with window
|
||||
DisposeWindowInfo(Window);
|
||||
Result := 0;
|
||||
end;
|
||||
else
|
||||
if UnicodeEnabledOS
|
||||
|
||||
@ -530,6 +530,7 @@ begin
|
||||
Info.Colors[1] := $00FF00; {le-green}
|
||||
Info.Colors[2] := $0000FF; {le-blue}
|
||||
|
||||
Result := False;
|
||||
StretchSrc := (nWidthDest <> nWidthSrc) or (nHeightDest <> nHeightSrc);
|
||||
if StretchSrc
|
||||
then begin
|
||||
@ -608,6 +609,7 @@ begin
|
||||
end
|
||||
else begin
|
||||
CleanupAlpha := False;
|
||||
AlphaBmp := INVALID_HANDLE_VALUE;
|
||||
end;
|
||||
|
||||
// create new srcbmp
|
||||
@ -690,6 +692,7 @@ begin
|
||||
Inc(SrcLinePtr, nXOriginSrc * SrcPixelBytes + nYOriginSrc * SrcRowStride);
|
||||
DstLinePtr := DstBytesPtr;
|
||||
|
||||
SrcAlpha := nil;
|
||||
if blendFunction.AlphaFormat = AC_SRC_ALPHA
|
||||
then begin
|
||||
if AlphaBytesPtr <> nil
|
||||
|
||||
@ -54,7 +54,7 @@ function TWin32WidgetSet.AddPipeEventHandler(AHandle: THandle;
|
||||
var
|
||||
lHandler: PPipeEventInfo;
|
||||
begin
|
||||
if AEventHandler = nil then exit;
|
||||
if AEventHandler = nil then exit(nil);
|
||||
New(lHandler);
|
||||
lHandler^.Handle := AHandle;
|
||||
lHandler^.UserData := AData;
|
||||
@ -72,7 +72,7 @@ function TWin32WidgetSet.AddProcessEventHandler(AHandle: THandle;
|
||||
var
|
||||
lProcessEvent: PProcessEvent;
|
||||
begin
|
||||
if AEventHandler = nil then exit;
|
||||
if AEventHandler = nil then exit(nil);
|
||||
New(lProcessEvent);
|
||||
lProcessEvent^.Handle := AHandle;
|
||||
lProcessEvent^.UserData := AData;
|
||||
@ -1121,7 +1121,9 @@ var
|
||||
begin
|
||||
OverlayWindow := GetWin32WindowInfo(Window)^.Overlay;
|
||||
if OverlayWindow <> 0 then
|
||||
Result := Windows.ReleaseDC(OverlayWindow, DC);
|
||||
Result := Windows.ReleaseDC(OverlayWindow, DC)
|
||||
else
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
procedure TWin32WidgetSet.RemoveEventHandler(var AHandler: PEventHandler);
|
||||
|
||||
@ -244,7 +244,9 @@ var
|
||||
lItemIndex: Integer;
|
||||
begin
|
||||
if (FFlagGetCaretIndex <> 0) and (GetCount = 0) then
|
||||
lItemIndex := SendMessage(FWin32List, FFlagGetCaretIndex, 0, 0);
|
||||
lItemIndex := SendMessage(FWin32List, FFlagGetCaretIndex, 0, 0)
|
||||
else
|
||||
lItemIndex := -1;
|
||||
|
||||
FLastInsertedIndex := Index;
|
||||
if FSorted then
|
||||
@ -281,6 +283,7 @@ var
|
||||
AData: Pointer;
|
||||
begin
|
||||
// remember selection
|
||||
lSelected := False;
|
||||
lItemIndex := -1;
|
||||
if FFlagGetSelected <> 0 then
|
||||
begin
|
||||
@ -304,10 +307,8 @@ begin
|
||||
RestoreData(Index, AData);
|
||||
|
||||
if lSelected then
|
||||
begin
|
||||
if (FFlagSetSelected = 0) or (SendMessage(FWin32List, FFlagSetSelected, Windows.WParam(true), lItemIndex) = -1) then
|
||||
SendMessage(FWin32List, FFlagSetItemIndex, lItemIndex, 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
||||
@ -1186,7 +1186,8 @@ begin
|
||||
|
||||
FullScanLine := Win32Platform = VER_PLATFORM_WIN32_WINDOWS;
|
||||
if FullScanLine
|
||||
then ScanLine := GetMem(AWinBmp.bmWidthBytes);
|
||||
then ScanLine := GetMem(AWinBmp.bmWidthBytes)
|
||||
else ScanLine := nil;
|
||||
|
||||
FillChar(Info.Header, sizeof(Windows.TBitmapInfoHeader), 0);
|
||||
Info.Header.biSize := sizeof(Windows.TBitmapInfoHeader);
|
||||
|
||||
@ -1560,6 +1560,7 @@ const
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
// ToDo: Fix Result and the loop. "I" is not used for anything.
|
||||
for I := 0 to FrameWidth - 1 do
|
||||
Result := Boolean(DrawEdge(DC, ARect, Edge[Style], BF_RECT or BF_ADJUST));
|
||||
end;
|
||||
@ -1944,8 +1945,10 @@ begin
|
||||
lpmi^.dwFlags := LocalInfo.dwFlags;
|
||||
PMonitorInfoEx(lpmi)^.szDevice := UTF16ToUTF8(LocalInfo.szDevice);
|
||||
end
|
||||
else
|
||||
else begin
|
||||
PMonitorInfoEx(lpmi)^.szDevice := AnsiToUtf8(PMonitorInfoEx(lpmi)^.szDevice);
|
||||
Result := True;
|
||||
end;
|
||||
end
|
||||
else
|
||||
{$ENDIF}
|
||||
@ -3634,6 +3637,7 @@ begin
|
||||
// check if the Src has an alpha channel
|
||||
Bmp := Windows.GetCurrentObject(SrcDC, OBJ_BITMAP);
|
||||
// get info
|
||||
// ToDo: WinBmp is not initialized at all. Should it be initialized from Bmp?
|
||||
HasAlpha := (Windows.GetObject(bmp, SizeOf(WinBmp), @WinBmp) <> 0)
|
||||
and (WinBmp.bmBitsPixel = 32)
|
||||
and CreatePremultipliedBitmap(WinBmp, Bmp, AlphaBmp);
|
||||
@ -3648,6 +3652,9 @@ begin
|
||||
Blend.BlendFlags := 0;
|
||||
Blend.SourceConstantAlpha := 255;
|
||||
Blend.AlphaFormat := AC_SRC_ALPHA;
|
||||
end
|
||||
else begin
|
||||
// ToDo: Initialize AlphaDC, AlphaObj and Blend.
|
||||
end;
|
||||
|
||||
Windows.SetBrushOrgEx(DestDC, 0, 0, nil);
|
||||
|
||||
@ -295,6 +295,7 @@ var
|
||||
EndBufferedPaint(PaintBuffer, True);
|
||||
NewBitmap := SelectObject(hdcNewBitmap, OldBitmapHandle);
|
||||
end;
|
||||
|
||||
var
|
||||
RGBA: PRGBAQuad;
|
||||
AlphaDraw: Boolean;
|
||||
@ -321,6 +322,8 @@ begin
|
||||
srcWidth := 0;
|
||||
srcHeight := 0;
|
||||
end;
|
||||
newWidth := 0;
|
||||
newHeight := 0;
|
||||
BitBtnLayout := BidiAdjustButtonLayout(BitBtn.UseRightToLeftReading, BitBtn.Layout);
|
||||
BitBtnDC := GetDC(BitBtnHandle);
|
||||
hdcNewBitmap := CreateCompatibleDC(BitBtnDC);
|
||||
|
||||
@ -440,7 +440,9 @@ begin
|
||||
// does the job very well too.
|
||||
// Note: this may produce trouble with embedded controls (e.g. progress bars).
|
||||
if WParam <> 0 then
|
||||
Result := CallDefaultWindowProc(Window, Msg, WParam, LParam) or WVR_REDRAW;
|
||||
Result := CallDefaultWindowProc(Window, Msg, WParam, LParam) or WVR_REDRAW
|
||||
else
|
||||
Result := 1;
|
||||
end;
|
||||
WM_ERASEBKGND:
|
||||
begin
|
||||
@ -904,7 +906,7 @@ begin
|
||||
TBCD_CHANNEL:
|
||||
begin
|
||||
// Retrieve the bounding box for the thumb.
|
||||
SendMessage(AWinControl.Handle, TBM_GETTHUMBRECT, 0, Integer(@R));
|
||||
SendMessage(AWinControl.Handle, TBM_GETTHUMBRECT, 0, PtrInt(@R));
|
||||
// Extend this rectangle to the top/bottom or left/right border, respectively.
|
||||
Offset := 0;
|
||||
if TCustomTrackBar(Control).Orientation = trHorizontal then
|
||||
|
||||
@ -530,7 +530,9 @@ var
|
||||
B: Boolean;
|
||||
begin
|
||||
if ALV.CheckBoxes then
|
||||
B := AItem.Checked;
|
||||
B := AItem.Checked
|
||||
else
|
||||
B := False;
|
||||
ItemSetText(ALV, AIndex, AItem, 0, AItem.Caption);
|
||||
for i := 0 to AItem.SubItems.Count - 1 do
|
||||
ItemSetText(ALV, AIndex, AItem, i + 1, AItem.SubItems[i]);
|
||||
|
||||
@ -502,7 +502,7 @@ function OpenFileDialogCallBack(Wnd: HWND; uMsg: UINT; wParam: WPARAM;
|
||||
var
|
||||
OpenFileNotify: LPOFNOTIFY;
|
||||
OpenFileName: Windows.POPENFILENAME;
|
||||
DialogRec: POpenFileDialogRec;
|
||||
DlgRec: POpenFileDialogRec;
|
||||
|
||||
procedure Reposition(ADialogWnd: Handle);
|
||||
var
|
||||
@ -533,10 +533,11 @@ var
|
||||
procedure ExtractDataFromNotify;
|
||||
begin
|
||||
OpenFileName := OpenFileNotify^.lpOFN;
|
||||
DialogRec := POpenFileDialogRec(OpenFileName^.lCustData);
|
||||
DlgRec := POpenFileDialogRec(OpenFileName^.lCustData);
|
||||
UpdateStorage(Wnd, OpenFileName);
|
||||
UpdateFileProperties(OpenFileName);
|
||||
end;
|
||||
|
||||
begin
|
||||
Result := 0;
|
||||
if uMsg = WM_INITDIALOG then
|
||||
@ -556,24 +557,24 @@ begin
|
||||
CDN_INITDONE:
|
||||
begin
|
||||
ExtractDataFromNotify;
|
||||
TOpenDialog(DialogRec^.Dialog).DoShow;
|
||||
TOpenDialog(DlgRec^.Dialog).DoShow;
|
||||
end;
|
||||
CDN_SELCHANGE:
|
||||
begin
|
||||
ExtractDataFromNotify;
|
||||
TOpenDialog(DialogRec^.Dialog).DoSelectionChange;
|
||||
TOpenDialog(DlgRec^.Dialog).DoSelectionChange;
|
||||
end;
|
||||
CDN_FOLDERCHANGE:
|
||||
begin
|
||||
ExtractDataFromNotify;
|
||||
TOpenDialog(DialogRec^.Dialog).DoFolderChange;
|
||||
TOpenDialog(DlgRec^.Dialog).DoFolderChange;
|
||||
end;
|
||||
CDN_FILEOK:
|
||||
ExtractDataFromNotify;
|
||||
CDN_TYPECHANGE:
|
||||
begin
|
||||
ExtractDataFromNotify;
|
||||
DialogRec^.Dialog.IntfFileTypeChanged(OpenFileNotify^.lpOFN^.nFilterIndex);
|
||||
DlgRec^.Dialog.IntfFileTypeChanged(OpenFileNotify^.lpOFN^.nFilterIndex);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -979,7 +980,9 @@ begin
|
||||
Dialog._AddRef;
|
||||
SetupVistaFileDialog(Dialog, TOpenDialog(ACommonDialog));
|
||||
Result := THandle(Dialog);
|
||||
end;
|
||||
end
|
||||
else
|
||||
Result := INVALID_HANDLE_VALUE;
|
||||
end
|
||||
else
|
||||
{$endif}
|
||||
@ -1062,12 +1065,15 @@ begin
|
||||
if CanUseVistaDialogs(TOpenDialog(ACommonDialog)) then
|
||||
//if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
||||
begin
|
||||
if Succeeded(CoCreateInstance(CLSID_FileSaveDialog, nil, CLSCTX_INPROC_SERVER, IFileSaveDialog, Dialog)) and Assigned(Dialog) then
|
||||
if Succeeded(CoCreateInstance(CLSID_FileSaveDialog, nil, CLSCTX_INPROC_SERVER, IFileSaveDialog, Dialog))
|
||||
and Assigned(Dialog) then
|
||||
begin
|
||||
Dialog._AddRef;
|
||||
TWin32WSOpenDialog.SetupVistaFileDialog(Dialog, TOpenDialog(ACommonDialog));
|
||||
Result := THandle(Dialog);
|
||||
end;
|
||||
end
|
||||
else
|
||||
Result := INVALID_HANDLE_VALUE;
|
||||
end
|
||||
else
|
||||
{$endif}
|
||||
@ -1327,8 +1333,8 @@ var
|
||||
{$endif}
|
||||
DirName: string;
|
||||
begin
|
||||
DirName := '';
|
||||
InitialDir := TSelectDirectoryDialog(ACommonDialog).FileName;
|
||||
|
||||
Options := TSelectDirectoryDialog(ACommonDialog).Options;
|
||||
|
||||
if length(InitialDir)=0 then
|
||||
|
||||
@ -873,7 +873,8 @@ function IsFlatMenus: Boolean; inline;
|
||||
var
|
||||
IsFlatMenu: Windows.BOOL;
|
||||
begin
|
||||
Result := (WindowsVersion >= wvXP) and ((SystemParametersInfo(SPI_GETFLATMENU, 0, @IsFlatMenu, 0)) and IsFlatMenu);
|
||||
Result := (WindowsVersion >= wvXP) and
|
||||
(SystemParametersInfo(SPI_GETFLATMENU, 0, @IsFlatMenu, 0) and IsFlatMenu);
|
||||
end;
|
||||
|
||||
function BackgroundColorMenu(const ItemState: UINT; const aIsInMenuBar: boolean): COLORREF;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user