IDE: Improve debug messages and fix compilation in TMessagesCtrl.

This commit is contained in:
Juha 2021-12-10 22:13:49 +02:00
parent ab4e2af841
commit 66e1e4fac4

View File

@ -1255,8 +1255,12 @@ begin
Assert(AValue>=-1, 'TMessagesCtrl.SetSelectedLine: AValue < -1.'); Assert(AValue>=-1, 'TMessagesCtrl.SetSelectedLine: AValue < -1.');
Assert(Assigned(SelectedView), 'TMessagesCtrl.SetSelectedLine: View = Nil.'); Assert(Assigned(SelectedView), 'TMessagesCtrl.SetSelectedLine: View = Nil.');
AValue:=Min(AValue, SelectedView.GetShownLineCount(false,true)-1); AValue:=Min(AValue, SelectedView.GetShownLineCount(false,true)-1);
if (FSelectedLines.Count>0) and (FSelectedLines[0]=AValue) then if (FSelectedLines.Count>0) and (FSelectedLines[0]=AValue) then begin
{$IFDEF VerboseMsgCtrlSelection}
DebugLn(['TMessagesCtrl.SetSelectedLine: Value ', AValue, ' already selected.']);
{$ENDIF}
Exit; Exit;
end;
FSelectedLines.Count:=1; // One line. FSelectedLines.Count:=1; // One line.
FSelectedLines[0]:=AValue; FSelectedLines[0]:=AValue;
Invalidate; Invalidate;
@ -2085,13 +2089,13 @@ var
i: Integer; i: Integer;
begin begin
Result:=false; Result:=false;
{$IFDEF VerboseMsgCtrlSelectNextShown} {$IFDEF VerboseMsgCtrlSelection}
debugln(['TMessagesCtrl.SelectNextShown START']); DebugLn(['TMessagesCtrl.SelectNextShown START']);
{$ENDIF} {$ENDIF}
while Offset<>0 do begin while Offset<>0 do begin
{$IFDEF VerboseMsgCtrlSelectNextShown} {$IFDEF VerboseMsgCtrlSelection}
debugln(['TMessagesCtrl.SelectNextShown LOOP Offset=',Offset, DebugLn(['TMessagesCtrl.SelectNextShown LOOP Offset=',Offset,
' ViewIndex=',IndexOfView(SelectedView),' Line=',SelectedLine]); ' ViewIndex=',IndexOfView(SelectedView),' Line=',SelectedLine1]);
{$ENDIF} {$ENDIF}
if SelectedView=nil then begin if SelectedView=nil then begin
if Offset>0 then begin if Offset>0 then begin
@ -2106,9 +2110,9 @@ begin
View:=SelectedView; View:=SelectedView;
Line:=SelectedLine1; Line:=SelectedLine1;
if Offset>0 then begin if Offset>0 then begin
{$IFDEF VerboseMsgCtrlSelectNextShown} {$IFDEF VerboseMsgCtrlSelection}
debugln(['TMessagesCtrl.SelectNextShown NEXT View.GetShownLineCount(false,true)=', DebugLn(['TMessagesCtrl.SelectNextShown NEXT View.GetShownLineCount(false,true)=',
View.GetShownLineCount(false,true),' ViewIndex=',IndexOfView(View),' Line=',Line]); View.GetShownLineCount(false,true),' ViewIndex=',IndexOfView(View),' Line=',Line]);
{$ENDIF} {$ENDIF}
inc(Line,Offset); inc(Line,Offset);
if Line<View.GetShownLineCount(false,true) then if Line<View.GetShownLineCount(false,true) then
@ -2117,14 +2121,14 @@ begin
// next view // next view
Offset:=Line-View.GetShownLineCount(false,true); Offset:=Line-View.GetShownLineCount(false,true);
i:=IndexOfView(View); i:=IndexOfView(View);
{$IFDEF VerboseMsgCtrlSelectNextShown} {$IFDEF VerboseMsgCtrlSelection}
debugln(['TMessagesCtrl.SelectNextShown Line=',Line,' Offset=',Offset,' ViewIndex=',i]); DebugLn(['TMessagesCtrl.SelectNextShown Line=',Line,' Offset=',Offset,' ViewIndex=',i]);
{$ENDIF} {$ENDIF}
repeat repeat
inc(i); inc(i);
if i>=ViewCount then begin if i>=ViewCount then begin
{$IFDEF VerboseMsgCtrlSelectNextShown} {$IFDEF VerboseMsgCtrlSelection}
debugln(['TMessagesCtrl.SelectNextShown can not go further down']); DebugLn(['TMessagesCtrl.SelectNextShown can not go further down']);
{$ENDIF} {$ENDIF}
exit; exit;
end; end;
@ -2143,8 +2147,8 @@ begin
repeat repeat
dec(i); dec(i);
if i<0 then begin if i<0 then begin
{$IFDEF VerboseMsgCtrlSelectNextShown} {$IFDEF VerboseMsgCtrlSelection}
debugln(['TMessagesCtrl.SelectNextShown can not go further up']); DebugLn(['TMessagesCtrl.SelectNextShown can not go further up']);
{$ENDIF} {$ENDIF}
exit; exit;
end; end;
@ -2153,15 +2157,17 @@ begin
Line:=View.GetShownLineCount(false,false)-1; Line:=View.GetShownLineCount(false,false)-1;
end; end;
end; end;
{$IFDEF VerboseMsgCtrlSelectNextShown} {$IFDEF VerboseMsgCtrlSelection}
debugln(['TMessagesCtrl.SelectNextShown SELECT Offset=',Offset,' ViewIndex=',IndexOfView(View),' Line=',Line]); DebugLn(['TMessagesCtrl.SelectNextShown SELECT Offset=',Offset,
' ViewIndex=',IndexOfView(View),' Line=',Line]);
{$ENDIF} {$ENDIF}
Select(View,Line,true,true); Select(View,Line,true,true);
Result:=true; Result:=true;
end; end;
end; end;
{$IFDEF VerboseMsgCtrlSelectNextShown} {$IFDEF VerboseMsgCtrlSelection}
debugln(['TMessagesCtrl.SelectNextShown END ViewIndex=',IndexOfView(SelectedView),' Line=',SelectedLine]); DebugLn(['TMessagesCtrl.SelectNextShown END ViewIndex=',IndexOfView(SelectedView),
' Line=',SelectedLine1]);
{$ENDIF} {$ENDIF}
end; end;