Changeset 349 for branches/highdpi/LocalPlayer/Select.pas
- Timestamp:
- Apr 6, 2021, 8:11:02 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/Select.pas
r303 r349 6 6 uses 7 7 UDpiControls, Protocol, ClientTools, Term, ScreenTools, IsoEngine, PVSB, BaseWin, 8 9 8 LCLIntf, LCLType, Messages, SysUtils, Classes, Graphics, Controls, Forms, 10 9 ExtCtrls, ButtonB, ButtonBase, Menus, Types; … … 46 45 private 47 46 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; 50 57 sb: TPVScrollbar; 51 58 Lines, FirstShrinkedLine: array [0 .. MaxLayer - 1] of integer; 52 59 code: array [0 .. MaxLayer - 1, 0 .. 4095] of integer; 53 60 Column: array [0 .. nPl - 1] of integer; 54 Closable, MultiPage: boolean; 55 ScienceNationDot: TDpiBitmap; 61 Closable: Boolean; 62 MultiPage: Boolean; 63 ScienceNationDotBuffer: TDpiBitmap; 56 64 procedure ScrollBarUpdate(Sender: TObject); 57 65 procedure InitLines; … … 86 94 ModalSelectDlg: TModalSelectDlg; 87 95 96 88 97 implementation 89 98 … … 109 118 Layer1Btn.Hint := Phrases.Lookup('BTN_WONDERS'); 110 119 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); 115 124 end; 116 125 … … 118 127 begin 119 128 FreeAndNil(sb); 120 FreeAndNil(ScienceNationDot );129 FreeAndNil(ScienceNationDotBuffer); 121 130 end; 122 131 … … 578 587 j := AdvValue[lix] div 1000; 579 588 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, 581 590 85, SRCAND); 582 591 Sprite(offscreen, HGrSystem, (8 + 16 - 5), y0 + 1, 14, 14, … … 816 825 LoweredTextOut(Canvas, -1, MainTexture, xScreen + 10, 817 826 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; 826 835 end; 827 836 end; … … 854 863 begin 855 864 CityDlg.FormShow(nil); 856 CityDlg.Invalidate 865 CityDlg.Invalidate; 857 866 end; 858 result := true 867 result := true; 859 868 end 860 869 else 861 result := false 870 result := false; 862 871 end; 863 872 … … 880 889 begin 881 890 UnitStatDlg.FormShow(nil); 882 UnitStatDlg.Invalidate 891 UnitStatDlg.Invalidate; 883 892 end; 884 result := true 893 result := true; 885 894 end 886 895 else 887 result := false 896 result := false; 888 897 end; 889 898 … … 904 913 result := lix; 905 914 Closable := true; 906 Close 907 end 915 Close; 916 end; 908 917 end 909 918 else if (ssLeft in Shift) and (ssShift in Shift) then … … 948 957 kShipPart, kEShipPart: 949 958 ; 950 end 959 end; 951 960 end 952 961 else if ssRight in Shift then … … 960 969 if RenameModel(lix) then 961 970 SmartUpdateContent; 962 end 963 end 971 end; 972 end; 964 973 end; 965 974 … … 990 999 swap := code[0, i]; 991 1000 code[0, i] := code[0, j]; 992 code[0, j] := swap 1001 code[0, j] := swap; 993 1002 end; 994 1003 end; … … 1005 1014 swap := code[0, i]; 1006 1015 code[0, i] := code[0, j]; 1007 code[0, j] := swap 1016 code[0, j] := swap; 1008 1017 end; 1009 1018 end; … … 1046 1055 if (AdvPreq[i, 1] >= 0) then 1047 1056 MarkPreqs(AdvPreq[i, 1]); 1048 end 1057 end; 1049 1058 end; 1050 1059 … … 1059 1068 begin 1060 1069 Lines[i] := 0; 1061 FirstShrinkedLine[i] := MaxInt 1070 FirstShrinkedLine[i] := MaxInt; 1062 1071 end; 1063 1072 case Kind of … … 1067 1076 code[0, 0] := cpImp + imTrGoods; 1068 1077 Lines[0] := 1; 1069 for i := 28to nImp - 1 do1078 for i := nWonder to nImp - 1 do 1070 1079 if Imp[i].Kind = ikCommon then 1071 1080 TryAddImpLine(0, i + cpImp); 1072 for i := 28to nImp - 1 do1081 for i := nWonder to nImp - 1 do 1073 1082 if not(Imp[i].Kind in [ikCommon, ikTrGoods]) and 1074 1083 ((MyRO.NatBuilt[i] = 0) or (Imp[i].Kind = ikNatLocal)) then … … 1082 1091 1083 1092 // wonders 1084 for i := 0 to 27do1093 for i := 0 to nWonder - 1 do 1085 1094 TryAddImpLine(1, i + cpImp); 1086 1095 … … 1102 1111 (MyMap[Loc1] and fCanal > 0)) then 1103 1112 ok := true; 1104 end 1113 end; 1105 1114 end 1106 1115 else … … 1111 1120 begin 1112 1121 code[2, Lines[2]] := i; 1113 inc(Lines[2]) 1122 inc(Lines[2]); 1114 1123 end; 1115 1124 if MyModel[i].Status and msAllowConscripts <> 0 then 1116 1125 begin 1117 1126 code[2, Lines[2]] := i + cpConscripts; 1118 inc(Lines[2]) 1127 inc(Lines[2]); 1119 1128 end; 1120 1129 end; … … 1152 1161 begin 1153 1162 code[0, Lines[0]] := adMilitary; 1154 inc(Lines[0]) 1163 inc(Lines[0]); 1155 1164 end; 1156 1165 end; … … 1269 1278 begin 1270 1279 code[0, Lines[0]] := i; 1271 inc(Lines[0]) 1280 inc(Lines[0]); 1272 1281 end; 1273 1282 SortCities; … … 1281 1290 begin 1282 1291 code[0, Lines[0]] := i; 1283 inc(Lines[0]) 1292 inc(Lines[0]); 1284 1293 end; 1285 1294 SortCities; 1286 FirstShrinkedLine[0] := 0 1295 FirstShrinkedLine[0] := 0; 1287 1296 end; 1288 1297 { kChooseECity: … … 1304 1313 Lines[0] := MyRO.nModel; 1305 1314 SortModels; 1306 FirstShrinkedLine[0] := 0 1315 FirstShrinkedLine[0] := 0; 1307 1316 end; 1308 1317 kChooseModel: … … 1328 1337 begin 1329 1338 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; 1333 1342 end; 1334 1343 kChooseEModel: … … 1348 1357 if ModelOk[emix] then 1349 1358 begin 1350 if Tribe[DipMem[me].pContact].ModelPicture1351 [MyRO.EnemyModel[emix].mix].HGr = 0then1359 if not Assigned(Tribe[DipMem[me].pContact].ModelPicture 1360 [MyRO.EnemyModel[emix].mix].HGr) then 1352 1361 InitEnemyModel(emix); 1353 1362 code[0, Lines[0]] := emix; … … 1361 1370 inc(Lines[0]); 1362 1371 end; 1363 FirstShrinkedLine[0] := 0 1372 FirstShrinkedLine[0] := 0; 1364 1373 end; 1365 1374 kEModels: … … 1372 1381 (MyRO.EnemyModel[code[1, Lines[0]]].mix = i)) do 1373 1382 dec(code[1, Lines[0]]); 1374 if Tribe[pView].ModelPicture[i].HGr = 0then1383 if not Assigned(Tribe[pView].ModelPicture[i].HGr) then 1375 1384 InitEnemyModel(code[1, Lines[0]]); 1376 1385 code[0, Lines[0]] := i; … … 1380 1389 end; 1381 1390 SortModels; 1382 FirstShrinkedLine[0] := 0 1391 FirstShrinkedLine[0] := 0; 1383 1392 end; 1384 1393 kAllEModels: … … 1393 1402 PPicture := @Tribe[MyRO.EnemyModel[emix].Owner].ModelPicture 1394 1403 [MyRO.EnemyModel[emix].mix]; 1395 if PPicture.HGr = 0then1404 if not Assigned(PPicture.HGr) then 1396 1405 InitEnemyModel(emix); 1397 1406 ok := true; … … 1408 1417 code[1, j] := 1; 1409 1418 ok := false; 1410 Break 1419 Break; 1411 1420 end; 1412 1421 end; … … 1417 1426 code[2, Lines[0]] := ModelSortValue(MyRO.EnemyModel[emix], true); 1418 1427 inc(Lines[0]); 1419 end 1428 end; 1420 1429 end; 1421 1430 SortModels; … … 1426 1435 begin 1427 1436 code[0, Lines[0]] := i; 1428 inc(Lines[0]) 1437 inc(Lines[0]); 1429 1438 end; 1430 1439 (* kDeliver: … … 1471 1480 begin 1472 1481 code[0, Lines[0]] := i; 1473 inc(Lines[0]) 1482 inc(Lines[0]); 1474 1483 end; 1475 1484 kMission: … … 1477 1486 begin 1478 1487 code[0, Lines[0]] := i; 1479 inc(Lines[0]) 1488 inc(Lines[0]); 1480 1489 end; 1481 1490 end; … … 1588 1597 TechNameSpace := TechNameSpace + 640 - InnerWidth - 2 * SideFrame; 1589 1598 InnerWidth := 640 - 2 * SideFrame 1590 end 1599 end; 1591 1600 end; 1592 1601 kAdvance, kFarAdvance: … … 1697 1706 begin 1698 1707 ToggleBtn.ButtonIndex := 13; 1699 ToggleBtn.Hint := Phrases.Lookup('FARTECH') 1708 ToggleBtn.Hint := Phrases.Lookup('FARTECH'); 1700 1709 end 1701 1710 else if Kind = kCities then 1702 1711 begin 1703 1712 ToggleBtn.ButtonIndex := 15; 1704 ToggleBtn.Hint := Phrases.Lookup('BTN_PAGE') 1713 ToggleBtn.Hint := Phrases.Lookup('BTN_PAGE'); 1705 1714 end 1706 1715 else 1707 1716 begin 1708 1717 ToggleBtn.ButtonIndex := 28; 1709 ToggleBtn.Hint := Phrases.Lookup('BTN_SELECT') 1718 ToggleBtn.Hint := Phrases.Lookup('BTN_SELECT'); 1710 1719 end; 1711 1720 … … 1742 1751 ShowNewContent(NewMode, kModels) 1743 1752 else 1744 ShowNewContent(NewMode, kEModels) 1753 ShowNewContent(NewMode, kEModels); 1745 1754 end; 1746 1755 … … 1758 1767 sb.Init(Lines[Layer] - 1, DispLines); 1759 1768 OffscreenPaint; 1760 Invalidate 1769 Invalidate; 1761 1770 end; 1762 1771 … … 1770 1779 Sel := -2; 1771 1780 sb.Init(Lines[Layer] - 1, DispLines); 1772 SmartUpdateContent 1781 SmartUpdateContent; 1773 1782 end; 1774 1783 … … 1783 1792 result := adFar; 1784 1793 Closable := true; 1785 Close 1794 Close; 1786 1795 end; 1787 1796 kCities, kCityEvents: … … 1823 1832 Popup.Popup(Left + ToggleBtn.Left, Top + ToggleBtn.Top + 1824 1833 ToggleBtn.Height); 1825 end 1826 end 1834 end; 1835 end; 1827 1836 end; 1828 1837 … … 1837 1846 // prevent closing 1838 1847 else 1839 inherited 1848 inherited; 1840 1849 end; 1841 1850 … … 1843 1852 begin 1844 1853 if Visible and (Kind = kCities) then 1845 SmartUpdateContent 1854 SmartUpdateContent; 1846 1855 end; 1847 1856
Note:
See TracChangeset
for help on using the changeset viewer.