mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
uppsrc: Developing HiDPI support
git-svn-id: svn://ultimatepp.org/upp/trunk@8788 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
11cff0c83a
commit
11bb51c8de
24 changed files with 135 additions and 118 deletions
|
|
@ -1202,7 +1202,8 @@ public:
|
|||
static void NoLayoutZoom();
|
||||
static void GetZoomRatio(Size& m, Size& d);
|
||||
|
||||
static int HZoom(int cx) { return HorzLayoutZoom(cx); }
|
||||
static int Zx(int cx) { return HorzLayoutZoom(cx); }
|
||||
static int Zy(int cy) { return VertLayoutZoom(cy); }
|
||||
|
||||
static bool ClickFocus();
|
||||
static void ClickFocus(bool cf);
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ void Button::AssignAccessKeys(dword used)
|
|||
|
||||
Button& Button::SetImage(const Image& _img)
|
||||
{
|
||||
img = _img;
|
||||
img = DPI(_img);
|
||||
monoimg = false;
|
||||
Refresh();
|
||||
return *this;
|
||||
|
|
@ -426,7 +426,7 @@ Button& Button::SetImage(const Image& _img)
|
|||
|
||||
Button& Button::SetMonoImage(const Image& _img)
|
||||
{
|
||||
img = _img;
|
||||
img = DPI(_img);
|
||||
monoimg = true;
|
||||
Refresh();
|
||||
return *this;
|
||||
|
|
@ -446,7 +446,7 @@ CH_STYLE(SpinButtons, Style, StyleDefault)
|
|||
inc = dec = Button::StyleNormal();
|
||||
CtrlsImageLook(inc.look, CtrlsImg::I_EB, CtrlsImg::SpU(), inc.monocolor);
|
||||
CtrlsImageLook(dec.look, CtrlsImg::I_EB, CtrlsImg::SpD(), dec.monocolor);
|
||||
width = 12;
|
||||
width = Ctrl::Zx(12);
|
||||
}
|
||||
|
||||
void SpinButtons::FrameLayout(Rect& r)
|
||||
|
|
|
|||
|
|
@ -585,7 +585,7 @@ void ChHostSkin()
|
|||
int m = ImageMargin(mimg, 4, 5);
|
||||
s.popupframe = WithHotSpot(mimg, m, m);
|
||||
s.popupbody = Crop(mimg, m, m, 32 - 2 * m, 32 - 2 * m);
|
||||
s.leftgap = 26;
|
||||
s.leftgap = Ctrl::Zx(26);
|
||||
ChGtkNew(menu_item, "menuitem", GTK_BOX);
|
||||
int sw = GTK_SHADOW_OUT;
|
||||
if(gtk_check_version(2, 1, 0))
|
||||
|
|
|
|||
|
|
@ -462,9 +462,9 @@ void ChHostSkin()
|
|||
Win32Look(s.topitem[1], XP_MENU, 8 , 2 /*HOT*/);
|
||||
Win32Look(s.topitem[2], XP_MENU, 8 , 3 /*HOT*/);
|
||||
Win32Look(s.popupiconbar, XP_MENU, 13, 1);
|
||||
s.leftgap = 32;
|
||||
s.textgap = 6;
|
||||
s.lsepm = 32;
|
||||
s.leftgap = Ctrl::Zx(32);
|
||||
s.textgap = Ctrl::Zx(6);
|
||||
s.lsepm = Ctrl::Zx(32);
|
||||
s.separator.l1 = Blend(SColorMenu(), SColorShadow());
|
||||
s.separator.l2 = SColorLight();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ void FileList::Insert(int ii,
|
|||
m.isdir = isdir;
|
||||
m.unixexe = unixexe;
|
||||
m.hidden = hidden;
|
||||
m.icon = icon;
|
||||
m.icon = DPI(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 = icon;
|
||||
m.icon = DPI(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 = icon;
|
||||
m.icon = DPI(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 = icon;
|
||||
m.icon = DPI(icon);
|
||||
m.name = name;
|
||||
m.font = font;
|
||||
m.ink = ink;
|
||||
|
|
@ -369,7 +369,7 @@ void FileList::Sort(const Order& order)
|
|||
}
|
||||
|
||||
FileList::FileList() {
|
||||
iconwidth = 16;
|
||||
iconwidth = Zx(16);
|
||||
ItemHeight(max(Draw::GetStdFontCy(), 16));
|
||||
Ctrl::Add(edit);
|
||||
edit.Hide();
|
||||
|
|
|
|||
|
|
@ -487,7 +487,7 @@ bool Load(FileList& list, const String& dir, const char *patterns, bool dirs,
|
|||
StdFont()
|
||||
);
|
||||
#ifdef PLATFORM_WIN32
|
||||
list.Add(t_("Network"), CtrlImg::Network(), StdFont().Bold(), SColorText,
|
||||
list.Add(t_("Network"), DPI(CtrlImg::Network()), StdFont().Bold(), SColorText,
|
||||
true, -1, Null, SColorDisabled, Null, StdFont());
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1565,7 +1565,7 @@ Image GetDirIcon(const String& s)
|
|||
#endif
|
||||
if(IsNull(img))
|
||||
img = CtrlImg::Dir();
|
||||
return img;
|
||||
return DPI(img);
|
||||
}
|
||||
|
||||
void FolderDisplay::Paint(Draw& w, const Rect& r, const Value& q,
|
||||
|
|
@ -1575,7 +1575,7 @@ void FolderDisplay::Paint(Draw& w, const Rect& r, const Value& q,
|
|||
w.DrawRect(r, paper);
|
||||
Image img = GetDirIcon(s);
|
||||
w.DrawImage(r.left, r.top + (r.Height() - img.GetSize().cx) / 2, img);
|
||||
w.DrawText(r.left + 20,
|
||||
w.DrawText(r.left + Ctrl::Zx(20),
|
||||
r.top + (r.Height() - StdFont().Bold().Info().GetHeight()) / 2,
|
||||
~s, StdFont().Bold(), ink);
|
||||
}
|
||||
|
|
@ -1584,9 +1584,10 @@ 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);
|
||||
w.DrawImage(r.left, r.top + (r.Height() - CtrlImg::Home().GetSize().cx) / 2,
|
||||
Image img = DPI(CtrlImg::Home());
|
||||
w.DrawImage(r.left, r.top + (r.Height() - img.GetSize().cx) / 2,
|
||||
CtrlImg::Home());
|
||||
w.DrawText(r.left + 20,
|
||||
w.DrawText(r.left + Ctrl::Zx(20),
|
||||
r.top + (r.Height() - StdFont().Bold().Info().GetHeight()) / 2,
|
||||
String(q), StdFont().Bold(), ink);
|
||||
}
|
||||
|
|
@ -1925,7 +1926,7 @@ void FileSel::AddPlaceRaw(const String& path, const Image& m, const String& name
|
|||
row = row < 0 ? places.GetCount() : row;
|
||||
places.Insert(row);
|
||||
places.Set(row, 0, path);
|
||||
places.Set(row, 1, m);
|
||||
places.Set(row, 1, DPI(m));
|
||||
places.Set(row, 2, name);
|
||||
places.Set(row, 3, group);
|
||||
places.SetLineCy(row, max(m.GetSize().cy + 4, GetStdFontCy() + 4));
|
||||
|
|
@ -1937,7 +1938,7 @@ void FileSel::AddPlaceRaw(const String& path, const Image& m, const String& name
|
|||
FileSel& FileSel::AddPlace(const String& path, const Image& m, const String& name, const char* group, int row)
|
||||
{
|
||||
if(path.GetCount())
|
||||
AddPlaceRaw(NormalizePath(path), m, name, group, row);
|
||||
AddPlaceRaw(NormalizePath(path), DPI(m), name, group, row);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@
|
|||
|
||||
NAMESPACE_UPP
|
||||
|
||||
Image DPI(const Image& img)
|
||||
Image DPI(const Image& img, int excy)
|
||||
{
|
||||
return GUI_HiDPI() ? CachedRescale(img, 2 * img.GetSize(), FILTER_LANCZOS3) : img;
|
||||
return GUI_HiDPI() && img.GetSize().cy <= excy ? CachedRescale(img, 2 * img.GetSize(), FILTER_LANCZOS3)
|
||||
: img;
|
||||
}
|
||||
|
||||
void CtrlsImageLook(Value *look, int i, int n)
|
||||
|
|
@ -22,7 +23,7 @@ void CtrlsImageLook(Value *look, int i, const Image& image, const Color *color,
|
|||
void CtrlsImageLook(Value *look, int i, const Image& image, int n)
|
||||
{
|
||||
for(int q = 0; q < n; q++)
|
||||
*look++ = ChLookWith(CtrlsImg::Get(i++), image);
|
||||
*look++ = ChLookWith(CtrlsImg::Get(i++), DPI(image));
|
||||
}
|
||||
|
||||
String DeAmp(const char *s)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Image DPI(const Image& img);
|
||||
Image DPI(const Image& img, int excy = 16);
|
||||
|
||||
enum {
|
||||
CTRL_NORMAL, CTRL_HOT, CTRL_PRESSED, CTRL_DISABLED,
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@ CH_STYLE(MenuBar, Style, StyleDefault)
|
|||
popupframe = Image(ib);
|
||||
popupbody = SColorMenu();
|
||||
popupiconbar = Null;
|
||||
leftgap = 26;
|
||||
textgap = 6;
|
||||
lsepm = rsepm = 2;
|
||||
leftgap = Ctrl::Zx(26);
|
||||
textgap = Ctrl::Zx(6);
|
||||
lsepm = rsepm = Ctrl::Zx(2);
|
||||
pullshift.x = 0;
|
||||
pullshift.y = -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public:
|
|||
MenuItemBase& SetFont(Font f) { font = f; return *this; }
|
||||
MenuItemBase& Style(const MenuBar::Style *s) { style = s; return *this; }
|
||||
Font GetFont() const { return font; }
|
||||
MenuItemBase& MaxIconSize(Size sz) { maxiconsize = sz; return *this; }
|
||||
MenuItemBase& MaxIconSize(Size sz) { maxiconsize = sz; return *this; } // deprecated
|
||||
bool InOpaqueBar() const;
|
||||
MenuItemBase& NoDarkAdjust(bool b = true) { nodarkadjust = b; return *this; }
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ MenuItemBase::MenuItemBase()
|
|||
isenabled = true;
|
||||
type = 0;
|
||||
font = StdFont();
|
||||
leftgap = 16;
|
||||
textgap = 6;
|
||||
leftgap = Zx(16);
|
||||
textgap = Zy(6);
|
||||
accesskey = 0;
|
||||
NoWantFocus();
|
||||
style = &MenuBar::StyleDefault();
|
||||
|
|
@ -210,7 +210,7 @@ void MenuItemBase::PaintTopItem(Draw& w, int state) {
|
|||
|
||||
Bar::Item& MenuItem::Image(const UPP::Image& img)
|
||||
{
|
||||
licon = img;
|
||||
licon = DPI(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 = img;
|
||||
ricon = DPI(img);
|
||||
if(IsDarkColorFace() && !nodarkadjust)
|
||||
ricon = MakeImage(ricon, AdjustForDarkBk);
|
||||
Refresh();
|
||||
|
|
@ -307,26 +307,27 @@ void MenuItem::Paint(Draw& w)
|
|||
case RADIO0: li = CtrlImg::MenuRadio0(); break;
|
||||
case RADIO1: li = CtrlImg::MenuRadio1(); break;
|
||||
}
|
||||
li = DPI(li);
|
||||
}
|
||||
Size imsz = li.GetSize();
|
||||
Size isz = min(maxiconsize, imsz);
|
||||
if(isz != imsz)
|
||||
li = CachedRescale(li, isz);
|
||||
Size isz = li.GetSize();
|
||||
// Size isz = min(maxiconsize, imsz);
|
||||
// if(isz != imsz)
|
||||
// li = CachedRescale(li, isz);
|
||||
int iy = (sz.cy - isz.cy) / 2;
|
||||
bool chk = false;
|
||||
int x = (max(isz.cx, leftgap - 2) - isz.cx) / 2;
|
||||
int x = Zx(2);
|
||||
if(!licon.IsEmpty() && type) {
|
||||
chk = type == CHECK1 || type == RADIO1;
|
||||
x = 2;
|
||||
if(GUI_GlobalStyle() >= GUISTYLE_XP) {
|
||||
if(chk && !hl) {
|
||||
DrawXPButton(w, RectC(0, iy - 2, isz.cx + 4, isz.cy + 4), BUTTON_EDGE|BUTTON_CHECKED);
|
||||
}
|
||||
if(chk && !hl)
|
||||
DrawXPButton(w, RectC(0, iy - Zy(2), isz.cx + Zx(4), isz.cy + Zy(4)),
|
||||
BUTTON_EDGE|BUTTON_CHECKED);
|
||||
}
|
||||
else {
|
||||
w.DrawRect(1, iy - 1, isz.cx + 2, isz.cy + 2, chk ? Blend(SColorFace, SColorLight)
|
||||
: SColorFace);
|
||||
DrawBorder(w, 0, iy - 2, isz.cx + 4, isz.cy + 4, chk ? ThinInsetBorder : ThinOutsetBorder);
|
||||
w.DrawRect(x - Zx(1), iy - Zy(1), isz.cx + Zx(2), isz.cy + Zy(2),
|
||||
chk ? Blend(SColorFace, SColorLight) : SColorFace);
|
||||
DrawBorder(w, x - Zx(2), iy - Zy(2), isz.cx + Zx(4), isz.cy + Zy(4),
|
||||
chk ? ThinInsetBorder : ThinOutsetBorder);
|
||||
}
|
||||
}
|
||||
if(isenabled)
|
||||
|
|
@ -342,10 +343,10 @@ void MenuItem::Paint(Draw& w)
|
|||
w.DrawImage(sz.cx - isz.cx, (sz.cy - isz.cy) / 2, ricon, hl ? style->itemtext : style->menutext);
|
||||
else
|
||||
w.DrawImage(sz.cx - isz.cx, (sz.cy - isz.cy) / 2, DisabledImage(ricon));
|
||||
x = sz.cx - max(isz.cx, 16) - 1;
|
||||
x = sz.cx - max(isz.cx, Zx(16)) - Zx(1);
|
||||
if(!IsEmpty(keydesc)) {
|
||||
isz = GetTextSize(keydesc, StdFont());
|
||||
UPP::DrawMenuText(w, x - isz.cx - 2, (sz.cy - isz.cy) / 2, keydesc, font, isenabled, hl,
|
||||
UPP::DrawMenuText(w, x - isz.cx - Zx(2), (sz.cy - isz.cy) / 2, keydesc, font, isenabled, hl,
|
||||
0, SColorMenuMark(), style->itemtext, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -356,13 +357,13 @@ Size MenuItem::GetMinSize() const
|
|||
Size sz2(0, 0);
|
||||
if(accel) {
|
||||
sz2 = GetTextSize(GetKeyDesc(accel), font);
|
||||
sz2.cx += 12;
|
||||
sz2.cx += Zx(12);
|
||||
}
|
||||
Size lsz = min(maxiconsize, licon.GetSize());
|
||||
Size rsz = ricon.GetSize();
|
||||
return AddFrameSize(Size(max(lsz.cx, leftgap) + sz1.cx + max(sz2.cx, (rsz.cx ? 16 : 0))
|
||||
+ max(rsz.cx, 16) + textgap + 10,
|
||||
max(max(lsz.cy, rsz.cy) + 4, sz1.cy + 6)));
|
||||
return AddFrameSize(Size(max(lsz.cx, leftgap) + sz1.cx + max(sz2.cx, (rsz.cx ? Zx(16) : 0))
|
||||
+ max(rsz.cx, Zx(16)) + textgap + Zx(10),
|
||||
max(max(lsz.cy, rsz.cy) + Zy(4), sz1.cy + Zy(6))));
|
||||
}
|
||||
|
||||
void MenuItem::LeftUp(Point, dword)
|
||||
|
|
|
|||
|
|
@ -165,14 +165,14 @@ Image ToolButton::GetImage() const
|
|||
if(IsDarkColorFace() && !nodarkadjust)
|
||||
m = MakeImage(m, AdjustForDarkBk);
|
||||
m = CachedRescale(m, min(m.GetSize(), maxiconsize));
|
||||
m = DPI(m);
|
||||
return m;
|
||||
}
|
||||
|
||||
Bar::Item& ToolButton::Image(const UPP::Image& img_)
|
||||
{
|
||||
if(!img_.IsSame(img)) {
|
||||
img = img_;
|
||||
Upp::Image m = DPI(img_);
|
||||
if(!m.IsSame(img)) {
|
||||
img = m;
|
||||
Refresh();
|
||||
}
|
||||
return *this;
|
||||
|
|
|
|||
|
|
@ -170,6 +170,9 @@ void Font::InitStdFont()
|
|||
String name;
|
||||
int height = 0;
|
||||
GetStdFontSys(name, height);
|
||||
#ifdef flagTEST_HIDPI
|
||||
height *= 2;
|
||||
#endif
|
||||
#ifdef PLATFORM_WIN32
|
||||
int q = FindFaceNameIndex(name);
|
||||
if(q <= 0)
|
||||
|
|
|
|||
|
|
@ -192,7 +192,10 @@ struct sCachedRescale : public ImageMaker
|
|||
}
|
||||
|
||||
virtual Image Make() const {
|
||||
return IsNull(filter) ? Rescale(img, sz, src) : RescaleFilter(img, sz, src, filter);
|
||||
ImageBuffer m = pick(IsNull(filter) ? Rescale(img, sz, src) : RescaleFilter(img, sz, src, filter));
|
||||
m.SetHotSpot(sz * (img.GetHotSpot() - src.TopLeft()) / src.GetSize());
|
||||
m.Set2ndSpot(sz * (img.Get2ndSpot() - src.TopLeft()) / src.GetSize());
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -51,10 +51,10 @@ Draw& EditPageDraw::Page(int _page)
|
|||
Rect RichEdit::GetTextRect() const
|
||||
{
|
||||
Size sz = GetSize();
|
||||
if(sz.cy < 16)
|
||||
sz.cy = 16;
|
||||
if(sz.cx < 80)
|
||||
return RectC(0, 0, 48, max(sz.cy, 16));
|
||||
if(sz.cy < Zx(16))
|
||||
sz.cy = Zx(16);
|
||||
if(sz.cx < Zx(80))
|
||||
return RectC(0, 0, Zx(48), max(sz.cy, Zy(16)));
|
||||
int cx = zoom * (sz.cx - 2 * viewborder) / 100;
|
||||
return RectC((sz.cx - cx) / 2, 0, cx, sz.cy);
|
||||
}
|
||||
|
|
@ -368,7 +368,7 @@ struct DisplayFont : public Display {
|
|||
{
|
||||
Font fnt;
|
||||
fnt.Face((int)q);
|
||||
fnt.Height(r.Height() - 4);
|
||||
fnt.Height(r.Height() - Ctrl::Zy(4));
|
||||
w.DrawRect(r, paper);
|
||||
w.DrawText(r.left, r.top + (r.Height() - fnt.Info().GetHeight()) / 2,
|
||||
Font::GetFaceName((int)q), fnt, ink);
|
||||
|
|
@ -462,7 +462,6 @@ void SetupFaceList(DropList& face)
|
|||
{
|
||||
face.ValueDisplay(Single<ValueDisplayFont>());
|
||||
face.SetDisplay(Single<DisplayFont>());
|
||||
face.SetLineCy(20);
|
||||
}
|
||||
|
||||
void RichEdit::SpellCheck()
|
||||
|
|
@ -599,7 +598,7 @@ RichEdit::RichEdit()
|
|||
Unicode();
|
||||
BackPaint();
|
||||
|
||||
viewborder = 16;
|
||||
viewborder = Zx(16);
|
||||
|
||||
face.NoWantFocus();
|
||||
height.NoWantFocus();
|
||||
|
|
@ -637,7 +636,7 @@ RichEdit::RichEdit()
|
|||
|
||||
adjustunits.Image(RichEditImg::AdjustUnits());
|
||||
adjustunits <<= THISBACK(SetupUnits);
|
||||
ruler.Add(adjustunits.RightPos(4, 16).TopPos(2, 16));
|
||||
ruler.Add(adjustunits.RightPosZ(4, 16).VSizePosZ(2, 2));
|
||||
|
||||
undosteps = 500;
|
||||
|
||||
|
|
|
|||
|
|
@ -705,9 +705,9 @@ public:
|
|||
bool Print();
|
||||
void DoPrint() { Print(); }
|
||||
|
||||
void StyleTool(Bar& bar, int width = 120);
|
||||
void FaceTool(Bar& bar, int width = 130);
|
||||
void HeightTool(Bar& bar, int width = 50);
|
||||
void StyleTool(Bar& bar, int width = Zx(120));
|
||||
void FaceTool(Bar& bar, int width = Zx(130));
|
||||
void HeightTool(Bar& bar, int width = Zx(50));
|
||||
void BoldTool(Bar& bar, dword key = K_CTRL_B);
|
||||
void ItalicTool(Bar& bar, dword key = K_CTRL_I);
|
||||
void UnderlineTool(Bar& bar, dword key = K_CTRL_U);
|
||||
|
|
@ -717,10 +717,10 @@ public:
|
|||
void SubscriptTool(Bar& bar, dword key = 0);
|
||||
void InkTool(Bar& bar);
|
||||
void PaperTool(Bar& bar);
|
||||
void LanguageTool(Bar& bar, int width = HZoom(60));
|
||||
void HyperlinkTool(Bar& bar, int width = 180, dword key = 0, const char *tip = NULL);
|
||||
void LanguageTool(Bar& bar, int width = Zx(60));
|
||||
void HyperlinkTool(Bar& bar, int width = Zx(180), dword key = 0, const char *tip = NULL);
|
||||
void SpellCheckTool(Bar& bar);
|
||||
void IndexEntryTool(Bar& bar, int width = 80, dword key = 0, const char *tip = NULL);
|
||||
void IndexEntryTool(Bar& bar, int width = Zx(80), dword key = 0, const char *tip = NULL);
|
||||
|
||||
void LeftTool(Bar& bar, dword key = K_CTRL_L);
|
||||
void RightTool(Bar& bar, dword key = K_CTRL_R);
|
||||
|
|
@ -732,7 +732,7 @@ public:
|
|||
void BoxWhiteBulletTool(Bar& bar, dword key = 0);
|
||||
void TextBulletTool(Bar& bar, dword key = 0);
|
||||
void ParaFormatTool(Bar& bar, dword key = 0);
|
||||
void LabelTool(Bar& bar, int width = 80, dword key = 0, const char *tip = NULL);
|
||||
void LabelTool(Bar& bar, int width = Zx(80), dword key = 0, const char *tip = NULL);
|
||||
void ToParaTool(Bar& bar, dword key = K_CTRL_K);
|
||||
|
||||
void UndoTool(Bar& bar, dword key = K_CTRL_Z);
|
||||
|
|
|
|||
|
|
@ -17,29 +17,30 @@ RichRuler::~RichRuler() {}
|
|||
|
||||
void RichRuler::FrameLayout(Rect& r)
|
||||
{
|
||||
LayoutFrameTop(r, this, Arial(10).Info().GetHeight() + 8);
|
||||
LayoutFrameTop(r, this, Arial(Zy(10)).GetHeight() + Zy(8));
|
||||
}
|
||||
|
||||
void RichRuler::FrameAddSize(Size& sz)
|
||||
{
|
||||
sz.cy += Arial(10).Info().GetHeight() + 8;
|
||||
sz.cy += Arial(Zy(10)).GetHeight() + Zy(8);
|
||||
}
|
||||
|
||||
void RichRuler::Paint(Draw& w)
|
||||
{
|
||||
Size sz = GetSize();
|
||||
w.DrawRect(sz, SColorFace);
|
||||
w.DrawRect(0, sz.cy - 1, sz.cx, 1, SColorShadow);
|
||||
w.DrawRect(0, sz.cy - Zx(1), sz.cx, Zy(1), SColorShadow);
|
||||
int cx = zoom * pgcx;
|
||||
w.DrawRect(x0 - 1, 3, cx + 3, sz.cy - 6, SColorPaper);
|
||||
w.DrawRect(x0 - Zx(1), Zy(3), cx + Zx(3), sz.cy - Zy(6), SColorPaper);
|
||||
int i = 0;
|
||||
for(;;) {
|
||||
int x = fround(++i * grid) * zoom;
|
||||
if(x >= cx) break;
|
||||
int h = (sz.cy - Zy(6)) / 3;
|
||||
if(i % marks == 0)
|
||||
w.DrawRect(x0 + x, 8, 1, 5, SColorHighlight);
|
||||
w.DrawRect(x0 + x, Zy(2) + h, Zx(1), h + Zy(2), SColorHighlight);
|
||||
else
|
||||
w.DrawRect(x0 + x, 9, 1, 3, SColorHighlight);
|
||||
w.DrawRect(x0 + x, Zy(3) + h, Zx(1), h, SColorHighlight);
|
||||
}
|
||||
i = 0;
|
||||
for(;;)
|
||||
|
|
@ -47,18 +48,18 @@ void RichRuler::Paint(Draw& w)
|
|||
int x = fround(i * grid) * zoom;
|
||||
if(x >= cx) break;
|
||||
String n = Format("%d", (int)(i * numbermul + 0.5));
|
||||
Size tsz = GetTextSize(n, Arial(10));
|
||||
Size tsz = GetTextSize(n, Arial(Zy(10)));
|
||||
if(x + tsz.cx - tsz.cx / 2 < cx) {
|
||||
int px = x0 + x - tsz.cx / 2;
|
||||
w.DrawRect(px, 4, tsz.cx, sz.cy - 8, SColorPaper);
|
||||
w.DrawText(x0 + x - tsz.cx / 2, 4, n, Arial(10), SColorText);
|
||||
w.DrawRect(px, Zy(4), tsz.cx, sz.cy - Zy(8), SColorPaper);
|
||||
w.DrawText(x0 + x - tsz.cx / 2, Zy(4), n, Arial(Zy(10)), SColorText);
|
||||
}
|
||||
}
|
||||
FieldFrame().FramePaint(w, RectC(x0 - 1, 3, cx + 3, sz.cy - 6));
|
||||
FieldFrame().FramePaint(w, RectC(x0 - Zx(1), Zy(3), cx + Zx(3), sz.cy - Zy(6)));
|
||||
for(i = marker.GetCount() - 1; i >= 0; --i) {
|
||||
const Marker& m = marker[i];
|
||||
if(!IsNull(m.pos))
|
||||
HotPaint(w, x0 + m.pos * zoom, m.top ? 1 : sz.cy - 4, m.image);
|
||||
HotPaint(w, x0 + m.pos * zoom, m.top ? Zy(1) : sz.cy - Zy(4), DPI(m.image));
|
||||
}
|
||||
i = 0;
|
||||
if(tabsize)
|
||||
|
|
@ -67,11 +68,11 @@ void RichRuler::Paint(Draw& w)
|
|||
int x = xp * zoom;
|
||||
if(x >= cx) break;
|
||||
if(xp > tabpos)
|
||||
w.DrawRect(x0 + x, sz.cy - 4, 1, 3, SColorShadow);
|
||||
w.DrawRect(x0 + x, sz.cy - Zy(4), Zx(1), Zy(3), SColorShadow);
|
||||
}
|
||||
w.DrawImage(4, 6, newtabalign == ALIGN_RIGHT ? RichEditImg::RightTab() :
|
||||
w.DrawImage(Zx(4), Zy(6), DPI(newtabalign == ALIGN_RIGHT ? RichEditImg::RightTab() :
|
||||
newtabalign == ALIGN_CENTER ? RichEditImg::CenterTab() :
|
||||
RichEditImg::LeftTab());
|
||||
RichEditImg::LeftTab()));
|
||||
}
|
||||
|
||||
int RichRuler::FindMarker(Point p)
|
||||
|
|
@ -98,7 +99,7 @@ void RichRuler::LeftDown(Point p, dword)
|
|||
WhenBeginTrack();
|
||||
}
|
||||
else
|
||||
if(p.x < 16) {
|
||||
if(p.x < Zx(16)) {
|
||||
newtabalign++;
|
||||
if(newtabalign > ALIGN_CENTER) newtabalign = ALIGN_LEFT;
|
||||
Refresh();
|
||||
|
|
@ -112,7 +113,7 @@ void RichRuler::LeftDown(Point p, dword)
|
|||
|
||||
void RichRuler::LeftDouble(Point p, dword)
|
||||
{
|
||||
if(p.x < x0 - 3) {
|
||||
if(p.x < x0 - Zx(3)) {
|
||||
newtabalign++;
|
||||
if(newtabalign > ALIGN_CENTER) newtabalign = ALIGN_LEFT;
|
||||
Refresh();
|
||||
|
|
@ -124,7 +125,7 @@ void RichRuler::LeftDouble(Point p, dword)
|
|||
|
||||
void RichRuler::RightDown(Point p, dword)
|
||||
{
|
||||
if(p.x < x0 - 3) {
|
||||
if(p.x < x0 - Zx(3)) {
|
||||
newtabalign--;
|
||||
if(newtabalign < ALIGN_LEFT) newtabalign = ALIGN_CENTER;
|
||||
Refresh();
|
||||
|
|
@ -148,7 +149,7 @@ void RichRuler::MouseMove(Point p, dword flags)
|
|||
|
||||
if(HasCapture() && track >= 0) {
|
||||
Marker& m = marker[track];
|
||||
if((p.y < -10 || p.y >= GetSize().cy + 10) && m.deletable)
|
||||
if((p.y < Zy(-10) || p.y >= GetSize().cy + Zy(10)) && m.deletable)
|
||||
m.pos = Null;
|
||||
else {
|
||||
int x = ((p.x + trackdx - x0) / zoom);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ TextCompareCtrl::TextCompareCtrl()
|
|||
number_bg = WhiteGray();
|
||||
SetFrame(FieldFrame());
|
||||
AddFrame(scroll);
|
||||
SetFont(Courier(14), Courier(10));
|
||||
SetFont(Courier(Zy(14)), Courier(Zy(10)));
|
||||
scroll.NoAutoHide();
|
||||
scroll.WhenScroll = THISBACK(SelfScroll);
|
||||
maxwidth = 0;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ void InstallBlueMenuBar()
|
|||
s.look = BlueImg::LK();
|
||||
s.topitem[1] = s.item = BlueImg::BH();
|
||||
s.itemtext = s.topitemtext[0] = s.topitemtext[1] = s.topitemtext[2] = SColorText();
|
||||
s.leftgap = 24;
|
||||
s.leftgap = Ctrl::Zx(24);
|
||||
s.lsepm = s.leftgap + s.textgap;
|
||||
s.popupiconbar = BlueImg::LR();
|
||||
ImageBuffer ib(7, 7);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
Size MakeLogo(Ctrl& parent, Array<Ctrl>& ctrl)
|
||||
{
|
||||
Image logo = IdeImg::logo();
|
||||
Image logo = DPI(IdeImg::logo(), 9999);
|
||||
Size isz = logo.GetSize();
|
||||
ImageCtrl& l = ctrl.Create<ImageCtrl>();
|
||||
Label& v1 = ctrl.Create<Label>();
|
||||
|
|
@ -44,20 +44,20 @@ Size MakeLogo(Ctrl& parent, Array<Ctrl>& ctrl)
|
|||
if(cpp.GetCount())
|
||||
h << "CodeBase: " << cpp.GetCount() << " classes, " << total << " items\n";
|
||||
v1 = h;
|
||||
v1.HSizePos(230, 10).BottomPos(20, Arial(20).GetHeight() * 5);
|
||||
v1.SetFont(Arial(10));
|
||||
v1.HSizePosZ(220, 10).BottomPosZ(20, Arial(Ctrl::Zy(20)).GetHeight() * 5);
|
||||
v1.SetFont(Arial(Ctrl::Zy(10)));
|
||||
l.Add(v1);
|
||||
parent.Add(ctrl.Create<StaticRect>().Color(White).SizePos());
|
||||
parent.Add(l.TopPos(0, isz.cy).LeftPos(0, isz.cx));
|
||||
#if 0
|
||||
parent.Add(ctrl.Create<StaticRect>().Color(Blue).LeftPos(2, isz.cx - 4).TopPos(isz.cy, 1));
|
||||
parent.Add(ctrl.Create<StaticRect>().Color(Blue).LeftPos(2, isz.cx - Zx(4)).TopPos(isz.cy, Zy(1)));
|
||||
RichTextView& w = ctrl.Create<RichTextView>();
|
||||
w.SetQTF(GetTopic("ide/app/Sponsor$en-us"));
|
||||
w.PageWidth(2900);
|
||||
w.NoSb();
|
||||
w.SetFrame(NullFrame());
|
||||
w.NoLazy();
|
||||
parent.Add(w.TopPos(isz.cy + 3, 99).LeftPos(0, isz.cx));
|
||||
parent.Add(w.TopPos(isz.cy + Zy(3), Zy(99)).LeftPos(0, isz.cx));
|
||||
#endif
|
||||
return sz;
|
||||
}
|
||||
|
|
@ -102,11 +102,12 @@ struct AboutDlg : TopWindow {
|
|||
|
||||
AboutDlg() {
|
||||
Size isz = MakeLogo(*this, ctrl);
|
||||
SetRect(0, 0, 1000, isz.cy);
|
||||
int cx = min(Zx(1000), GetWorkArea().GetWidth());
|
||||
SetRect(0, 0, cx, isz.cy);
|
||||
about.SetQTF(GetTopic("ide/app/About$en-us"), Zoom(130, 1024));
|
||||
about.SetZoom(Zoom(1, 1));
|
||||
about.RightPos(0, 1000 - isz.cx).VSizePos();
|
||||
about.HMargins(4);
|
||||
about.RightPos(0, cx - isz.cx).VSizePos();
|
||||
about.HMargins(Zx(4));
|
||||
about.SetFrame(NullFrame());
|
||||
about.NoLazy();
|
||||
Background(PaintRect(ColorDisplay(), SColorPaper()));
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ void PaintCppItemImage(Draw& w, int& x, int ry, int access, int kind, bool focus
|
|||
WITHBODY, BrowserImg::impl(),
|
||||
Image());
|
||||
if(!IsNull(img))
|
||||
w.DrawImage(x, ry - img.GetHeight() / 2, img);
|
||||
x += 3;
|
||||
w.DrawImage(x, ry - img.GetHeight() / 2, DPI(img));
|
||||
x += Ctrl::Zx(3);
|
||||
img = BrowserImg::unknown();
|
||||
Image bk;
|
||||
switch(kind) {
|
||||
|
|
@ -114,6 +114,9 @@ void PaintCppItemImage(Draw& w, int& x, int ry, int access, int kind, bool focus
|
|||
break;
|
||||
}
|
||||
|
||||
img = DPI(img);
|
||||
bk = DPI(bk);
|
||||
|
||||
int by = ry - bk.GetSize().cy / 2;
|
||||
int iy = ry - img.GetSize().cy / 2;
|
||||
|
||||
|
|
@ -136,15 +139,14 @@ int CppItemInfoDisplay::DoPaint(Draw& w, const Rect& r, const Value& q,
|
|||
if(IsNull(q)) return 0;
|
||||
int x = r.left;
|
||||
int ry = r.top + r.GetHeight() / 2;
|
||||
|
||||
PaintCppItemImage(w, x, ry, m.access, m.kind, focuscursor);
|
||||
|
||||
if(m.inherited) {
|
||||
w.DrawImage(x + 10, r.top, BrowserImg::inherited());
|
||||
w.DrawImage(x + Ctrl::Zx(10), r.top, BrowserImg::inherited());
|
||||
for(int i = 1; i < min(m.inherited, 5); i++)
|
||||
w.DrawRect(x + 10, r.top + 7 + 2 * i, 7, 1, SColorText);
|
||||
w.DrawRect(x + Ctrl::Zx(10), r.top + Ctrl::Zy(7) + 2 * i, Ctrl::Zx(7), Ctrl::Zy(1), SColorText);
|
||||
}
|
||||
x += 16;
|
||||
x += Ctrl::Zx(16);
|
||||
int y = ry - Draw::GetStdFontCy() / 2;
|
||||
int x0 = x;
|
||||
Vector<ItemTextPart> n = ParseItemNatural(m);
|
||||
|
|
@ -185,7 +187,7 @@ int CppItemInfoDisplay::DoPaint(Draw& w, const Rect& r, const Value& q,
|
|||
w.DrawText(p.x + ax, p.y + ay, txt, fnt, White);
|
||||
w.DrawText(p.x, p.y, txt, fnt, Blue);
|
||||
}
|
||||
x += sz.cx + 3;
|
||||
x += sz.cx + Ctrl::Zx(3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -201,5 +203,5 @@ Size CppItemInfoDisplay::GetStdSize(const Value& q) const
|
|||
{
|
||||
NilDraw w;
|
||||
return Size(DoPaint(w, Rect(0, 0, INT_MAX, INT_MAX), q, Null, Null, 0),
|
||||
max(16, BrowserFont().Info().GetHeight()));
|
||||
max(Ctrl::Zy(16), BrowserFont().Info().GetHeight()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ int Navigator::NavigatorDisplay::DoPaint(Draw& w, const Rect& r, const Value& q,
|
|||
|
||||
PaintCppItemImage(w, x, ry, m.access, m.kind, focuscursor);
|
||||
|
||||
x += 15;
|
||||
x += Ctrl::Zx(15);
|
||||
Vector<ItemTextPart> n = ParseItemNatural(m.name, m.natural, m.ptype, m.pname, m.type,
|
||||
m.tname, m.ctname, ~m.natural + m.at);
|
||||
int starti = 0;
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ SelectPackageDlg::SelectPackageDlg(const char *title, bool selectvars_, bool mai
|
|||
alist.ColumnWidths("108 79 317");
|
||||
alist.WhenCursor = THISBACK(ListCursor);
|
||||
alist.EvenRowColor();
|
||||
alist.SetLineCy(max(16, Draw::GetStdFontCy()));
|
||||
alist.SetLineCy(max(Zy(16), Draw::GetStdFontCy()));
|
||||
list.Add(clist.SizePos());
|
||||
list.Add(alist.SizePos());
|
||||
splitter.Horz(base, list);
|
||||
|
|
@ -387,8 +387,8 @@ struct PackageDisplay : Display {
|
|||
virtual Size GetStdSize(const Value& q) const {
|
||||
ValueArray va = q;
|
||||
Size sz = GetTextSize(String(va[0]), fnt);
|
||||
sz.cx += 20;
|
||||
sz.cy = max(sz.cy, 16);
|
||||
sz.cx += Ctrl::Zx(20);
|
||||
sz.cy = max(sz.cy, Ctrl::Zy(16));
|
||||
return sz;
|
||||
}
|
||||
|
||||
|
|
@ -396,9 +396,12 @@ struct PackageDisplay : Display {
|
|||
ValueArray va = q;
|
||||
String txt = va[0];
|
||||
Image icon = va[1];
|
||||
if(IsNull(icon))
|
||||
icon = IdeImg::Package();
|
||||
icon = DPI(icon);
|
||||
w.DrawRect(r, paper);
|
||||
w.DrawImage(r.left, r.top + (r.Height() - 16) / 2, IsNull(icon) ? IdeImg::Package() : icon);
|
||||
w.DrawText(r.left + 20, r.top + (r.Height() - Draw::GetStdFontCy()) / 2, txt, fnt, ink);
|
||||
w.DrawImage(r.left, r.top + (r.Height() - icon.GetHeight()) / 2, icon);
|
||||
w.DrawText(r.left + Ctrl::Zx(20), r.top + (r.Height() - Draw::GetStdFontCy()) / 2, txt, fnt, ink);
|
||||
}
|
||||
|
||||
PackageDisplay() { fnt = StdFont(); }
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ void WorkspaceWork::SyncErrorPackages()
|
|||
break;
|
||||
}
|
||||
}
|
||||
ff.icon = DPI(ff.icon);
|
||||
package.Set(i, ff);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue