mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
upp.src: developing UHD
git-svn-id: svn://ultimatepp.org/upp/trunk@8802 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
83f2d755bb
commit
8502b19b26
16 changed files with 73 additions and 36 deletions
|
|
@ -418,7 +418,7 @@ void Button::AssignAccessKeys(dword used)
|
|||
|
||||
Button& Button::SetImage(const Image& _img)
|
||||
{
|
||||
img = DPI(_img);
|
||||
img = _img;
|
||||
monoimg = false;
|
||||
Refresh();
|
||||
return *this;
|
||||
|
|
@ -426,7 +426,7 @@ Button& Button::SetImage(const Image& _img)
|
|||
|
||||
Button& Button::SetMonoImage(const Image& _img)
|
||||
{
|
||||
img = DPI(_img);
|
||||
img = _img;
|
||||
monoimg = true;
|
||||
Refresh();
|
||||
return *this;
|
||||
|
|
|
|||
|
|
@ -614,7 +614,9 @@ void ChSysInit()
|
|||
if(height > 0 && height < 200) // sanity..
|
||||
Font::SetDefaultFont(Font(q >= 0 ? q : Font::SANSSERIF, height));
|
||||
|
||||
bool uhd = GetStdFontCy() > 22;
|
||||
GUI_HiDPI_Write(GetStdFontCy() > 22);
|
||||
SetUHDMode(uhd);
|
||||
|
||||
GUI_GlobalStyle_Write(IsWinXP() && !ScreenInPaletteMode() && IsSysFlag(0x1022 /*SPI_GETFLATMENU*/)
|
||||
? GUISTYLE_XP : GUISTYLE_CLASSIC);
|
||||
|
|
|
|||
|
|
@ -113,13 +113,14 @@ ColorButton::~ColorButton() {}
|
|||
|
||||
Size ColorButton::GetMinSize() const
|
||||
{
|
||||
return Size(24, 24);
|
||||
return DPI(Size(24, 24));
|
||||
}
|
||||
|
||||
void ColorButton::Paint(Draw& w)
|
||||
{
|
||||
Size sz = GetSize();
|
||||
Size isz = (IsNull(image) ? staticimage : image).GetSize();
|
||||
DDUMP(image.GetSize());
|
||||
Point center = (sz - isz) / 2;
|
||||
if(GUI_GlobalStyle() >= GUISTYLE_XP)
|
||||
ChPaint(w, sz, style->look[!IsEnabled() ? CTRL_DISABLED : push ? CTRL_PRESSED
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ void FileList::Insert(int ii,
|
|||
m.isdir = isdir;
|
||||
m.unixexe = unixexe;
|
||||
m.hidden = hidden;
|
||||
m.icon = DPI(icon);
|
||||
m.icon = icon;
|
||||
m.name = name;
|
||||
m.font = font;
|
||||
m.ink = ink;
|
||||
|
|
@ -264,7 +264,7 @@ void FileList::Set(int ii,
|
|||
m.isdir = isdir;
|
||||
m.unixexe = unixexe;
|
||||
m.hidden = hidden;
|
||||
m.icon = DPI(icon);
|
||||
m.icon = icon;
|
||||
m.name = name;
|
||||
m.font = font;
|
||||
m.ink = ink;
|
||||
|
|
@ -293,7 +293,7 @@ void FileList::SetIcon(int ii, const Image& icon)
|
|||
Value v;
|
||||
File& m = CreateRawValue<File>(v);
|
||||
m = Get(ii);
|
||||
m.icon = DPI(icon);
|
||||
m.icon = icon;
|
||||
ColumnList::Set(ii, v, !m.isdir);
|
||||
KillEdit();
|
||||
}
|
||||
|
|
@ -308,7 +308,7 @@ void FileList::Add(const String& name, const Image& icon, Font font, Color ink,
|
|||
m.isdir = isdir;
|
||||
m.unixexe = unixexe;
|
||||
m.hidden = hidden;
|
||||
m.icon = DPI(icon);
|
||||
m.icon = icon;
|
||||
m.name = name;
|
||||
m.font = font;
|
||||
m.ink = ink;
|
||||
|
|
|
|||
|
|
@ -487,7 +487,7 @@ bool Load(FileList& list, const String& dir, const char *patterns, bool dirs,
|
|||
StdFont()
|
||||
);
|
||||
#ifdef PLATFORM_WIN32
|
||||
list.Add(t_("Network"), DPI(CtrlImg::Network()), StdFont().Bold(), SColorText,
|
||||
list.Add(t_("Network"), CtrlImg::Network(), StdFont().Bold(), SColorText,
|
||||
true, -1, Null, SColorDisabled, Null, StdFont());
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1584,7 +1584,7 @@ struct HomeDisplay : public Display {
|
|||
virtual void Paint(Draw& w, const Rect& r, const Value& q,
|
||||
Color ink, Color paper, dword style) const {
|
||||
w.DrawRect(r, paper);
|
||||
Image img = DPI(CtrlImg::Home());
|
||||
Image img = CtrlImg::Home();
|
||||
w.DrawImage(r.left, r.top + (r.Height() - img.GetSize().cx) / 2,
|
||||
CtrlImg::Home());
|
||||
w.DrawText(r.left + Zx(20),
|
||||
|
|
|
|||
|
|
@ -2,12 +2,6 @@
|
|||
|
||||
NAMESPACE_UPP
|
||||
|
||||
Image DPI(const Image& img, int excy)
|
||||
{
|
||||
return GUI_HiDPI() && img.GetSize().cy <= excy ? CachedRescale(img, 2 * img.GetSize(), FILTER_LANCZOS3)
|
||||
: img;
|
||||
}
|
||||
|
||||
void CtrlsImageLook(Value *look, int i, int n)
|
||||
{
|
||||
while(n--)
|
||||
|
|
@ -17,13 +11,13 @@ void CtrlsImageLook(Value *look, int i, int n)
|
|||
void CtrlsImageLook(Value *look, int i, const Image& image, const Color *color, int n)
|
||||
{
|
||||
for(int q = 0; q < n; q++)
|
||||
*look++ = ChLookWith(CtrlsImg::Get(i++), DPI(image), *color++);
|
||||
*look++ = ChLookWith(CtrlsImg::Get(i++), image, *color++);
|
||||
}
|
||||
|
||||
void CtrlsImageLook(Value *look, int i, const Image& image, int n)
|
||||
{
|
||||
for(int q = 0; q < n; q++)
|
||||
*look++ = ChLookWith(CtrlsImg::Get(i++), DPI(image));
|
||||
*look++ = ChLookWith(CtrlsImg::Get(i++), image);
|
||||
}
|
||||
|
||||
String DeAmp(const char *s)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
Image DPI(const Image& img, int excy = 16);
|
||||
|
||||
enum {
|
||||
CTRL_NORMAL, CTRL_HOT, CTRL_PRESSED, CTRL_DISABLED,
|
||||
CTRL_CHECKED, CTRL_HOTCHECKED
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ void MenuItemBase::PaintTopItem(Draw& w, int state) {
|
|||
|
||||
Bar::Item& MenuItem::Image(const UPP::Image& img)
|
||||
{
|
||||
licon = DPI(img);
|
||||
licon = img;
|
||||
if(IsDarkColorFace() && !nodarkadjust)
|
||||
licon = MakeImage(licon, AdjustForDarkBk);
|
||||
Refresh();
|
||||
|
|
@ -219,7 +219,7 @@ Bar::Item& MenuItem::Image(const UPP::Image& img)
|
|||
|
||||
MenuItem& MenuItem::RightImage(const UPP::Image& img)
|
||||
{
|
||||
ricon = DPI(img);
|
||||
ricon = img;
|
||||
if(IsDarkColorFace() && !nodarkadjust)
|
||||
ricon = MakeImage(ricon, AdjustForDarkBk);
|
||||
Refresh();
|
||||
|
|
@ -307,7 +307,6 @@ void MenuItem::Paint(Draw& w)
|
|||
case RADIO0: li = CtrlImg::MenuRadio0(); break;
|
||||
case RADIO1: li = CtrlImg::MenuRadio1(); break;
|
||||
}
|
||||
li = DPI(li);
|
||||
}
|
||||
Size isz = li.GetSize();
|
||||
// Size isz = min(maxiconsize, imsz);
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ Image ToolButton::GetImage() const
|
|||
|
||||
Bar::Item& ToolButton::Image(const UPP::Image& img_)
|
||||
{
|
||||
Upp::Image m = DPI(img_);
|
||||
Upp::Image m = img_;
|
||||
if(!m.IsSame(img)) {
|
||||
img = m;
|
||||
Refresh();
|
||||
|
|
|
|||
|
|
@ -130,8 +130,6 @@ Value ChBorder(const ColorF *colors, const Value& face)
|
|||
return RawToValue(b);
|
||||
}
|
||||
|
||||
Image DPI(const Image& img, int excy = 16);
|
||||
|
||||
Value StdChLookFn(Draw& w, const Rect& r, const Value& v, int op)
|
||||
{
|
||||
if(IsType<sChLookWith>(v)) {
|
||||
|
|
@ -139,15 +137,14 @@ Value StdChLookFn(Draw& w, const Rect& r, const Value& v, int op)
|
|||
if(op == LOOK_PAINT) {
|
||||
LOGPNG(AsString(x.img.GetSerialId()), x.img);
|
||||
ChPaint(w, r, x.look);
|
||||
Image m = DPI(x.img);
|
||||
Point p = r.CenterPos(m.GetSize()) + x.offset;
|
||||
Point p = r.CenterPos(x.img.GetSize()) + x.offset;
|
||||
if(x.colorfn)
|
||||
w.DrawImage(p.x, p.y, m, (*x.colorfn)(x.ii));
|
||||
w.DrawImage(p.x, p.y, x.img, (*x.colorfn)(x.ii));
|
||||
else
|
||||
if(!IsNull(x.color))
|
||||
w.DrawImage(p.x, p.y, m, x.color);
|
||||
w.DrawImage(p.x, p.y, x.img, x.color);
|
||||
else
|
||||
w.DrawImage(p.x, p.y, m);
|
||||
w.DrawImage(p.x, p.y, x.img);
|
||||
return 1;
|
||||
}
|
||||
return sChOp(w, r, x.look, op);
|
||||
|
|
@ -186,7 +183,7 @@ Value StdChLookFn(Draw& w, const Rect& r, const Value& v, int op)
|
|||
}
|
||||
if(IsType<Image>(v)) {
|
||||
Image img = v;
|
||||
img = DPI(img);
|
||||
img = img;
|
||||
Size isz = img.GetSize();
|
||||
Size sz = r.GetSize();
|
||||
Point p = img.GetHotSpot();
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ file
|
|||
RescaleFilter.cpp optimize_speed,
|
||||
MakeCache.cpp,
|
||||
DrawRasterData.cpp,
|
||||
Uhd.cpp,
|
||||
Iml.cpp,
|
||||
iml.h,
|
||||
iml_header.h,
|
||||
|
|
|
|||
|
|
@ -198,3 +198,8 @@ Image RescaleBicubic(const Image& src, Size sz, const Rect& src_rc, Gate2<int, i
|
|||
Image RescaleBicubic(const Image& img, Size sz, Gate2<int, int> progress = false);
|
||||
Image RescaleBicubic(const Image& img, int cx, int cy, Gate2<int, int> progress = false);
|
||||
|
||||
void SetUHDMode(bool b = true);
|
||||
bool IsUHDMode();
|
||||
|
||||
Image DPI(const Image& m);
|
||||
inline Size DPI(Size sz) { return IsUHDMode() ? 2 * sz : sz; }
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ Image Iml::Get(int i)
|
|||
for(int i = 0; i < cached.GetCount(); i++)
|
||||
cached[i] = Premultiply(cached[i]);
|
||||
}
|
||||
m.image = cached[i];
|
||||
m.image = DPI(cached[i]);
|
||||
break;
|
||||
}
|
||||
i -= d.count;
|
||||
|
|
|
|||
40
uppsrc/Draw/Uhd.cpp
Normal file
40
uppsrc/Draw/Uhd.cpp
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#include "Draw.h"
|
||||
|
||||
namespace Upp {
|
||||
|
||||
static bool sUHDMode;
|
||||
|
||||
void SetUHDMode(bool b)
|
||||
{
|
||||
for(int i = 0; i < GetImlCount(); i++)
|
||||
GetIml(i).Reset();
|
||||
sUHDMode = b;
|
||||
}
|
||||
|
||||
bool IsUHDMode()
|
||||
{
|
||||
return sUHDMode;
|
||||
}
|
||||
|
||||
Image DPI(const Image& img)
|
||||
{
|
||||
if(IsUHDMode()) {
|
||||
if(img.GetResolution() == IMAGE_RESOLUTION_STANDARD) {
|
||||
Image m = CachedRescale(img, 2 * img.GetSize(), FILTER_LANCZOS3);
|
||||
ImageBuffer h(m);
|
||||
h.SetResolution(IMAGE_RESOLUTION_UHD);
|
||||
return h;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(img.GetResolution() == IMAGE_RESOLUTION_UHD) {
|
||||
Image m = CachedRescale(img, img.GetSize() - 2, FILTER_LANCZOS3);
|
||||
ImageBuffer h(m);
|
||||
h.SetResolution(IMAGE_RESOLUTION_UHD);
|
||||
return h;
|
||||
}
|
||||
}
|
||||
return img;
|
||||
}
|
||||
|
||||
};
|
||||
|
|
@ -267,7 +267,7 @@ ParaFormatting::ParaFormatting()
|
|||
bullet.Add(RichPara::BULLET_BOXWHITE, RichEditImg::BoxWhiteBullet());
|
||||
bullet.Add(RichPara::BULLET_TEXT, RichEditImg::TextBullet());
|
||||
bullet.SetDisplay(CenteredHighlightImageDisplay());
|
||||
bullet.SetLineCy(18);
|
||||
bullet.SetLineCy(RichEditImg::RoundBullet().GetHeight() + Zy(2));
|
||||
for(int i = 0; i < 8; i++) {
|
||||
DropList& list = n[i];
|
||||
list.Add(Null);
|
||||
|
|
|
|||
|
|
@ -70,9 +70,9 @@ void RichRuler::Paint(Draw& w)
|
|||
if(xp > tabpos)
|
||||
w.DrawRect(x0 + x, sz.cy - Zy(4), Zx(1), Zy(3), SColorShadow);
|
||||
}
|
||||
w.DrawImage(Zx(4), Zy(6), DPI(newtabalign == ALIGN_RIGHT ? RichEditImg::RightTab() :
|
||||
newtabalign == ALIGN_CENTER ? RichEditImg::CenterTab() :
|
||||
RichEditImg::LeftTab()));
|
||||
w.DrawImage(Zx(4), Zy(6), newtabalign == ALIGN_RIGHT ? RichEditImg::RightTab() :
|
||||
newtabalign == ALIGN_CENTER ? RichEditImg::CenterTab() :
|
||||
RichEditImg::LeftTab());
|
||||
}
|
||||
|
||||
int RichRuler::FindMarker(Point p)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue