mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-16 14:16:09 -06:00
ide: Find in files now can find in all assemblies
This commit is contained in:
parent
0c375ba143
commit
9298d61657
4 changed files with 37 additions and 21 deletions
|
|
@ -13,7 +13,7 @@ FileSel& sSD()
|
|||
}
|
||||
|
||||
void Ide::SerializeFindInFiles(Stream& s) {
|
||||
int version = 7;
|
||||
int version = 8;
|
||||
s / version;
|
||||
s % ff.files;
|
||||
ff.files.SerializeList(s);
|
||||
|
|
@ -36,8 +36,13 @@ void Ide::SerializeFindInFiles(Stream& s) {
|
|||
s % ff.samecase;
|
||||
if(version >= 5)
|
||||
s % ff.regexp;
|
||||
if(version >= 6)
|
||||
s % ff.workspace;
|
||||
if(version >= 6) {
|
||||
Option dummy;
|
||||
s % dummy;
|
||||
}
|
||||
if(version >= 8) {
|
||||
s % ff.where;
|
||||
}
|
||||
}
|
||||
|
||||
void SearchForFiles(Index<String>& files, String dir, String mask, int readonly, Time since, Progress& pi) {
|
||||
|
|
@ -243,12 +248,15 @@ void Ide::FindInFiles(bool replace) {
|
|||
Time since = Null;
|
||||
if(!IsNull(ff.recent))
|
||||
since = ToTime(GetSysDate() - (int)~ff.recent);
|
||||
if(ff.workspace) {
|
||||
int where = ~ff.where;
|
||||
if(where == 0) {
|
||||
const Workspace& wspc = GetIdeWorkspace();
|
||||
for(int i = 0; i < wspc.GetCount(); i++)
|
||||
SearchForFiles(files, GetFileFolder(PackagePath(wspc[i])),
|
||||
~ff.files, ~ff.readonly, since, pi);
|
||||
SearchForFiles(files, GetFileFolder(PackagePath(wspc[i])), ~ff.files, ~ff.readonly, since, pi);
|
||||
}
|
||||
if(where == 1)
|
||||
for(String h : GetAllNests())
|
||||
SearchForFiles(files, NormalizePath(h), ~ff.files, ~ff.readonly, since, pi);
|
||||
else
|
||||
SearchForFiles(files, NormalizePath(~~ff.folder, GetUppDir()), ~ff.files,
|
||||
~ff.readonly, since, pi);
|
||||
|
|
@ -424,8 +432,7 @@ void FindInFilesDlg::Sync()
|
|||
wildcards.Enable(b);
|
||||
ignorecase.Enable(b);
|
||||
wholeword.Enable(b);
|
||||
folder.Enable(!workspace);
|
||||
folder_lbl.Enable(!workspace);
|
||||
folder.Enable((int)~where == 2);
|
||||
samecase.Enable(ignorecase && b);
|
||||
}
|
||||
|
||||
|
|
@ -443,7 +450,8 @@ FindInFilesDlg::FindInFilesDlg()
|
|||
recent.Add(7, "7 Days");
|
||||
recent.Add(14, "14 Days");
|
||||
recent.Add(32, "28 Days");
|
||||
workspace <<= THISBACK(Sync);
|
||||
where <<= THISBACK(Sync);
|
||||
where <<= 0;
|
||||
}
|
||||
|
||||
void FindInFilesDlg::Setup(bool replacing)
|
||||
|
|
|
|||
|
|
@ -35,20 +35,27 @@ void GatherAllFiles(const String& path, Index<String>& filei, VectorMap<String,
|
|||
|
||||
CoEvent ide_bg_scheduler;
|
||||
|
||||
Index<String> GetAllNests(bool sleep)
|
||||
{
|
||||
Index<String> dir;
|
||||
for(FindFile ff(ConfigFile("*.var")); ff && !Thread::IsShutdownThreads(); ff.Next()) {
|
||||
VectorMap<String, String> var;
|
||||
LoadVarFile(ff.GetPath(), var);
|
||||
for(String d : Split(var.Get("UPP", ""), ';'))
|
||||
dir.FindAdd(NormalizePath(d));
|
||||
if(sleep)
|
||||
Sleep(0);
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
|
||||
void IdeBackgroundThread()
|
||||
{
|
||||
while(!Thread::IsShutdownThreads()) {
|
||||
VectorMap<String, String> file;
|
||||
Index<String> dir;
|
||||
Index<String> filei;
|
||||
|
||||
for(FindFile ff(ConfigFile("*.var")); ff && !Thread::IsShutdownThreads(); ff.Next()) {
|
||||
VectorMap<String, String> var;
|
||||
LoadVarFile(ff.GetPath(), var);
|
||||
for(String d : Split(var.Get("UPP", ""), ';'))
|
||||
dir.FindAdd(NormalizePath(d));
|
||||
Sleep(0);
|
||||
}
|
||||
|
||||
Index<String> dir = GetAllNests(true);
|
||||
|
||||
for(String d : dir)
|
||||
GatherAllFiles(d, filei, file);
|
||||
|
|
|
|||
|
|
@ -1283,6 +1283,8 @@ void HighlightLine(const String& path, Vector<LineEdit::Highlight>& hln, const W
|
|||
|
||||
String GetGitBranchRaw(const String& dir);
|
||||
|
||||
Index<String> GetAllNests(bool sleep = false);
|
||||
|
||||
#include "urepo.h"
|
||||
|
||||
#endif
|
||||
|
|
@ -75,9 +75,8 @@ LAYOUT(FindInFilesLayout, 568, 152)
|
|||
ITEM(Upp::WithDropChoice<Upp::EditString>, find, HSizePosZ(52, 4).TopPosZ(4, 19))
|
||||
ITEM(Upp::Label, dv___2, SetLabel(t_("In fil&es")).LeftPosZ(4, 48).TopPosZ(28, 19))
|
||||
ITEM(Upp::WithDropChoice<Upp::EditString>, files, HSizePosZ(52, 4).TopPosZ(28, 19))
|
||||
ITEM(Upp::Label, folder_lbl, SetLabel(t_("In f&older")).LeftPosZ(4, 48).TopPosZ(52, 19))
|
||||
ITEM(Upp::WithDropChoice<Upp::EditString>, folder, HSizePosZ(52, 144).TopPosZ(52, 19))
|
||||
ITEM(Upp::Option, workspace, SetLabel(t_("In workspace folders")).LeftPosZ(428, 136).TopPosZ(52, 20))
|
||||
ITEM(Upp::Switch, where, SetLabel(t_("Workspace\nAll assemblies\nFolder:")).LeftPosZ(52, 228).TopPosZ(52, 19))
|
||||
ITEM(Upp::WithDropChoice<Upp::EditString>, folder, HSizePosZ(280, 4).TopPosZ(52, 19))
|
||||
ITEM(Upp::Label, replace_lbl, SetLabel(t_("&Replace")).LeftPosZ(4, 48).TopPosZ(74, 22))
|
||||
ITEM(Upp::Switch, style, SetLabel(t_("&None\nCo&nfirm\n&Auto")).LeftPosZ(52, 164).TopPosZ(76, 19))
|
||||
ITEM(Upp::Label, replace_lbl2, SetLabel(t_("with:")).LeftPosZ(220, 28).TopPosZ(76, 19))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue