Changeset 194 for trunk/Start.pas


Ignore:
Timestamp:
May 7, 2020, 8:39:24 PM (4 years ago)
Author:
chronos
Message:
  • Fixed: Locale configuration in configuration was not working as expected. ModalResult of Ok and Cancel buttons was opposite. Selected locale was not applied during application startup.
  • Fixed: Updating fullscreen mode after changeing mode in configuration window.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Start.pas

    r192 r194  
    155155    procedure SaveConfig;
    156156    procedure LoadAiBrainsPictures;
     157    procedure UpdateInterface;
    157158  end;
    158159
     
    432433var
    433434  x, i: Integer;
    434   r0, r1: HRgn;
    435   Location: TPoint;
    436435  PlayerSlot: TPlayerSlot;
    437436  AIBrains: TBrains;
     
    445444  end;
    446445  LoadConfig;
     446  LoadAssets;
    447447
    448448  ActionsOffered := [maConfig, maManual, maCredits, maWeb];
     
    467467  DirectDlg.Top := (Screen.Height - DirectDlg.Height) div 2;
    468468
    469   if FullScreen then begin
    470     Location := Point((Screen.Width - 800) * 3 div 8,
    471       Screen.Height - Height - (Screen.Height - 600) div 3);
    472     Left := Location.X;
    473     Top := Location.Y;
    474 
    475     r0 := CreateRectRgn(0, 0, Width, Height);
    476     r1 := CreateRectRgn(TabOffset + 4 * TabSize + 2, 0, Width, TabHeight);
    477     CombineRgn(r0, r0, r1, RGN_DIFF);
    478     DeleteObject(r1);
    479     r1 := CreateRectRgn(QuitBtn.Left, QuitBtn.Top, QuitBtn.Left + QuitBtn.Width,
    480       QuitBtn.top + QuitBtn.Height);
    481     CombineRgn(r0, r0, r1, RGN_OR);
    482     DeleteObject(r1);
    483     SetWindowRgn(Handle, r0, False);
    484     DeleteObject(r0); // causes crash with Windows 95
    485   end else begin
    486     Left := (Screen.Width - Width) div 2;
    487     Top := (Screen.Height - Height) div 2;
    488   end;
     469  UpdateInterface;
    489470
    490471  Canvas.Font.Assign(UniFont[ftNormal]);
     
    703684  end;
    704685  AIBrains.Free;
     686end;
     687
     688procedure TStartDlg.UpdateInterface;
     689var
     690  r0, r1: HRgn;
     691  Location: TPoint;
     692begin
     693  if FullScreen then begin
     694    Location := Point((Screen.Width - 800) * 3 div 8,
     695      Screen.Height - Height - (Screen.Height - 600) div 3);
     696    Left := Location.X;
     697    Top := Location.Y;
     698
     699    r0 := CreateRectRgn(0, 0, Width, Height);
     700    r1 := CreateRectRgn(TabOffset + 4 * TabSize + 2, 0, Width, TabHeight);
     701    CombineRgn(r0, r0, r1, RGN_DIFF);
     702    DeleteObject(r1);
     703    r1 := CreateRectRgn(QuitBtn.Left, QuitBtn.Top, QuitBtn.Left + QuitBtn.Width,
     704      QuitBtn.top + QuitBtn.Height);
     705    CombineRgn(r0, r0, r1, RGN_OR);
     706    DeleteObject(r1);
     707    SetWindowRgn(Handle, r0, False);
     708    DeleteObject(r0); // causes crash with Windows 95
     709  end else begin
     710    Left := (Screen.Width - Width) div 2;
     711    Top := (Screen.Height - Height) div 2;
     712  end;
    705713end;
    706714
     
    16361644          LocaleDlg := TLocaleDlg.Create(nil);
    16371645          if LocaleDlg.ShowModal = mrOk then begin
    1638             LoadPhrases;
     1646            LoadAssets;
    16391647            Invalidate;
     1648            UpdateInterface;
     1649            Background.UpdateInterface;
    16401650          end;
    16411651          FreeAndNil(LocaleDlg);
Note: See TracChangeset for help on using the changeset viewer.