Changeset 90
- Timestamp:
- Jan 19, 2017, 9:04:16 PM (8 years ago)
- Location:
- trunk/LocalPlayer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/PVSB.pas
r89 r90 19 19 FOnUpdate: TNotifyEvent; 20 20 ScrollBar: TScrollBar; 21 FMax: Integer; 21 22 function GetMax: Integer; 22 23 function GetPageSize: Integer; … … 29 30 constructor Create(Parent: TWinControl); 30 31 destructor Destroy; override; 31 procedure Init(Max, Page : Integer);32 procedure Init(Max, PageSize: Integer); 32 33 procedure SetPos(Pos: Integer); 33 34 function Process(const m: TMessage): boolean; … … 48 49 Count: Integer = 0; 49 50 50 procedure TPVScrollBar.Init(Max, Page : Integer);51 procedure TPVScrollBar.Init(Max, PageSize: Integer); 51 52 begin 53 ScrollBar.PageSize := PageSize; 52 54 ScrollBar.Min := 0; 53 ScrollBar.Max := Max; 54 ScrollBar.PageSize := Page; 55 Self.Max := Max; 55 56 ScrollBar.Position := 0; 56 ScrollBar.Visible := ScrollBar.Max >= ScrollBar.PageSize;57 ScrollBar.Visible := Max >= ScrollBar.PageSize; 57 58 end; 58 59 … … 68 69 NewPos: integer; 69 70 begin 70 if ScrollBar.Max < ScrollBar.PageSize then71 if Max < ScrollBar.PageSize then 71 72 result := false 72 73 else … … 91 92 if NewPos < 0 then 92 93 NewPos := 0; 93 if NewPos > ScrollBar.Max - ScrollBar.PageSize + 1 then94 NewPos := ScrollBar.Max - ScrollBar.PageSize + 1;94 if NewPos > Max - ScrollBar.PageSize + 1 then 95 NewPos := Max - ScrollBar.PageSize + 1; 95 96 result := NewPos <> ScrollBar.Position; 96 97 if (NewPos <> ScrollBar.Position) or ((m.wParam and $ffff) = SB_ENDSCROLL) then … … 106 107 NewPos: integer; 107 108 begin 108 if ScrollBar.Max < ScrollBar.PageSize then Result := False109 if Max < ScrollBar.PageSize then Result := False 109 110 else begin 110 111 NewPos := ScrollBar.Position - Delta div 300; 111 112 if NewPos < 0 then NewPos := 0; 112 if NewPos > ScrollBar.Max - ScrollBar.PageSize + 1 then113 NewPos := ScrollBar.Max - ScrollBar.PageSize + 1;113 if NewPos > Max - ScrollBar.PageSize + 1 then 114 NewPos := Max - ScrollBar.PageSize + 1; 114 115 Result := NewPos <> ScrollBar.Position; 115 116 if NewPos <> ScrollBar.Position then begin … … 121 122 procedure TPVScrollBar.Show(Visible: boolean); 122 123 begin 123 if not Visible or ( ScrollBar.Max < ScrollBar.PageSize) then124 if not Visible or (Max < ScrollBar.PageSize) then 124 125 ScrollBar.Visible := False 125 126 else ScrollBar.Visible := True; … … 128 129 procedure TPVScrollBar.EndSB; 129 130 begin 130 if ScrollBar.Max < ScrollBar.PageSize then131 if Max < ScrollBar.PageSize then 131 132 ScrollBar.Position := 0 // hidden 132 133 else begin 133 ScrollBar.Position := ScrollBar.Max - ScrollBar.PageSize + 1;134 ScrollBar.Position := Max - ScrollBar.PageSize + 1; 134 135 end; 135 136 end; … … 151 152 procedure TPVScrollBar.SetMax(AValue: Integer); 152 153 begin 153 ScrollBar.Max := AValue; 154 FMax := AValue; 155 ScrollBar.Max := Max{$IFDEF LINUX} - PageSize + 1{$ENDIF}; 154 156 end; 155 157 … … 166 168 function TPVScrollBar.GetMax: Integer; 167 169 begin 168 Result := ScrollBar.Max;170 Result := FMax; 169 171 end; 170 172 -
trunk/LocalPlayer/Term.lfm
r66 r90 25 25 OnMouseMove = FormMouseMove 26 26 OnMouseUp = FormMouseUp 27 OnMouseWheel = FormMouseWheel 27 28 OnPaint = FormPaint 28 29 OnResize = FormResize 29 30 OnShow = FormShow 30 31 Position = poDefault 31 LCLVersion = '1.6. 2.0'32 LCLVersion = '1.6.0.4' 32 33 WindowState = wsMaximized 33 34 object UnitBtn: TButtonB -
trunk/LocalPlayer/Term.pas
r89 r90 13 13 Protocol, Tribes, PVSB, ClientTools, ScreenTools, BaseWin, Messg, ButtonBase, 14 14 LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, 15 Forms, Menus, ExtCtrls, dateutils, Platform, ButtonB, ButtonC, EOTButton, Area ;15 Forms, Menus, ExtCtrls, dateutils, Platform, ButtonB, ButtonC, EOTButton, Area, Types; 16 16 17 17 const … … 173 173 procedure FormCreate(Sender: TObject); 174 174 procedure FormDestroy(Sender: TObject); 175 procedure FormMouseWheel(Sender: TObject; Shift: TShiftState; 176 WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); 175 177 procedure Timer1Timer(Sender: TObject); 176 178 procedure MapBoxMouseDown(Sender: TObject; Button: TMouseButton; … … 3517 3519 if AILogo[i] <> nil then 3518 3520 FreeAndNil(AILogo[i]); 3521 end; 3522 3523 procedure TMainScreen.FormMouseWheel(Sender: TObject; Shift: TShiftState; 3524 WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); 3525 begin 3526 if sb.ProcessMouseWheel(WheelDelta) then begin 3527 PanelPaint; 3528 Update; 3529 end; 3519 3530 end; 3520 3531
Note:
See TracChangeset
for help on using the changeset viewer.