Changeset 439
- Timestamp:
- May 18, 2022, 11:39:46 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/Select.pas
r438 r439 50 50 cixProject: Integer; 51 51 pView: Integer; 52 Sel : Integer;52 Selected: Integer; 53 53 DispLines: Integer; 54 54 Layer: Integer; … … 56 56 TechNameSpace: Integer; 57 57 ScienceNation: Integer; 58 sb: TPVScrollbar; 59 Lines, FirstShrinkedLine: array [0 .. MaxLayer - 1] of integer; 60 code: array [0 .. MaxLayer - 1, 0 .. 4095] of integer; 61 Column: array [0 .. nPl - 1] of integer; 58 ScrollBar: TPVScrollbar; 59 Lines: array [0 .. MaxLayer - 1] of Integer; 60 FirstShrinkedLine: array [0 .. MaxLayer - 1] of Integer; 61 code: array [0 .. MaxLayer - 1, 0 .. 4095] of Integer; 62 Column: array [0 .. nPl - 1] of Integer; 62 63 Closable: Boolean; 63 64 MultiPage: Boolean; … … 112 113 inherited; 113 114 Canvas.Font.Assign(UniFont[ftNormal]); 114 sb:= TPVScrollbar.Create(Self);115 sb.SetBorderSpacing(36, 10, 36);116 sb.OnUpdate := ScrollBarUpdate;115 ScrollBar := TPVScrollbar.Create(Self); 116 ScrollBar.SetBorderSpacing(36, 10, 36); 117 ScrollBar.OnUpdate := ScrollBarUpdate; 117 118 InitButtons; 118 119 Kind := kMission; … … 128 129 procedure TListDlg.FormDestroy(Sender: TObject); 129 130 begin 130 FreeAndNil( sb);131 FreeAndNil(ScrollBar); 131 132 FreeAndNil(ScienceNationDotBuffer); 132 133 end; … … 146 147 begin 147 148 { TODO: Handled by MouseWheel event 148 if sb.Process(Msg) then begin149 Sel := -2;149 if ScrollBar.Process(Msg) then begin 150 Selected := -2; 150 151 SmartUpdateContent(true); 151 152 end; … … 155 156 procedure TListDlg.OnMouseLeave(var Msg: TMessage); 156 157 begin 157 if not Closable and (Sel <> -2) then158 begin 159 line(Canvas, Sel , false, false);160 Sel := -2;158 if not Closable and (Selected <> -2) then 159 begin 160 line(Canvas, Selected, false, false); 161 Selected := -2; 161 162 end; 162 163 end; … … 168 169 inherited; 169 170 Canvas.Font.Assign(UniFont[ftNormal]); 170 if Sel <> -2 then171 line(Canvas, Sel , false, true);171 if Selected <> -2 then 172 line(Canvas, Selected, false, true); 172 173 s := ''; 173 174 if (Kind = kAdvance) and (MyData.FarTech <> adNone) then … … 246 247 CanGrow: boolean; 247 248 begin 248 lix := code[Layer, sb.Position + l];249 lix := code[Layer, ScrollBar.Position + l]; 249 250 y0 := 2 + (l + 1) * LineDistance; 250 if sb.Position + l >= FirstShrinkedLine[Layer] then251 ofs := ( sb.Position + l - FirstShrinkedLine[Layer]) and 1 * 33251 if ScrollBar.Position + l >= FirstShrinkedLine[Layer] then 252 ofs := (ScrollBar.Position + l - FirstShrinkedLine[Layer]) and 1 * 33 252 253 else { if FirstShrinkedLine[Layer]<Lines[Layer] then } 253 254 ofs := 33; … … 480 481 begin 481 482 s := Tribe[mox.Owner].ModelName[mox.mix]; 482 if (Kind = kAllEModels) and (code[1, sb.Position + l] = 0) then483 if (Kind = kAllEModels) and (code[1, ScrollBar.Position + l] = 0) then 483 484 s := Format(Tribe[mox.Owner].TPhrase('OWNED'), [s]); 484 485 end … … 766 767 767 768 for i := -1 to DispLines do 768 if (i + sb.Position >= 0) and (i + sb.Position < Lines[Layer]) then769 if (i + ScrollBar.Position >= 0) and (i + ScrollBar.Position < Lines[Layer]) then 769 770 Self.line(offscreen.Canvas, i, true, false); 770 771 end; … … 779 780 begin 780 781 y := y - TitleHeight; 781 i0 := sb.Position;782 Sel0 := Sel ;782 i0 := ScrollBar.Position; 783 Sel0 := Selected; 783 784 if (x >= SideFrame) and (x < SideFrame + InnerWidth) and (y >= 0) and 784 785 (y < InnerHeight) and (y mod LineDistance >= 4) and (y mod LineDistance < 20) 785 786 then 786 Sel := y div LineDistance - 1787 Selected := y div LineDistance - 1 787 788 else 788 Sel := -2;789 if (Sel < -1) or (Sel > DispLines) or (Sel+ i0 < 0) or790 (Sel + i0 >= Lines[Layer]) then791 Sel := -2;792 if Sel <> Sel0 then789 Selected := -2; 790 if (Selected < -1) or (Selected > DispLines) or (Selected + i0 < 0) or 791 (Selected + i0 >= Lines[Layer]) then 792 Selected := -2; 793 if Selected <> Sel0 then 793 794 begin 794 795 if Sel0 <> -2 then 795 796 line(Canvas, Sel0, false, false); 796 if Sel <> -2 then797 line(Canvas, Sel , false, true);797 if Selected <> -2 then 798 line(Canvas, Selected, false, true); 798 799 end; 799 800 … … 841 842 WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); 842 843 begin 843 if sb.ProcessMouseWheel(WheelDelta) then begin844 if ScrollBar.ProcessMouseWheel(WheelDelta) then begin 844 845 PaintBox1MouseMove(nil, [], MousePos.X - Left, 845 846 MousePos.Y - Top); … … 915 916 lix: integer; 916 917 begin 917 if sb.Position + Sel>= 0 then918 lix := code[Layer, sb.Position + Sel];918 if ScrollBar.Position + Selected >= 0 then 919 lix := code[Layer, ScrollBar.Position + Selected]; 919 920 if Kind in [kScience, kCities, kCityEvents, kModels, kEModels, kAllEModels] 920 921 then … … 922 923 if (ssLeft in Shift) and not(ssShift in Shift) then 923 924 begin 924 if Sel <> -2 then925 if Selected <> -2 then 925 926 begin 926 927 result := lix; … … 931 932 else if (ssLeft in Shift) and (ssShift in Shift) then 932 933 begin // show help/info popup 933 if Sel <> -2 then934 if Selected <> -2 then 934 935 case Kind of 935 936 kCities: … … 943 944 kEModels: 944 945 UnitStatDlg.ShowNewContent_EnemyModel(wmPersistent, 945 code[1, sb.Position + Sel]);946 code[1, ScrollBar.Position + Selected]); 946 947 kAllEModels, kChooseEModel: 947 948 if lix <> mixAll then … … 972 973 else if ssRight in Shift then 973 974 begin 974 if Sel <> -2 then975 if Selected <> -2 then 975 976 case Kind of 976 977 kCities, kCityEvents: … … 1562 1563 if (Kind = kAdvance) and (MyData.FarTech <> adNone) or (Kind = kModels) or 1563 1564 (Kind = kEModels) then begin 1564 sb.SetBorderSpacing(56, 10, 10);1565 ScrollBar.SetBorderSpacing(56, 10, 10); 1565 1566 TitleHeight := WideFrame + 20; 1566 1567 end else begin 1567 sb.SetBorderSpacing(36, 10, 34);1568 ScrollBar.SetBorderSpacing(36, 10, 34); 1568 1569 TitleHeight := WideFrame; 1569 1570 end; … … 1625 1626 CaptionRight := CloseBtn.Left; 1626 1627 { TODO: 1627 SetWindowPos( sb.ScrollBar.Handle, 0, SideFrame + InnerWidth - GetSystemMetrics(SM_CXVSCROLL),1628 SetWindowPos(ScrollBar.ScrollBar.Handle, 0, SideFrame + InnerWidth - GetSystemMetrics(SM_CXVSCROLL), 1628 1629 TitleHeight, GetSystemMetrics(SM_CXVSCROLL), LineDistance * DispLines + 48, 1629 1630 SWP_NOZORDER or SWP_NOREDRAW); … … 1658 1659 1659 1660 Layer := 0; 1660 Sel := -2;1661 Selected := -2; 1661 1662 ScienceNation := -1; 1662 sb.Init(Lines[Layer] - 1, DispLines);1663 ScrollBar.Init(Lines[Layer] - 1, DispLines); 1663 1664 1664 1665 OffscreenPaint; … … 1775 1776 end; 1776 1777 InitLines; 1777 Sel := -2;1778 sb.Init(Lines[Layer] - 1, DispLines);1778 Selected := -2; 1779 ScrollBar.Init(Lines[Layer] - 1, DispLines); 1779 1780 OffscreenPaint; 1780 1781 Invalidate; … … 1788 1789 Layer := TComponent(Sender).Tag; 1789 1790 1790 Sel := -2;1791 sb.Init(Lines[Layer] - 1, DispLines);1791 Selected := -2; 1792 ScrollBar.Init(Lines[Layer] - 1, DispLines); 1792 1793 SmartUpdateContent; 1793 1794 end; … … 1892 1893 procedure TListDlg.ScrollBarUpdate(Sender: TObject); 1893 1894 begin 1894 Sel := -2;1895 Selected := -2; 1895 1896 SmartUpdateContent(true); 1896 1897 end;
Note:
See TracChangeset
for help on using the changeset viewer.