[commit] r2797 - trunk/GME/PartBrowser
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Mon Apr 5 11:26:01 CDT 2021
Author: ksmyth
Date: Mon Apr 5 11:26:01 2021
New Revision: 2797
Log:
PartBrowser: render bigger for high-DPI
Modified:
trunk/GME/PartBrowser/PartBrowserPane.cpp
trunk/GME/PartBrowser/PartBrowserPane.h
trunk/GME/PartBrowser/PartBrowserPaneFrame.cpp
trunk/GME/PartBrowser/PartBrowserPaneFrame.h
Modified: trunk/GME/PartBrowser/PartBrowserPane.cpp
==============================================================================
--- trunk/GME/PartBrowser/PartBrowserPane.cpp Mon Apr 5 11:25:57 2021 (r2796)
+++ trunk/GME/PartBrowser/PartBrowserPane.cpp Mon Apr 5 11:26:01 2021 (r2797)
@@ -38,6 +38,9 @@
txtMetricFont.CreateFont(fontSizes[GME_NAME_FONT], 0, 0, 0, FW_NORMAL, false, 0, 0, ANSI_CHARSET,
OUT_DEVICE_PRECIS, CLIP_DEFAULT_PRECIS,
PROOF_QUALITY, FF_SWISS, _T("Arial"));
+ HDC hdc = ::GetDC(NULL);
+ logPixelsY = GetDeviceCaps(hdc, LOGPIXELSY);
+ ::ReleaseDC(NULL, hdc);
}
CPartBrowserPane::~CPartBrowserPane()
@@ -93,11 +96,6 @@
CRect rc (x1, y1, x2, y2);
if (rc.PtInRect(pt)) {
pdt = &(*ii);
-
- long sizeX = 0;
- long sizeY = 0;
- COMTHROW((*ii).decorator->GetPreferredSize(&sizeX, &sizeY));
-
return true;
}
}
@@ -203,6 +201,11 @@
if (!mgaMetaModel || currentAspectIndex < 0 || pdts.size() <= 0 || currentAspectIndex >= (int)pdts.size())
return;
+ r.bottom = MulDiv(r.bottom, 96, logPixelsY);
+ r.top = MulDiv(r.top, 96, logPixelsY);
+ r.left = MulDiv(r.left, 96, logPixelsY);
+ r.right = MulDiv(r.right, 96, logPixelsY);
+
bool oldOmitPaintMessages = omitPaintMessages;
omitPaintMessages = true;
ChangeAspect(currentAspectIndex);
@@ -292,8 +295,8 @@
CPartBrowserPaneFrame* parent = (CPartBrowserPaneFrame*)GetParent();
ASSERT(parent != NULL);
- parent->SetLogicalHeight(pt.y);
- parent->SetPageHeight(r.Height());
+ parent->SetLogicalHeight(MulDiv(pt.y, logPixelsY, 96));
+ parent->SetPageHeight(MulDiv(r.Height(), logPixelsY, 96));
parent->SetScrollBar();
Invalidate();
@@ -393,6 +396,7 @@
CPartBrowserPaneFrame* parent = (CPartBrowserPaneFrame*)GetParent();
ASSERT(parent != NULL);
+ ASSERT(dynamic_cast<CPartBrowserPaneFrame*>(GetParent()));
Invalidate();
@@ -424,7 +428,14 @@
ASSERT(parent != NULL);
CPaintDC dc(this); // device context for painting
- dc.SetWindowOrg(0, parent->GetScrollPosition ());
+
+ dc.SetWindowOrg(0, MulDiv(parent->GetScrollPosition(), 96, logPixelsY));
+
+ dc.SetMapMode(MM_ISOTROPIC);
+ dc.SetWindowExt(100, 100);
+ int curzoom = MulDiv(100, logPixelsY, 96);
+ dc.SetViewportExt(curzoom, curzoom);
+
if (pdts.size() > 0 && currentAspectIndex >= 0) {
try {
@@ -472,6 +483,9 @@
point.y += parent->GetScrollPosition ();
const PartWithDecorator* pdt;
+
+ point.x = MulDiv(point.x, 96, logPixelsY);
+ point.y = MulDiv(point.y, 96, logPixelsY);
bool found = FindObject(point, pdt);
if (found) {
Modified: trunk/GME/PartBrowser/PartBrowserPane.h
==============================================================================
--- trunk/GME/PartBrowser/PartBrowserPane.h Mon Apr 5 11:25:57 2021 (r2796)
+++ trunk/GME/PartBrowser/PartBrowserPane.h Mon Apr 5 11:26:01 2021 (r2797)
@@ -64,6 +64,16 @@
bool FindObject(CPoint &pt, const PartWithDecorator*& pdt);
void CreateDecorators(CComPtr<IMgaMetaParts> metaParts);
void DestroyDecorators(void);
+ int logPixelsY;
+ HRESULT GetDecoratorSize(IMgaDecorator* decorator, long &sizeX, long &sizeY) {
+ HRESULT hr = decorator->GetPreferredSize(&sizeX, &sizeY);
+ sizeX = MulDiv(sizeX, logPixelsY, 96);
+ sizeY = MulDiv(sizeX, logPixelsY, 96);
+ return hr;
+ }
+ HRESULT GetDecoratorSize(const PartWithDecorator& decorator, long &sizeX, long &sizeY) {
+ return GetDecoratorSize(decorator.decorator, sizeX, sizeY);
+ }
// Attributes
protected:
Modified: trunk/GME/PartBrowser/PartBrowserPaneFrame.cpp
==============================================================================
--- trunk/GME/PartBrowser/PartBrowserPaneFrame.cpp Mon Apr 5 11:25:57 2021 (r2796)
+++ trunk/GME/PartBrowser/PartBrowserPaneFrame.cpp Mon Apr 5 11:26:01 2021 (r2797)
@@ -19,8 +19,7 @@
CPartBrowserPaneFrame::CPartBrowserPaneFrame(CWnd* pParent/* = NULL*/)
: CDialog(CPartBrowserPaneFrame::IDD, pParent),
vScrollWidth (::GetSystemMetrics (SM_CXVSCROLL)), // WinXP default style: 17
- lineSize (20),
- pageSize (60),
+ pageSize(60),
pageHeight(100), // maybe fix UNINITIALIZED READ: reading register edx PartBrowser.OCX!CPartBrowserPaneFrame::Resize [c:\users\kevin\documents\gme\gme\partbrowser\partbrowserpaneframe.cpp:57]
logicalHeight(100),
scrollPos(0)
@@ -28,6 +27,11 @@
//{{AFX_DATA_INIT(CPartBrowserPaneFrame)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
+ HDC hdc = ::GetDC(NULL);
+ int logPixelsY = GetDeviceCaps(hdc, LOGPIXELSY);
+ ::ReleaseDC(NULL, hdc);
+
+ lineSize = MulDiv(30, logPixelsY, 96);
}
Modified: trunk/GME/PartBrowser/PartBrowserPaneFrame.h
==============================================================================
--- trunk/GME/PartBrowser/PartBrowserPaneFrame.h Mon Apr 5 11:25:57 2021 (r2796)
+++ trunk/GME/PartBrowser/PartBrowserPaneFrame.h Mon Apr 5 11:26:01 2021 (r2797)
@@ -42,7 +42,7 @@
int pageHeight;
int scrollPos;
const int vScrollWidth;
- const int lineSize;
+ int lineSize;
const int pageSize;
public:
More information about the gme-commit
mailing list