Changeset 220


Ignore:
Timestamp:
May 11, 2020, 11:15:35 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Use wsFullScreen to switch to fullscreen mode.
  • Fixed: Image memory leak in TechTree.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Back.pas

    r219 r220  
    6565begin
    6666  if FullScreen then begin
    67     WindowState := wsMaximized;
     67    WindowState := wsFullScreen;
    6868    if not Assigned(Img) then begin
    6969      FileName := GetGraphicsDir + DirectorySeparator + 'Background.png';
  • trunk/LocalPlayer/TechTree.pas

    r205 r220  
    99
    1010type
     11
     12  { TTechTreeDlg }
     13
    1114  TTechTreeDlg = class(TDrawDlg)
    1215    CloseBtn: TButtonB;
    1316    procedure FormCreate(Sender: TObject);
     17    procedure FormDestroy(Sender: TObject);
    1418    procedure FormPaint(Sender: TObject);
    1519    procedure FormShow(Sender: TObject);
     
    2428    xOffset, yOffset, xDown, yDown: Integer;
    2529    Image: TBitmap;
    26     dragging: boolean;
     30    Dragging: Boolean;
    2731  end;
    2832
     
    7276  InitButtons;
    7377  Image := nil;
     78end;
     79
     80procedure TTechTreeDlg.FormDestroy(Sender: TObject);
     81begin
     82  FreeAndNil(Image);
    7483end;
    7584
     
    121130  X, Y, ad: Integer;
    122131  s: string;
     132  NewWidth: Integer;
     133  NewHeight: Integer;
    123134const
    124135  TransparentColor = $7F007F;
     
    164175
    165176  // fit window to image, center image in window, center window to screen
    166   width := min(Screen.width - 40, Image.width + LeftBorder + RightBorder + 2 *
    167     BlackBorder);
    168   height := min(Screen.height - 40, Image.height + TopBorder + BottomBorder + 2
    169     * BlackBorder);
    170   Left := (Screen.width - width) div 2;
    171   Top := (Screen.height - height) div 2;
     177  NewWidth := Min(Screen.Width - 40, Image.Width + LeftBorder + RightBorder + 2 * BlackBorder);
     178  NewHeight := Min(Screen.Height - 40, Image.Height + TopBorder + BottomBorder + 2 * BlackBorder);
     179  BoundsRect := Bounds((Screen.Width - NewWidth) div 2,
     180    (Screen.Height - NewHeight) div 2,
     181    NewWidth, NewHeight);
    172182  CloseBtn.Left := width - CloseBtn.width - BlackBorder - 8;
    173183  CloseBtn.Top := BlackBorder + 8;
    174   xOffset := (ClientWidth - Image.width + LeftBorder - RightBorder) div 2 -
     184  xOffset := (ClientWidth - Image.Width + LeftBorder - RightBorder) div 2 -
    175185    BlackBorder;
    176   yOffset := ClientHeight - 2 * BlackBorder - Image.height - BottomBorder;
     186  yOffset := ClientHeight - 2 * BlackBorder - Image.Height - BottomBorder;
    177187end;
    178188
  • trunk/LocalPlayer/Term.pas

    r219 r220  
    77957795begin
    77967796  if FullScreen then begin
    7797     WindowState := wsMaximized;
     7797    WindowState := wsFullScreen;
    77987798    BorderStyle := bsNone;
    77997799    BorderIcons := [];
Note: See TracChangeset for help on using the changeset viewer.