Forum > CustomDrawn
[SOLVED] Code cleanup at procedure SendFormToBack
(1/1)
lagprogramming:
lcl/interfaces/customdrawn/customdrawnproc.pas has procedure SendFormToBack(ACDForm: TCDNonNativeForm);
This is the original code:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure SendFormToBack(ACDForm: TCDNonNativeForm);var lCount, lCurIndex: Integer;begin // Hide the form ACDForm.Visible := False; InitNonNativeForms(); lCount := NonNativeForms.Count; lCurIndex := NonNativeForms.IndexOf(ACDForm); {$IFDEF VerboseCDForms} DebugLn(Format('SendFormToBack lOldIndex=%d lNewIndex=0', [lCurIndex])); {$ENDIF} NonNativeForms.Move(lCurIndex, 0);end;It can be noticed that variable lCount has an assigned value at line "lCount := NonNativeForms.Count;" but it's not used at all. Most probably it's presence is due to a copy/paste from the previous in file, procedure BringFormToFront.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure BringFormToFront(ACDForm: TCDNonNativeForm);var lCount, lCurIndex: Integer;begin InitNonNativeForms(); lCount := NonNativeForms.Count; lCurIndex := NonNativeForms.IndexOf(ACDForm); {$IFDEF VerboseCDForms} DebugLn(Format('BringFormToFront lOldIndex=%d lNewIndex=%d', [lCurIndex, lCount-1])); {$ENDIF} NonNativeForms.Move(lCurIndex, lCount-1);end;
The patch removes from SendFormToBack the variable lCount and it's value assignment.
The new code will be:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure SendFormToBack(ACDForm: TCDNonNativeForm);var lCurIndex: Integer;begin // Hide the form ACDForm.Visible := False; InitNonNativeForms(); lCurIndex := NonNativeForms.IndexOf(ACDForm); {$IFDEF VerboseCDForms} DebugLn(Format('SendFormToBack lOldIndex=%d lNewIndex=0', [lCurIndex])); {$ENDIF} NonNativeForms.Move(lCurIndex, 0);end;
The patch:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---diff --git a/lcl/interfaces/customdrawn/customdrawnproc.pas b/lcl/interfaces/customdrawn/customdrawnproc.pasindex 5170ddc72b..0e8303af08 100644--- a/lcl/interfaces/customdrawn/customdrawnproc.pas+++ b/lcl/interfaces/customdrawn/customdrawnproc.pas@@ -312,13 +312,12 @@ end; procedure SendFormToBack(ACDForm: TCDNonNativeForm); var- lCount, lCurIndex: Integer;+ lCurIndex: Integer; begin // Hide the form ACDForm.Visible := False; InitNonNativeForms();- lCount := NonNativeForms.Count; lCurIndex := NonNativeForms.IndexOf(ACDForm); {$IFDEF VerboseCDForms} DebugLn(Format('SendFormToBack lOldIndex=%d lNewIndex=0', [lCurIndex]));
wp:
Committed along with other changes to reduce hints. ATM, compilation of the customdrawn package does not generate any hints any more.
Navigation
[0] Message Index