diff --git a/uppsrc/CtrlCore/CtrlCore.h b/uppsrc/CtrlCore/CtrlCore.h index bf2a2d268..0b1e189aa 100644 --- a/uppsrc/CtrlCore/CtrlCore.h +++ b/uppsrc/CtrlCore/CtrlCore.h @@ -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); diff --git a/uppsrc/CtrlLib/Button.cpp b/uppsrc/CtrlLib/Button.cpp index 464534ac0..68f3eeb63 100644 --- a/uppsrc/CtrlLib/Button.cpp +++ b/uppsrc/CtrlLib/Button.cpp @@ -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) diff --git a/uppsrc/CtrlLib/ChGtk.cpp b/uppsrc/CtrlLib/ChGtk.cpp index 319d8a03a..71217c43b 100644 --- a/uppsrc/CtrlLib/ChGtk.cpp +++ b/uppsrc/CtrlLib/ChGtk.cpp @@ -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)) diff --git a/uppsrc/CtrlLib/ChWin32.cpp b/uppsrc/CtrlLib/ChWin32.cpp index d78196924..b7c5f24fa 100644 --- a/uppsrc/CtrlLib/ChWin32.cpp +++ b/uppsrc/CtrlLib/ChWin32.cpp @@ -455,16 +455,16 @@ void ChHostSkin() { MenuBar::Style& s = MenuBar::StyleDefault().Write(); if(vista_aero) { - s.topitemtext[0] = s.topitemtext[1] = s.topitemtext[2] = - s.itemtext = XpColor(XP_MENU, 8 /*MENU_POPUPITEM*/, + s.topitemtext[0] = s.topitemtext[1] = s.topitemtext[2] = + s.itemtext = XpColor(XP_MENU, 8 /*MENU_POPUPITEM*/, 2 /*HOT*/, 3803/*TMT_TEXTCOLOR*/); Win32Look(s.item, XP_MENU, 14 /*MENU_POPUPITEM*/, 2 /*HOT*/); 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(); } diff --git a/uppsrc/CtrlLib/FileList.cpp b/uppsrc/CtrlLib/FileList.cpp index 364e66289..b7b3725f9 100644 --- a/uppsrc/CtrlLib/FileList.cpp +++ b/uppsrc/CtrlLib/FileList.cpp @@ -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(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(); diff --git a/uppsrc/CtrlLib/FileSel.cpp b/uppsrc/CtrlLib/FileSel.cpp index 2d05af2bd..e66f4c747 100644 --- a/uppsrc/CtrlLib/FileSel.cpp +++ b/uppsrc/CtrlLib/FileSel.cpp @@ -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; } diff --git a/uppsrc/CtrlLib/LabelBase.cpp b/uppsrc/CtrlLib/LabelBase.cpp index 796a39988..4eebf6c24 100644 --- a/uppsrc/CtrlLib/LabelBase.cpp +++ b/uppsrc/CtrlLib/LabelBase.cpp @@ -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) diff --git a/uppsrc/CtrlLib/LabelBase.h b/uppsrc/CtrlLib/LabelBase.h index 4c83f8940..be8790b29 100644 --- a/uppsrc/CtrlLib/LabelBase.h +++ b/uppsrc/CtrlLib/LabelBase.h @@ -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, diff --git a/uppsrc/CtrlLib/MenuBar.cpp b/uppsrc/CtrlLib/MenuBar.cpp index 5e8dbf9d7..cab156ef6 100644 --- a/uppsrc/CtrlLib/MenuBar.cpp +++ b/uppsrc/CtrlLib/MenuBar.cpp @@ -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; } diff --git a/uppsrc/CtrlLib/MenuImp.h b/uppsrc/CtrlLib/MenuImp.h index cb3cefef7..8795d1ede 100644 --- a/uppsrc/CtrlLib/MenuImp.h +++ b/uppsrc/CtrlLib/MenuImp.h @@ -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; } diff --git a/uppsrc/CtrlLib/MenuItem.cpp b/uppsrc/CtrlLib/MenuItem.cpp index a7a6ead0b..3eb19c709 100644 --- a/uppsrc/CtrlLib/MenuItem.cpp +++ b/uppsrc/CtrlLib/MenuItem.cpp @@ -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) diff --git a/uppsrc/CtrlLib/ToolButton.cpp b/uppsrc/CtrlLib/ToolButton.cpp index 814e99bc3..23b2eb849 100644 --- a/uppsrc/CtrlLib/ToolButton.cpp +++ b/uppsrc/CtrlLib/ToolButton.cpp @@ -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; diff --git a/uppsrc/Draw/Font.cpp b/uppsrc/Draw/Font.cpp index d6308360b..a35725c66 100644 --- a/uppsrc/Draw/Font.cpp +++ b/uppsrc/Draw/Font.cpp @@ -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) diff --git a/uppsrc/Draw/MakeCache.cpp b/uppsrc/Draw/MakeCache.cpp index 8d210f230..125e4fdfc 100644 --- a/uppsrc/Draw/MakeCache.cpp +++ b/uppsrc/Draw/MakeCache.cpp @@ -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; } }; diff --git a/uppsrc/RichEdit/Editor.cpp b/uppsrc/RichEdit/Editor.cpp index 41694891b..9b7d4821f 100644 --- a/uppsrc/RichEdit/Editor.cpp +++ b/uppsrc/RichEdit/Editor.cpp @@ -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()); face.SetDisplay(Single()); - 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; diff --git a/uppsrc/RichEdit/RichEdit.h b/uppsrc/RichEdit/RichEdit.h index 0fc210884..baa5a94fa 100644 --- a/uppsrc/RichEdit/RichEdit.h +++ b/uppsrc/RichEdit/RichEdit.h @@ -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); diff --git a/uppsrc/RichEdit/Ruler.cpp b/uppsrc/RichEdit/Ruler.cpp index 65887b2c5..a96db2319 100644 --- a/uppsrc/RichEdit/Ruler.cpp +++ b/uppsrc/RichEdit/Ruler.cpp @@ -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() : - newtabalign == ALIGN_CENTER ? RichEditImg::CenterTab() : - RichEditImg::LeftTab()); + w.DrawImage(Zx(4), Zy(6), DPI(newtabalign == ALIGN_RIGHT ? RichEditImg::RightTab() : + newtabalign == ALIGN_CENTER ? RichEditImg::CenterTab() : + 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); diff --git a/uppsrc/TextDiffCtrl/TextCtrl.cpp b/uppsrc/TextDiffCtrl/TextCtrl.cpp index 29e690735..c79bdc366 100644 --- a/uppsrc/TextDiffCtrl/TextCtrl.cpp +++ b/uppsrc/TextDiffCtrl/TextCtrl.cpp @@ -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; @@ -28,7 +28,7 @@ TextCompareCtrl::TextCompareCtrl() int TextCompareCtrl::GetLineNo(int y, int& ii) { ii = scroll.Get().y + y / letter.cy; - return ii >= 0 && ii < lines.GetCount() ? lines[ii].number : Null; + return ii >= 0 && ii < lines.GetCount() ? lines[ii].number : Null; } void TextCompareCtrl::DoSelection(int y, bool shift) diff --git a/uppsrc/art/BlueBar/BlueSkin.cpp b/uppsrc/art/BlueBar/BlueSkin.cpp index 9512126f2..17bb6023c 100644 --- a/uppsrc/art/BlueBar/BlueSkin.cpp +++ b/uppsrc/art/BlueBar/BlueSkin.cpp @@ -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); diff --git a/uppsrc/ide/About.cpp b/uppsrc/ide/About.cpp index f5ce33689..887af8eec 100644 --- a/uppsrc/ide/About.cpp +++ b/uppsrc/ide/About.cpp @@ -13,7 +13,7 @@ Size MakeLogo(Ctrl& parent, Array& ctrl) { - Image logo = IdeImg::logo(); + Image logo = DPI(IdeImg::logo(), 9999); Size isz = logo.GetSize(); ImageCtrl& l = ctrl.Create(); Label& v1 = ctrl.Create