IDE: Prepare to support multi-line selection in Messages window. Use IntegerList instead of one integer index.

git-svn-id: trunk@65311 -
This commit is contained in:
juha 2021-06-26 15:28:26 +00:00
parent 22449a3dbc
commit 6857527965
2 changed files with 96 additions and 94 deletions

View File

@ -32,17 +32,18 @@ unit etMessageFrame;
interface interface
uses uses
Math, strutils, Classes, SysUtils, Laz_AVL_Tree, Math, StrUtils, Classes, SysUtils, Laz_AVL_Tree,
// LCL // LCL
Forms, Buttons, ExtCtrls, Controls, LMessages, LCLType, LCLIntf, Forms, Buttons, ExtCtrls, Controls, LMessages, LCLType, LCLIntf,
Graphics, Themes, ImgList, Menus, Clipbrd, Dialogs, StdCtrls, Graphics, Themes, ImgList, Menus, Clipbrd, Dialogs, StdCtrls,
// LazUtils // LazUtils
GraphType, UTF8Process, FileProcs, LazFileCache, LazFileUtils, LazUTF8, GraphType, UTF8Process, LazUTF8, LazFileCache, LazFileUtils, IntegerList,
// SynEdit // SynEdit
SynEdit, SynEditMarks, SynEdit, SynEditMarks,
// BuildIntf
ProjectIntf, PackageIntf, CompOptsIntf, IDEExternToolIntf,
// IDEIntf // IDEIntf
IDEExternToolIntf, IDEImagesIntf, MenuIntf, PackageIntf, IDEImagesIntf, MenuIntf, IDECommands, IDEDialogs, LazIDEIntf,
IDECommands, IDEDialogs, ProjectIntf, CompOptsIntf, LazIDEIntf,
// IDE // IDE
LazarusIDEStrConsts, EnvironmentOpts, HelpFPCMessages, etSrcEditMarks, LazarusIDEStrConsts, EnvironmentOpts, HelpFPCMessages, etSrcEditMarks,
MsgWnd_Options, etQuickFixes, ExtTools, IDEOptionDefs, CompilerOptions; MsgWnd_Options, etQuickFixes, ExtTools, IDEOptionDefs, CompilerOptions;
@ -161,7 +162,7 @@ type
FScrollTop: integer; FScrollTop: integer;
fScrollTopMax: integer; fScrollTopMax: integer;
FSearchText: string; FSearchText: string;
FSelectedLine: integer; FSelectedLines: TIntegerList;
FSelectedView: TLMsgWndView; FSelectedView: TLMsgWndView;
FSourceMarks: TETMarks; FSourceMarks: TETMarks;
FTextColor: TColor; FTextColor: TColor;
@ -202,7 +203,6 @@ type
procedure WMMouseWheel(var Message: TLMMouseEvent); message LM_MOUSEWHEEL; procedure WMMouseWheel(var Message: TLMMouseEvent); message LM_MOUSEWHEEL;
procedure WMSetFocus(var Message: TLMSetFocus); message LM_SETFOCUS; procedure WMSetFocus(var Message: TLMSetFocus); message LM_SETFOCUS;
procedure WMKillFocus(var Message: TLMKillFocus); message LM_KILLFOCUS; procedure WMKillFocus(var Message: TLMKillFocus); message LM_KILLFOCUS;
function GetMaxSelectedLine: integer;
procedure ImageListChange(Sender: TObject); procedure ImageListChange(Sender: TObject);
procedure OnIdle(Sender: TObject; var {%H-}Done: Boolean); procedure OnIdle(Sender: TObject; var {%H-}Done: Boolean);
procedure OnFilterChanged(Sender: TObject); procedure OnFilterChanged(Sender: TObject);
@ -223,8 +223,7 @@ type
procedure CreateWnd; override; procedure CreateWnd; override;
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); override; procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
); override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure DoOnShowHint(HintInfo: PHintInfo); override; procedure DoOnShowHint(HintInfo: PHintInfo); override;
procedure DoAllViewsStopped; procedure DoAllViewsStopped;
@ -255,13 +254,12 @@ type
function Filters: TLMsgViewFilters; inline; function Filters: TLMsgViewFilters; inline;
// select, search // select, search
// Note: At the moment only single single selected is implemented
function HasSelection: boolean; function HasSelection: boolean;
function IsLineSelected(View: TLMsgWndView; LineNumber: integer): boolean; function IsLineSelected(View: TLMsgWndView; LineNumber: integer): boolean;
procedure Select(View: TLMsgWndView; LineNumber: integer; DoScroll, FullyVisible: boolean);
function SearchNext(StartView: TLMsgWndView; StartLine: integer; function SearchNext(StartView: TLMsgWndView; StartLine: integer;
SkipStart, Downwards: boolean; SkipStart, Downwards: boolean;
out View: TLMsgWndView; out LineNumber: integer): boolean; out View: TLMsgWndView; out LineNumber: integer): boolean;
procedure Select(View: TLMsgWndView; LineNumber: integer; DoScroll, FullyVisible: boolean);
procedure Select(Msg: TMessageLine; DoScroll: boolean); procedure Select(Msg: TMessageLine; DoScroll: boolean);
function SelectNextOccurrence(Downwards: boolean): boolean; function SelectNextOccurrence(Downwards: boolean): boolean;
function SelectNextShown(Offset: integer): boolean; function SelectNextShown(Offset: integer): boolean;
@ -307,7 +305,9 @@ type
Property OnOptionsChanged: TNotifyEvent read FOnOptionsChanged write FOnOptionsChanged; Property OnOptionsChanged: TNotifyEvent read FOnOptionsChanged write FOnOptionsChanged;
property Options: TMsgCtrlOptions read FOptions write SetOptions default MCDefaultOptions; property Options: TMsgCtrlOptions read FOptions write SetOptions default MCDefaultOptions;
property SearchText: string read FSearchText write SetSearchText; property SearchText: string read FSearchText write SetSearchText;
property SelectedLine: integer read GetSelectedLine write SetSelectedLine; // -1=header line, can be on progress line (=View.Count) property SelectedLines: TIntegerList read FSelectedLines;
// -1=header line, can be on progress line (=View.Count)
property SelectedLine1: integer read GetSelectedLine write SetSelectedLine;
property SelectedView: TLMsgWndView read FSelectedView write SetSelectedView; property SelectedView: TLMsgWndView read FSelectedView write SetSelectedView;
property ShowHint default true; property ShowHint default true;
property SourceMarks: TETMarks read FSourceMarks write SetSourceMarks; property SourceMarks: TETMarks read FSourceMarks write SetSourceMarks;
@ -1129,8 +1129,7 @@ begin
Invalidate; Invalidate;
// auto scroll // auto scroll
if (SelectedView<>nil) if (SelectedView<>nil) and (SelectedLine1<SelectedView.Lines.Count) then
and (SelectedLine<SelectedView.Lines.Count) then
exit; // user has selected a non progress line -> do not auto scroll exit; // user has selected a non progress line -> do not auto scroll
for i:=0 to ViewCount-1 do for i:=0 to ViewCount-1 do
@ -1253,12 +1252,22 @@ begin
end; end;
procedure TMessagesCtrl.SetSelectedLine(AValue: integer); procedure TMessagesCtrl.SetSelectedLine(AValue: integer);
// Select the given line, clear possibly existing selections.
begin begin
if AValue<-1 then AValue:=-1; Assert(AValue>=-1, 'TMessagesCtrl.SetSelectedLine: AValue < -1.');
if FSelectedLine=AValue then Exit; Assert(Assigned(SelectedView), 'TMessagesCtrl.SetSelectedLine: View = Nil.');
AValue:=Min(AValue,GetMaxSelectedLine); AValue:=Min(AValue, SelectedView.GetShownLineCount(false,true)-1);
if FSelectedLine=AValue then Exit; if AValue=-1 then begin
FSelectedLine:=AValue; if FSelectedLines.Count=0 then
Exit;
FSelectedLines.Clear; // -1 = no selection.
end
else begin
if (FSelectedLines.Count>0) and (FSelectedLines[0]=AValue) then
Exit;
FSelectedLines.Count:=1; // One line.
FSelectedLines[0]:=AValue;
end;
Invalidate; Invalidate;
end; end;
@ -1383,17 +1392,6 @@ begin
inherited; inherited;
end; end;
function TMessagesCtrl.GetMaxSelectedLine: integer;
var
View: TLMsgWndView;
begin
View:=SelectedView;
if View<>nil then
Result:=View.GetShownLineCount(false,true)-1
else
Result:=-1;
end;
procedure TMessagesCtrl.ImageListChange(Sender: TObject); procedure TMessagesCtrl.ImageListChange(Sender: TObject);
begin begin
Invalidate; Invalidate;
@ -1452,18 +1450,12 @@ begin
end; end;
function TMessagesCtrl.GetSelectedLine: integer; function TMessagesCtrl.GetSelectedLine: integer;
var // Return the first selected line number.
View: TLMsgWndView;
begin begin
View:=SelectedView; if FSelectedLines.Count>0 then
if View<>nil then begin Result:=FSelectedLines[0]
Result:=FSelectedLine; else
if Result>=0 then Result:=-1; // No selection.
Result:=Min(FSelectedLine,GetMaxSelectedLine);
end else begin
Result:=-1;
end;
FSelectedLine:=Result;
end; end;
procedure TMessagesCtrl.CreateSourceMarks(View: TLMsgWndView; procedure TMessagesCtrl.CreateSourceMarks(View: TLMsgWndView;
@ -1538,13 +1530,13 @@ var
TextRect.Right:=TextRect.Left+Canvas.TextWidth(aTxt)+2; TextRect.Right:=TextRect.Left+Canvas.TextWidth(aTxt)+2;
if IsSelected then begin if IsSelected then begin
if (mcsFocused in FStates) or (mcoAlwaysDrawFocused in Options) then if (mcsFocused in FStates) or (mcoAlwaysDrawFocused in Options) then
Details := ThemeServices.GetElementDetails(ttItemSelected) Details:=ThemeServices.GetElementDetails(ttItemSelected)
else else
Details := ThemeServices.GetElementDetails(ttItemSelectedNotFocus); Details:=ThemeServices.GetElementDetails(ttItemSelectedNotFocus);
ThemeServices.DrawElement(Canvas.Handle, Details, TextRect, nil); ThemeServices.DrawElement(Canvas.Handle, Details, TextRect, nil);
TxtColor:=clDefault; TxtColor:=clDefault;
end else end else
Details := ThemeServices.GetElementDetails(ttItemNormal); Details:=ThemeServices.GetElementDetails(ttItemNormal);
if LoSearchText<>'' then begin if LoSearchText<>'' then begin
LoTxt:=UTF8LowerCase(aTxt); LoTxt:=UTF8LowerCase(aTxt);
p:=1; p:=1;
@ -1623,7 +1615,7 @@ begin
Canvas.Line(NodeRect.Left,NodeRect.Top,NodeRect.Right,NodeRect.Top); Canvas.Line(NodeRect.Left,NodeRect.Top,NodeRect.Right,NodeRect.Top);
Canvas.Pen.Style:=psSolid; Canvas.Pen.Style:=psSolid;
DrawText(NodeRect,GetHeaderText(View), DrawText(NodeRect,GetHeaderText(View),
(fSelectedView=View) and (FSelectedLine=-1),TextColor); (fSelectedView=View) and (FSelectedLines.Count=0),TextColor);
Canvas.Brush.Color:=BackgroundColor; Canvas.Brush.Color:=BackgroundColor;
end; end;
inc(y,ItemHeight); inc(y,ItemHeight);
@ -1639,7 +1631,7 @@ begin
while (j<View.Lines.Count) and (y<ClientHeight) do begin while (j<View.Lines.Count) and (y<ClientHeight) do begin
Line:=View.Lines[j]; Line:=View.Lines[j];
NodeRect:=Rect(Indent,y,ClientWidth,y+ItemHeight); NodeRect:=Rect(Indent,y,ClientWidth,y+ItemHeight);
IsSelected:=(fSelectedView=View) and (FSelectedLine=j); IsSelected:=(fSelectedView=View) and (SelectedLine1=j);
if not IsSelected then begin if not IsSelected then begin
if (y>-ItemHeight) and (y<=0) then if (y>-ItemHeight) and (y<=0) then
FirstLineIsNotSelectedMessage:=true FirstLineIsNotSelectedMessage:=true
@ -1691,7 +1683,7 @@ begin
if col=clDefault then if col=clDefault then
col:=TextColor; col:=TextColor;
DrawText(NodeRect,View.ProgressLine.Msg, DrawText(NodeRect,View.ProgressLine.Msg,
(fSelectedView=View) and (FSelectedLine=View.Lines.Count),col); (fSelectedView=View) and (SelectedLine1=View.Lines.Count),col);
end; end;
inc(y,ItemHeight); inc(y,ItemHeight);
end; end;
@ -1748,8 +1740,8 @@ begin
//Application.HideHint; //Application.HideHint;
end; end;
procedure TMessagesCtrl.MouseDown(Button: TMouseButton; Shift: TShiftState; X, procedure TMessagesCtrl.MouseDown(Button: TMouseButton; Shift: TShiftState;
Y: Integer); X, Y: Integer);
var var
View: TLMsgWndView; View: TLMsgWndView;
LineNumber: integer; LineNumber: integer;
@ -2007,18 +1999,29 @@ begin
until not Next; until not Next;
end; end;
procedure TMessagesCtrl.Select(View: TLMsgWndView; LineNumber: integer;
DoScroll, FullyVisible: boolean);
begin
BeginUpdate;
SelectedView:=View;
SelectedLine1:=LineNumber;
if DoScroll then
ScrollToLine(SelectedView,LineNumber,FullyVisible);
EndUpdate;
end;
procedure TMessagesCtrl.Select(Msg: TMessageLine; DoScroll: boolean); procedure TMessagesCtrl.Select(Msg: TMessageLine; DoScroll: boolean);
begin begin
BeginUpdate; BeginUpdate;
if (Msg=nil) or (Msg.Lines=nil) or (not (Msg.Lines.Owner is TLMsgWndView)) if (Msg=nil) or (Msg.Lines=nil) or not (Msg.Lines.Owner is TLMsgWndView) then
then begin begin
SelectedView:=nil; SelectedView:=nil;
SelectedLine:=-1; SelectedLine1:=-1;
end else begin end else begin
SelectedView:=TLMsgWndView(Msg.Lines.Owner); SelectedView:=TLMsgWndView(Msg.Lines.Owner);
SelectedLine:=Msg.Index; SelectedLine1:=Msg.Index;
if DoScroll then if DoScroll then
ScrollToLine(SelectedView,SelectedLine,true); ScrollToLine(SelectedView,Msg.Index,true);
end; end;
EndUpdate; EndUpdate;
end; end;
@ -2029,7 +2032,7 @@ var
LineNumber: integer; LineNumber: integer;
begin begin
StoreSelectedAsSearchStart; StoreSelectedAsSearchStart;
Result:=SearchNext(SelectedView,SelectedLine,true,Downwards,View,LineNumber); Result:=SearchNext(SelectedView,SelectedLine1,true,Downwards,View,LineNumber);
if not Result then exit; if not Result then exit;
Select(View,LineNumber,true,true); Select(View,LineNumber,true,true);
end; end;
@ -2047,7 +2050,8 @@ begin
{$ENDIF} {$ENDIF}
while Offset<>0 do begin while Offset<>0 do begin
{$IFDEF VerboseMsgCtrlSelectNextShown} {$IFDEF VerboseMsgCtrlSelectNextShown}
debugln(['TMessagesCtrl.SelectNextShown LOOP Offset=',Offset,' ViewIndex=',IndexOfView(SelectedView),' Line=',SelectedLine]); debugln(['TMessagesCtrl.SelectNextShown LOOP Offset=',Offset,
' ViewIndex=',IndexOfView(SelectedView),' Line=',SelectedLine]);
{$ENDIF} {$ENDIF}
if SelectedView=nil then begin if SelectedView=nil then begin
if Offset>0 then begin if Offset>0 then begin
@ -2060,10 +2064,11 @@ begin
Result:=true; Result:=true;
end else begin end else begin
View:=SelectedView; View:=SelectedView;
Line:=SelectedLine; Line:=SelectedLine1;
if Offset>0 then begin if Offset>0 then begin
{$IFDEF VerboseMsgCtrlSelectNextShown} {$IFDEF VerboseMsgCtrlSelectNextShown}
debugln(['TMessagesCtrl.SelectNextShown NEXT View.GetShownLineCount(false,true)=',View.GetShownLineCount(false,true),' ',' ViewIndex=',IndexOfView(View),' Line=',Line]); debugln(['TMessagesCtrl.SelectNextShown NEXT View.GetShownLineCount(false,true)=',
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
@ -2151,6 +2156,7 @@ begin
end; end;
function TMessagesCtrl.GetSelectedMsg: TMessageLine; function TMessagesCtrl.GetSelectedMsg: TMessageLine;
// Return the first selected message.
var var
View: TLMsgWndView; View: TLMsgWndView;
Line: Integer; Line: Integer;
@ -2158,12 +2164,14 @@ begin
Result:=nil; Result:=nil;
View:=SelectedView; View:=SelectedView;
if View=nil then exit; if View=nil then exit;
Line:=SelectedLine; Line:=SelectedLine1;
if (Line<0) then exit; if (Line<0) then exit;
if Line<View.Lines.Count then if Line<View.Lines.Count then
Result:=View.Lines[Line] Result:=View.Lines[Line]
else if (Line=View.Lines.Count) and (View.ProgressLine.Msg<>'') then else if View.ProgressLine.Msg<>'' then begin
Assert((Line=View.Lines.Count), 'TMessagesCtrl.GetSelectedMsg: Line is too big.');
Result:=View.ProgressLine; Result:=View.ProgressLine;
end;
end; end;
function TMessagesCtrl.SearchNextUrgent(StartView: TLMsgWndView; function TMessagesCtrl.SearchNextUrgent(StartView: TLMsgWndView;
@ -2277,23 +2285,21 @@ begin
Result:=true; Result:=true;
end; end;
function TMessagesCtrl.SelectNextUrgentMessage( function TMessagesCtrl.SelectNextUrgentMessage(aMinUrgency: TMessageLineUrgency;
aMinUrgency: TMessageLineUrgency; WithSrcPos: boolean; Downwards: boolean WithSrcPos: boolean; Downwards: boolean): boolean;
): boolean;
var var
View: TLMsgWndView; View: TLMsgWndView;
LineNumber: integer; LineNumber: integer;
begin begin
Result:=false; Result:=false;
if not SearchNextUrgent(SelectedView,SelectedLine,true,Downwards, if not SearchNextUrgent(SelectedView,SelectedLine1,true,Downwards,
aMinUrgency,WithSrcPos,View,LineNumber) aMinUrgency,WithSrcPos,View,LineNumber)
then exit; then exit;
Select(View,LineNumber,true,true); Select(View,LineNumber,true,true);
Result:=true; Result:=true;
end; end;
function TMessagesCtrl.IsLineVisible(View: TLMsgWndView; LineNumber: integer function TMessagesCtrl.IsLineVisible(View: TLMsgWndView; LineNumber: integer): boolean;
): boolean;
var var
y: Integer; y: Integer;
begin begin
@ -2407,17 +2413,6 @@ begin
Result:=nil; Result:=nil;
end; end;
procedure TMessagesCtrl.Select(View: TLMsgWndView; LineNumber: integer;
DoScroll, FullyVisible: boolean);
begin
BeginUpdate;
SelectedView:=View;
SelectedLine:=LineNumber;
if DoScroll then
ScrollToLine(SelectedView,SelectedLine,FullyVisible);
EndUpdate;
end;
procedure TMessagesCtrl.ScrollToLine(View: TLMsgWndView; LineNumber: integer; procedure TMessagesCtrl.ScrollToLine(View: TLMsgWndView; LineNumber: integer;
FullyVisible: boolean); FullyVisible: boolean);
var var
@ -2478,13 +2473,13 @@ begin
Filters.OnChanged:=@OnFilterChanged; Filters.OnChanged:=@OnFilterChanged;
FActiveFilter:=Filters[0]; FActiveFilter:=Filters[0];
FViews:=TFPList.Create; FViews:=TFPList.Create;
FSelectedLines:=TIntegerList.Create;
FUpdateTimer:=TTimer.Create(Self); FUpdateTimer:=TTimer.Create(Self);
FUpdateTimer.Name:='MsgUpdateTimer'; FUpdateTimer.Name:='MsgUpdateTimer';
FUpdateTimer.Interval:=200; FUpdateTimer.Interval:=200;
FUpdateTimer.OnTimer:=@MsgUpdateTimerTimer; FUpdateTimer.OnTimer:=@MsgUpdateTimerTimer;
FItemHeight:=20; FItemHeight:=20;
FSelectedView:=nil; FSelectedView:=nil;
FSelectedLine:=-1;
BorderWidth:=0; BorderWidth:=0;
fBackgroundColor:=MsgWndDefBackgroundColor; fBackgroundColor:=MsgWndDefBackgroundColor;
FHeaderBackground[lmvtsRunning]:=MsgWndDefHeaderBackgroundRunning; FHeaderBackground[lmvtsRunning]:=MsgWndDefHeaderBackgroundRunning;
@ -2492,10 +2487,10 @@ begin
FHeaderBackground[lmvtsFailed]:=MsgWndDefHeaderBackgroundFailed; FHeaderBackground[lmvtsFailed]:=MsgWndDefHeaderBackgroundFailed;
FAutoHeaderBackground:=MsgWndDefAutoHeaderBackground; FAutoHeaderBackground:=MsgWndDefAutoHeaderBackground;
FTextColor:=MsgWndDefTextColor; FTextColor:=MsgWndDefTextColor;
TabStop := True; TabStop:=True;
ParentColor := False; ParentColor:=False;
FImageChangeLink := TChangeLink.Create; FImageChangeLink:=TChangeLink.Create;
FImageChangeLink.OnChange := @ImageListChange; FImageChangeLink.OnChange:=@ImageListChange;
for u:=Low(TMessageLineUrgency) to high(TMessageLineUrgency) do for u:=Low(TMessageLineUrgency) to high(TMessageLineUrgency) do
fUrgencyStyles[u]:=TMsgCtrlUrgencyStyle.Create(Self,u); fUrgencyStyles[u]:=TMsgCtrlUrgencyStyle.Create(Self,u);
ShowHint:=true; ShowHint:=true;
@ -2509,6 +2504,7 @@ begin
Images:=nil; Images:=nil;
ClearViews(false); ClearViews(false);
FreeAndNil(FSelectedLines);
FreeAndNil(FViews); FreeAndNil(FViews);
FreeAndNil(FUpdateTimer); FreeAndNil(FUpdateTimer);
FreeAndNil(FImageChangeLink); FreeAndNil(FImageChangeLink);
@ -2549,7 +2545,7 @@ var
begin begin
for u in TMessageLineUrgency do for u in TMessageLineUrgency do
UrgencyStyles[u].Color := EnvironmentOptions.MsgColors[u]; UrgencyStyles[u].Color:=EnvironmentOptions.MsgColors[u];
BackgroundColor:=EnvironmentOptions.MsgViewColors[mwBackground]; BackgroundColor:=EnvironmentOptions.MsgViewColors[mwBackground];
AutoHeaderBackground:=EnvironmentOptions.MsgViewColors[mwAutoHeader]; AutoHeaderBackground:=EnvironmentOptions.MsgViewColors[mwAutoHeader];
HeaderBackground[lmvtsRunning]:=EnvironmentOptions.MsgViewColors[mwRunning]; HeaderBackground[lmvtsRunning]:=EnvironmentOptions.MsgViewColors[mwRunning];
@ -2666,7 +2662,7 @@ procedure TMessagesCtrl.StoreSelectedAsSearchStart;
begin begin
fLastLoSearchText:=UTF8LowerCase(FSearchText); fLastLoSearchText:=UTF8LowerCase(FSearchText);
fLastSearchStartView:=FSelectedView; fLastSearchStartView:=FSelectedView;
fLastSearchStartLine:=FSelectedLine; fLastSearchStartLine:=SelectedLine1;
end; end;
function TMessagesCtrl.OpenSelection: boolean; function TMessagesCtrl.OpenSelection: boolean;
@ -2718,13 +2714,12 @@ begin
Result:=false; Result:=false;
View:=SelectedView; View:=SelectedView;
if View=nil then exit; if View=nil then exit;
Result:=SelectedLine<View.GetShownLineCount(false,true); Result:=SelectedLine1<View.GetShownLineCount(false,true);
end; end;
function TMessagesCtrl.IsLineSelected(View: TLMsgWndView; LineNumber: integer function TMessagesCtrl.IsLineSelected(View: TLMsgWndView; LineNumber: integer): boolean;
): boolean;
begin begin
Result:=(View=SelectedView) and (LineNumber=SelectedLine); Result:=(View=SelectedView) and (LineNumber=SelectedLine1);
end; end;
{ TMessagesFrame } { TMessagesFrame }
@ -2889,7 +2884,7 @@ begin
// check selection // check selection
View:=MessagesCtrl.SelectedView; View:=MessagesCtrl.SelectedView;
if View<>nil then begin if View<>nil then begin
LineNumber:=MessagesCtrl.SelectedLine; LineNumber:=MessagesCtrl.SelectedLine1;
if (LineNumber>=0) and (LineNumber<View.Lines.Count) then begin if (LineNumber>=0) and (LineNumber<View.Lines.Count) then begin
Line:=View.Lines[LineNumber]; Line:=View.Lines[LineNumber];
HasFilename:=Line.Filename<>''; HasFilename:=Line.Filename<>'';
@ -3481,7 +3476,7 @@ var
begin begin
View:=MessagesCtrl.SelectedView; View:=MessagesCtrl.SelectedView;
if View=nil then exit; if View=nil then exit;
LineNumber:=MessagesCtrl.SelectedLine; LineNumber:=MessagesCtrl.SelectedLine1;
if LineNumber<0 then begin if LineNumber<0 then begin
// header // header
if OnlyFilename then exit; if OnlyFilename then exit;
@ -3597,7 +3592,7 @@ begin
// search // search
SearchPanel.Visible:=false; // by default the search is hidden SearchPanel.Visible:=false; // by default the search is hidden
HideSearchSpeedButton.Hint:=lisHideSearch; HideSearchSpeedButton.Hint:=lisHideSearch;
IDEImages.AssignImage(HideSearchSpeedButton, 'debugger_power_grey'); IDEImages.AssignImage(HideSearchSpeedButton, 'debugger_power');
SearchNextSpeedButton.Hint:=lisUDSearchNextOccurrenceOfThisPhrase; SearchNextSpeedButton.Hint:=lisUDSearchNextOccurrenceOfThisPhrase;
IDEImages.AssignImage(SearchNextSpeedButton, 'callstack_bottom'); IDEImages.AssignImage(SearchNextSpeedButton, 'callstack_bottom');
SearchPrevSpeedButton.Hint:=lisUDSearchPreviousOccurrenceOfThisPhrase; SearchPrevSpeedButton.Hint:=lisUDSearchPreviousOccurrenceOfThisPhrase;

View File

@ -30,10 +30,17 @@ unit etMessagesWnd;
interface interface
uses uses
Classes, SysUtils, FileUtil, IDEMsgIntf, IDEImagesIntf, IDEOptionDefs, Classes, SysUtils,
IDEExternToolIntf, LazIDEIntf, SynEditMarks, // LCL
Forms, Controls, Graphics, Dialogs, LCLProc, etMessageFrame, Forms, Controls, Graphics, Dialogs,
etQuickFixes, LazarusIDEStrConsts; // BuildIntf
IDEExternToolIntf,
// IdeIntf
IDEMsgIntf, LazIDEIntf,
// SynEdit
SynEditMarks,
// IDE
IDEOptionDefs, etMessageFrame, etQuickFixes, LazarusIDEStrConsts;
type type