From 26b381bcefca490974b63a13f9844f080af5d1c2 Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 9 Aug 2015 11:14:16 +0000 Subject: [PATCH] upp.src: UHD issues git-svn-id: svn://ultimatepp.org/upp/trunk@8803 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CodeEditor/CodeEditor.cpp | 2 +- uppsrc/CtrlCore/CtrlCore.h | 5 +++-- uppsrc/CtrlLib/ColorPusher.cpp | 1 - uppsrc/CtrlLib/Help.cpp | 2 +- uppsrc/CtrlLib/LineEdit.cpp | 4 ++-- uppsrc/CtrlLib/MenuItem.cpp | 4 ++-- uppsrc/CtrlLib/TreeCtrl.cpp | 2 +- uppsrc/Draw/ImageOp.h | 3 +++ uppsrc/Draw/Uhd.cpp | 11 +++++++++++ uppsrc/Esc/Esc.upp | 2 +- uppsrc/HexView/HexView.cpp | 6 +++--- uppsrc/IconDes/RGBACtrl.cpp | 2 +- uppsrc/Painter/Painter.upp | 2 +- uppsrc/TextDiffCtrl/TextCtrl.cpp | 2 +- uppsrc/ide/About.cpp | 2 +- uppsrc/ide/Debuggers/Dbg.cpp | 2 +- uppsrc/ide/Debuggers/Disas.cpp | 4 ++-- uppsrc/ide/Debuggers/Gdb_MI2.cpp | 2 +- uppsrc/ide/LayDes/fontprop.cpp | 6 +++--- uppsrc/ide/LayDes/visgen.cpp | 4 ++-- uppsrc/ide/SelectPkg.cpp | 5 +++-- uppsrc/ide/Template.cpp | 6 +++--- uppsrc/ide/ide.upp | 2 +- uppsrc/ide/idewin.cpp | 4 ++-- uppsrc/usvn/SvnSync.cpp | 6 +++--- 25 files changed, 53 insertions(+), 38 deletions(-) diff --git a/uppsrc/CodeEditor/CodeEditor.cpp b/uppsrc/CodeEditor/CodeEditor.cpp index f44c82a32..40c89f2be 100644 --- a/uppsrc/CodeEditor/CodeEditor.cpp +++ b/uppsrc/CodeEditor/CodeEditor.cpp @@ -968,7 +968,7 @@ CodeEditor::CodeEditor() { bracket_start = 0; stat_edit_time = 0; last_key_time = Null; - SetFont(Courier(16)); + SetFont(CourierZ(16)); AddFrame(bar); bar.SetEditor(this); UndoSteps(10000); diff --git a/uppsrc/CtrlCore/CtrlCore.h b/uppsrc/CtrlCore/CtrlCore.h index f4e7f276a..334652c52 100644 --- a/uppsrc/CtrlCore/CtrlCore.h +++ b/uppsrc/CtrlCore/CtrlCore.h @@ -1267,8 +1267,9 @@ void GuiPlatformGripResize(TopWindow *q); Color GuiPlatformGetScreenPixel(int x, int y); void GuiPlatformAfterMenuPopUp(); -inline int Zx(int cx) { return Ctrl::HorzLayoutZoom(cx); } -inline int Zy(int cy) { return Ctrl::VertLayoutZoom(cy); } +inline int Zx(int cx) { return Ctrl::HorzLayoutZoom(cx); } +inline int Zy(int cy) { return Ctrl::VertLayoutZoom(cy); } +inline Size Zsz(int cx, int cy) { return Size(Zx(cx), Zy(cy)); } Font FontZ(int face, int height = 0); diff --git a/uppsrc/CtrlLib/ColorPusher.cpp b/uppsrc/CtrlLib/ColorPusher.cpp index 417f2111b..99cfe0ad4 100644 --- a/uppsrc/CtrlLib/ColorPusher.cpp +++ b/uppsrc/CtrlLib/ColorPusher.cpp @@ -120,7 +120,6 @@ 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 diff --git a/uppsrc/CtrlLib/Help.cpp b/uppsrc/CtrlLib/Help.cpp index c5a848162..60884619d 100644 --- a/uppsrc/CtrlLib/Help.cpp +++ b/uppsrc/CtrlLib/Help.cpp @@ -88,7 +88,7 @@ void HelpWindow::Forward() void HelpWindow::SetZoom() { - zoom.d = 1000; + zoom.d = 1000000 / Zy(1000); current_link = Null; GoTo0(topic); Refresh(); diff --git a/uppsrc/CtrlLib/LineEdit.cpp b/uppsrc/CtrlLib/LineEdit.cpp index 5171bd00f..263684961 100644 --- a/uppsrc/CtrlLib/LineEdit.cpp +++ b/uppsrc/CtrlLib/LineEdit.cpp @@ -9,7 +9,7 @@ LineEdit::LineEdit() { nohbar = false; showtabs = false; tabsize = 4; - font = Courier(16); + font = CourierZ(16); SetFrame(ViewFrame()); sb.NoBox(); AddFrame(sb); @@ -1190,7 +1190,7 @@ void LineEdit::LeftDrag(Point p, dword flags) ImageDraw iw(sz); iw.DrawRect(sz, Black()); iw.Alpha().DrawRect(sz, Black()); - DrawTLText(iw.Alpha(), 0, 0, 9999, sample, Courier(10), White()); + DrawTLText(iw.Alpha(), 0, 0, 9999, sample, CourierZ(10), White()); NextUndo(); if(DoDragAndDrop(ClipFmtsText(), iw) == DND_MOVE && !IsReadOnly()) { RemoveSelection(); diff --git a/uppsrc/CtrlLib/MenuItem.cpp b/uppsrc/CtrlLib/MenuItem.cpp index 1e9bf7817..6760f0164 100644 --- a/uppsrc/CtrlLib/MenuItem.cpp +++ b/uppsrc/CtrlLib/MenuItem.cpp @@ -646,12 +646,12 @@ bool TopMenuItem::Key(dword key, int count) Size TopMenuItem::GetMinSize() const { - return AddFrameSize(GetTextSize(text, StdFont()) + Size(12, 7)); + return AddFrameSize(GetTextSize(text, StdFont()) + Zsz(12, 7)); } int TopMenuItem::GetStdHeight(Font font) { - return font.Info().GetHeight() + 7; + return font.Info().GetHeight() + Zy(7); } void TopMenuItem::SyncState() diff --git a/uppsrc/CtrlLib/TreeCtrl.cpp b/uppsrc/CtrlLib/TreeCtrl.cpp index 720aa54fd..5e0d6a4b0 100644 --- a/uppsrc/CtrlLib/TreeCtrl.cpp +++ b/uppsrc/CtrlLib/TreeCtrl.cpp @@ -56,7 +56,7 @@ TreeCtrl::Node::Node(const Image& img, Ctrl& ctrl, int cx, int cy) TreeCtrl::TreeCtrl() { display = &StdDisplay(); - levelcx = 16; + levelcx = DPI(16); nocursor = false; noroot = false; dirty = true; diff --git a/uppsrc/Draw/ImageOp.h b/uppsrc/Draw/ImageOp.h index 7e82a952d..7aaf5fb0e 100644 --- a/uppsrc/Draw/ImageOp.h +++ b/uppsrc/Draw/ImageOp.h @@ -202,4 +202,7 @@ void SetUHDMode(bool b = true); bool IsUHDMode(); Image DPI(const Image& m); +Image DPI(const Image& img, int expected); + +inline int DPI(int a) { return IsUHDMode() ? 2 * a : a; } inline Size DPI(Size sz) { return IsUHDMode() ? 2 * sz : sz; } diff --git a/uppsrc/Draw/Uhd.cpp b/uppsrc/Draw/Uhd.cpp index 09590dc27..08da524bb 100644 --- a/uppsrc/Draw/Uhd.cpp +++ b/uppsrc/Draw/Uhd.cpp @@ -37,4 +37,15 @@ Image DPI(const Image& img) return img; } +Image DPI(const Image& img, int expected) +{ + if(img.GetSize().cy <= expected && IsUHDMode()) { + Image m = CachedRescale(img, 2 * img.GetSize(), FILTER_LANCZOS3); + ImageBuffer h(m); + h.SetResolution(IMAGE_RESOLUTION_UHD); + return h; + } + return img; +} + }; \ No newline at end of file diff --git a/uppsrc/Esc/Esc.upp b/uppsrc/Esc/Esc.upp index 045b19166..b0e51e77c 100644 --- a/uppsrc/Esc/Esc.upp +++ b/uppsrc/Esc/Esc.upp @@ -6,7 +6,7 @@ uses Core; file - Esc.h options PCH, + Esc.h options(BUILDER_OPTION) PCH, EscValue.cpp, EscArray.cpp, EscMap.cpp, diff --git a/uppsrc/HexView/HexView.cpp b/uppsrc/HexView/HexView.cpp index d96fbeef9..5eae2f991 100644 --- a/uppsrc/HexView/HexView.cpp +++ b/uppsrc/HexView/HexView.cpp @@ -128,7 +128,7 @@ void HexViewInfo::Paint(Draw& w) void HexViewInfo::SetMode(int _mode) { mode = _mode; - Height(mode * GetTextSize("X", Courier(12)).cy + 3); + Height(mode * GetTextSize("X", CourierZ(12)).cy + 3); Show(mode); } @@ -137,7 +137,7 @@ HexViewInfo::HexViewInfo() SetMode(0); AddFrame(TopSeparatorFrame()); AddFrame(RightSeparatorFrame()); - font = Courier(12); + font = CourierZ(12); } int HexView::Byte(int64 adr) @@ -466,7 +466,7 @@ void HexView::SerializeSettings(Stream& s) HexView::HexView() { - SetFont(Courier(12)); + SetFont(CourierZ(12)); BackPaint(); charset = CHARSET_WIN1252; sb <<= THISBACK(Scroll); diff --git a/uppsrc/IconDes/RGBACtrl.cpp b/uppsrc/IconDes/RGBACtrl.cpp index 76836833b..720b62ff5 100644 --- a/uppsrc/IconDes/RGBACtrl.cpp +++ b/uppsrc/IconDes/RGBACtrl.cpp @@ -191,7 +191,7 @@ RGBACtrl::RGBACtrl() ramp <<= THISBACK(Ramp); Add(alpha); alpha <<= THISBACK(Alpha); - text.SetFont(Courier(11)); + text.SetFont(CourierZ(11)); text.NoWantFocus(); text.SetReadOnly(); Add(text); diff --git a/uppsrc/Painter/Painter.upp b/uppsrc/Painter/Painter.upp index 75a73599a..f84e5eab9 100644 --- a/uppsrc/Painter/Painter.upp +++ b/uppsrc/Painter/Painter.upp @@ -4,7 +4,7 @@ uses Draw; file - Painter.h options PCH, + Painter.h options(BUILDER_OPTION) PCH, Painter.hpp, Painter.cpp, SvgArc.cpp, diff --git a/uppsrc/TextDiffCtrl/TextCtrl.cpp b/uppsrc/TextDiffCtrl/TextCtrl.cpp index c79bdc366..3ef213cd4 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(Zy(14)), Courier(Zy(10))); + SetFont(CourierZ(14), CourierZ(10)); scroll.NoAutoHide(); scroll.WhenScroll = THISBACK(SelfScroll); maxwidth = 0; diff --git a/uppsrc/ide/About.cpp b/uppsrc/ide/About.cpp index 272e1f4fb..d75388fdf 100644 --- a/uppsrc/ide/About.cpp +++ b/uppsrc/ide/About.cpp @@ -13,7 +13,7 @@ Size MakeLogo(Ctrl& parent, Array& ctrl) { - Image logo = DPI(IdeImg::logo(), 9999); + Image logo = IdeImg::logo(); Size isz = logo.GetSize(); ImageCtrl& l = ctrl.Create(); Label& v1 = ctrl.Create