Changeset 194


Ignore:
Timestamp:
May 7, 2020, 8:39:24 PM (18 months 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.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Back.pas

    r189 r194  
    1919  private
    2020    Img: TBitmap;
     21  public
     22    procedure UpdateInterface;
    2123  end;
    2224
     
    3739
    3840procedure TBackground.FormShow(Sender: TObject);
    39 var
    40   FileName: string;
    4141begin
    42   if FullScreen then begin
    43     if not Assigned(Img) then begin
    44       FileName := GetGraphicsDir + DirectorySeparator + 'Background.png';
    45       if FileExists(FileName) then begin
    46         Img := TBitmap.Create;
    47         LoadGraphicFile(img, FileName);
    48       end;
    49     end;
    50   end else begin
    51     WindowState := wsNormal;
    52     Width := StartDlg.Width + 16;
    53     Height := StartDlg.Height + 16;
    54     Left := StartDlg.Left - 8;
    55     Top := StartDlg.Top - 8;
    56   end;
     42  UpdateInterface;
    5743end;
    5844
     
    7460end;
    7561
     62procedure TBackground.UpdateInterface;
     63var
     64  FileName: string;
     65begin
     66  if FullScreen then begin
     67    WindowState := wsMaximized;
     68    if not Assigned(Img) then begin
     69      FileName := GetGraphicsDir + DirectorySeparator + 'Background.png';
     70      if FileExists(FileName) then begin
     71        Img := TBitmap.Create;
     72        LoadGraphicFile(img, FileName);
     73      end;
     74    end;
     75  end else begin
     76    WindowState := wsNormal;
     77    Width := StartDlg.Width + 16;
     78    Height := StartDlg.Height + 16;
     79    Left := StartDlg.Left - 8;
     80    Top := StartDlg.Top - 8;
     81  end;
     82end;
     83
    7684end.
  • trunk/Locale.pas

    r167 r194  
    111111procedure TLocaleDlg.CancelBtnClick(Sender: TObject);
    112112begin
    113   ModalResult := mrOk;
     113  ModalResult := mrCancel;
    114114end;
    115115
     
    161161begin
    162162  LocaleCode := Languages[List.ItemIndex].ShortName;
    163   ModalResult := mrCancel;
     163  ModalResult := mrOk;
    164164end;
    165165
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r192 r194  
    199199  Gamma: Integer; // global gamma correction (cent)
    200200
     201procedure LoadAssets;
    201202procedure UnitInit;
    202203procedure UnitDone;
     
    14861487  P: integer;
    14871488begin
    1488   for Section := Low(TFontType) to High(TFontType) do
    1489     UniFont[Section] := TFont.Create;
    1490 
    14911489  Section := ftNormal;
    14921490  AssignFile(FontScript, LocalizedFilePath('Fonts.txt'));
    14931491  try
    1494     Reset(fontscript);
    1495     while not EOF(FontScript) do begin
     1492    Reset(FontScript);
     1493    while not Eof(FontScript) do begin
    14961494      ReadLn(FontScript, s);
    14971495      if s <> '' then
     
    15491547end;
    15501548
     1549procedure LoadAssets;
     1550begin
     1551  LoadPhrases;
     1552  LoadFonts;
     1553  LoadGraphicFile(Templates, GetGraphicsDir + DirectorySeparator +
     1554    'Templates.png', gfNoGamma);
     1555  LoadGraphicFile(Colors, GetGraphicsDir + DirectorySeparator + 'Colors.png');
     1556  LoadGraphicFile(Paper, GetGraphicsDir + DirectorySeparator + 'Paper.jpg');
     1557  LoadGraphicFile(BigImp, GetGraphicsDir + DirectorySeparator + 'Icons.png');
     1558end;
     1559
    15511560procedure UnitInit;
     1561var
     1562  Section: TFontType;
    15521563begin
    15531564  Gamma := 100;
     
    15591570  {$ENDIF}
    15601571
    1561   LoadPhrases;
    1562 
    15631572  LogoBuffer := TBitmap.Create;
    15641573  LogoBuffer.PixelFormat := pf24bit;
    15651574  LogoBuffer.SetSize(wBBook, hBBook);
    15661575
    1567   LoadFonts;
     1576  for Section := Low(TFontType) to High(TFontType) do
     1577    UniFont[Section] := TFont.Create;
    15681578
    15691579  nGrExt := 0;
     
    15721582  Templates := TBitmap.Create;
    15731583  Templates.PixelFormat := pf24bit;
    1574   LoadGraphicFile(Templates, GetGraphicsDir + DirectorySeparator +
    1575     'Templates.png', gfNoGamma);
    15761584  Colors := TBitmap.Create;
    15771585  Colors.PixelFormat := pf24bit;
    1578   LoadGraphicFile(Colors, GetGraphicsDir + DirectorySeparator + 'Colors.png');
    15791586  Paper := TBitmap.Create;
    15801587  Paper.PixelFormat := pf24bit;
    1581   LoadGraphicFile(Paper, GetGraphicsDir + DirectorySeparator + 'Paper.jpg');
    15821588  BigImp := TBitmap.Create;
    15831589  BigImp.PixelFormat := pf24bit;
    1584   LoadGraphicFile(BigImp, GetGraphicsDir + DirectorySeparator + 'Icons.png');
    15851590  MainTexture.Image := TBitmap.Create;
    15861591  MainTextureAge := -2;
     
    15881593  InitOrnamentDone := False;
    15891594  GenerateNames := True;
     1595
     1596  LoadAssets;
    15901597end;
    15911598
  • 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.