Browse Source

Fix: cosmetic and minor bugs

Herman Schoenfeld 7 years ago
parent
commit
ffb8d9798b

+ 4 - 2
Units/Forms/UFRMAccountExplorer.lfm

@@ -1,14 +1,16 @@
 object FRMAccountExplorer: TFRMAccountExplorer
 object FRMAccountExplorer: TFRMAccountExplorer
-  Left = 135
+  Left = 205
   Height = 471
   Height = 471
-  Top = 14
+  Top = 107
   Width = 868
   Width = 868
   Caption = 'Accounts Explorer'
   Caption = 'Accounts Explorer'
   ClientHeight = 451
   ClientHeight = 451
   ClientWidth = 868
   ClientWidth = 868
+  FormStyle = fsMDIChild
   Menu = meAccountExplorerMenu
   Menu = meAccountExplorerMenu
   OnCreate = FormCreate
   OnCreate = FormCreate
   OnDestroy = FormDestroy
   OnDestroy = FormDestroy
+  Position = poOwnerFormCenter
   LCLVersion = '1.6.4.0'
   LCLVersion = '1.6.4.0'
   object Splitter1: TSplitter
   object Splitter1: TSplitter
     Left = 380
     Left = 380

+ 0 - 1
Units/Forms/UFRMAccountInfo.lfm

@@ -8,7 +8,6 @@ object FRMAccountInfo: TFRMAccountInfo
   Color = clBtnFace
   Color = clBtnFace
   Font.Charset = DEFAULT_CHARSET
   Font.Charset = DEFAULT_CHARSET
   Font.Color = clWindowText
   Font.Color = clWindowText
-  Font.Height = -11
   Font.Name = 'Tahoma'
   Font.Name = 'Tahoma'
   Font.Style = []
   Font.Style = []
   OldCreateOrder = False
   OldCreateOrder = False

+ 1 - 0
Units/Forms/UFRMBlockExplorer.lfm

@@ -9,6 +9,7 @@ object FRMBlockExplorer: TFRMBlockExplorer
   Menu = BlockExplorerMenu
   Menu = BlockExplorerMenu
   OnCreate = FormCreate
   OnCreate = FormCreate
   OnDestroy = FormDestroy
   OnDestroy = FormDestroy
+  Position = poOwnerFormCenter
   LCLVersion = '1.6.4.0'
   LCLVersion = '1.6.4.0'
   object Panel2: TPanel
   object Panel2: TPanel
     Left = 0
     Left = 0

+ 3 - 2
Units/Forms/UFRMLogs.lfm

@@ -1,13 +1,14 @@
 object FRMLogs: TFRMLogs
 object FRMLogs: TFRMLogs
-  Left = 973
+  Left = 0
   Height = 466
   Height = 466
-  Top = 333
+  Top = 0
   Width = 868
   Width = 868
   Caption = 'Logs'
   Caption = 'Logs'
   ClientHeight = 466
   ClientHeight = 466
   ClientWidth = 868
   ClientWidth = 868
   OnCreate = FormCreate
   OnCreate = FormCreate
   OnDestroy = FormDestroy
   OnDestroy = FormDestroy
+  Position = poOwnerFormCenter
   LCLVersion = '1.6.4.0'
   LCLVersion = '1.6.4.0'
   object pnlTopLogs: TPanel
   object pnlTopLogs: TPanel
     Left = 0
     Left = 0

+ 2 - 1
Units/Forms/UFRMMainForm.lfm

@@ -13,13 +13,14 @@ object FRMMainForm: TFRMMainForm
   Font.Color = clWindowText
   Font.Color = clWindowText
   Font.Height = -11
   Font.Height = -11
   Font.Name = 'Tahoma'
   Font.Name = 'Tahoma'
+  FormStyle = fsMDIForm
   Menu = meMainMenu
   Menu = meMainMenu
   OnClose = FormClose
   OnClose = FormClose
   OnCloseQuery = FormCloseQuery
   OnCloseQuery = FormCloseQuery
   OnCreate = FormCreate
   OnCreate = FormCreate
   OnDestroy = FormDestroy
   OnDestroy = FormDestroy
   OnResize = FormResize
   OnResize = FormResize
-  Position = poDefault
+  Position = poScreenCenter
   ShowHint = True
   ShowHint = True
   LCLVersion = '1.6.4.0'
   LCLVersion = '1.6.4.0'
   object paLogoPanel: TPanel
   object paLogoPanel: TPanel

+ 1 - 0
Units/Forms/UFRMMessages.lfm

@@ -7,6 +7,7 @@ object FRMMessages: TFRMMessages
   ClientHeight = 441
   ClientHeight = 441
   ClientWidth = 874
   ClientWidth = 874
   OnActivate = FormActivate
   OnActivate = FormActivate
+  Position = poOwnerFormCenter    
   LCLVersion = '1.6.4.0'
   LCLVersion = '1.6.4.0'
   object Label11: TLabel
   object Label11: TLabel
     Left = 15
     Left = 15

+ 1 - 0
Units/Forms/UFRMNodes.lfm

@@ -7,6 +7,7 @@ object FRMNodes: TFRMNodes
   ClientHeight = 444
   ClientHeight = 444
   ClientWidth = 861
   ClientWidth = 861
   OnCreate = FormCreate
   OnCreate = FormCreate
+  Position = poOwnerFormCenter  
   LCLVersion = '1.6.4.0'
   LCLVersion = '1.6.4.0'
   object Label3: TLabel
   object Label3: TLabel
     Left = 15
     Left = 15

+ 1 - 1
Units/Forms/UFRMOperation.pas

@@ -1029,7 +1029,7 @@ begin
         end;
         end;
         wk := WalletKeys.Key[iWallet];
         wk := WalletKeys.Key[iWallet];
         if not assigned(wk.PrivateKey) then begin
         if not assigned(wk.PrivateKey) then begin
-          if wk.CryptedKey<>'' then begin
+          if wk.HasPrivateKey then begin
             errors := 'Wallet is password protected. Need password';
             errors := 'Wallet is password protected. Need password';
             bbPassword.Visible := true;
             bbPassword.Visible := true;
             bbPassword.Enabled := true;
             bbPassword.Enabled := true;

+ 2 - 2
Units/Forms/UFRMWalletKeys.pas

@@ -140,8 +140,8 @@ begin
 
 
   if (TSettings.MinerPrivateKeyType = mpk_Selected) AND (TSettings.MinerSelectedPrivateKey = TAccountComp.AccountKey2RawString(wk.AccountKey)) then begin
   if (TSettings.MinerPrivateKeyType = mpk_Selected) AND (TSettings.MinerSelectedPrivateKey = TAccountComp.AccountKey2RawString(wk.AccountKey)) then begin
     TUserInterface.ShowError(Self, 'Delete Key Faied',
     TUserInterface.ShowError(Self, 'Delete Key Faied',
-    'This key is used for mining and cannot be deleted.' + #10 + #10 +
-    'De-select this key from options and try again.');
+    'This key is currently being used for mining and cannot be deleted.' + #10 + #10 +
+    'Remove this key from the Options dialog and try again.');
     exit;
     exit;
   end;
   end;
 
 

+ 12 - 25
Units/Forms/UUserInterface.pas

@@ -260,11 +260,6 @@ begin
     // open the sync dialog
     // open the sync dialog
     FMainForm.SyncControl.UpdateBlockChainState;   //TODO fix this work-flow
     FMainForm.SyncControl.UpdateBlockChainState;   //TODO fix this work-flow
     RefreshConnectionStatusDisplay;
     RefreshConnectionStatusDisplay;
-
-    // Setup tray icon
-
-    // Disable wallet form
-    FMainForm.Enabled:=false;
     FStarted := true;
     FStarted := true;
   Except
   Except
     On E:Exception do begin
     On E:Exception do begin
@@ -275,7 +270,7 @@ begin
   end;
   end;
 
 
 
 
-  // Notify accounts again?
+  // Notify accounts changed
   OnAccountsChanged(FMainForm);
   OnAccountsChanged(FMainForm);
 
 
   // Refresh status bar since may not have been displayed
   // Refresh status bar since may not have been displayed
@@ -476,7 +471,6 @@ Var FRM : TFRMWalletKeys;
 begin
 begin
   FRM := TFRMWalletKeys.Create(parentForm);
   FRM := TFRMWalletKeys.Create(parentForm);
   try
   try
-    //FRM.WalletKeys := FWalletKeys;
     FRM.ShowModal;
     FRM.ShowModal;
   finally
   finally
     FRM.Free;
     FRM.Free;
@@ -498,20 +492,20 @@ end;
 
 
 class procedure TUserInterface.ChangeWalletPassword(parentForm: TForm);
 class procedure TUserInterface.ChangeWalletPassword(parentForm: TForm);
 var
 var
-  s,s2 : String;
+  pwd1,pwd2 : String;
   locked : boolean;
   locked : boolean;
 begin
 begin
-  s := ''; s2 := '';
+  pwd1 := ''; pwd2 := '';
   locked := (NOT TWallet.Keys.HasPassword) OR (NOT TWallet.Keys.IsValidPassword);
   locked := (NOT TWallet.Keys.HasPassword) OR (NOT TWallet.Keys.IsValidPassword);
-  if Not AskEnterProtectedString(parentForm, 'Change password','Enter new password',s)
+  if Not AskEnterProtectedString(parentForm, 'Change password','Enter new password',pwd1)
     then exit;
     then exit;
-  if trim(s)<>s then
+  if trim(pwd1)<>pwd1 then
     raise Exception.Create('Password cannot start or end with a space character');
     raise Exception.Create('Password cannot start or end with a space character');
-  if Not AskEnterProtectedString(parentForm, 'Change password', 'Enter new password again',s2)
+  if Not AskEnterProtectedString(parentForm, 'Change password', 'Enter new password again',pwd2)
     then exit;
     then exit;
-  if s<>s2 then
+  if pwd1<>pwd2 then
     raise Exception.Create('Two passwords are different!');
     raise Exception.Create('Two passwords are different!');
-  TWallet.Keys.WalletPassword := s;
+  TWallet.Keys.WalletPassword := pwd1;
   if locked then
   if locked then
     TWallet.Keys.LockWallet;
     TWallet.Keys.LockWallet;
 
 
@@ -523,12 +517,12 @@ begin
 end;
 end;
 
 
 class procedure TUserInterface.UnlockWallet(parentForm: TForm);
 class procedure TUserInterface.UnlockWallet(parentForm: TForm);
-Var s : String;
+Var pwd : String;
 begin
 begin
-  s := '';
+  pwd := '';
   Repeat
   Repeat
-    if Not AskEnterProtectedString(parentForm, 'Wallet password','Enter wallet password',s) then exit;
-    TWallet.Keys.WalletPassword := s;
+    if Not AskEnterProtectedString(parentForm, 'Wallet password','Enter wallet password',pwd) then exit;
+    TWallet.Keys.WalletPassword := pwd;
     if Not TWallet.Keys.IsValidPassword then
     if Not TWallet.Keys.IsValidPassword then
       ShowError(parentForm, 'Invalid Password', 'The password you have entered is incorrect.');
       ShowError(parentForm, 'Invalid Password', 'The password you have entered is incorrect.');
   Until TWallet.Keys.IsValidPassword;
   Until TWallet.Keys.IsValidPassword;
@@ -591,7 +585,6 @@ begin
        FAccountExplorer := TFRMAccountExplorer.Create(FMainForm);
        FAccountExplorer := TFRMAccountExplorer.Create(FMainForm);
        FAccountExplorer.CloseAction:= caFree;
        FAccountExplorer.CloseAction:= caFree;
        FAccountExplorer.OnDestroyed:= Self.OnSubFormDestroyed;
        FAccountExplorer.OnDestroyed:= Self.OnSubFormDestroyed;
-       FAccountExplorer.SetSubFormCoordinate(FAccountExplorer);
     end else
     end else
       FAccountExplorer.Refresh;
       FAccountExplorer.Refresh;
     FAccountExplorer.Show;
     FAccountExplorer.Show;
@@ -608,7 +601,6 @@ begin
        FBlockExplorerForm := TFRMBlockExplorer.Create(FMainForm);
        FBlockExplorerForm := TFRMBlockExplorer.Create(FMainForm);
        FBlockExplorerForm.CloseAction:= caFree;
        FBlockExplorerForm.CloseAction:= caFree;
        FBlockExplorerForm.OnDestroyed:= Self.OnSubFormDestroyed;
        FBlockExplorerForm.OnDestroyed:= Self.OnSubFormDestroyed;
-       FMainForm.SetSubFormCoordinate(FBlockExplorerForm);
     end;
     end;
     FBlockExplorerForm.Show;
     FBlockExplorerForm.Show;
   finally
   finally
@@ -624,7 +616,6 @@ begin
       FOperationsExplorerForm := TFRMOperationExplorer.Create(FMainForm);
       FOperationsExplorerForm := TFRMOperationExplorer.Create(FMainForm);
       FOperationsExplorerForm.CloseAction:= caFree;
       FOperationsExplorerForm.CloseAction:= caFree;
       FOperationsExplorerForm.OnDestroyed:= Self.OnSubFormDestroyed;
       FOperationsExplorerForm.OnDestroyed:= Self.OnSubFormDestroyed;
-      FMainForm.SetSubFormCoordinate(FOperationsExplorerForm);
     end;
     end;
     FOperationsExplorerForm.Show;
     FOperationsExplorerForm.Show;
   finally
   finally
@@ -640,7 +631,6 @@ begin
       FPendingOperationForm := TFRMPendingOperations.Create(FMainForm);
       FPendingOperationForm := TFRMPendingOperations.Create(FMainForm);
       FPendingOperationForm.CloseAction:= caFree;
       FPendingOperationForm.CloseAction:= caFree;
       FPendingOperationForm.OnDestroyed:= Self.OnSubFormDestroyed;
       FPendingOperationForm.OnDestroyed:= Self.OnSubFormDestroyed;
-      FMainForm.SetSubFormCoordinate(FPendingOperationForm);
     end;
     end;
     FPendingOperationForm.Show;
     FPendingOperationForm.Show;
   finally
   finally
@@ -656,7 +646,6 @@ begin
        FMessagesForm := TFRMMessages.Create(FMainForm);
        FMessagesForm := TFRMMessages.Create(FMainForm);
        FMessagesForm.CloseAction:= caFree;
        FMessagesForm.CloseAction:= caFree;
        FMessagesForm.OnDestroyed:= Self.OnSubFormDestroyed;
        FMessagesForm.OnDestroyed:= Self.OnSubFormDestroyed;
-       FMainForm.SetSubFormCoordinate(FMessagesForm);
     end;
     end;
     FMessagesForm.Show;
     FMessagesForm.Show;
   finally
   finally
@@ -672,7 +661,6 @@ begin
        FNodesForm := TFRMNodes.Create(FMainForm);
        FNodesForm := TFRMNodes.Create(FMainForm);
        FNodesForm.CloseAction:= caFree;
        FNodesForm.CloseAction:= caFree;
        FNodesForm.OnDestroyed:= Self.OnSubFormDestroyed;
        FNodesForm.OnDestroyed:= Self.OnSubFormDestroyed;
-       FMainForm.SetSubFormCoordinate(FNodesForm);
     end;
     end;
     FNodesForm.Show;
     FNodesForm.Show;
   finally
   finally
@@ -688,7 +676,6 @@ begin
        FLogsForm := TFRMLogs.Create(FMainForm);
        FLogsForm := TFRMLogs.Create(FMainForm);
        FLogsForm.CloseAction:= caFree;
        FLogsForm.CloseAction:= caFree;
        FLogsForm.OnDestroyed:= Self.OnSubFormDestroyed;
        FLogsForm.OnDestroyed:= Self.OnSubFormDestroyed;
-       FMainForm.SetSubFormCoordinate(FLogsForm);
     end;
     end;
     FLogsForm.Show;
     FLogsForm.Show;
   finally
   finally

+ 3 - 3
Units/PascalCoin/UCrypto.pas

@@ -128,7 +128,7 @@ Const
 implementation
 implementation
 
 
 uses
 uses
-  UAES, ULog, UConst, UAccounts;
+  UAES, ULog, UConst, UAccounts, UCommon;
 
 
 Var _initialized : Boolean = false;
 Var _initialized : Boolean = false;
 
 
@@ -146,8 +146,8 @@ class operator TECDSA_Public.= (const a,b : TECDSA_Public) : boolean;
 begin
 begin
   Result :=
   Result :=
     (a.EC_OpenSSL_NID = b.EC_OpenSSL_NID) AND
     (a.EC_OpenSSL_NID = b.EC_OpenSSL_NID) AND
-    (a.x = b.x) AND
-    (a.y = b.y);
+    (BinStrComp(a.x, b.x) = 0) AND
+    (BinStrComp(a.y, b.y) = 0);
 end;
 end;
 
 
 { TECPrivateKey }
 { TECPrivateKey }

+ 1 - 2
Units/Utils/UCommon.pas

@@ -209,7 +209,7 @@ begin
      Result := 1
      Result := 1
    else begin
    else begin
      Result := 0;
      Result := 0;
-     For i:= 1 to Str1Len do begin
+     for i:= Low(Str1) to High(Str1) do begin
        if Str1[i] < Str2[i] then begin
        if Str1[i] < Str2[i] then begin
          Result := -1;
          Result := -1;
          break;
          break;
@@ -300,7 +300,6 @@ begin
     Result := AValue
     Result := AValue
 end;
 end;
 
 
-
 { DateTime functions }
 { DateTime functions }
 function TimeStamp : AnsiString;
 function TimeStamp : AnsiString;
 begin
 begin

+ 6 - 19
Units/Utils/UCommonUI.pas

@@ -17,7 +17,7 @@ unit UCommonUI;
 interface
 interface
 
 
 uses
 uses
-  Classes, SysUtils, Forms, Controls,ExtCtrls,  FGL, Graphics, Generics.Collections, Generics.Defaults, syncobjs;
+  Classes, SysUtils, Forms, Controls,ExtCtrls,  Graphics, Generics.Collections, Generics.Defaults, syncobjs;
 
 
 type
 type
   TApplicationForm = class(TForm)
   TApplicationForm = class(TForm)
@@ -29,7 +29,7 @@ type
       procedure NotifyActivateFirstTime;
       procedure NotifyActivateFirstTime;
       procedure NotifyDestroyed;
       procedure NotifyDestroyed;
     protected
     protected
-      FUILock : TCriticalSection;
+      FUILock : syncobjs.TCriticalSection;
       procedure DoCreate; override;
       procedure DoCreate; override;
       procedure Activate; override;
       procedure Activate; override;
       procedure ActivateFirstTime; virtual;
       procedure ActivateFirstTime; virtual;
@@ -54,7 +54,6 @@ type
   { TFormHelper }
   { TFormHelper }
 
 
   TFormHelper = class helper for TForm
   TFormHelper = class helper for TForm
-    procedure SetSubFormCoordinate(SubForm: TForm);
   end;
   end;
 
 
   { TImageHelper }
   { TImageHelper }
@@ -66,12 +65,15 @@ type
 
 
 implementation
 implementation
 
 
+uses
+  lcl, FGL;
+
 {%region TApplicationForm}
 {%region TApplicationForm}
 
 
 procedure TApplicationForm.DoCreate;
 procedure TApplicationForm.DoCreate;
 begin
 begin
   inherited;
   inherited;
-  FUILock := TCriticalSection.Create;
+  FUILock := syncobjs.TCriticalSection.Create;
   FActivatedCount := 0;
   FActivatedCount := 0;
   FCloseAction:=caHide;
   FCloseAction:=caHide;
 end;
 end;
@@ -159,21 +161,6 @@ end;
 
 
 {%region TFormHelper}
 {%region TFormHelper}
 
 
-//Form is shown centered over parent form
-//Show the position of the subform
-procedure TFormHelper.SetSubFormCoordinate(SubForm: TForm);
-var TopLeft:TPoint;
-begin
-  // TODO this needs to be changed
-//  Subform.Position:=poOwnerFormCenter; - test for only use center of from
-// On Linux ClientToScreen work only if window show as resut need call from OnAcivate from linux correct show.
-// on window shows correct in OnShow
-  TopLeft:= Self.ClientToScreen(Point(Self.Left,Self.Top));
-  Subform.Top   :=TopLeft.y;
-  Subform.Left  :=TopLeft.x;
-  Subform.Height:= Self.Height-27;
-  Subform.Width := Self.Width-9;
-end;
 
 
 {%endregion}
 {%endregion}