Recent

Author Topic: [SOLVED] Code clean up at /lcl/buttons.pp  (Read 2046 times)

lagprogramming

  • Sr. Member
  • ****
  • Posts: 407
[SOLVED] Code clean up at /lcl/buttons.pp
« on: July 23, 2023, 08:59:42 am »
/lcl/buttons.pp has the following routines:
Code: Pascal  [Select][+][-]
  1. function GetDefaultButtonIcon(idButton: Integer;
  2.   ScalePercent: Integer): TCustomBitmap;
  3. var
  4.   ResName: string;
  5. begin
  6.   Result := nil;
  7.   if (idButton < Low(BitBtnResNames)) or (idButton > High(BitBtnResNames)) then
  8.     Exit;
  9.   if BitBtnResNames[idButton] = '' then
  10.     Exit;
  11.   Result := GetDefaultGlyph(BitBtnResNames[idButton], ScalePercent);
  12. end;
Code: Pascal  [Select][+][-]
  1. procedure LoadGlyphFromResource(AGlyph: TButtonGlyph; idButton: Integer);
  2. var
  3.   I: Integer;
  4. begin
  5.   if not((Low(TButtonImage)<=idButton) and (idButton<=High(TButtonImage))) then
  6.     Exit;
  7.   AGlyph.LCLGlyphName := BitBtnResNames[idButton];
  8. end;
The variables are declared but never used.
The following patch removes them:
Code: Pascal  [Select][+][-]
  1. diff --git a/lcl/buttons.pp b/lcl/buttons.pp
  2. index c441f1494a..55d9ae8988 100644
  3. --- a/lcl/buttons.pp
  4. +++ b/lcl/buttons.pp
  5. @@ -575,8 +575,6 @@ end;
  6.  
  7.  function GetDefaultButtonIcon(idButton: Integer;
  8.    ScalePercent: Integer): TCustomBitmap;
  9. -var
  10. -  ResName: string;
  11.  begin
  12.    Result := nil;
  13.    if (idButton < Low(BitBtnResNames)) or (idButton > High(BitBtnResNames)) then
  14. @@ -631,8 +629,6 @@ begin
  15.  end;
  16.  
  17.  procedure LoadGlyphFromResource(AGlyph: TButtonGlyph; idButton: Integer);
  18. -var
  19. -  I: Integer;
  20.  begin
  21.    if not((Low(TButtonImage)<=idButton) and (idButton<=High(TButtonImage))) then
  22.      Exit;
« Last Edit: July 31, 2023, 10:43:17 am by lagprogramming »

AlexTP

  • Hero Member
  • *****
  • Posts: 2488
    • UVviewsoft

 

TinyPortal © 2005-2018