Ignore:
Timestamp:
Jan 19, 2017, 8:40:22 PM (7 years ago)
Author:
chronos
Message:
  • Modified: Simplified PVSB.TPVScrollBar class and fixed wrong scrolling under Windows.
  • Modified: Enabled Windows XP manifest to have themed scrollbars.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Term.pas

    r88 r89  
    14741474    StayOnTop_Ensured := false;
    14751475
    1476     sb.Setup(0, 0, 0, Self);
     1476    sb := TPVScrollbar.Create(Self);
    14771477    sb.OnUpdate := ScrollBarUpdate;
    14781478  end; { InitModule }
     
    34353435    SoundMode := smOn;
    34363436
    3437   sb := TPVScrollbar.Create;
    34383437{$IFDEF WINDOWS}{ TODO }
    34393438  Screen.Cursors[crImpDrag] := LoadCursor(HInstance, 'DRAG');
     
    35763575  EOT.Top := ClientHeight - 64;
    35773576  EOT.Left := ClientWidth - 62;
    3578   sb.ScrollBar.BorderSpacing.Top := ClientHeight - yTroop - 24;
    3579   sb.ScrollBar.BorderSpacing.Right := ClientWidth - xRightPanel + 8;
    3580   sb.ScrollBar.BorderSpacing.Bottom := 8;
     3577  sb.SetBorderSpacing(ClientHeight - yTroop - 24, ClientWidth - xRightPanel + 8, 8);
     3578  {TODO:
    35813579  SetWindowPos(sb.ScrollBar.Handle, 0, xRightPanel + 10 - 14 - GetSystemMetrics(SM_CXVSCROLL),
    35823580    ClientHeight - MidPanelHeight + 8, 0, 0, SWP_NOSIZE or SWP_NOZORDER);
     3581    }
    35833582  MapBtn0.Left := xMini + G.lx - 44;
    35843583  MapBtn0.Top := ClientHeight - 15;
     
    44144413      for i := 0 to nBrushTypes - 1 do
    44154414      begin // display terrain types
    4416         if (Count >= TrRow * sb.si.npos) and (Count < TrRow * (sb.si.npos + 1))
     4415        if (Count >= TrRow * sb.Position) and (Count < TrRow * (sb.Position + 1))
    44174416        then
    44184417        begin
    4419           trix[Count - TrRow * sb.si.npos] := BrushTypes[i];
    4420           x := (Count - TrRow * sb.si.npos) * TrPitch;
     4418          trix[Count - TrRow * sb.Position] := BrushTypes[i];
     4419          x := (Count - TrRow * sb.Position) * TrPitch;
    44214420          xSrcBase := -1;
    44224421          case BrushTypes[i] of
     
    46464645                  if unx.Loc = TroopLoc then
    46474646                  begin
    4648                     if (Count >= TrRow * sb.si.npos) and
    4649                       (Count < TrRow * (sb.si.npos + 1)) then
     4647                    if (Count >= TrRow * sb.Position) and
     4648                      (Count < TrRow * (sb.Position + 1)) then
    46504649                    begin
    4651                       trix[Count - TrRow * sb.si.npos] := uix;
     4650                      trix[Count - TrRow * sb.Position] := uix;
    46524651                      MakeUnitInfo(me, unx, UnitInfo);
    4653                       x := (Count - TrRow * sb.si.npos) * TrPitch;
     4652                      x := (Count - TrRow * sb.Position) * TrPitch;
    46544653                      if uix = UnFocus then
    46554654                      begin
     
    47004699          Server(sGetUnits, me, TroopLoc, Count);
    47014700          for i := 0 to Count - 1 do
    4702             if (i >= TrRow * sb.si.npos) and (i < TrRow * (sb.si.npos + 1)) then
     4701            if (i >= TrRow * sb.Position) and (i < TrRow * (sb.Position + 1)) then
    47034702            begin // display enemy units
    4704               trix[i - TrRow * sb.si.npos] := i;
    4705               x := (i - TrRow * sb.si.npos) * TrPitch;
     4703              trix[i - TrRow * sb.Position] := i;
     4704              x := (i - TrRow * sb.Position) * TrPitch;
    47064705              NoMap.SetOutput(Panel);
    47074706              NoMap.PaintUnit(xTroop + 2 + x, yTroop + 1,
     
    63486347  begin
    63496348    sb.Init((TrCnt + TrRow - 1) div TrRow - 1, 1);
    6350     with sb.si do
    6351       if (nMax >= integer(nPage)) and (trixFocus >= 0) then
    6352       begin
    6353         sb.si.npos := trixFocus div TrRow;
    6354         sb.si.FMask := SIF_POS;
    6355         SetScrollInfo(sb.ScrollBar.Handle, SB_CTL, sb.si, true);
    6356       end
    6357   end
     6349    if (sb.Max >= sb.PageSize) and (trixFocus >= 0) then
     6350      sb.Position := trixFocus div TrRow;
     6351  end;
    63586352end;
    63596353
Note: See TracChangeset for help on using the changeset viewer.