mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-12 23:59:59 +02:00
Win32: Remove the use of IfDef's for UseVistaDialogs. It has been defined for over 4 years now, without a mechanisme to undefine it.
git-svn-id: trunk@50522 -
This commit is contained in:
parent
c76c07b037
commit
0ef4cb9fff
@ -21,8 +21,4 @@
|
||||
// valuable for investigation of message trees / interrelations
|
||||
{ $define MSG_DEBUG}
|
||||
|
||||
{$IFNDEF DisableUseVistaDialogs}
|
||||
//please keep this settings because of issue #29105
|
||||
{$DEFINE UseVistaDialogs}
|
||||
{$ENDIF}
|
||||
{.$DEFINE RedirectDestroyMessages}
|
||||
|
@ -247,7 +247,6 @@ type
|
||||
PROPERTYKEY = _tagpropertykey;
|
||||
REFPROPERTYKEY = ^PROPERTYKEY;
|
||||
REFPROPVARIANT = ^TPROPVARIANT;
|
||||
{$ifdef UseVistaDialogs}
|
||||
IEnumShellItems = interface(IUnknown)
|
||||
['{70629033-e363-4a28-a567-0db78006e6d7}']
|
||||
function Next(celt: ULONG; out rgelt: IShellItem; var pceltFetched: ULONG): HResult; stdcall;
|
||||
@ -355,7 +354,6 @@ type
|
||||
function GetProperties(var ppStore: IPropertyStore): HResult; stdcall;
|
||||
function ApplyProperties(psi: IShellItem; pStore: IPropertyStore; hwnd: HWND; pSink: IFileOperationProgressSink): HResult; stdcall;
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
// AlphaBlend is only defined for win98&2k and up
|
||||
// load dynamic and use ownfunction if not defined
|
||||
|
@ -71,13 +71,11 @@ type
|
||||
|
||||
TWin32WSOpenDialog = class(TWSOpenDialog)
|
||||
public
|
||||
{$ifdef UseVistaDialogs}
|
||||
class procedure SetupVistaFileDialog(ADialog: IFileDialog; const AOpenDialog: TOpenDialog);
|
||||
class function ProcessVistaDialogResult(ADialog: IFileDialog; const AOpenDialog: TOpenDialog): HResult;
|
||||
class procedure VistaDialogShowModal(ADialog: IFileDialog; const AOpenDialog: TOpenDialog);
|
||||
class function GetFileName(ShellItem: IShellItem): String;
|
||||
class function GetParentWnd: HWND;
|
||||
{$endif}
|
||||
published
|
||||
class function CreateHandle(const ACommonDialog: TCommonDialog): THandle; override;
|
||||
class procedure DestroyHandle(const ACommonDialog: TCommonDialog); override;
|
||||
@ -122,7 +120,6 @@ type
|
||||
class function CreateHandle(const ACommonDialog: TCommonDialog): THandle; override;
|
||||
end;
|
||||
|
||||
{$ifdef UseVistaDialogs}
|
||||
|
||||
{ TFileDialogEvents }
|
||||
|
||||
@ -146,7 +143,6 @@ type
|
||||
public
|
||||
constructor Create(ADialog: TOpenDialog);
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
function OpenFileDialogCallBack(Wnd: HWND; uMsg: UINT; wParam: WPARAM;
|
||||
lParam: LPARAM): UINT_PTR; stdcall;
|
||||
@ -156,9 +152,7 @@ procedure RestoreApplicationState(AState: TApplicationState);
|
||||
function UTF8StringToPWideChar(const s: string) : PWideChar;
|
||||
function UTF8StringToPAnsiChar(const s: string) : PAnsiChar;
|
||||
|
||||
{$ifdef UseVistaDialogs}
|
||||
function CanUseVistaDialogs(const AOpenDialog: TOpenDialog): Boolean;
|
||||
{$endif}
|
||||
|
||||
var
|
||||
cOpenDialogAllFiles: string = 'All files';
|
||||
@ -337,12 +331,10 @@ begin
|
||||
ACommonDialog.UserChoice := mrCancel;
|
||||
end;
|
||||
|
||||
{$ifdef UseVistaDialogs}
|
||||
function CanUseVistaDialogs(const AOpenDialog: TOpenDialog): Boolean;
|
||||
begin
|
||||
Result := (WindowsVersion >= wvVista) and not (ofOldStyleDialog in AOpenDialog.Options);
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
{ TWin32WSColorDialog }
|
||||
|
||||
@ -737,7 +729,6 @@ begin
|
||||
end;
|
||||
|
||||
{ TWin32WSOpenDialog }
|
||||
{$ifdef UseVistaDialogs}
|
||||
|
||||
|
||||
class procedure TWin32WSOpenDialog.SetupVistaFileDialog(ADialog: IFileDialog; const AOpenDialog: TOpenDialog);
|
||||
@ -931,15 +922,11 @@ begin
|
||||
else
|
||||
Result := WidgetSet.AppHandle;
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
class function TWin32WSOpenDialog.CreateHandle(const ACommonDialog: TCommonDialog): THandle;
|
||||
{$ifdef UseVistaDialogs}
|
||||
var
|
||||
Dialog: IFileOpenDialog;
|
||||
{$endif}
|
||||
begin
|
||||
{$ifdef UseVistaDialogs}
|
||||
if CanUseVistaDialogs(TOpenDialog(ACommonDialog)) then
|
||||
//if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
||||
begin
|
||||
@ -953,18 +940,14 @@ begin
|
||||
Result := INVALID_HANDLE_VALUE;
|
||||
end
|
||||
else
|
||||
{$endif}
|
||||
Result := CreateFileDialogHandle(TOpenDialog(ACommonDialog));
|
||||
end;
|
||||
|
||||
class procedure TWin32WSOpenDialog.DestroyHandle(const ACommonDialog: TCommonDialog);
|
||||
{$ifdef UseVistaDialogs}
|
||||
var
|
||||
Dialog: IFileDialog;
|
||||
{$endif}
|
||||
begin
|
||||
if ACommonDialog.Handle <> 0 then
|
||||
{$ifdef UseVistaDialogs}
|
||||
if CanUseVistaDialogs(TOpenDialog(ACommonDialog)) then
|
||||
//if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
||||
begin
|
||||
@ -973,7 +956,6 @@ begin
|
||||
Dialog := nil;
|
||||
end
|
||||
else
|
||||
{$endif}
|
||||
DestroyFileDialogHandle(ACommonDialog.Handle)
|
||||
end;
|
||||
|
||||
@ -981,9 +963,7 @@ class procedure TWin32WSOpenDialog.ShowModal(const ACommonDialog: TCommonDialog)
|
||||
var
|
||||
State: TApplicationState;
|
||||
lOldWorkingDir, lInitialDir: string;
|
||||
{$ifdef UseVistaDialogs}
|
||||
Dialog: IFileOpenDialog;
|
||||
{$endif}
|
||||
begin
|
||||
if ACommonDialog.Handle <> 0 then
|
||||
begin
|
||||
@ -992,7 +972,6 @@ begin
|
||||
try
|
||||
lInitialDir := TOpenDialog(ACommonDialog).InitialDir;
|
||||
if lInitialDir <> '' then SetCurrentDirUTF8(lInitialDir);
|
||||
{$ifdef UseVistaDialogs}
|
||||
if CanUseVistaDialogs(TOpenDialog(ACommonDialog)) then
|
||||
//if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
||||
begin
|
||||
@ -1000,7 +979,6 @@ begin
|
||||
VistaDialogShowModal(Dialog, TOpenDialog(ACommonDialog));
|
||||
end
|
||||
else
|
||||
{$endif}
|
||||
begin
|
||||
if UnicodeEnabledOS then
|
||||
ProcessFileDialogResult(TOpenDialog(ACommonDialog),
|
||||
@ -1019,12 +997,9 @@ end;
|
||||
{ TWin32WSSaveDialog }
|
||||
|
||||
class function TWin32WSSaveDialog.CreateHandle(const ACommonDialog: TCommonDialog): THandle;
|
||||
{$ifdef UseVistaDialogs}
|
||||
var
|
||||
Dialog: IFileSaveDialog;
|
||||
{$endif}
|
||||
begin
|
||||
{$ifdef UseVistaDialogs}
|
||||
if CanUseVistaDialogs(TOpenDialog(ACommonDialog)) then
|
||||
//if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
||||
begin
|
||||
@ -1039,18 +1014,14 @@ begin
|
||||
Result := INVALID_HANDLE_VALUE;
|
||||
end
|
||||
else
|
||||
{$endif}
|
||||
Result := CreateFileDialogHandle(TOpenDialog(ACommonDialog));
|
||||
end;
|
||||
|
||||
class procedure TWin32WSSaveDialog.DestroyHandle(const ACommonDialog: TCommonDialog);
|
||||
{$ifdef UseVistaDialogs}
|
||||
var
|
||||
Dialog: IFileDialog;
|
||||
{$endif}
|
||||
begin
|
||||
if ACommonDialog.Handle <> 0 then
|
||||
{$ifdef UseVistaDialogs}
|
||||
if CanUseVistaDialogs(TOpenDialog(ACommonDialog)) then
|
||||
//if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
||||
begin
|
||||
@ -1059,7 +1030,6 @@ begin
|
||||
Dialog := nil;
|
||||
end
|
||||
else
|
||||
{$endif}
|
||||
DestroyFileDialogHandle(ACommonDialog.Handle)
|
||||
end;
|
||||
|
||||
@ -1067,9 +1037,7 @@ class procedure TWin32WSSaveDialog.ShowModal(const ACommonDialog: TCommonDialog)
|
||||
var
|
||||
State: TApplicationState;
|
||||
lOldWorkingDir, lInitialDir: string;
|
||||
{$ifdef UseVistaDialogs}
|
||||
Dialog: IFileSaveDialog;
|
||||
{$endif}
|
||||
begin
|
||||
if ACommonDialog.Handle <> 0 then
|
||||
begin
|
||||
@ -1078,7 +1046,6 @@ begin
|
||||
try
|
||||
lInitialDir := TSaveDialog(ACommonDialog).InitialDir;
|
||||
if lInitialDir <> '' then SetCurrentDirUTF8(lInitialDir);
|
||||
{$ifdef UseVistaDialogs}
|
||||
if CanUseVistaDialogs(TOpenDialog(ACommonDialog)) then
|
||||
//if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
||||
begin
|
||||
@ -1086,7 +1053,6 @@ begin
|
||||
TWin32WSOpenDialog.VistaDialogShowModal(Dialog, TOpenDialog(ACommonDialog));
|
||||
end
|
||||
else
|
||||
{$endif}
|
||||
begin
|
||||
if UnicodeEnabledOS then
|
||||
ProcessFileDialogResult(TOpenDialog(ACommonDialog),
|
||||
@ -1338,7 +1304,6 @@ begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
{$ifdef UseVistaDialogs}
|
||||
{ TFileDialogEvents }
|
||||
|
||||
function TFileDialogEvents.OnFileOk(pfd: IFileDialog): HResult; stdcall;
|
||||
@ -1439,7 +1404,6 @@ begin
|
||||
inherited Create;
|
||||
FDialog := ADialog;
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
initialization
|
||||
if (Win32MajorVersion = 4) then
|
||||
|
@ -161,14 +161,11 @@ end;
|
||||
{ TWin32WSOpenPictureDialog }
|
||||
|
||||
class function TWin32WSOpenPictureDialog.CreateHandle(const ACommonDialog: TCommonDialog): THandle;
|
||||
{$ifdef UseVistaDialogs}
|
||||
var
|
||||
Dialog: IFileOpenDialog;
|
||||
fos: FILEOPENDIALOGOPTIONS;
|
||||
{$endif}
|
||||
begin
|
||||
Result := inherited CreateHandle(ACommonDialog);
|
||||
{$ifdef UseVistaDialogs}
|
||||
//if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
||||
if CanUseVistaDialogs(TOpenDialog(ACommonDialog)) then
|
||||
begin
|
||||
@ -180,7 +177,6 @@ begin
|
||||
end;
|
||||
end
|
||||
else
|
||||
{$endif}
|
||||
AddPreviewControl(ACommonDialog, LPOPENFILENAME(Result));
|
||||
end;
|
||||
|
||||
@ -208,14 +204,11 @@ end;
|
||||
|
||||
class function TWin32WSSavePictureDialog.CreateHandle(
|
||||
const ACommonDialog: TCommonDialog): THandle;
|
||||
{$ifdef UseVistaDialogs}
|
||||
var
|
||||
Dialog: IFileSaveDialog;
|
||||
fos: FILEOPENDIALOGOPTIONS;
|
||||
{$endif}
|
||||
begin
|
||||
Result := inherited CreateHandle(ACommonDialog);
|
||||
{$ifdef UseVistaDialogs}
|
||||
//if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
||||
if CanUseVistaDialogs(TOpenDialog(ACommonDialog)) then
|
||||
begin
|
||||
@ -227,7 +220,6 @@ begin
|
||||
end;
|
||||
end
|
||||
else
|
||||
{$endif}
|
||||
AddPreviewControl(ACommonDialog, LPOPENFILENAME(Result));
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user