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
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue