瀏覽代碼

Merge pull request #188 from skalogryz/macos

macOS compatability fixes
Herman Schoenfeld 6 年之前
父節點
當前提交
84144cdf31

+ 5 - 0
src/config.inc

@@ -81,7 +81,12 @@ ERROR: You must select ONLY ONE option: PRODUCTION or TESTNET
 ERROR: You must select ONE option!
 {$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}
 {$IFDEF OPTIONS_BY_DEFAULT}
+  {$ifdef darwin}
+  {$DEFINE Use_CryptoLib4Pascal}
+  {$else}
   {$DEFINE Use_OpenSSL}
+  {$endif}
+
   // By default are: Synapse + OpenSSLv11
   {$IFDEF ANDROID} 
     // Android usage (on Delphi) does not use Synapse

+ 2 - 0
src/gui-classic/UFRMPascalCoinWalletConfig.lfm

@@ -120,6 +120,7 @@ object FRMPascalCoinWalletConfig: TFRMPascalCoinWalletConfig
     Kind = bkOK
     ModalResult = 1
     OnClick = bbOkClick
+    Caption = 'OK'
     TabOrder = 18
   end
   object bbCancel: TBitBtn
@@ -130,6 +131,7 @@ object FRMPascalCoinWalletConfig: TFRMPascalCoinWalletConfig
     Cancel = True
     Kind = bkCancel
     ModalResult = 2
+    Caption = 'Cancel'
     TabOrder = 19
   end
   object udInternetServerPort: TUpDown

+ 3 - 0
src/gui-classic/UFRMPascalCoinWalletConfig.pas

@@ -201,6 +201,9 @@ begin
   bbUpdatePassword.Enabled := false;
   UpdateWalletConfig;
   lblDefaultJSONRPCMinerServerPort.Caption := Format('(Default %d)',[CT_JSONRPCMinerServer_Port]);
+  {$ifdef fpc}{$ifdef darwin}
+  Caption:='Preferences';
+  {$endif}{$endif}
 end;
 
 procedure TFRMPascalCoinWalletConfig.cbDownloadNewCheckpointClick(

+ 51 - 0
src/gui-classic/UFRMWallet.pas

@@ -243,6 +243,7 @@ type
     Procedure FillOperationInformation(Const Strings : TStrings; Const OperationResume : TOperationResume);
     {$IFDEF TESTNET}
     Procedure InitMenuForTesting;
+    Procedure InitMacOSMenu;
     Procedure Test_RandomOperations(Sender: TObject);
     Procedure Test_AskForFreeAccount(Sender: TObject);
     {$IFDEF TESTING_NO_POW_CHECK}
@@ -963,6 +964,52 @@ begin
   end;
 end;
 
+Procedure TFRMWallet.InitMacOSMenu;
+{$ifdef fpc}
+var
+  mi : TMenuItem;
+  app : TMenuItem;
+{$endif}
+begin
+  {$ifdef fpc}
+  {$ifndef darwin}
+  Exit;
+  {$endif}
+  app := TMenuItem.Create(MainMenu);
+  app := TMenuItem.Create(MainMenu);
+  app.Caption:=#$EF#$A3#$BF;
+
+  miAboutPascalCoin.Parent.Remove(miAboutPascalCoin);
+  app.Add(miAboutPascalCoin);
+  {$IFDEF TESTNET}
+  // Things for testing purposes only
+  miAbout.caption := 'Testing';
+  {$ELSE}
+  miAbout.Visible:=false;
+  {$ENDIF}
+
+  // Move "Options" to "Prefernces"
+  mi := TMenuItem.Create(MainMenu);
+  mi.Caption:='-';
+  app.Add(mi);
+  miOptions.Parent.Remove(miOptions);
+  miOptions.Caption:='Preferences...';
+  miOptions.ShortCut:=Menus.ShortCut(VK_OEM_COMMA, [ssMeta]);
+  app.Add(miOptions);
+
+  MiFindaccount.ShortCut:=Menus.ShortCut(VK_F, [ssMeta]);
+  MiOperationsExplorer.ShortCut:=Menus.ShortCut(VK_E, [ssMeta]);
+  MiFindpreviousaccountwithhighbalance.ShortCut:=Menus.Shortcut(VK_F3, [ssMeta]);
+  miOptions.ShortCut:=Menus.ShortCut(VK_OEM_COMMA, [ssMeta]); // match preferences
+  miPrivatekeys.ShortCut:=Menus.Shortcut(VK_P, [ssMeta]);
+
+  N1.Visible:=false;
+  MiClose.Visible:=false;
+
+  MainMenu.Items.Insert(0, app);
+  {$endif}
+end;
+
 {$IFDEF TESTNET}
 procedure TFRMWallet.InitMenuForTesting;
 var mi : TMenuItem;
@@ -1227,6 +1274,10 @@ begin
   // Things for testing purposes only
   InitMenuForTesting;
   {$ENDIF}
+  {$ifdef DARWIN}
+  // this is macOS specific menu layout
+  InitMacOSMenu;
+  {$endif}
 end;
 
 procedure TFRMWallet.ebHashRateBackBlocksKeyPress(Sender: TObject; var Key: char);

+ 3 - 3
src/gui-classic/UGridUtils.pas

@@ -651,7 +651,7 @@ begin
     C.ColumnType := act_account_number;
     C.width := -1;
   end;
-  DrawGrid.Canvas.Font.Color:=clBlack;
+  DrawGrid.Canvas.Font.Color:=clWindowText;
   if (ARow=0) then begin
     // Header
     s := CT_ColumnHeader[C.ColumnType];
@@ -1078,7 +1078,7 @@ procedure TOperationsGrid.OnGridDrawCell(Sender: TObject; ACol, ARow: Integer; R
 Var s : String;
   opr : TOperationResume;
 begin
-  DrawGrid.Canvas.Font.Color:=clBlack;
+  DrawGrid.Canvas.Font.Color:=clWindowText;
   opr := CT_TOperationResume_NUL;
   Try
   if (ARow=0) then begin
@@ -1508,7 +1508,7 @@ Var s : String;
   deviation : Real;
   hr_base : Int64;
 begin
-  DrawGrid.Canvas.Font.Color:=clBlack;
+  DrawGrid.Canvas.Font.Color:=clWindowText;
   if (ARow=0) then begin
     // Header
     case ACol of

+ 1 - 1
src/pascalcoin_wallet_classic.dpr

@@ -7,7 +7,7 @@ program PascalCoin_Wallet_Classic;
 uses
   {$IFnDEF FPC}
   {$ELSE}
-  {$IFDEF LINUX}
+  {$IFDEF UNIX}
   cthreads,
   {$ENDIF }
   Interfaces,

+ 0 - 1
src/pascalcoin_wallet_classic.lpi

@@ -12,7 +12,6 @@
       <SessionStorage Value="InProjectDir"/>
       <MainUnit Value="0"/>
       <Title Value="PascalCoinWalletLazarus"/>
-      <UseAppBundle Value="False"/>
       <ResourceType Value="res"/>
       <Icon Value="0"/>
     </General>