Changeset 717


Ignore:
Timestamp:
Jan 10, 2026, 12:15:35 PM (16 hours ago)
Author:
chronos
Message:

Merged revision(s) 705-716 from trunk:

  • Fixed: Subversion properties.
  • Fixed: Better start screen location calculation for lower than 800x600 resolutions to make visible entire window.
  • Fixed: Memory overflow in minimap drawing with some higher DPI settings.
  • Fixed: Crashes with mini map drawing in Start screen with some DPI resolutions.
  • Added: Enter key confirms battle dialog window.
  • Fixed: Potential battle dialog drawing issue.
  • Modified: Code cleanup.
  • Fixed: Disable auto selection of input text in message dialog.
  • Fixed: Edit boxes to have black background and blue selection.
  • Fixed: Automatically create Saved and Maps user data directories if they don't exist yet.
  • Modified: Code cleanup.
  • Fixed: Wrong unit models opened after click on Military report foreign units.
  • Modified: Do not store .png file extension in graphics names in book files. This is for compatibility with older C-evo versions.
  • Fixed: Support both books with graphics name with and without .png file extensions.
Location:
branches/zoom
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • branches/zoom

  • branches/zoom/Back.pas

    r623 r717  
    6666    WindowState := TWindowState.wsFullScreen;
    6767    if not Assigned(Img) then begin
    68       FileName := GetGraphicsDir + DirectorySeparator + 'Background.png';
     68      FileName := GetGraphicsDir + DirectorySeparator + 'Background' + PngExt;
    6969      if FileExists(FileName) then begin
    7070        Img := TBitmap.Create;
  • branches/zoom/Brain.pas

    r679 r717  
    8080  TextSize: TSize;
    8181begin
    82   if not LoadGraphicFile(Picture, GetAiDir + DirectorySeparator + FileName + DirectorySeparator + FileName + '.png', [gfNoError]) then begin
     82  if not LoadGraphicFile(Picture, GetAiDir + DirectorySeparator + FileName + DirectorySeparator + FileName + PngExt, [gfNoError]) then begin
    8383    with Picture.Canvas do begin
    8484      Brush.Color := $904830;
  • branches/zoom/GameServer.pas

    r683 r717  
    606606      end;
    607607
     608  ForceDirectories(ExtractFileDir(FileName));
    608609  if Auto and AutoSaveExists then // append to existing file
    609610    LogFile := TFileStream.Create(FileName, fmOpenReadWrite or fmShareExclusive)
     
    32903291          Map.MaxTurn := MaxTurn;
    32913292          Move(RealMap, Map.Tiles[0], MapSize * 4);
     3293          ForceDirectories(ExtractFileDir(MapFileName));
    32923294          Map.SaveToFile(MapFileName);
    32933295          FreeAndNil(Map);
  • branches/zoom/LocalPlayer/Battle.lfm

    • Property svn:mime-type deleted
  • branches/zoom/LocalPlayer/Battle.pas

    r622 r717  
    6666  MaxBar := 65;
    6767
    68   // TerrType:=MyMap[ToLoc] and fTerrain;
     68  // TerrType := MyMap[ToLoc] and fTerrain;
    6969  GetUnitInfo(ToLoc, euix, UnitInfo);
    7070
     
    171171  UnshareBitmap(Buffer);
    172172  BitBltCanvas(Buffer.Canvas, 0, 0, 66, 48, ca, xm + 8 + 4, ym - 8 - 12 - 48);
    173   { if TerrType<fForest then
    174     Sprite(Buffer,HGrTerrain,0,16,66,32,1+TerrType*(xxt*2+1),1+yyt)
     173  { if TerrType < fForest then
     174    Sprite(Buffer, HGrTerrain, 0, 16, 66, 32, 1 + TerrType * (xxt * 2 + 1), 1 + yyt)
    175175    else
    176176    begin
    177     Sprite(Buffer,HGrTerrain,0,16,66,32,1+2*(xxt*2+1),1+yyt+2*(yyt*3+1));
    178     if (TerrType=fForest) and IsJungle(ToLoc div G.lx) then
    179     Sprite(Buffer,HGrTerrain,0,16,66,32,1+7*(xxt*2+1),1+yyt+19*(yyt*3+1))
    180     else Sprite(Buffer,HGrTerrain,0,16,66,32,1+7*(xxt*2+1),1+yyt+2*(2+TerrType-fForest)*(yyt*3+1));
     177      Sprite(Buffer, HGrTerrain, 0, 16, 66, 32, 1 + 2 * (xxt * 2 + 1), 1 + yyt + 2 * (yyt * 3 + 1));
     178      if (TerrType = fForest) and IsJungle(ToLoc div G.lx) then
     179      Sprite(Buffer, HGrTerrain, 0, 16, 66, 32, 1 + 7 * (xxt * 2 + 1), 1+ yyt + 19 * (yyt * 3 + 1))
     180      else Sprite(Buffer, HGrTerrain, 0, 16, 66, 32, 1 + 7 * (xxt * 2 + 1), 1 + yyt + 2 * (2 + TerrType - fForest) * (yyt * 3 + 1));
    181181    end; }
    182182  IsoMap.PaintUnit(1, 0, UnitInfo, 0);
     
    201201procedure TBattleDlg.FormShow(Sender: TObject);
    202202begin
    203   if IsSuicideQuery then
    204   begin
    205     ClientWidth := 300;
    206     ClientHeight := 288;
     203  if IsSuicideQuery then begin
     204    BoundsRect := Bounds(0, 0, 300, 288);
    207205    OKBtn.Visible := True;
    208206    CancelBtn.Visible := True;
    209207    CenterToScreen;
    210   end
    211   else
    212   begin
    213     ClientWidth := 178;
    214     ClientHeight := 178;
     208  end else begin
     209    BoundsRect := Bounds(0, 0, 178, 178);
    215210    OKBtn.Visible := False;
    216211    CancelBtn.Visible := False;
     
    226221  begin
    227222    Brush.Color := 0;
    228     FillRect(Rect(0, 0, ClientWidth, ClientHeight));
     223    FillRect(Rect(0, 0, Width, Height));
    229224    Brush.Style := TBrushStyle.bsClear;
    230225    PaintBackground(Canvas, 3 + Border, 3 + Border,
    231       ClientWidth - (6 + 2 * Border), ClientHeight - (6 + 2 * Border),
    232       ClientWidth, ClientHeight);
    233   end;
    234   Frame(Canvas, Border + 1, Border + 1, ClientWidth - (2 + Border),
    235     ClientHeight - (2 + Border), MainTexture.ColorBevelLight,
     226      Width - (6 + 2 * Border), Height - (6 + 2 * Border),
     227      Width, Height);
     228  end;
     229  Frame(Canvas, Border + 1, Border + 1, Width - (2 + Border),
     230    Height - (2 + Border), MainTexture.ColorBevelLight,
    236231    MainTexture.ColorBevelShade);
    237   Frame(Canvas, 2 + Border, 2 + Border, ClientWidth - (3 + Border),
    238     ClientHeight - (3 + Border), MainTexture.ColorBevelLight,
     232  Frame(Canvas, 2 + Border, 2 + Border, Width - (3 + Border),
     233    Height - (3 + Border), MainTexture.ColorBevelLight,
    239234    MainTexture.ColorBevelShade);
    240235
     
    243238    Canvas.Font.Assign(UniFont[ftCaption]);
    244239    S := Phrases.Lookup('TITLE_SUICIDE');
    245     RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, S)) div 2,
     240    RisedTextOut(Canvas, (Width - BiColorTextWidth(Canvas, S)) div 2,
    246241      7 + Border, S);
    247242    Canvas.Font.Assign(UniFont[ftNormal]);
     
    249244    P := Pos('\', S);
    250245    if P = 0 then
    251       RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, S))
    252         div 2, 205, S)
     246      RisedTextOut(Canvas, (Width - BiColorTextWidth(Canvas, S)) div 2, 205, S)
    253247    else
    254248    begin
    255249      s1 := Copy(S, 1, P - 1);
    256       RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, s1)) div 2,
     250      RisedTextOut(Canvas, (Width - BiColorTextWidth(Canvas, s1)) div 2,
    257251        205 - MessageLineSpacing div 2, s1);
    258252      s1 := Copy(S, P + 1, 255);
    259       RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, s1)) div 2,
     253      RisedTextOut(Canvas, (Width - BiColorTextWidth(Canvas, s1)) div 2,
    260254        205 + (MessageLineSpacing - MessageLineSpacing div 2), s1);
    261255    end;
     
    263257  end
    264258  else
    265     ym := ClientHeight div 2;
     259    ym := Height div 2;
    266260  Canvas.Font.Assign(UniFont[ftSmall]);
    267   PaintBattleOutcome(Canvas, ClientWidth div 2, ym, uix, ToLoc, Forecast);
     261  PaintBattleOutcome(Canvas, Width div 2, ym, uix, ToLoc, Forecast);
    268262
    269263  for cix := 0 to ControlCount - 1 do
     
    293287  Shift: TShiftState);
    294288begin
     289  if Key = VK_RETURN then OKBtnClick(Self)
     290  else
    295291  if not IsSuicideQuery and (Key <> VK_SHIFT) then
    296292  begin
  • branches/zoom/LocalPlayer/CityScreen.pas

    r662 r717  
    231231  Template := TBitmap.Create;
    232232  Template.PixelFormat := TPixelFormat.pf24bit;
    233   LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'City.png',
     233  LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'City' + PngExt,
    234234    [gfNoGamma]);
    235235  CityMapTemplate := TBitmap.Create;
    236236  CityMapTemplate.PixelFormat := TPixelFormat.pf24bit;
    237   LoadGraphicFile(CityMapTemplate, GetGraphicsDir + DirectorySeparator + 'BigCityMap.png',
     237  LoadGraphicFile(CityMapTemplate, GetGraphicsDir + DirectorySeparator + 'BigCityMap' + PngExt,
    238238    [gfNoGamma]);
    239239  SmallCityMapTemplate := TBitmap.Create;
    240240  SmallCityMapTemplate.PixelFormat := TPixelFormat.pf24bit;
    241   LoadGraphicFile(SmallCityMapTemplate, GetGraphicsDir + DirectorySeparator + 'SmallCityMap.png',
     241  LoadGraphicFile(SmallCityMapTemplate, GetGraphicsDir + DirectorySeparator + 'SmallCityMap' + PngExt,
    242242    [gfNoGamma]);
    243243  SmallCityMap := TBitmap.Create;
  • branches/zoom/LocalPlayer/Draft.pas

    r684 r717  
    9595  Template := TBitmap.Create;
    9696  Template.PixelFormat := TPixelFormat.pf24bit;
    97   LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'MiliRes.png',
     97  LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'MiliRes' + PngExt,
    9898    [gfNoGamma]);
    9999end;
     
    415415procedure TDraftDlg.SetDomain(D: Integer);
    416416
    417   function Prio(fix: Integer): Integer;
     417  function Prio(Fix: Integer): Integer;
    418418  var
    419419    FeaturePreq: Integer;
    420420  begin
    421     FeaturePreq := Feature[fix].Preq;
     421    FeaturePreq := Feature[Fix].Preq;
    422422    Assert(FeaturePreq <> preNA);
    423     if fix < mcFirstNonCap then
    424       Result := 10000 + fix
     423    if Fix < mcFirstNonCap then
     424      Result := 10000 + Fix
    425425    else if FeaturePreq = preNone then
    426426      Result := 20000
     
    429429    else
    430430      Result := 30000 + AdvValue[FeaturePreq];
    431     if not (fix in AutoFeature) then
     431    if not (Fix in AutoFeature) then
    432432      Inc(Result, 90000);
    433433  end;
     
    471471begin
    472472  Domain := dGround;
    473   while (Domain < dAir) and (upgrade[Domain, 0].Preq <> preNone) and
    474     (MyRO.Tech[upgrade[Domain, 0].Preq] < tsApplicable) do
     473  while (Domain < dAir) and (Upgrade[Domain, 0].Preq <> preNone) and
     474    (MyRO.Tech[Upgrade[Domain, 0].Preq] < tsApplicable) do
    475475    Inc(Domain);
    476476
     
    478478  MaxLines := 0;
    479479  for D := 0 to nDomains - 1 do
    480     if (upgrade[D, 0].Preq = preNone) or
    481       (MyRO.Tech[upgrade[D, 0].Preq] >= tsApplicable) then
     480    if (Upgrade[D, 0].Preq = preNone) or
     481      (MyRO.Tech[Upgrade[D, 0].Preq] >= tsApplicable) then
    482482    begin
    483483      Count := 0;
     
    519519  begin
    520520    for D := 0 to nDomains - 1 do
    521       if (D <> Domain) and ((upgrade[D, 0].Preq = preNone) or
    522         (MyRO.Tech[upgrade[D, 0].Preq] >= tsApplicable)) and
     521      if (D <> Domain) and ((Upgrade[D, 0].Preq = preNone) or
     522        (MyRO.Tech[Upgrade[D, 0].Preq] >= tsApplicable)) and
    523523        (X >= xDomain + D * DomainPitch) and
    524524        (X < xDomain + D * DomainPitch + 36) and (Y >= yDomain) and
  • branches/zoom/LocalPlayer/Help.pas

    r684 r717  
    10711071          until (P > Length(S)) or (S[P] = '\');
    10721072          if LoadGraphicFile(ExtPic, LocalizedFilePath('Help' +
    1073             DirectorySeparator + Copy(S, 2, P - 2) + '.png')) then
     1073            DirectorySeparator + Copy(S, 2, P - 2) + PngExt)) then
    10741074          begin
    10751075            MainText.AddLine('', pkExternal);
  • branches/zoom/LocalPlayer/IsoEngine.pas

    r608 r717  
    337337  IsoMapCache[ATileSize] := TIsoMapCache.Create;
    338338
    339   FileName := Format('Terrain%dx%d.png', [xxt * 2, yyt * 2]);
     339  FileName := Format('Terrain%dx%d' + PngExt, [xxt * 2, yyt * 2]);
    340340  IsoMapCache[ATileSize].HGrTerrain := LoadGraphicSet(FileName);
    341341  if not Assigned(IsoMapCache[ATileSize].HGrTerrain) then
     
    343343
    344344
    345   FileName := Format('Cities%dx%d.png', [xxt * 2, yyt * 2]);
     345  FileName := Format('Cities%dx%d' + PngExt, [xxt * 2, yyt * 2]);
    346346  IsoMapCache[ATileSize].HGrCities := LoadGraphicSet(FileName);
    347347  if not Assigned(IsoMapCache[ATileSize].HGrCities) then
  • branches/zoom/LocalPlayer/MessgEx.pas

    r622 r717  
    7777  CenterTo := 0;
    7878  OpenSound := '';
     79  EInput.AutoSelect := False;
    7980end;
    8081
  • branches/zoom/LocalPlayer/NatStat.pas

    r549 r717  
    9393  Template := TBitmap.Create;
    9494  Template.PixelFormat := TPixelFormat.pf24bit;
    95   LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'Nation.png',
     95  LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'Nation' + PngExt,
    9696    [gfNoGamma]);
    9797end;
  • branches/zoom/LocalPlayer/Nego.lfm

    • Property svn:mime-type deleted
  • branches/zoom/LocalPlayer/Select.pas

    r693 r717  
    10551055        kEnemyModels:
    10561056          MainScreen.UnitStatDlg.ShowNewContent_EnemyModel(wmPersistent,
    1057             Layers[laImprovements].Lines[ScrollBar.Position + Selected].Code);
     1057            Layers[laImprovements].Lines[ScrollBar.Position + Selected].Model);
    10581058        kAllEnemyModels, kChooseEnemyModel:
    10591059          if lix <> mixAll then
  • branches/zoom/LocalPlayer/TechTree.pas

    r684 r717  
    178178    Image := TBitmap.Create;
    179179    Image.PixelFormat := TPixelFormat.pf24bit;
    180     LoadGraphicFile(Image, GetAppSharePath('Help' + DirectorySeparator + 'AdvTree.png'),
     180    LoadGraphicFile(Image, GetAppSharePath('Help' + DirectorySeparator + 'AdvTree' + PngExt),
    181181      [gfNoGamma]);
    182182
  • branches/zoom/LocalPlayer/Term.pas

    r704 r717  
    803803      Picture.pix := pixNoSlaves;
    804804    Picture.Hash := 0;
    805     Picture.GrName := 'StdUnits.png';
     805    Picture.GrName := 'StdUnits';
    806806    IsNew := True;
    807807  end
     
    14071407    if AILogo[P] = nil then
    14081408      AILogo[P] := TBitmap.Create;
    1409     if not LoadGraphicFile(AILogo[P], GetAppSharePath(Name + '.png'), [gfNoError]) then
     1409    if not LoadGraphicFile(AILogo[P], GetAppSharePath(Name + PngExt), [gfNoError]) then
    14101410    begin
    14111411      FreeAndNil(AILogo[P]);
     
    17661766  MainMap.SetOutput(Offscreen);
    17671767
    1768   HGrStdUnits := LoadGraphicSet('StdUnits.png');
     1768  HGrStdUnits := LoadGraphicSet('StdUnits' + PngExt);
    17691769  SmallImp := TBitmap.Create;
    17701770  SmallImp.PixelFormat := TPixelFormat.pf24bit;
     
    19191919            pix := pixNoSlaves;
    19201920          Hash := 0;
    1921           GrName := 'StdUnits.png';
     1921          GrName := 'StdUnits';
    19221922          Tribe[p1].SetModelPicture(Picture, True);
    19231923        end;
     
    29282928          InitTurn(NewPlayer);
    29292929          DipMem[Me].pContact := -1;
    2930           (* if (Me=0) and (MyRO.Alive and (1 shl Me)=0)} then
     2930          (* if (Me = 0) and (MyRO.Alive and (1 shl Me) = 0)} then
    29312931            begin
    2932             if SimpleQuery(Phrases.Lookup('RESIGN'))=mrIgnore then
    2933             Server(sResign,Me,0,nil^)
    2934             else Server(sBreak,Me,0,nil^)
     2932            if SimpleQuery(Phrases.Lookup('RESIGN')) = mrIgnore then
     2933            Server(sResign, Me, 0, nil^)
     2934            else Server(sBreak, Me, 0, nil^)
    29352935            end
    29362936            else Play('TURNSTART'); *)
  • branches/zoom/LocalPlayer/Tribes.pas

    r661 r717  
    322322      Item := Get;
    323323      sympix := GetNum;
    324       symHGr := LoadGraphicSet(Item + '.png');
     324      symHGr := LoadGraphicSet(Item + PngExt);
    325325    end;
    326326  end;
     
    442442            end;
    443443          end;
    444         cHGr := LoadGraphicSet(Item + '.png');
     444        cHGr := LoadGraphicSet(Item + PngExt);
    445445        for X := 0 to 3 do
    446446          with CityPicture[X] do begin
     
    461461      else
    462462      begin
    463         faceHGr := LoadGraphicSet(Item + '.png');
     463        faceHGr := LoadGraphicSet(Item + PngExt);
    464464        facepix := GetNum;
    465465        if faceHGr.Data.Canvas.Pixels[facepix mod 10 * 65,
     
    610610  LeastUsed := MaxInt;
    611611
    612   TestPic.GrName := 'StdUnits.png';
     612  TestPic.GrName := 'StdUnits';
    613613  HGr := HGrStdUnits;
    614614  for I := 0 to StdUnitScript.Count - 1 do
     
    625625    begin
    626626      Ok := True;
    627       TestPic.GrName := Copy(Input, 8, 255) + '.png';
     627      TestPic.GrName := Copy(Input, 8, 255);
    628628      HGr := GrExt.SearchByName(TestPic.GrName);
    629629    end
  • branches/zoom/LocalPlayer/UnitStat.pas

    r622 r717  
    8686  Template := TBitmap.Create;
    8787  Template.PixelFormat := TPixelFormat.pf24bit;
    88   LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'Unit.png',
     88  LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'Unit' + PngExt,
    8989    [gfNoGamma]);
    9090end;
  • branches/zoom/Localization/ru/Language2.txt

    • Property svn:mime-type deleted
  • branches/zoom/MiniMap.pas

    r704 r717  
    200200            else CM := Colors[Tile and fTerrain, I];
    201201          if (PByte(MiniPixel.Pixel) >= Bitmap.RawImage.Data) and
    202           (PByte(MiniPixel.Pixel) < (Bitmap.RawImage.Data + YY * MiniPixel.BytesPerLine)) then begin
     202          (PByte(MiniPixel.Pixel) < (Bitmap.RawImage.Data + YY * MiniPixel.BytesPerLine) - 1) then begin
    203203            MiniPixel.PixelB := (CM shr 16) and $ff;
    204204            MiniPixel.PixelG := (CM shr 8) and $ff;
     
    239239          fTerrain, I];
    240240        if (PByte(MiniPixel.Pixel) >= Bitmap.RawImage.Data) and
    241         (PByte(MiniPixel.Pixel) < (Bitmap.RawImage.Data + YY * MiniPixel.BytesPerLine)) then begin
     241        (PByte(MiniPixel.Pixel) < (Bitmap.RawImage.Data + YY * MiniPixel.BytesPerLine) - 1) then begin
    242242          MiniPixel.PixelB := ((CM shr 16) and $FF) * Brightness div 3;
    243243          MiniPixel.PixelG := ((CM shr 8) and $FF) * Brightness div 3;
     
    283283              PrevMiniPixel.SetX(XM);
    284284              if (PByte(PrevMiniPixel.Pixel) >= Bitmap.RawImage.Data) and
    285               (PByte(PrevMiniPixel.Pixel) < (Bitmap.RawImage.Data + YY * PrevMiniPixel.BytesPerLine)) then begin
     285              (PByte(PrevMiniPixel.Pixel) < (Bitmap.RawImage.Data + YY * PrevMiniPixel.BytesPerLine) - 1) then begin
    286286                PrevMiniPixel.PixelB := CM shr 16;
    287287                PrevMiniPixel.PixelG:= CM shr 8 and $FF;
     
    296296            CM := Colors[Tile and fTerrain, I];
    297297          if (PByte(MiniPixel.Pixel) >= Bitmap.RawImage.Data) and
    298           (PByte(MiniPixel.Pixel) < (Bitmap.RawImage.Data + YY * MiniPixel.BytesPerLine)) then begin
     298          (PByte(MiniPixel.Pixel) < (Bitmap.RawImage.Data + YY * MiniPixel.BytesPerLine) - 1) then begin
    299299            MiniPixel.PixelB := (CM shr 16) and $ff;
    300300            MiniPixel.PixelG := (CM shr 8) and $ff;
     
    368368              PrevMiniPixel.SetX(XM);
    369369              if (PByte(PrevMiniPixel.Pixel) >= Bitmap.RawImage.Data) and
    370               (PByte(PrevMiniPixel.Pixel) < (Bitmap.RawImage.Data + YY * PrevMiniPixel.BytesPerLine)) then begin
     370              (PByte(PrevMiniPixel.Pixel) < (Bitmap.RawImage.Data + YY * PrevMiniPixel.BytesPerLine) - 1) then begin
    371371                PrevMiniPixel.PixelB := (CM shr 16) and $ff;
    372372                PrevMiniPixel.PixelG := (CM shr 8) and $ff;
     
    393393          end;
    394394          if (PByte(MiniPixel.Pixel) >= Bitmap.RawImage.Data) and
    395           (PByte(MiniPixel.Pixel) < (Bitmap.RawImage.Data + YY * MiniPixel.BytesPerLine)) then begin
     395          (PByte(MiniPixel.Pixel) < (Bitmap.RawImage.Data + YY * MiniPixel.BytesPerLine) - 1) then begin
    396396            MiniPixel.PixelB := (CM shr 16) and $ff;
    397397            MiniPixel.PixelG := (CM shr 8) and $ff;
  • branches/zoom/Packages/CevoComponents/Directories.pas

    r664 r717  
    2222
    2323uses
    24   FileUtil, LCLIntf, LCLType, LCLProc, LazUTF8, SysUtils, LazFileUtils, Forms;
     24  FileUtil, LCLIntf, LCLType, LCLProc, LazUTF8, SysUtils, LazFileUtils, Forms,
     25  Translations;
    2526
    2627function GetAppSharePath(Path: string): string;
     
    3334  {$IFDEF UNIX}
    3435  // If installed in Linux system then try to use different installation directory
     36  NewPath := ExtractFileDir(Application.ExeName) + DirectorySeparator + '..' +
     37    DirectorySeparator + 'share' + DirectorySeparator +
     38    ExtractFileNameOnly(Application.ExeName) + DirectorySeparator + Path;
     39
    3540  if not DirectoryExists(Result) then begin
    36     NewPath := ExtractFileDir(Application.ExeName) + DirectorySeparator + '..' +
    37       DirectorySeparator + 'share' + DirectorySeparator +
    38       ExtractFileNameOnly(Application.ExeName) + DirectorySeparator + Path;
    3941    if DirectoryExists(NewPath) then begin
    4042      Result := NewPath;
     
    4244    end;
    4345  end;
     46
    4447  if not FileExists(Result) then begin
    45     NewPath := ExtractFileDir(Application.ExeName) + DirectorySeparator + '..' +
    46       DirectorySeparator + 'share' + DirectorySeparator +
    47       ExtractFileNameOnly(Application.ExeName) + DirectorySeparator + Path;
    4848    if FileExists(NewPath) then begin
    4949      Result := NewPath;
     
    5656function GetLocale: string;
    5757var
    58   Lang: string;
    5958  I: Integer;
    60   T: string;
     59  LanguageID: TLanguageID;
    6160begin
    6261  // Win32 user may decide to override locale with LANG variable.
    63   Lang := Copy(GetEnvironmentVariableUTF8('LANG'), 1, 2);
     62  Result := Copy(GetEnvironmentVariableUTF8('LANG'), 1, 2);
    6463
    65   if Lang = '' then begin
    66     for I := 1 to Paramcount - 1 do
     64  if Result = '' then begin
     65    for I := 1 to ParamCount - 1 do
    6766      if (ParamStrUTF8(I) = '--LANG') or (ParamStrUTF8(I) = '-l') or
    6867        (ParamStrUTF8(I) = '--lang') then
    69           Lang := ParamStrUTF8(I + 1);
     68          Result := ParamStrUTF8(I + 1);
    7069  end;
    71   if Lang = '' then begin
    72     T := '';
    73     LazGetLanguageIDs(Lang, T);
    74     Lang := Copy(Lang, 1, 2);
     70  if Result = '' then begin
     71    LanguageID := GetLanguageID;
     72    Result := Copy(LanguageID.LanguageID, 1, 2);
    7573  end;
    76 
    77   Result := Lang;
    7874end;
    7975
  • branches/zoom/Packages/CevoComponents/ScreenTools.pas

    r684 r717  
    116116
    117117const
     118  BmpExt = '.bmp';
     119  PngExt = '.png';
     120  JpgExt = '.jpg';
     121
    118122  TransparentColor1 = $FF00FF;
    119123  TransparentColor2 = $7F007F;
     
    434438  Result := False;
    435439  if ExtractFileExt(FileName) = '' then
    436     FileName := FileName + '.png';
     440    FileName := FileName + PngExt;
    437441
    438442  if FileExists(FileName) then begin
    439     if ExtractFileExt(FileName) = '.jpg' then begin
     443    if ExtractFileExt(FileName) = JpgExt then begin
    440444      Jpeg := TJpegImage.Create;
    441445      try
     
    451455      FreeAndNil(Jpeg);
    452456    end else
    453     if ExtractFileExt(FileName) = '.png' then begin
     457    if ExtractFileExt(FileName) = PngExt then begin
    454458      Png := TPortableNetworkGraphic.Create;
    455459      try
     
    473477      FreeAndNil(Png);
    474478    end else
    475     if ExtractFileExt(FileName) = '.bmp' then begin
     479    if ExtractFileExt(FileName) = BmpExt then begin
    476480      try
    477481        Bmp.LoadFromFile(FileName);
     
    17991803
    18001804procedure Gtk2DisableControlStyling(WinControl: TWinControl);
    1801 begin
     1805{$IFDEF LCLGTK2}
     1806var
     1807  GtkWhite: string;
     1808  GtkBlue: string;
     1809  GtkBlack: string;
     1810  GtkOrange: string;
     1811{$ENDIF}
     1812begin
     1813  {$IFDEF LCLGTK2}
    18021814  // https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/38516
    1803   {$IFDEF LCLGTK2}
     1815  GtkBlue := '{ 0.373, 0.467, 0.796 }';
     1816  GtkWhite := '{ 1.0, 1.0, 1.0 }';
     1817  GtkBlack := '{ 0, 0, 0 }';
     1818  GtkOrange := '{ 0.373, 0.465, 0.793 }';
     1819
    18041820  // parse gtkrc from string
    18051821  gtk_rc_parse_string(PChar('style "noengine" {' + LineEnding +
    1806     'engine "" {}' + LineEnding +
     1822    'engine "" { }' + LineEnding +
     1823
     1824    'base[INSENSITIVE] = ' + GtkBlack + LineEnding +
     1825    'base[PRELIGHT] = ' + GtkBlack + LineEnding +
     1826    'base[NORMAL] = ' + GtkBlack + LineEnding +
     1827    'base[SELECTED] = ' + GtkBlue + LineEnding +
     1828    'base[ACTIVE] = ' + GtkBlack + LineEnding +
     1829
     1830    'text[INSENSITIVE] = ' + GtkOrange + LineEnding +
     1831    'text[NORMAL] = ' + GtkOrange + LineEnding +
     1832    'text[PRELIGHT] = ' + GtkOrange + LineEnding +
     1833    'text[SELECTED] = ' + GtkWhite + LineEnding +
     1834    'text[ACTIVE] = ' + GtkOrange + LineEnding +
     1835
    18071836    '}' + LineEnding +
    18081837    'widget "*.your-edit" style "noengine"'));
     
    18571886  LoadPhrases;
    18581887  LoadFonts;
    1859   Templates := LoadGraphicSet('Templates.png', False);
     1888  Templates := LoadGraphicSet('Templates' + PngExt, False);
    18601889  with Templates do begin
    18611890    Logo := GetItem('Logo');
     
    18731902  end;
    18741903
    1875   LoadGraphicFile(Colors, GetGraphicsDir + DirectorySeparator + 'Colors.png');
    1876   LoadGraphicFile(Paper, GetGraphicsDir + DirectorySeparator + 'Paper.jpg');
    1877   LoadGraphicFile(BigImp, GetGraphicsDir + DirectorySeparator + 'Icons.png');
     1904  LoadGraphicFile(Colors, GetGraphicsDir + DirectorySeparator + 'Colors' + PngExt);
     1905  LoadGraphicFile(Paper, GetGraphicsDir + DirectorySeparator + 'Paper' + JpgExt);
     1906  LoadGraphicFile(BigImp, GetGraphicsDir + DirectorySeparator + 'Icons' + PngExt);
    18781907end;
    18791908
     
    18981927  GrExt := TGraphicSets.Create;
    18991928
    1900   HGrSystem := LoadGraphicSet('System.png');
     1929  HGrSystem := LoadGraphicSet('System' + PngExt);
    19011930  with HGrSystem do begin
    19021931    CityMark1 := GetItem('CityMark1');
     
    19041933  end;
    19051934
    1906   HGrSystem2 := LoadGraphicSet('System2.png');
     1935  HGrSystem2 := LoadGraphicSet('System2' + PngExt);
    19071936  with HGrSystem2 do begin
    19081937    Ornament := GetItem('Ornament');
  • branches/zoom/Packages/CevoComponents/Texture.pas

    r471 r717  
    4747  FAge := AValue;
    4848  LoadGraphicFile(Image, GetGraphicsDir + DirectorySeparator +
    49     'Texture' + IntToStr(Age + 1) + '.jpg');
     49    'Texture' + IntToStr(Age + 1) + JpgExt);
    5050  ColorBevelLight := Colors.Canvas.Pixels[clkAge0 + Age, cliBevelLight];
    5151  ColorBevelShade := Colors.Canvas.Pixels[clkAge0 + Age, cliBevelShade];
  • branches/zoom/Packages/DpiControls/Dpi.StdCtrls.pas

    r673 r717  
    3838  TEdit = class(TWinControl)
    3939  private
     40    function GetAutoSelect: Boolean;
    4041    function GetSelLength: Integer;
    4142    function GetSelStart: Integer;
     43    procedure SetAutoSelect(AValue: Boolean);
    4244    procedure SetSelLength(AValue: Integer);
    4345    procedure SetSelStart(AValue: Integer);
     
    5658    property BorderStyle default bsSingle;
    5759    property ParentFont;
     60    property AutoSelect: Boolean read GetAutoSelect write SetAutoSelect default True;
    5861  end;
    5962
     
    303306end;
    304307
     308function TEdit.GetAutoSelect: Boolean;
     309begin
     310  Result := GetNativeEdit.AutoSelect;
     311end;
     312
    305313function TEdit.GetSelLength: Integer;
    306314begin
     
    311319begin
    312320  Result := GetNativeEdit.SelStart;
     321end;
     322
     323procedure TEdit.SetAutoSelect(AValue: Boolean);
     324begin
     325  GetNativeEdit.AutoSelect := AValue;
    313326end;
    314327
  • branches/zoom/Settings.pas

    r681 r717  
    66  Classes, SysUtils, FileUtil, Dialogs, LCLProc, ScreenTools, Messg, ButtonA,
    77  Directories, DrawDlg, ButtonC, KeyBindings, Languages, ListBoxEx,
    8   {$IFDEF DPI}Dpi.Forms, Dpi.Controls, Dpi.Graphics, Dpi.StdCtrls, System.UITypes{$ELSE}
     8  {$IFDEF DPI}Dpi.Forms, Dpi.Controls, Dpi.Graphics, Dpi.StdCtrls{$ELSE}
    99  Forms, Controls, Graphics, StdCtrls{$ENDIF}, Controls;
    1010
     
    5656    LocalGamma: Integer;
    5757    LocalKeyBindings: TKeyBindings;
    58     LocalMusicEnabled: Integer;
    5958    LocalMusicVolume: Integer;
    6059    CurrentKeyBinding: TKeyBinding;
  • branches/zoom/Start.pas

    r685 r717  
    55
    66uses
    7   GameServer, Messg, ButtonBase, ButtonA, ButtonC, ButtonB, Area, Types,
    8   LCLIntf, LCLType, SysUtils, Classes, BaseWin, ListBoxEx, LazFileUtils,
     7  GameServer, Messg, ButtonBase, ButtonA, ButtonC, ButtonB, Area,
     8  LCLIntf, LCLType, SysUtils, Classes, BaseWin, ListBoxEx, LazFileUtils, Math,
    99  Registry, DrawDlg, Generics.Collections, Protocol, MiniMap, Brain, Translator,
    1010  {$IFDEF DPI}System.UITypes, Dpi.Graphics, Dpi.Controls, Dpi.Forms, Dpi.StdCtrls,
     
    520520  r0, r1: HRgn;
    521521  Location: TPoint;
     522  Shift: TPoint;
    522523begin
    523524  if FullScreen then begin
    524     Location := Point(Screen.PrimaryMonitor.Left + (Screen.PrimaryMonitor.Width - 800) * 3 div 8,
    525       Screen.PrimaryMonitor.Top + Screen.PrimaryMonitor.Height - Height - (Screen.PrimaryMonitor.Height - 600) div 3);
     525    Shift := Point(((Screen.PrimaryMonitor.Width - Min(Screen.PrimaryMonitor.Width, 800)) * 3 div 8),
     526      (Screen.PrimaryMonitor.Height - Min(Screen.PrimaryMonitor.Height, 600)) div 3);
     527    Location := Point(Screen.PrimaryMonitor.Left + Shift.X,
     528      Screen.PrimaryMonitor.Top + Screen.PrimaryMonitor.Height - Height - Shift.Y);
    526529    BoundsRect := Bounds(Location.X, Location.Y, Width, Height);
    527530
Note: See TracChangeset for help on using the changeset viewer.