mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 11:36:02 +02:00
Carbon intf: Applied #0009905: Some entries in the Carbon CursorToThemeCursor array were wrong, and a fix is suggested from James Chandler Jr. (added to Contributors.txt)
- implemented #0009889: Carbon TSaveDialog ignores InitialDir - fixed #0009888: Carbon: impossible to have menus with Modal forms git-svn-id: trunk@12409 -
This commit is contained in:
parent
cf3d81df7b
commit
0b9b60dd65
@ -41,6 +41,7 @@ Grzegorz Zakrzewski
|
|||||||
Hans-Joachim Ott
|
Hans-Joachim Ott
|
||||||
Hwang Weng Sun
|
Hwang Weng Sun
|
||||||
Ido Kanner
|
Ido Kanner
|
||||||
|
James Chandler Jr.
|
||||||
Jan Foster
|
Jan Foster
|
||||||
Jason King
|
Jason King
|
||||||
Jeffrey A. Wormsley
|
Jeffrey A. Wormsley
|
||||||
|
@ -197,14 +197,14 @@ const
|
|||||||
kThemeUndefCursor = ThemeCursor(-1); // undefined mac theme cursor
|
kThemeUndefCursor = ThemeCursor(-1); // undefined mac theme cursor
|
||||||
|
|
||||||
CursorToThemeCursor: array[crLow..crHigh] of ThemeCursor =
|
CursorToThemeCursor: array[crLow..crHigh] of ThemeCursor =
|
||||||
({crSizeSE } kThemeResizeLeftCursor, {!!}
|
({crSizeSE } kThemeResizeRightCursor, {!!}
|
||||||
{crSizeS } kThemeResizeDownCursor,
|
{crSizeS } kThemeResizeDownCursor,
|
||||||
{crSizeSW } kThemeResizeRightCursor, {!!}
|
{crSizeSW } kThemeResizeLeftCursor, {!!}
|
||||||
{crSizeE } kThemeResizeLeftCursor,
|
{crSizeE } kThemeResizeRightCursor,
|
||||||
{crSizeW } kThemeResizeRightCursor,
|
{crSizeW } kThemeResizeLeftCursor,
|
||||||
{crSizeNE } kThemeResizeLeftCursor, {!!}
|
{crSizeNE } kThemeResizeRightCursor, {!!}
|
||||||
{crSizeN } kThemeResizeUpCursor,
|
{crSizeN } kThemeResizeUpCursor,
|
||||||
{crSizeNW } kThemeResizeRightCursor, {!!}
|
{crSizeNW } kThemeResizeLeftCursor, {!!}
|
||||||
{crSizeAll } kThemeUndefCursor, // will be loaded from resource
|
{crSizeAll } kThemeUndefCursor, // will be loaded from resource
|
||||||
{crHandPoint } kThemePointingHandCursor,
|
{crHandPoint } kThemePointingHandCursor,
|
||||||
{crHelp } kThemeUndefCursor, // will be loaded from resource
|
{crHelp } kThemeUndefCursor, // will be loaded from resource
|
||||||
@ -220,7 +220,7 @@ const
|
|||||||
{crUpArrow } kThemeUndefCursor, // will be loaded from resource
|
{crUpArrow } kThemeUndefCursor, // will be loaded from resource
|
||||||
{crSizeWE } kThemeResizeLeftRightCursor,
|
{crSizeWE } kThemeResizeLeftRightCursor,
|
||||||
{crSizeNWSE } kThemeResizeLeftRightCursor, {!!}
|
{crSizeNWSE } kThemeResizeLeftRightCursor, {!!}
|
||||||
{crSizeNS } kThemeResizeLeftRightCursor, {!!}
|
{crSizeNS } kThemeResizeUpDownCursor, {!!}
|
||||||
{crSizeNESW } kThemeResizeLeftRightCursor, {!!}
|
{crSizeNESW } kThemeResizeLeftRightCursor, {!!}
|
||||||
{undefined } kThemeArrowCursor, {!!}
|
{undefined } kThemeArrowCursor, {!!}
|
||||||
{crIBeam } kThemeIBeamCursor,
|
{crIBeam } kThemeIBeamCursor,
|
||||||
|
@ -112,6 +112,7 @@ type
|
|||||||
public
|
public
|
||||||
procedure SetMainMenuEnabled(AEnabled: Boolean);
|
procedure SetMainMenuEnabled(AEnabled: Boolean);
|
||||||
procedure SetRootMenu(const AMenu: TMainMenu);
|
procedure SetRootMenu(const AMenu: TMainMenu);
|
||||||
|
property MainMenu: TMainMenu read FMainMenu;
|
||||||
public
|
public
|
||||||
procedure SetCaptureWidget(const AWidget: HWND);
|
procedure SetCaptureWidget(const AWidget: HWND);
|
||||||
end;
|
end;
|
||||||
|
@ -1401,8 +1401,9 @@ begin
|
|||||||
SetWindowModality(WindowRef(Widget), kWindowModalityAppModal, nil),
|
SetWindowModality(WindowRef(Widget), kWindowModalityAppModal, nil),
|
||||||
Self, 'ShowModal', SSetModality);
|
Self, 'ShowModal', SSetModality);
|
||||||
|
|
||||||
CarbonWidgetSet.SetMainMenuEnabled(False);
|
|
||||||
SelectWindow(WindowRef(Widget));
|
SelectWindow(WindowRef(Widget));
|
||||||
|
if CarbonWidgetSet.MainMenu <> (LCLObject as TCustomForm).Menu then
|
||||||
|
CarbonWidgetSet.SetMainMenuEnabled(False);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
@ -171,6 +171,46 @@ begin
|
|||||||
//DebugLn('FilterCallback ' + DbgS(FilterMask) + ' ' + ExtractFilename(FilePath) + ' ' + DbgS(Result));
|
//DebugLn('FilterCallback ' + DbgS(FilterMask) + ' ' + ExtractFilename(FilePath) + ' ' + DbgS(Result));
|
||||||
end; {FilterCallback}
|
end; {FilterCallback}
|
||||||
|
|
||||||
|
procedure NavDialogCallback(CallBackSelector: NavEventCallbackMessage;
|
||||||
|
CallBackParms: NavCBRecPtr; CallBackUD: UnivPtr); stdcall;
|
||||||
|
var
|
||||||
|
Dir: AEDesc;
|
||||||
|
DirRef: FSRef;
|
||||||
|
DirURL: CFURLRef;
|
||||||
|
DirCFStr: CFStringRef;
|
||||||
|
const
|
||||||
|
SName = 'NavDialogCallback';
|
||||||
|
begin
|
||||||
|
//DebugLn('NavDialogCallback ' + DbgS(CallbackUD));
|
||||||
|
if CallbackUD = nil then // No user data passed?
|
||||||
|
Exit;
|
||||||
|
|
||||||
|
case CallBackSelector of
|
||||||
|
kNavCBStart:
|
||||||
|
begin
|
||||||
|
// Set InitialDir
|
||||||
|
if DirectoryExists(TFileDialog(CallbackUD).InitialDir) then
|
||||||
|
begin
|
||||||
|
//DebugLn('Set InitialDir ' + TFileDialog(CallbackUD).InitialDir);
|
||||||
|
CreateCFString(TFileDialog(CallbackUD).InitialDir, DirCFStr);
|
||||||
|
try
|
||||||
|
DirURL := CFURLCreateWithFileSystemPath(nil, DirCFStr,
|
||||||
|
kCFURLPOSIXPathStyle, True);
|
||||||
|
finally
|
||||||
|
FreeCFString(DirCFStr);
|
||||||
|
end;
|
||||||
|
|
||||||
|
if DirURL <> nil then
|
||||||
|
if CFURLGetFSRef(DirURL, DirRef) then
|
||||||
|
if not OSError(AECreateDesc(typeFSRef, @DirRef, SizeOf(FSRef), Dir),
|
||||||
|
SName, 'AECreateDesc') then
|
||||||
|
OSError(NavCustomControl(CallBackParms^.context, kNavCtlSetLocation, @Dir),
|
||||||
|
SName, 'NavCustomControl');
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TCarbonWSFileDialog.ShowModal
|
Method: TCarbonWSFileDialog.ShowModal
|
||||||
@ -184,12 +224,12 @@ end; {FilterCallback}
|
|||||||
class procedure TCarbonWSFileDialog.ShowModal(const ACommonDialog: TCommonDialog);
|
class procedure TCarbonWSFileDialog.ShowModal(const ACommonDialog: TCommonDialog);
|
||||||
{
|
{
|
||||||
Called by Execute method of TOpenDialog, TSaveDialog and TSelectDirectoryDialog.
|
Called by Execute method of TOpenDialog, TSaveDialog and TSelectDirectoryDialog.
|
||||||
TODO: Figure out how to use dialog's InitialDir property.
|
|
||||||
}
|
}
|
||||||
var
|
var
|
||||||
FileDialog: TFileDialog;
|
FileDialog: TFileDialog;
|
||||||
CreationOptions: NavDialogCreationOptions;
|
CreationOptions: NavDialogCreationOptions;
|
||||||
FilterUPP: NavObjectFilterUPP;
|
FilterUPP: NavObjectFilterUPP;
|
||||||
|
NavDialogUPP: NavEventUPP;
|
||||||
DialogRef: NavDialogRef;
|
DialogRef: NavDialogRef;
|
||||||
DialogReply: NavReplyRecord;
|
DialogReply: NavReplyRecord;
|
||||||
FileCount: Integer;
|
FileCount: Integer;
|
||||||
@ -218,6 +258,7 @@ begin
|
|||||||
FileDialog.UserChoice := mrCancel; // Return this if user cancels or we need to exit
|
FileDialog.UserChoice := mrCancel; // Return this if user cancels or we need to exit
|
||||||
|
|
||||||
FilterUPP := NewNavObjectFilterUPP(NavObjectFilterProcPtr(@FilterCallback));
|
FilterUPP := NewNavObjectFilterUPP(NavObjectFilterProcPtr(@FilterCallback));
|
||||||
|
NavDialogUPP := NewNavEventUPP(NavEventProcPtr(@NavDialogCallback));
|
||||||
|
|
||||||
// user cannot pick individual filter -> use all
|
// user cannot pick individual filter -> use all
|
||||||
Filters := TParseStringList.Create(FileDialog.Filter, '|');
|
Filters := TParseStringList.Create(FileDialog.Filter, '|');
|
||||||
@ -249,14 +290,14 @@ begin
|
|||||||
|
|
||||||
// Create Save dialog
|
// Create Save dialog
|
||||||
if OSError(
|
if OSError(
|
||||||
NavCreatePutFileDialog(@CreationOptions, 0, 0, nil, nil, DialogRef),
|
NavCreatePutFileDialog(@CreationOptions, 0, 0, NavDialogUPP, nil, DialogRef),
|
||||||
Self, SShowModal, 'NavCreatePutFileDialog') then Exit;
|
Self, SShowModal, 'NavCreatePutFileDialog') then Exit;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if FileDialog is TSelectDirectoryDialog then // Create Choose folder dialog
|
if FileDialog is TSelectDirectoryDialog then // Create Choose folder dialog
|
||||||
begin
|
begin
|
||||||
if OSError(
|
if OSError(
|
||||||
NavCreateChooseFolderDialog(@CreationOptions, nil,
|
NavCreateChooseFolderDialog(@CreationOptions, NavDialogUPP,
|
||||||
FilterUPP, UnivPtr(FileDialog), DialogRef),
|
FilterUPP, UnivPtr(FileDialog), DialogRef),
|
||||||
Self, SShowModal, 'NavCreateChooseFolderDialog') then Exit;
|
Self, SShowModal, 'NavCreateChooseFolderDialog') then Exit;
|
||||||
end
|
end
|
||||||
@ -272,7 +313,7 @@ begin
|
|||||||
|
|
||||||
// Create Open dialog
|
// Create Open dialog
|
||||||
if OSError(
|
if OSError(
|
||||||
NavCreateGetFileDialog(@CreationOptions, nil, nil, nil,
|
NavCreateGetFileDialog(@CreationOptions, nil, NavDialogUPP, nil,
|
||||||
FilterUPP, UnivPtr(FileDialog), DialogRef),
|
FilterUPP, UnivPtr(FileDialog), DialogRef),
|
||||||
Self, SShowModal, 'NavCreateGetFileDialog') then Exit;
|
Self, SShowModal, 'NavCreateGetFileDialog') then Exit;
|
||||||
end;
|
end;
|
||||||
@ -338,6 +379,7 @@ begin
|
|||||||
finally
|
finally
|
||||||
FreeAndNil(FilterMask);
|
FreeAndNil(FilterMask);
|
||||||
DisposeNavObjectFilterUPP(FilterUPP);
|
DisposeNavObjectFilterUPP(FilterUPP);
|
||||||
|
DisposeNavEventUPP(NavDialogUPP);
|
||||||
FreeCFString(CreationOptions.windowTitle);
|
FreeCFString(CreationOptions.windowTitle);
|
||||||
FreeCFString(CreationOptions.saveFileName);
|
FreeCFString(CreationOptions.saveFileName);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user