mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
FIX: the issue of attaching/deattaching image edit toolbar on macOS
This commit is contained in:
parent
015e8f3ff5
commit
b7ea4cdf03
1 changed files with 34 additions and 13 deletions
|
|
@ -59,6 +59,21 @@ begin
|
|||
Result:= TfrmViewer(form);
|
||||
end;
|
||||
|
||||
function isImageToolBarAttached( const form: TCustomForm ): Boolean;
|
||||
var
|
||||
toolBar: NSToolBar;
|
||||
index: Integer;
|
||||
begin
|
||||
Result:= False;
|
||||
|
||||
toolBar:= TCocoaToolBarUtils.getToolBar( form );
|
||||
if toolBar = nil then
|
||||
Exit;
|
||||
|
||||
index:= TCocoaToolBarUtils.findItemIndexByIdentifier( toolBar, viewerImageItemsIdentifiers[0] );
|
||||
Result:= (index>=0);
|
||||
end;
|
||||
|
||||
procedure viewerAttachImageToolBar( const form: TCustomForm );
|
||||
var
|
||||
toolBar: NSToolBar;
|
||||
|
|
@ -68,7 +83,7 @@ begin
|
|||
if toolBar = nil then
|
||||
Exit;
|
||||
|
||||
if TCocoaToolBarUtils.findItemIndexByIdentifier(toolBar,viewerImageItemsIdentifiers[0]) > 0 then
|
||||
if isImageToolBarAttached(form) then
|
||||
Exit;
|
||||
|
||||
for i:= 0 to Length(viewerImageItemsIdentifiers)-1 do
|
||||
|
|
@ -882,11 +897,13 @@ var
|
|||
end;
|
||||
|
||||
begin
|
||||
viewerAttachImageToolBar( viewer );
|
||||
toolBar:= TCocoaToolBarUtils.getToolBar( viewer );
|
||||
if toolBar = nil then
|
||||
Exit;
|
||||
|
||||
if NOT isImageToolBarAttached(viewer) then
|
||||
Exit;
|
||||
|
||||
updateHighlightState;
|
||||
updatePaintState;
|
||||
end;
|
||||
|
|
@ -899,18 +916,22 @@ var
|
|||
image: NSImage;
|
||||
begin
|
||||
form:= getCurrentViewerForm;
|
||||
if Assigned(form) then begin
|
||||
if form.btnSlideShow.Down then
|
||||
imageName:= 'pause'
|
||||
else
|
||||
imageName:= 'play';
|
||||
image:= NSImage.imageWithSystemSymbolName_accessibilityDescription(
|
||||
StringToNSString(imageName), nil );
|
||||
item:= TCocoaToolBarUtils.findItemByIdentifier( form, 'ViewerForm.Slide' );
|
||||
item.setImage( image );
|
||||
if NOT Assigned(form) then
|
||||
Exit;
|
||||
|
||||
form.TimerViewer.Enabled:= form.btnSlideShow.Down;
|
||||
end;
|
||||
item:= TCocoaToolBarUtils.findItemByIdentifier( form, 'ViewerForm.Slide' );
|
||||
if item = nil then
|
||||
Exit;
|
||||
|
||||
if form.btnSlideShow.Down then
|
||||
imageName:= 'pause'
|
||||
else
|
||||
imageName:= 'play';
|
||||
image:= NSImage.imageWithSystemSymbolName_accessibilityDescription(
|
||||
StringToNSString(imageName), nil );
|
||||
item.setImage( image );
|
||||
|
||||
form.TimerViewer.Enabled:= form.btnSlideShow.Down;
|
||||
end;
|
||||
|
||||
procedure TCocoaViewerFormHandler.onPenWidthChanged( Sender: TObject );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue