Changeset 50 for trunk/LocalPlayer


Ignore:
Timestamp:
Jan 11, 2017, 5:26:09 PM (8 years ago)
Author:
chronos
Message:
  • Fixed: Deallocation of TPVScrollBar structure. Changed to class and added initialization and finalization.
Location:
trunk/LocalPlayer
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Help.pas

    r40 r50  
    208208  SearchResult := THyperText.Create;
    209209  SearchResult.OwnsObjects := True;
     210  sb := TPVScrollbar.Create;
    210211  CreatePVSB(sb, Handle, 36, 551, 36 + 432);
    211212
     
    244245procedure THelpDlg.FormDestroy(Sender: TObject);
    245246begin
     247  FreeAndNil(sb);
    246248  FreeAndNil(MainText);
    247249  FreeAndNil(SearchResult);
  • trunk/LocalPlayer/PVSB.pas

    r49 r50  
    1111
    1212type
    13   TPVScrollbar = record
     13
     14  { TPVScrollbar }
     15
     16  TPVScrollbar = class
    1417    h: integer;
    1518    si: TScrollInfo;
    1619    Form: TForm;
     20    destructor Destroy; override;
    1721  end;
    1822
     
    154158end;
    155159
     160{ TPVScrollbar }
     161
     162destructor TPVScrollbar.Destroy;
     163begin
     164  h := 0;
     165  si.cbSize := 0;
     166  FreeAndNil(Form);
     167end;
     168
    156169end.
  • trunk/LocalPlayer/Select.pas

    r41 r50  
    100100  inherited;
    101101  Canvas.Font.Assign(UniFont[ftNormal]);
     102  sb := TPVScrollbar.Create;
    102103  CreatePVSB(sb, Handle, 2, 361, 2 + 422);
    103104  InitButtons();
     
    114115procedure TListDlg.FormDestroy(Sender: TObject);
    115116begin
    116   ScienceNationDot.Free;
     117  FreeAndNil(sb);
     118  FreeAndNil(ScienceNationDot);
    117119end;
    118120
     
    120122begin
    121123  Closable := true;
    122   Close
     124  Close;
    123125end;
    124126
    125127procedure TListDlg.FormCloseQuery(Sender: TObject; var CanClose: boolean);
    126128begin
    127   CanClose := Closable or not(Kind in MustChooseKind)
     129  CanClose := Closable or not(Kind in MustChooseKind);
    128130end;
    129131
     
    133135  begin
    134136    Sel := -2;
    135     SmartUpdateContent(true)
    136   end
     137    SmartUpdateContent(true);
     138  end;
    137139end;
    138140
     
    145147    PaintBox1MouseMove(nil, [], m.lParam and $FFFF - Left,
    146148      m.lParam shr 16 - Top);
    147   end
     149  end;
    148150end;
    149151
     
    154156    line(Canvas, Sel, false, false);
    155157    Sel := -2;
    156   end
     158  end;
    157159end;
    158160
     
    183185    LoweredTextOut(Canvas, -2, MainTexture,
    184186      (ClientWidth - BiColorTextWidth(Canvas, s)) div 2, ClientHeight - 29, s);
    185   end
     187  end;
    186188end;
    187189
  • trunk/LocalPlayer/Term.pas

    r49 r50  
    34553455  i, j: integer;
    34563456begin
     3457  sb := TPVScrollbar.Create;
    34573458{$IFDEF WINDOWS}{ TODO }
    34583459  Screen.Cursors[crImpDrag] := LoadCursor(HInstance, 'DRAG');
     
    35293530  i: integer;
    35303531begin
    3531   TopBar.free;
    3532   Mini.free;
    3533   Buffer.free;
    3534   Panel.free;
     3532  FreeAndNil(sb);
     3533  FreeAndNil(TopBar);
     3534  FreeAndNil(Mini);
     3535  FreeAndNil(Buffer);
     3536  FreeAndNil(Panel);
    35353537  for i := 0 to nPl - 1 do
    35363538    if AILogo[i] <> nil then
    3537       AILogo[i].free;
     3539      FreeAndNil(AILogo[i]);
    35383540end;
    35393541
     
    41554157end;
    41564158
    4157 function ScrollDCCopy(Canvas: TCanvas; dx: longint; dy: longint; const lprcScroll:TRect; const lprcClip:TRect; hrgnUpdate:HRGN; lprcUpdate: PRect):Boolean;
     4159{$IFDEF LINUX}
     4160// Can't do scrolling of DC under Linux, then fallback into BitBlt.
     4161function ScrollDC(Canvas: TCanvas; dx: longint; dy: longint; const lprcScroll:TRect; const lprcClip:TRect; hrgnUpdate:HRGN; lprcUpdate: PRect):Boolean;
    41584162begin
    41594163  BitBltCanvas(Canvas, lprcScroll.Left + dx, lprcScroll.Top + dy, lprcScroll.Right - lprcScroll.Left, lprcScroll.Bottom - lprcScroll.Top,
    41604164    Canvas, lprcScroll.Left, lprcScroll.Top, SRCCOPY);
    41614165end;
     4166{$ENDIF}
    41624167
    41634168procedure TMainScreen.MainOffscreenPaint;
     
    42124217{$ENDIF}
    42134218{$IFDEF LINUX}
    4214     // Fallback to bitblt
    4215     ScrollDCCopy(offscreen.Canvas, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt,
     4219    ScrollDC(offscreen.Canvas, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt,
    42164220      rec, rec, 0, nil);
    42174221{$ENDIF}
     
    42264230{$ENDIF}
    42274231{$IFDEF LINUX}
    4228         // Fallback to bitblt
    4229         ScrollDCCopy(Canvas, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt,
     4232        ScrollDC(Canvas, (xwd - xw) * (xxt * 2), (ywd - yw) * yyt,
    42304233          rec, rec, 0, nil);
    42314234{$ENDIF}
Note: See TracChangeset for help on using the changeset viewer.