Ignore:
Timestamp:
Apr 6, 2021, 8:11:02 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Merged trunk branch version r348 into highdpi branch.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/LocalPlayer/Select.pas

    r303 r349  
    66uses
    77  UDpiControls, Protocol, ClientTools, Term, ScreenTools, IsoEngine, PVSB, BaseWin,
    8 
    98  LCLIntf, LCLType, Messages, SysUtils, Classes, Graphics, Controls, Forms,
    109  ExtCtrls, ButtonB, ButtonBase, Menus, Types;
     
    4645  private
    4746    Kind: TListKind;
    48     LineDistance, MaxLines, cixProject, pView, Sel, DispLines, Layer, nColumn,
    49       TechNameSpace, ScienceNation: integer;
     47    LineDistance: Integer;
     48    MaxLines: Integer;
     49    cixProject: Integer;
     50    pView: Integer;
     51    Sel: Integer;
     52    DispLines: Integer;
     53    Layer: Integer;
     54    nColumn: Integer;
     55    TechNameSpace: Integer;
     56    ScienceNation: Integer;
    5057    sb: TPVScrollbar;
    5158    Lines, FirstShrinkedLine: array [0 .. MaxLayer - 1] of integer;
    5259    code: array [0 .. MaxLayer - 1, 0 .. 4095] of integer;
    5360    Column: array [0 .. nPl - 1] of integer;
    54     Closable, MultiPage: boolean;
    55     ScienceNationDot: TDpiBitmap;
     61    Closable: Boolean;
     62    MultiPage: Boolean;
     63    ScienceNationDotBuffer: TDpiBitmap;
    5664    procedure ScrollBarUpdate(Sender: TObject);
    5765    procedure InitLines;
     
    8694  ModalSelectDlg: TModalSelectDlg;
    8795
     96
    8897implementation
    8998
     
    109118  Layer1Btn.Hint := Phrases.Lookup('BTN_WONDERS');
    110119  Layer2Btn.Hint := Phrases.Lookup('BTN_CLASSES');
    111   ScienceNationDot := TDpiBitmap.Create;
    112   ScienceNationDot.PixelFormat := pf24bit;
    113   ScienceNationDot.SetSize(17, 17);
    114   ScienceNationDot.Canvas.FillRect(0, 0, ScienceNationDot.Width, ScienceNationDot.Height);
     120  ScienceNationDotBuffer := TDpiBitmap.Create;
     121  ScienceNationDotBuffer.PixelFormat := pf24bit;
     122  ScienceNationDotBuffer.SetSize(17, 17);
     123  ScienceNationDotBuffer.Canvas.FillRect(0, 0, ScienceNationDotBuffer.Width, ScienceNationDotBuffer.Height);
    115124end;
    116125
     
    118127begin
    119128  FreeAndNil(sb);
    120   FreeAndNil(ScienceNationDot);
     129  FreeAndNil(ScienceNationDotBuffer);
    121130end;
    122131
     
    578587                j := AdvValue[lix] div 1000;
    579588                DpiBitCanvas(offscreen.Canvas, (8 + 16 - 4), y0 + 2, 14, 14,
    580                   GrExt[HGrSystem].Mask.Canvas, 127 + j * 15,
     589                  HGrSystem.Mask.Canvas, 127 + j * 15,
    581590                  85, SRCAND);
    582591                Sprite(offscreen, HGrSystem, (8 + 16 - 5), y0 + 1, 14, 14,
     
    816825        LoweredTextOut(Canvas, -1, MainTexture, xScreen + 10,
    817826          ClientHeight - 29, s);
    818         DpiBitCanvas(ScienceNationDot.Canvas, 0, 0, 17, 17, Canvas,
    819           xScreen - 10, ClientHeight - 27);
    820         ImageOp_BCC(ScienceNationDot, Templates, 0, 0, 114, 211, 17, 17,
    821           MainTexture.clBevelShade, Tribe[ScienceNation].Color);
    822         DpiBitCanvas(Canvas, xScreen - 10, ClientHeight - 27, 17, 17,
    823           ScienceNationDot.Canvas, 0, 0);
    824       end;
    825     end
     827        DpiBitCanvas(ScienceNationDotBuffer.Canvas, 0, 0, ScienceNationDot.Width,
     828          ScienceNationDot.Height, Canvas, xScreen - 10, ClientHeight - 27);
     829        ImageOp_BCC(ScienceNationDotBuffer, Templates.Data, Point(0, 0),
     830          ScienceNationDot.BoundsRect, MainTexture.clBevelShade, Tribe[ScienceNation].Color);
     831        DpiBitCanvas(Canvas, xScreen - 10, ClientHeight - 27, ScienceNationDot.Width,
     832          ScienceNationDot.Height, ScienceNationDotBuffer.Canvas, 0, 0);
     833      end;
     834    end;
    826835  end;
    827836end;
     
    854863    begin
    855864      CityDlg.FormShow(nil);
    856       CityDlg.Invalidate
     865      CityDlg.Invalidate;
    857866    end;
    858     result := true
     867    result := true;
    859868  end
    860869  else
    861     result := false
     870    result := false;
    862871end;
    863872
     
    880889    begin
    881890      UnitStatDlg.FormShow(nil);
    882       UnitStatDlg.Invalidate
     891      UnitStatDlg.Invalidate;
    883892    end;
    884     result := true
     893    result := true;
    885894  end
    886895  else
    887     result := false
     896    result := false;
    888897end;
    889898
     
    904913      result := lix;
    905914      Closable := true;
    906       Close
    907     end
     915      Close;
     916    end;
    908917  end
    909918  else if (ssLeft in Shift) and (ssShift in Shift) then
     
    948957        kShipPart, kEShipPart:
    949958          ;
    950       end
     959      end;
    951960  end
    952961  else if ssRight in Shift then
     
    960969          if RenameModel(lix) then
    961970            SmartUpdateContent;
    962       end
    963   end
     971      end;
     972  end;
    964973end;
    965974
     
    990999            swap := code[0, i];
    9911000            code[0, i] := code[0, j];
    992             code[0, j] := swap
     1001            code[0, j] := swap;
    9931002          end;
    9941003  end;
     
    10051014          swap := code[0, i];
    10061015          code[0, i] := code[0, j];
    1007           code[0, j] := swap
     1016          code[0, j] := swap;
    10081017        end;
    10091018  end;
     
    10461055      if (AdvPreq[i, 1] >= 0) then
    10471056        MarkPreqs(AdvPreq[i, 1]);
    1048     end
     1057    end;
    10491058  end;
    10501059
     
    10591068  begin
    10601069    Lines[i] := 0;
    1061     FirstShrinkedLine[i] := MaxInt
     1070    FirstShrinkedLine[i] := MaxInt;
    10621071  end;
    10631072  case Kind of
     
    10671076        code[0, 0] := cpImp + imTrGoods;
    10681077        Lines[0] := 1;
    1069         for i := 28 to nImp - 1 do
     1078        for i := nWonder to nImp - 1 do
    10701079          if Imp[i].Kind = ikCommon then
    10711080            TryAddImpLine(0, i + cpImp);
    1072         for i := 28 to nImp - 1 do
     1081        for i := nWonder to nImp - 1 do
    10731082          if not(Imp[i].Kind in [ikCommon, ikTrGoods]) and
    10741083            ((MyRO.NatBuilt[i] = 0) or (Imp[i].Kind = ikNatLocal)) then
     
    10821091
    10831092        // wonders
    1084         for i := 0 to 27 do
     1093        for i := 0 to nWonder - 1 do
    10851094          TryAddImpLine(1, i + cpImp);
    10861095
     
    11021111                    (MyMap[Loc1] and fCanal > 0)) then
    11031112                    ok := true;
    1104                 end
     1113                end;
    11051114          end
    11061115          else
     
    11111120            begin
    11121121              code[2, Lines[2]] := i;
    1113               inc(Lines[2])
     1122              inc(Lines[2]);
    11141123            end;
    11151124            if MyModel[i].Status and msAllowConscripts <> 0 then
    11161125            begin
    11171126              code[2, Lines[2]] := i + cpConscripts;
    1118               inc(Lines[2])
     1127              inc(Lines[2]);
    11191128            end;
    11201129          end;
     
    11521161        begin
    11531162          code[0, Lines[0]] := adMilitary;
    1154           inc(Lines[0])
     1163          inc(Lines[0]);
    11551164        end;
    11561165      end;
     
    12691278            begin
    12701279              code[0, Lines[0]] := i;
    1271               inc(Lines[0])
     1280              inc(Lines[0]);
    12721281            end;
    12731282        SortCities;
     
    12811290          begin
    12821291            code[0, Lines[0]] := i;
    1283             inc(Lines[0])
     1292            inc(Lines[0]);
    12841293          end;
    12851294        SortCities;
    1286         FirstShrinkedLine[0] := 0
     1295        FirstShrinkedLine[0] := 0;
    12871296      end;
    12881297    { kChooseECity:
     
    13041313        Lines[0] := MyRO.nModel;
    13051314        SortModels;
    1306         FirstShrinkedLine[0] := 0
     1315        FirstShrinkedLine[0] := 0;
    13071316      end;
    13081317    kChooseModel:
     
    13281337        begin
    13291338          code[0, Lines[0]] := mixAll;
    1330           inc(Lines[0]);
    1331         end;
    1332         FirstShrinkedLine[0] := 0
     1339          inc(Lines[0]);;
     1340        end;
     1341        FirstShrinkedLine[0] := 0;
    13331342      end;
    13341343    kChooseEModel:
     
    13481357          if ModelOk[emix] then
    13491358          begin
    1350             if Tribe[DipMem[me].pContact].ModelPicture
    1351               [MyRO.EnemyModel[emix].mix].HGr = 0 then
     1359            if not Assigned(Tribe[DipMem[me].pContact].ModelPicture
     1360              [MyRO.EnemyModel[emix].mix].HGr) then
    13521361              InitEnemyModel(emix);
    13531362            code[0, Lines[0]] := emix;
     
    13611370          inc(Lines[0]);
    13621371        end;
    1363         FirstShrinkedLine[0] := 0
     1372        FirstShrinkedLine[0] := 0;
    13641373      end;
    13651374    kEModels:
     
    13721381            (MyRO.EnemyModel[code[1, Lines[0]]].mix = i)) do
    13731382            dec(code[1, Lines[0]]);
    1374           if Tribe[pView].ModelPicture[i].HGr = 0 then
     1383          if not Assigned(Tribe[pView].ModelPicture[i].HGr) then
    13751384            InitEnemyModel(code[1, Lines[0]]);
    13761385          code[0, Lines[0]] := i;
     
    13801389        end;
    13811390        SortModels;
    1382         FirstShrinkedLine[0] := 0
     1391        FirstShrinkedLine[0] := 0;
    13831392      end;
    13841393    kAllEModels:
     
    13931402            PPicture := @Tribe[MyRO.EnemyModel[emix].Owner].ModelPicture
    13941403              [MyRO.EnemyModel[emix].mix];
    1395             if PPicture.HGr = 0 then
     1404            if not Assigned(PPicture.HGr) then
    13961405              InitEnemyModel(emix);
    13971406            ok := true;
     
    14081417                  code[1, j] := 1;
    14091418                  ok := false;
    1410                   Break
     1419                  Break;
    14111420                end;
    14121421              end;
     
    14171426              code[2, Lines[0]] := ModelSortValue(MyRO.EnemyModel[emix], true);
    14181427              inc(Lines[0]);
    1419             end
     1428            end;
    14201429          end;
    14211430        SortModels;
     
    14261435      begin
    14271436        code[0, Lines[0]] := i;
    1428         inc(Lines[0])
     1437        inc(Lines[0]);
    14291438      end;
    14301439    (* kDeliver:
     
    14711480        begin
    14721481          code[0, Lines[0]] := i;
    1473           inc(Lines[0])
     1482          inc(Lines[0]);
    14741483        end;
    14751484    kMission:
     
    14771486      begin
    14781487        code[0, Lines[0]] := i;
    1479         inc(Lines[0])
     1488        inc(Lines[0]);
    14801489      end;
    14811490  end;
     
    15881597          TechNameSpace := TechNameSpace + 640 - InnerWidth - 2 * SideFrame;
    15891598          InnerWidth := 640 - 2 * SideFrame
    1590         end
     1599        end;
    15911600      end;
    15921601    kAdvance, kFarAdvance:
     
    16971706  begin
    16981707    ToggleBtn.ButtonIndex := 13;
    1699     ToggleBtn.Hint := Phrases.Lookup('FARTECH')
     1708    ToggleBtn.Hint := Phrases.Lookup('FARTECH');
    17001709  end
    17011710  else if Kind = kCities then
    17021711  begin
    17031712    ToggleBtn.ButtonIndex := 15;
    1704     ToggleBtn.Hint := Phrases.Lookup('BTN_PAGE')
     1713    ToggleBtn.Hint := Phrases.Lookup('BTN_PAGE');
    17051714  end
    17061715  else
    17071716  begin
    17081717    ToggleBtn.ButtonIndex := 28;
    1709     ToggleBtn.Hint := Phrases.Lookup('BTN_SELECT')
     1718    ToggleBtn.Hint := Phrases.Lookup('BTN_SELECT');
    17101719  end;
    17111720
     
    17421751    ShowNewContent(NewMode, kModels)
    17431752  else
    1744     ShowNewContent(NewMode, kEModels)
     1753    ShowNewContent(NewMode, kEModels);
    17451754end;
    17461755
     
    17581767  sb.Init(Lines[Layer] - 1, DispLines);
    17591768  OffscreenPaint;
    1760   Invalidate
     1769  Invalidate;
    17611770end;
    17621771
     
    17701779  Sel := -2;
    17711780  sb.Init(Lines[Layer] - 1, DispLines);
    1772   SmartUpdateContent
     1781  SmartUpdateContent;
    17731782end;
    17741783
     
    17831792        result := adFar;
    17841793        Closable := true;
    1785         Close
     1794        Close;
    17861795      end;
    17871796    kCities, kCityEvents:
     
    18231832        Popup.Popup(Left + ToggleBtn.Left, Top + ToggleBtn.Top +
    18241833          ToggleBtn.Height);
    1825       end
    1826   end
     1834      end;
     1835  end;
    18271836end;
    18281837
     
    18371846  // prevent closing
    18381847  else
    1839     inherited
     1848    inherited;
    18401849end;
    18411850
     
    18431852begin
    18441853  if Visible and (Kind = kCities) then
    1845     SmartUpdateContent
     1854    SmartUpdateContent;
    18461855end;
    18471856
Note: See TracChangeset for help on using the changeset viewer.