ide: IconDes improvements

This commit is contained in:
Mirek Fidler 2026-05-05 14:43:56 +02:00
parent 7e2760bc7d
commit c0507faf0a
5 changed files with 32 additions and 6 deletions

View file

@ -1,6 +1,7 @@
PREMULTIPLIED
VERSION(20260403)
IMAGE_ID(pdf)
IMAGE_ID(pdf__UHD)
IMAGE_ID(pdf__600)
IMAGE_BEGIN_DATA
IMAGE_DATA(120,156,237,218,205,109,195,48,12,5,96,143,208,1,50,64,55,72,22,201,189,167,220,187,65,166,235,28,129,23,113,107)

View file

@ -384,7 +384,7 @@ IconDes::IconDes()
AddFrame(sb);
AddFrame(ViewFrame());
leftpane.Left(rgbactrl, 256);
leftpane.Left(rgbactrl, DPI(250));
rgbactrl.SubCtrl(&imgs);
rgbactrl <<= THISBACK(ColorChanged);
@ -415,7 +415,7 @@ IconDes::IconDes()
search <<= THISBACK(Search);
search.SetFilter(CharFilterToUpper);
bottompane.Bottom(iconshow, 64);
bottompane.Bottom(iconshow, DPI(150));
magnify = 13;
pen = 1;

View file

@ -391,6 +391,7 @@ private:
static FileSel& ImgFile();
static String FormatImageName(const Slot& c);
static String FormatImageNameQtf(const Slot& c);
public:
void ListMenu(Bar& bar);

View file

@ -22,6 +22,30 @@ String IconDes::FormatImageName(const Slot& c)
return r;
}
String IconDes::FormatImageNameQtf(const Slot& c)
{
Size sz = c.image.GetSize();
String r;
r << "\1[g \1" << c.name << "\1 [@r " << sz.cx << "[@K x]" << sz.cy << "]";
if(c.flags & IML_IMAGE_FLAG_FIXED)
r << " [@B$Y Fxd]";
else {
if(c.flags & IML_IMAGE_FLAG_FIXED_COLORS)
r << " [@B$Y Clr]";
if(c.flags & IML_IMAGE_FLAG_FIXED_SIZE)
r << " [@B$Y Sz]";
}
if(!(c.flags & (IML_IMAGE_FLAG_FIXED|IML_IMAGE_FLAG_FIXED_SIZE))) {
int scale = ImlFlagsToDPIScale(c.flags);
r << "[@B " << decode(scale, DPI_100, " 1[0 00`%]", DPI_150, " 15[0 0`%]", DPI_200, " 2[0 00`%]", DPI_300, " 3[0 00`%]", "") << "]";
}
if(c.exp)
r << " X";
return r;
}
void IconDes::SyncList()
{
if(syncinglist)
@ -34,7 +58,7 @@ void IconDes::SyncList()
for(int i = 0; i < slot.GetCount(); i++) {
Slot& c = slot[i];
if(ToUpper(c.name).Find(s) >= 0)
ilist.Add(i, FormatImageName(c), RawToValue(MakeTuple(c.image, c.flags)));
ilist.Add(i, FormatImageNameQtf(c), RawToValue(MakeTuple(c.image, c.flags)));
}
ilist.ScrollTo(sc);
ilist.FindSetCursor(q);
@ -85,7 +109,7 @@ void IconDes::PrepareImageDlg(WithImageLayout<TopWindow>& dlg)
dlg.scale = decode(scale, DPI_100, 1, DPI_150, 2, DPI_200, 3, DPI_300, 4, 0);
for(Ctrl& q : dlg)
if(dynamic_cast<Option *>(&q))
if(dynamic_cast<Option *>(&q) || dynamic_cast<Switch *>(&q))
q << [&] { dlg.Break(-1000); };
}
dlg.name.SetConvert(

View file

@ -38,7 +38,7 @@ void IconShow::Paint(Draw& w)
return;
}
int n = min(__countof(color), sz.cx / (sz300.cx + DPI(15)));
int n = min(__countof(color), sz.cx / (2 * sz300.cx + DPI(20)));
int cx = sz.cx / n;
int y = DPI(5);
for(int i = 0; i < n; i++)