fix #60 - searches results should go in their own message category

This commit is contained in:
Basile Burg 2020-09-13 00:34:17 +02:00
parent df4773f6ce
commit 7057c97c89
5 changed files with 41 additions and 16 deletions

View File

@ -2,6 +2,7 @@
## Enhancements
- Messages, searches: results of Find All with for scope a whole project go in their own category, preventing to repeat the operation in certain circumstances. (#60)
- Project inspector: moved the list of configuration to a combo box over the file tree.
## Bugs fixed

View File

@ -248,6 +248,7 @@ type
amcProj, // used as filter
amcApp, // used as filter
amcMisc, // used as filter
amcSearch, // used as filter
amcAutoEdit, // same as amcEdit but the message data is set automatically by the IMessagesDisplay
amcAutoProj, // same as amcProj but the message data is set automatically by the IMessagesDisplay
amcAutoCompile // same as amcAutoEdit or amcAutoProj but set by the IMessagesDisplay according to what's being compiled.

View File

@ -47,8 +47,8 @@ inherited MessagesWidget: TMessagesWidget
Wrapable = False
OnResize = toolbarResize
object sep: TDexedToolButton[0]
Left = 832
Height = 5
Left = 405
Height = 28
Hint = 'Clean filtered messages'
Top = 0
AutoSize = True
@ -56,7 +56,7 @@ inherited MessagesWidget: TMessagesWidget
scaledSeparator = False
end
object btnSelMisc: TDexedToolButton[1]
Left = 262
Left = 367
Hint = 'filter the other messages'
Top = 0
AutoSize = True
@ -65,7 +65,7 @@ inherited MessagesWidget: TMessagesWidget
end
object button2: TDexedToolButton[2]
Left = 257
Height = 5
Height = 28
Top = 0
AutoSize = True
Caption = 'button2'
@ -82,7 +82,7 @@ inherited MessagesWidget: TMessagesWidget
end
object button4: TDexedToolButton[4]
Left = 171
Height = 5
Height = 28
Top = 0
AutoSize = True
Caption = 'button4'
@ -99,7 +99,7 @@ inherited MessagesWidget: TMessagesWidget
end
object button6: TDexedToolButton[6]
Left = 113
Height = 5
Height = 28
Top = 0
AutoSize = True
Caption = 'button6'
@ -116,7 +116,7 @@ inherited MessagesWidget: TMessagesWidget
end
object button8: TDexedToolButton[8]
Left = 62
Height = 5
Height = 28
Top = 0
AutoSize = True
Caption = 'button8'
@ -133,11 +133,11 @@ inherited MessagesWidget: TMessagesWidget
scaledSeparator = False
end
object TreeFilterEdit1: TTreeFilterEdit[10]
Left = 304
Left = 416
Height = 28
Hint = 'in the selected category, filter the messages that contain the text typed here'
Top = 1
Width = 528
Width = 416
OnAfterFilter = TreeFilterEdit1AfterFilter
ButtonWidth = 23
Align = alRight
@ -158,13 +158,29 @@ inherited MessagesWidget: TMessagesWidget
end
object sepCat: TDexedToolButton[12]
Left = 29
Height = 5
Height = 28
Top = 0
AutoSize = True
Caption = 'sepCat'
Style = tbsDivider
scaledSeparator = False
end
object btnSelSearches: TDexedToolButton[13]
Left = 262
Top = 0
AutoSize = True
Caption = 'Search results'
scaledSeparator = False
end
object button3: TDexedToolButton[14]
Left = 362
Height = 28
Top = 0
AutoSize = True
Caption = 'button3'
Style = tbsDivider
scaledSeparator = False
end
end
end
inherited contextMenu: TPopupMenu

View File

@ -70,6 +70,8 @@ type
TMessagesWidget = class(TDexedWidget, IEditableOptions, IDocumentObserver, IProjectObserver, IMessagesDisplay)
btnClearCat: TDexedToolButton;
btnSelSearches: TDexedToolButton;
button3: TDexedToolButton;
sepCat: TDexedToolButton;
btnSelAll: TDexedToolButton;
btnSelApp: TDexedToolButton;
@ -448,11 +450,13 @@ begin
btnSelEdit.OnClick := @selCtxtClick;
btnSelApp.OnClick := @selCtxtClick;
btnSelAll.OnClick := @selCtxtClick;
btnSelSearches.OnClick := @selCtxtClick;
fBtns[amcAll] := btnSelAll;
fBtns[amcApp] := btnSelApp;
fBtns[amcEdit]:= btnSelEdit;
fBtns[amcMisc]:= btnSelMisc;
fBtns[amcProj]:= btnSelProj;
fBtns[amcSearch]:= btnSelSearches;
btnClearCat.OnClick := @actClearCurCatExecute;
@ -557,7 +561,9 @@ begin
else if btn = btnSelApp then
fCtxt := amcApp
else if btn = btnSelMisc then
fCtxt := amcMisc;
fCtxt := amcMisc
else if btn = btnSelSearches then
fCtxt := amcSearch;
if o <> fCtxt then
fJustChangedContext := true;
filterMessages(fCtxt);
@ -1160,6 +1166,7 @@ begin
amcProj: result := (fProj = ICommonProject(msgDt^.data)) and (aCtxt = amcProj);
amcApp: result := aCtxt = amcApp;
amcMisc: result := aCtxt = amcMisc;
amcSearch: result := aCtxt = amcSearch;
end;
end;

View File

@ -418,7 +418,7 @@ begin
begin
m := getMessageDisplay;
m.message(format('0 result for the pattern <%s>', [fToFind]),
nil, amcMisc, amkInf);
nil, amcSearch, amkInf);
end;
finally
c.Free;
@ -439,7 +439,7 @@ begin
begin
m := getMessageDisplay;
m.message(format('0 result for the pattern <%s>', [fToFind]),
nil, amcMisc, amkInf);
nil, amcSearch, amkInf);
end;
finally
c.Free;
@ -499,7 +499,7 @@ begin
begin
msg := format('%d result(s) for the pattern `%s` in %s',
[length(res), fToFind, filename]);
msgs.message(msg, nil, amcMisc, amkInf);
msgs.message(msg, nil, amcSearch, amkInf);
end;
fmt := fileName + '(%d,%d): "%s"';
// highlighting
@ -537,7 +537,7 @@ begin
until
not r.ExecNext();
s += msg[rStart .. msg.length];
msgs.message(format(fmt, [res[i].Y, res[i].X, s]), nil, amcMisc, amkInf);
msgs.message(format(fmt, [res[i].Y, res[i].X, s]), nil, amcSearch, amkInf);
o := res[i].Y;
end;
finally
@ -548,7 +548,7 @@ begin
begin
msg := Trim(lines[res[i].Y-1]);
msg := strutils.ReplaceStr(msg, fToFind, '`' + fToFind + '`');
msgs.message(format(fmt, [res[i].Y, res[i].X, msg]), nil, amcMisc, amkInf);
msgs.message(format(fmt, [res[i].Y, res[i].X, msg]), nil, amcSearch, amkInf);
end;
finally
search.free;