Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ LRESULT CDDS_ITEMPOSTPAINT (NMTVCUSTOMDRAW nmcd, long wParam, long lParam) {
}
}
}
rect.left += INSET - 1;
rect.left += Win32DPIUtils.pointToPixel(INSET - 1, zoom) ;
if (drawImage) {
Image image = null;
if (index == 0) {
Expand All @@ -759,8 +759,8 @@ LRESULT CDDS_ITEMPOSTPAINT (NMTVCUSTOMDRAW nmcd, long wParam, long lParam) {
Image [] images = item.images;
if (images != null) image = images [index];
}
int inset = i != 0 ? INSET : 0;
int offset = i != 0 ? INSET : INSET + 2;
int inset = i != 0 ? Win32DPIUtils.pointToPixel(INSET, zoom) : 0;
int offset = i != 0 ? Win32DPIUtils.pointToPixel(INSET, zoom) : Win32DPIUtils.pointToPixel(INSET + 2, zoom);
if (image != null) {
Rectangle bounds = image.getBounds (); // Points
if (size == null) size = Win32DPIUtils.pixelToPoint (getImageSize (), zoom); // To Points
Expand Down Expand Up @@ -5488,7 +5488,7 @@ public void showColumn (TreeColumn column) {
SCROLLINFO info = new SCROLLINFO();
info.cbSize = SCROLLINFO.sizeof;
info.fMask = OS.SIF_POS;
info.nPos = Math.max(0, headerRect.left - Tree.INSET / 2);
info.nPos = Math.max(0, headerRect.left - Win32DPIUtils.pointToPixel(INSET / 2, getZoom()));
OS.SetScrollInfo(hwndParent, OS.SB_HORZ, info, true);
setScrollWidth();
} else if (scrollBecauseRight) {
Expand All @@ -5502,8 +5502,8 @@ public void showColumn (TreeColumn column) {
// info.nPos + wideRect = headerRect.left + wideHeader
// info.nPos = headerRect.left + wideHeader - wideRect
info.nPos = Math.max(0, wideHeader + headerRect.left - wideRect
- Tree.INSET / 2);
info.nPos = Math.min(rect.right - Tree.INSET / 2, info.nPos);
- Win32DPIUtils.pointToPixel(INSET / 2, getZoom()) );
info.nPos = Math.min(rect.right - Win32DPIUtils.pointToPixel(INSET / 2, getZoom()), info.nPos);

OS.SetScrollInfo(hwndParent, OS.SB_HORZ, info, true);
setScrollWidth();
Expand Down Expand Up @@ -7930,7 +7930,7 @@ LRESULT wmNotifyHeader (NMHDR hdr, long wParam, long lParam) {
}
}

int x = rects[i].left + INSET + 2;
int x = rects[i].left + Win32DPIUtils.pointToPixel(INSET + 2, getZoom());
if (columns[i].image != null) {
GCData data = new GCData();
data.device = display;
Expand Down Expand Up @@ -8248,7 +8248,7 @@ LRESULT wmNotifyToolTip (NMTTCUSTOMDRAW nmcd, long lParam) {
data.background = OS.GetBkColor (nmcd.hdc);
data.font = Font.win32_new (display, hFont);
GC gc = createNewGC(nmcd.hdc, data);
int x = cellRect [0].left + INSET;
int x = cellRect [0].left + Win32DPIUtils.pointToPixel(INSET, getZoom());
if (index [0] != 0) x -= gridWidth;
Image image = item [0].getImage (index [0]);
if (image != null || index [0] == 0) {
Expand All @@ -8259,11 +8259,11 @@ LRESULT wmNotifyToolTip (NMTTCUSTOMDRAW nmcd, long lParam) {
Rectangle rect = image.getBounds (); // Points
int zoom = getZoom();
gc.drawImage (image, rect.x, rect.y, rect.width, rect.height, DPIUtil.pixelToPoint(x, zoom), DPIUtil.pixelToPoint(imageRect.top, zoom), DPIUtil.pixelToPoint(size.x, zoom), DPIUtil.pixelToPoint(size.y, zoom));
x += INSET + (index [0] == 0 ? 1 : 0);
x += Win32DPIUtils.pointToPixel(INSET, getZoom()) + (index [0] == 0 ? 1 : 0);
}
x += size.x;
} else {
x += INSET;
x += Win32DPIUtils.pointToPixel(INSET, getZoom());
}
String string = item [0].getText (index [0]);
if (string != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ RECT getBounds (int index, boolean getText, boolean getImage, boolean fullText,
if (getImage && !fullImage) {
if (OS.SendMessage (hwnd, OS.TVM_GETIMAGELIST, OS.TVSIL_NORMAL, 0) != 0) {
Point size = parent.getImageSize ();
rect.left -= size.x + Tree.INSET;
rect.left -= size.x + Win32DPIUtils.pointToPixel(Tree.INSET, getZoom());
if (!getText) rect.right = rect.left + size.x;
} else {
if (!getText) rect.right = rect.left;
Expand Down Expand Up @@ -496,7 +496,7 @@ RECT getBounds (int index, boolean getText, boolean getImage, boolean fullText,
}
if (getText) {
if (fullText && clip) {
rect.left = rect.right + Tree.INSET;
rect.left = rect.right + Win32DPIUtils.pointToPixel(Tree.INSET, getZoom());
rect.right = headerRect.right;
} else {
String string = index == 0 ? text : strings != null ? strings [index] : null;
Expand All @@ -517,10 +517,10 @@ RECT getBounds (int index, boolean getText, boolean getImage, boolean fullText,
OS.ReleaseDC (hwnd, hNewDC);
}
if (getImage) {
rect.right += textRect.right - textRect.left + Tree.INSET * 3;
rect.right += textRect.right - textRect.left + Win32DPIUtils.pointToPixel(Tree.INSET * 3, getZoom());
} else {
rect.left = rect.right + Tree.INSET;
rect.right = rect.left + (textRect.right - textRect.left) + Tree.INSET;
rect.left = rect.right + Win32DPIUtils.pointToPixel(Tree.INSET, getZoom());
rect.right = rect.left + (textRect.right - textRect.left) + Win32DPIUtils.pointToPixel(Tree.INSET, getZoom());
}
}
}
Expand Down Expand Up @@ -918,9 +918,8 @@ public Rectangle getTextBounds (int index) {
Rectangle getTextBoundsInPixels (int index) {
if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED);
RECT rect = getBounds (index, true, false, true);
if (index == 0) rect.left += Tree.INSET - 1;
rect.left = Math.min (rect.left, rect.right);
rect.right = rect.right - Tree.INSET + 1; // Add 1 px margin to avoid truncation of text seen with "Segoe UI" font
rect.right = rect.right + Win32DPIUtils.pointToPixel(Tree.INSET, getZoom()); // Add INSET margin to avoid truncation of text seen with "Segoe UI" font
int width = Math.max (0, rect.right - rect.left);
int height = Math.max (0, rect.bottom - rect.top);
return new Rectangle (rect.left, rect.top, width, height);
Expand Down
Loading