mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
UPD: apply TDCCocoaModernFormUtils to simplify code
This commit is contained in:
parent
e864d3458a
commit
7f6e77ae73
7 changed files with 39 additions and 33 deletions
|
|
@ -102,10 +102,8 @@ uses
|
|||
, uMyUnix
|
||||
{$ENDIF}
|
||||
{$IFDEF LclCocoa}
|
||||
{$if NOT defined(DisableCocoaModernForm)}
|
||||
,uCocoaModernFormConfig
|
||||
{$endif}
|
||||
,CocoaConfig
|
||||
, uCocoaModernFormConfig
|
||||
, CocoaConfig
|
||||
{$ENDIF}
|
||||
;
|
||||
|
||||
|
|
@ -225,9 +223,7 @@ begin
|
|||
InitPasswordStore;
|
||||
LoadPixMapManager;
|
||||
{$IF DEFINED(DARWIN)}
|
||||
{$if NOT defined(DisableCocoaModernForm)}
|
||||
TDCCocoaModernFormUtils.initConfig;
|
||||
{$endif}
|
||||
iCloudDriveConfigUtil.load;
|
||||
{$ENDIF}
|
||||
Application.CreateForm(TfrmMain, frmMain); // main form
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ uses
|
|||
uShowMsg, DCClassesUtf8, dmCommonData, uDCUtils, uConvEncoding, uAdministrator,
|
||||
LCLVersion, LCLStrConsts, uFileProcs
|
||||
{$IFDEF DARWIN}
|
||||
, uDarwinApplication, uEarlyConfig
|
||||
, uCocoaModernFormConfig
|
||||
{$ENDIF}
|
||||
;
|
||||
|
||||
|
|
@ -1465,7 +1465,7 @@ begin
|
|||
ToolBar.SetButtonSize(gToolIconsSize + ScaleX(6, 96),
|
||||
gToolIconsSize + ScaleY(6, 96));
|
||||
{$IFDEF DARWIN}
|
||||
if gModernUI and TDarwinApplicationUtil.supportsModernForm then
|
||||
if TDCCocoaModernFormUtils.isEnabled then
|
||||
ToolBar.Hide;
|
||||
{$ENDIF}
|
||||
contextMenu.ImagesWidth:= gIconsInMenusSize;
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ uses
|
|||
, SynEditWrappedView
|
||||
{$endif}
|
||||
{$IFDEF DARWIN}
|
||||
, uDarwinApplication, uEarlyConfig
|
||||
, uCocoaModernFormConfig
|
||||
{$ENDIF}
|
||||
;
|
||||
|
||||
|
|
@ -681,7 +681,7 @@ begin
|
|||
tbToolBar.SetButtonSize(gToolIconsSize + ScaleX(6, 96),
|
||||
gToolIconsSize + ScaleY(6, 96));
|
||||
{$IFDEF DARWIN}
|
||||
if gModernUI and TDarwinApplicationUtil.supportsModernForm then
|
||||
if TDCCocoaModernFormUtils.isEnabled then
|
||||
tbToolBar.Hide;
|
||||
{$ENDIF}
|
||||
pmContextMenu.ImagesWidth:= gIconsInMenusSize;
|
||||
|
|
|
|||
|
|
@ -1273,9 +1273,7 @@ begin
|
|||
TDarwinFileViewUtil.init( @ActiveNotebook, @ActiveFrame );
|
||||
if gForceFunctionKey then
|
||||
Application.OnIdle:= @installMacOSFNKeyTap;
|
||||
{$if NOT defined(DisableCocoaModernForm)}
|
||||
TDCCocoaModernFormUtils.checkAndSetPrivilegeItem;
|
||||
{$endif}
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
|
|
|
|||
|
|
@ -455,9 +455,6 @@ type
|
|||
procedure ImagePaintBackground(ASender: TObject; ACanvas: TCanvas; ARect: TRect);
|
||||
procedure CreatePreview(FullPathToFile:string; index:integer; delete: boolean = false);
|
||||
procedure showLCLToolBar( newVisibility: Boolean );
|
||||
{$IFDEF DARWIN}
|
||||
function modernToolBarEnabled: Boolean;
|
||||
{$ENDIF}
|
||||
|
||||
property Commands: TFormCommands read FCommands implements IFormCommands;
|
||||
|
||||
|
|
@ -590,7 +587,7 @@ uses
|
|||
, SynEditWrappedView
|
||||
{$endif}
|
||||
{$IFDEF DARWIN}
|
||||
, uDarwinApplication, uEarlyConfig
|
||||
, uCocoaModernFormConfig
|
||||
{$ENDIF}
|
||||
;
|
||||
|
||||
|
|
@ -1202,7 +1199,7 @@ end;
|
|||
procedure TfrmViewer.GifAnimMouseEnter(Sender: TObject);
|
||||
begin
|
||||
{$IFDEF DARWIN}
|
||||
if NOT self.modernToolBarEnabled then
|
||||
if NOT TDCCocoaModernFormUtils.isEnabled then
|
||||
{$ENDIF}
|
||||
if miFullScreen.Checked then TimerViewer.Enabled:=true;
|
||||
end;
|
||||
|
|
@ -1298,7 +1295,7 @@ end;
|
|||
procedure TfrmViewer.ImageMouseEnter(Sender: TObject);
|
||||
begin
|
||||
{$IFDEF DARWIN}
|
||||
if NOT self.modernToolBarEnabled then
|
||||
if NOT TDCCocoaModernFormUtils.isEnabled then
|
||||
{$ENDIF}
|
||||
if miFullScreen.Checked then TimerViewer.Enabled:=true;
|
||||
end;
|
||||
|
|
@ -1306,7 +1303,7 @@ end;
|
|||
procedure TfrmViewer.ImageMouseLeave(Sender: TObject);
|
||||
begin
|
||||
{$IFDEF DARWIN}
|
||||
if NOT self.modernToolBarEnabled then
|
||||
if NOT TDCCocoaModernFormUtils.isEnabled then
|
||||
{$ENDIF}
|
||||
if miFullScreen.Checked then TimerViewer.Enabled:=false;
|
||||
end;
|
||||
|
|
@ -1506,19 +1503,12 @@ end;
|
|||
procedure TfrmViewer.showLCLToolBar( newVisibility: Boolean );
|
||||
begin
|
||||
{$IFDEF DARWIN}
|
||||
if self.modernToolBarEnabled then
|
||||
if TDCCocoaModernFormUtils.isEnabled then
|
||||
newVisibility:= False;
|
||||
{$ENDIF}
|
||||
ToolBar1.Visible:= newVisibility;
|
||||
end;
|
||||
|
||||
{$IFDEF DARWIN}
|
||||
function TfrmViewer.modernToolBarEnabled: Boolean;
|
||||
begin
|
||||
Result:= gModernUI and TDarwinApplicationUtil.supportsModernForm;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TfrmViewer.WMCommand(var Message: TLMCommand);
|
||||
var
|
||||
Index: Integer;
|
||||
|
|
@ -1627,7 +1617,7 @@ begin
|
|||
sboxImage.VertScrollBar.Visible:= not(miFullScreen.Checked);
|
||||
|
||||
{$IFDEF DARWIN}
|
||||
if NOT self.modernToolBarEnabled then
|
||||
if NOT TDCCocoaModernFormUtils.isEnabled then
|
||||
{$ENDIF}
|
||||
TimerViewer.Enabled:=miFullScreen.Checked;
|
||||
|
||||
|
|
@ -2198,7 +2188,7 @@ end;
|
|||
procedure TfrmViewer.sboxImageMouseEnter(Sender: TObject);
|
||||
begin
|
||||
{$IFDEF DARWIN}
|
||||
if NOT self.modernToolBarEnabled then
|
||||
if NOT TDCCocoaModernFormUtils.isEnabled then
|
||||
{$ENDIF}
|
||||
if miFullScreen.Checked then TimerViewer.Enabled:=true;
|
||||
end;
|
||||
|
|
@ -2206,7 +2196,7 @@ end;
|
|||
procedure TfrmViewer.sboxImageMouseLeave(Sender: TObject);
|
||||
begin
|
||||
{$IFDEF DARWIN}
|
||||
if NOT self.modernToolBarEnabled then
|
||||
if NOT TDCCocoaModernFormUtils.isEnabled then
|
||||
{$ENDIF}
|
||||
if miFullScreen.Checked then TimerViewer.Enabled:=false;
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -148,5 +148,3 @@ begin
|
|||
TCocoaToolBarUtils.removeItemByIndex( toolBar, index );
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,32 @@ unit uCocoaModernFormConfig;
|
|||
{$else}
|
||||
|
||||
interface
|
||||
|
||||
type
|
||||
|
||||
{ TDCCocoaModernFormUtils }
|
||||
|
||||
TDCCocoaModernFormUtils = class
|
||||
class procedure initConfig;
|
||||
class function isEnabled: Boolean;
|
||||
class procedure checkAndSetPrivilegeItem;
|
||||
end;
|
||||
|
||||
implementation
|
||||
end.
|
||||
|
||||
class procedure TDCCocoaModernFormUtils.initConfig;
|
||||
begin
|
||||
end;
|
||||
|
||||
class function TDCCocoaModernFormUtils.isEnabled: Boolean;
|
||||
begin
|
||||
Result:= False;
|
||||
end;
|
||||
|
||||
class procedure TDCCocoaModernFormUtils.checkAndSetPrivilegeItem;
|
||||
begin
|
||||
end;
|
||||
|
||||
{$endif}
|
||||
|
||||
end.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue