mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
.CtrlLib: Tuning FileSel icons
git-svn-id: svn://ultimatepp.org/upp/trunk@2915 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
cb3218469b
commit
106208819b
2 changed files with 35 additions and 17 deletions
|
|
@ -365,14 +365,16 @@ void LazyFileIcons::Do()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int tm = GetTickCount();
|
int tm = GetTickCount();
|
||||||
while(pos < list->GetCount()) {
|
while(pos < ndx.GetCount()) {
|
||||||
if((int)GetTickCount() - tm > ptime) {
|
if((int)GetTickCount() - tm > ptime) {
|
||||||
ptime = 50;
|
ptime = 50;
|
||||||
Restart(0);
|
Restart(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const FileList::File& f = list->Get(pos);
|
int ii = ndx[pos];
|
||||||
if(ToLower(GetFileExt(f.name)) == ".exe") {
|
if(ii < 0 || ii >= list->GetCount())
|
||||||
|
return;
|
||||||
|
const FileList::File& f = list->Get(ii);
|
||||||
int t0 = GetTickCount();
|
int t0 = GetTickCount();
|
||||||
#ifdef PLATFORM_WIN32
|
#ifdef PLATFORM_WIN32
|
||||||
Image img = GetFileIcon(AppendFileName(dir, f.name), f.isdir, f.unixexe, false, quick);
|
Image img = GetFileIcon(AppendFileName(dir, f.name), f.isdir, f.unixexe, false, quick);
|
||||||
|
|
@ -382,14 +384,28 @@ void LazyFileIcons::Do()
|
||||||
WhenIcon(f.isdir, f.name, img);
|
WhenIcon(f.isdir, f.name, img);
|
||||||
if(f.hidden)
|
if(f.hidden)
|
||||||
img = Contrast(img, 200);
|
img = Contrast(img, 200);
|
||||||
list->SetIcon(pos, img);
|
list->SetIcon(ii, img);
|
||||||
if(GetTickCount() - t0 > 500/* || GetTickCount() - start > 1500*/)
|
if(GetTickCount() - t0 > 700)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LazyFileIcons::ReOrder()
|
||||||
|
{
|
||||||
|
ndx.Clear();
|
||||||
|
Vector<int> len;
|
||||||
|
for(int i = 0; i < list->GetCount(); i++) {
|
||||||
|
const FileList::File& f = list->Get(i);
|
||||||
|
if(ToLower(GetFileExt(f.name)) == ".exe" && !f.isdir) {
|
||||||
|
ndx.Add(i);
|
||||||
|
len.Add((int)min((int64)INT_MAX, f.length));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IndexSort(len, ndx);
|
||||||
|
Restart(0);
|
||||||
|
}
|
||||||
|
|
||||||
void LazyFileIcons::Start(FileList& list_, const String& dir_, Callback3<bool, const String&, Image&> WhenIcon_)
|
void LazyFileIcons::Start(FileList& list_, const String& dir_, Callback3<bool, const String&, Image&> WhenIcon_)
|
||||||
{
|
{
|
||||||
list = &list_;
|
list = &list_;
|
||||||
|
|
@ -399,7 +415,7 @@ void LazyFileIcons::Start(FileList& list_, const String& dir_, Callback3<bool, c
|
||||||
quick = false;
|
quick = false;
|
||||||
ptime = 150;
|
ptime = 150;
|
||||||
start = GetTickCount();
|
start = GetTickCount();
|
||||||
Restart(0);
|
ReOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
class FileListSortName : public FileList::Order {
|
class FileListSortName : public FileList::Order {
|
||||||
|
|
@ -569,9 +585,6 @@ void FileSel::SearchLoad()
|
||||||
SearchLoad();
|
SearchLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PLATFORM_WIN32
|
|
||||||
lazyicons.Start(list, d, WhenIcon);
|
|
||||||
#endif
|
|
||||||
places.KillCursor();
|
places.KillCursor();
|
||||||
if(d.GetCount())
|
if(d.GetCount())
|
||||||
places.FindSetCursor(d);
|
places.FindSetCursor(d);
|
||||||
|
|
@ -608,6 +621,9 @@ void FileSel::SearchLoad()
|
||||||
else
|
else
|
||||||
SortByName(list);
|
SortByName(list);
|
||||||
Update();
|
Update();
|
||||||
|
#ifdef PLATFORM_WIN32
|
||||||
|
lazyicons.Start(list, d, WhenIcon);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
String TrimDot(String f) {
|
String TrimDot(String f) {
|
||||||
|
|
|
||||||
|
|
@ -128,12 +128,14 @@ class LazyFileIcons {
|
||||||
bool quick;
|
bool quick;
|
||||||
int ptime;
|
int ptime;
|
||||||
int start;
|
int start;
|
||||||
|
Vector<int> ndx;
|
||||||
Callback3<bool, const String&, Image&> WhenIcon;
|
Callback3<bool, const String&, Image&> WhenIcon;
|
||||||
|
|
||||||
void Do();
|
void Do();
|
||||||
void Restart(int delay) { tm.KillSet(delay, callback(this, &LazyFileIcons::Do)); }
|
void Restart(int delay) { tm.KillSet(delay, callback(this, &LazyFileIcons::Do)); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void ReOrder();
|
||||||
void Start(FileList& list_, const String& dir_, Callback3<bool, const String&, Image&> WhenIcon_);
|
void Start(FileList& list_, const String& dir_, Callback3<bool, const String&, Image&> WhenIcon_);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue