ide: file info improved

This commit is contained in:
Mirek Fidler 2025-10-23 13:44:41 +02:00
parent 0850a738d8
commit cb6fb99e88
3 changed files with 21 additions and 11 deletions

View file

@ -118,7 +118,7 @@ void IconDes::SettingBar(Bar& bar)
bar.Add("Show downscaled", IconDesImg::ShowSmall(),
[=] { show_downscaled = !show_downscaled; show_synthetics = false; SyncShow(); SetBar(); })
.Check(show_downscaled);
bar.Add("Show secondardy grid", IconDesImg::grid2(),
bar.Add("Show secondary grid", IconDesImg::grid2(),
[=] { show_grid2 = !show_grid2; Refresh(); SetBar(); })
.Check(show_grid2);
bar.Add(c, AK_ZOOM_IN, IconDesImg::ZoomMinus(), THISBACK(ZoomOut))

View file

@ -641,7 +641,7 @@ void Ide::SetIcon()
Rect Ide::GetFileInfoRect()
{
Rect r = display.GetScreenRect();
r.top = r.bottom;
r.top = r.bottom - GetStdFontCy() / 2;
r.bottom = r.top + GetStdFontCy() + DPI(2);
return r - GetScreenRect().TopLeft();
}
@ -652,11 +652,26 @@ void Ide::PaintFileInfo(Draw& w)
Time tm(edittime);
String qtf = "[g ";
qtf << AsString(Format(" %d-%02d-%02d %02d:%02d:%02d",
qtf << AsString(Format(" [@b* %d]-[@b* %02d]-[@b* %02d] [* %02d]:[* %02d]:%02d",
(int)tm.year, (int)tm.month, (int)tm.day,
(int)tm.hour, (int)tm.minute, (int)tm.second));
qtf << ", Size " << FormatFileSize(editfile_length);
double d = (GetSysTime() - tm) / 60;
String unit = "minute";
auto DoUnit = [&](double m, const char *s) {
if(d > m) {
d /= m;
unit = s;
}
};
DoUnit(60, "hour");
DoUnit(24, "day");
DoUnit(30.5, "month");
DoUnit(12, "year");
int n = (int)round(d);
if(n != 1)
unit << "s";
qtf << " ([* " << n << ' ' << unit << "] ago), size [* " << FormatFileSize(editfile_length);
RichText txt = ParseQTF(qtf);
txt.ApplyZoom(GetRichTextStdScreenZoom());
@ -681,8 +696,7 @@ void Ide::Periodic()
SyncClang();
bool b = display.GetScreenRect().Contains(GetMousePos());
if(fileinfo_visible != b) {
Refresh(GetFileInfoRect());
Refresh();
RefreshFrame(GetFileInfoRect());
fileinfo_visible = b;
}
}

View file

@ -1187,15 +1187,11 @@ public:
void TabsLR( int jd );
void TabsStackLR( int jd );
void RefreshFrame(bool auto_disasm);
void RefreshLine(int frame, bool auto_disasm);
void SetBar();
void SetMenuBar();
void SetToolBar();
TimeCallback delayed_toolbar;
void UpdateFormat(CodeEditor& editor);
void UpdateFormat();
void ReadHlStyles(ArrayCtrl& hlstyle);