Changeset 535 for trunk/LocalPlayer


Ignore:
Timestamp:
Apr 15, 2024, 8:39:16 PM (7 months ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Term.pas

    r534 r535  
    315315    Panel: TBitmap;
    316316    TopBar: TBitmap;
    317     sb: TPVScrollbar;
     317    VerticalScrollBar: TPVScrollbar;
    318318    Closable: Boolean;
    319319    RepaintOnResize: Boolean;
     
    17401740  StartRunning := False;
    17411741
    1742   sb := TPVScrollbar.Create(Self);
    1743   sb.OnUpdate := ScrollBarUpdate;
     1742  VerticalScrollBar := TPVScrollbar.Create(Self);
     1743  VerticalScrollBar.OnUpdate := ScrollBarUpdate;
    17441744end;
    17451745
     
    27952795          if Controls[I] is TButtonC then
    27962796            Controls[I].Visible := False;
    2797         sb.Init(0, 1);
     2797        VerticalScrollBar.Init(0, 1);
    27982798        for p1 := 0 to nPl - 1 do
    27992799          if Tribe[p1] <> nil then
     
    36023602
    36033603  MainFormKeyDown := nil;
    3604   FreeAndNil(sb);
     3604  FreeAndNil(VerticalScrollBar);
    36053605  FreeAndNil(TopBar);
    36063606  FreeAndNil(MiniMap);
     
    36233623  if (MousePos.Y > ClientHeight - MidPanelHeight) and
    36243624    (MousePos.Y < ClientHeight) then begin
    3625     if sb.ProcessMouseWheel(WheelDelta) then begin
     3625    if VerticalScrollBar.ProcessMouseWheel(WheelDelta) then begin
    36263626      PanelPaint;
    36273627      Update;
     
    42184218procedure TMainScreen.OnScroll(var Msg: TMessage);
    42194219begin
    4220   if sb.Process(Msg) then begin
     4220  if VerticalScrollBar.Process(Msg) then begin
    42214221    PanelPaint;
    42224222    Update;
     
    49214921      for I := 0 to nBrushTypes - 1 do
    49224922      begin // display terrain types
    4923         if (Count >= TrRow * sb.Position) and (Count < TrRow * (sb.Position + 1))
     4923        if (Count >= TrRow * VerticalScrollBar.Position) and (Count < TrRow * (VerticalScrollBar.Position + 1))
    49244924        then
    49254925        begin
    4926           trix[Count - TrRow * sb.Position] := BrushTypes[I];
    4927           X := (Count - TrRow * sb.Position) * TrPitch;
     4926          trix[Count - TrRow * VerticalScrollBar.Position] := BrushTypes[I];
     4927          X := (Count - TrRow * VerticalScrollBar.Position) * TrPitch;
    49284928          xSrcBase := -1;
    49294929          case BrushTypes[I] of
     
    51555155                  if unx.Loc = TroopLoc then
    51565156                  begin
    5157                     if (Count >= TrRow * sb.Position) and
    5158                       (Count < TrRow * (sb.Position + 1)) then
     5157                    if (Count >= TrRow * VerticalScrollBar.Position) and
     5158                      (Count < TrRow * (VerticalScrollBar.Position + 1)) then
    51595159                    begin
    5160                       trix[Count - TrRow * sb.Position] := uix;
     5160                      trix[Count - TrRow * VerticalScrollBar.Position] := uix;
    51615161                      MakeUnitInfo(Me, unx, UnitInfo);
    5162                       X := (Count - TrRow * sb.Position) * TrPitch;
     5162                      X := (Count - TrRow * VerticalScrollBar.Position) * TrPitch;
    51635163                      if uix = UnFocus then
    51645164                      begin
     
    52095209          Server(sGetUnits, Me, TroopLoc, Count);
    52105210          for I := 0 to Count - 1 do
    5211             if (I >= TrRow * sb.Position) and (I < TrRow * (sb.Position + 1)) then
     5211            if (I >= TrRow * VerticalScrollBar.Position) and (I < TrRow * (VerticalScrollBar.Position + 1)) then
    52125212            begin // display enemy units
    5213               trix[I - TrRow * sb.Position] := I;
    5214               X := (I - TrRow * sb.Position) * TrPitch;
     5213              trix[I - TrRow * VerticalScrollBar.Position] := I;
     5214              X := (I - TrRow * VerticalScrollBar.Position) * TrPitch;
    52155215              NoMapPanel.SetOutput(Panel);
    52165216              NoMapPanel.PaintUnit(xTroop + 2 + X, yTroop + 1,
     
    68716871      Server(sGetUnits, Me, Loc, TrCnt);
    68726872  if TrCnt = 0 then
    6873     sb.Init(0, 1)
     6873    VerticalScrollBar.Init(0, 1)
    68746874  else
    68756875  begin
    6876     sb.Init((TrCnt + TrRow - 1) div TrRow - 1, 1);
    6877     if (sb.Max >= sb.PageSize) and (trixFocus >= 0) then
    6878       sb.Position := trixFocus div TrRow;
     6876    VerticalScrollBar.Init((TrCnt + TrRow - 1) div TrRow - 1, 1);
     6877    if (VerticalScrollBar.Max >= VerticalScrollBar.PageSize) and (trixFocus >= 0) then
     6878      VerticalScrollBar.Position := trixFocus div TrRow;
    68796879  end;
    68806880end;
     
    70137013procedure TMainScreen.SetFullScreen(Active: Boolean);
    70147014begin
    7015     if Active and (CurrentWindowState <> TWindowState.wsFullScreen) then begin
    7016       PrevWindowState := WindowState;
    7017       CurrentWindowState := TWindowState.wsFullScreen;
     7015  if Active and (CurrentWindowState <> TWindowState.wsFullScreen) then begin
     7016    PrevWindowState := WindowState;
     7017    CurrentWindowState := TWindowState.wsFullScreen;
     7018    WindowState := CurrentWindowState;
     7019    {$IFDEF WINDOWS}
     7020    BorderStyle := TBorderStyle.bsNone;
     7021    {$ENDIF}
     7022    BorderIcons := [];
     7023  end else
     7024  if not Active and (CurrentWindowState = TWindowState.wsFullScreen) then begin
     7025    if PrevWindowState = TWindowState.wsMaximized then begin
     7026      CurrentWindowState := TWindowState.wsNormal;
    70187027      WindowState := CurrentWindowState;
    7019       {$IFDEF WINDOWS}
    7020       BorderStyle := TBorderStyle.bsNone;
    7021       {$ENDIF}
    7022       BorderIcons := [];
    7023     end else
    7024     if not Active and (CurrentWindowState = TWindowState.wsFullScreen) then begin
    7025       if PrevWindowState = TWindowState.wsMaximized then begin
    7026         CurrentWindowState := TWindowState.wsNormal;
    7027         WindowState := CurrentWindowState;
    7028       end else begin
    7029         CurrentWindowState := PrevWindowState;
    7030         WindowState := CurrentWindowState;
    7031         WindowState := TWindowState.wsFullScreen;
    7032         WindowState := CurrentWindowState;
    7033       end;
    7034       {$IFDEF WINDOWS}
    7035       BorderStyle := TBorderStyle.bsSizeable;
    7036       {$ENDIF}
    7037       BorderIcons := [TBorderIcon.biSystemMenu, TBorderIcon.biMinimize,
    7038         TBorderIcon.biMaximize];
    7039     end;
     7028    end else begin
     7029      CurrentWindowState := PrevWindowState;
     7030      WindowState := CurrentWindowState;
     7031      WindowState := TWindowState.wsFullScreen;
     7032      WindowState := CurrentWindowState;
     7033    end;
     7034    {$IFDEF WINDOWS}
     7035    BorderStyle := TBorderStyle.bsSizeable;
     7036    {$ENDIF}
     7037    BorderIcons := [TBorderIcon.biSystemMenu, TBorderIcon.biMinimize,
     7038      TBorderIcon.biMaximize];
     7039    if Left < 0 then Left := 0;
     7040    if Top < 0 then Top := 0;
     7041  end;
    70407042end;
    70417043
     
    83198321  EOT.Top := Height - 64;
    83208322  EOT.Left := Width - 62;
    8321   sb.SetBorderSpacing(Height - yTroop - 24, Width - xRightPanel + 8, 8);
    8322   SetWindowPos(sb.ScrollBar.Handle, 0, xRightPanel + 10 - 14 - GetSystemMetrics(SM_CXVSCROLL),
     8323  VerticalScrollBar.SetBorderSpacing(Height - yTroop - 24, Width - xRightPanel + 8, 8);
     8324  SetWindowPos(VerticalScrollBar.ScrollBar.Handle, 0, xRightPanel + 10 - 14 - GetSystemMetrics(SM_CXVSCROLL),
    83238325    Height - MidPanelHeight + 8, 0, 0, SWP_NOSIZE or SWP_NOZORDER);
    83248326  MapBtn0.Left := xMini + G.lx - 44;
Note: See TracChangeset for help on using the changeset viewer.