[commit] r2758 - in trunk/GME: Gme MgaUtil ObjectInspector
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Fri Oct 19 13:41:42 CDT 2018
Author: ksmyth
Date: Fri Oct 19 13:41:42 2018
New Revision: 2758
Log:
Fix GDI DC leaks
Modified:
trunk/GME/Gme/ChildFrm.cpp
trunk/GME/Gme/ModelPropertiesDlgBar.cpp
trunk/GME/MgaUtil/AnnotationBrowserDlg.cpp
trunk/GME/MgaUtil/CompDlg.cpp
trunk/GME/ObjectInspector/InspectorList.cpp
trunk/GME/ObjectInspector/SplitterBar.cpp
Modified: trunk/GME/Gme/ChildFrm.cpp
==============================================================================
--- trunk/GME/Gme/ChildFrm.cpp Fri Oct 19 13:41:38 2018 (r2757)
+++ trunk/GME/Gme/ChildFrm.cpp Fri Oct 19 13:41:42 2018 (r2758)
@@ -127,7 +127,7 @@
// int zoomvals[] = {ZOOM_NO, 150, 200, 250, 300, 350, 400, 0}; // for test
propBar.SetZoomList(zoomvals);
propBar.DockToFrameWindow(CBRS_ALIGN_TOP);
- propBar.SetMinSize(CSize(10, 26 * GetDC()->GetDeviceCaps(LOGPIXELSY) / 96));
+ propBar.SetMinSize(CSize(10, 26 * CClientDC(this).GetDeviceCaps(LOGPIXELSY) / 96));
ShowPane(&propBar, true, false, true);
}
Modified: trunk/GME/Gme/ModelPropertiesDlgBar.cpp
==============================================================================
--- trunk/GME/Gme/ModelPropertiesDlgBar.cpp Fri Oct 19 13:41:38 2018 (r2757)
+++ trunk/GME/Gme/ModelPropertiesDlgBar.cpp Fri Oct 19 13:41:42 2018 (r2758)
@@ -30,7 +30,7 @@
void CModelPropertiesDlgBar::ShowType()
{
- int size = (int)(16.0 * GetDC()->GetDeviceCaps(LOGPIXELSY) / 96.0);
+ int size = (int)(16.0 * CClientDC(this).GetDeviceCaps(LOGPIXELSY) / 96.0);
GetDlgItem(IDC_TYPEMARK)->MoveWindow(6, 8, size, size);
GetDlgItem(IDC_TYPEMARK)->ShowWindow(SW_SHOW);
GetDlgItem(IDC_INSTANCEMARK)->ShowWindow(SW_HIDE);
@@ -40,7 +40,7 @@
void CModelPropertiesDlgBar::ShowInstance()
{
GetDlgItem(IDC_TYPEMARK)->ShowWindow(SW_HIDE);
- int size = (int)(16.0 * GetDC()->GetDeviceCaps(LOGPIXELSY) / 96.0);
+ int size = (int)(16.0 * CClientDC(this).GetDeviceCaps(LOGPIXELSY) / 96.0);
GetDlgItem(IDC_INSTANCEMARK)->MoveWindow(6, 8, size, size);
GetDlgItem(IDC_INSTANCEMARK)->ShowWindow(SW_SHOW);
GetDlgItem(IDC_BASETYPE_LABEL)->SetWindowText(_T("Type:"));
Modified: trunk/GME/MgaUtil/AnnotationBrowserDlg.cpp
==============================================================================
--- trunk/GME/MgaUtil/AnnotationBrowserDlg.cpp Fri Oct 19 13:41:38 2018 (r2757)
+++ trunk/GME/MgaUtil/AnnotationBrowserDlg.cpp Fri Oct 19 13:41:42 2018 (r2758)
@@ -358,7 +358,7 @@
void CAnnotationBrowserDlg::UpdateFontStr(void) {
int height = m_anLogFont.lfHeight;
if (height < 0) {
- height = -MulDiv(height, 72, GetDeviceCaps(GetDC()->m_hDC, LOGPIXELSY));
+ height = -MulDiv(height, 72, CClientDC(this).GetDeviceCaps(LOGPIXELSY));
}
m_anFont.Format(_T("%s, %d, %s%s"), m_anLogFont.lfFaceName, height, m_anLogFont.lfWeight <= 500 ? _T("Regular") : _T("Bold"), m_anLogFont.lfItalic ? _T(", Italic") : _T(""));
}
Modified: trunk/GME/MgaUtil/CompDlg.cpp
==============================================================================
--- trunk/GME/MgaUtil/CompDlg.cpp Fri Oct 19 13:41:38 2018 (r2757)
+++ trunk/GME/MgaUtil/CompDlg.cpp Fri Oct 19 13:41:42 2018 (r2758)
@@ -120,19 +120,20 @@
lvc.mask = LVCF_WIDTH | LVCF_TEXT;
lvc.pszText = _T("Name");
- lvc.cx = (int)(150.0 * GetDC()->GetDeviceCaps(LOGPIXELSY) / 96.0);;
+ CClientDC dc(this);
+ lvc.cx = (int)(150.0 * dc.GetDeviceCaps(LOGPIXELSY) / 96.0);;
VERIFYTHROW( m_list.InsertColumn(0, &lvc) != -1 );
lvc.pszText = _T("Type");
- lvc.cx = (int)(80.0 * GetDC()->GetDeviceCaps(LOGPIXELSY) / 96.0);
+ lvc.cx = (int)(80.0 * dc.GetDeviceCaps(LOGPIXELSY) / 96.0);
VERIFYTHROW( m_list.InsertColumn(1, &lvc) != -1 );
lvc.pszText = _T("ProgID");
- lvc.cx = (int)(200.0 * GetDC()->GetDeviceCaps(LOGPIXELSY) / 96.0);
+ lvc.cx = (int)(200.0 * dc.GetDeviceCaps(LOGPIXELSY) / 96.0);
VERIFYTHROW( m_list.InsertColumn(2, &lvc) != -1 );
lvc.pszText = _T("Path");
- lvc.cx = (int)(300.0 * GetDC()->GetDeviceCaps(LOGPIXELSY) / 96.0);
+ lvc.cx = (int)(300.0 * dc.GetDeviceCaps(LOGPIXELSY) / 96.0);
VERIFYTHROW( m_list.InsertColumn(3, &lvc) != -1 );
iconlist.Create(IDB_BITMAP1,16,0,15);
Modified: trunk/GME/ObjectInspector/InspectorList.cpp
==============================================================================
--- trunk/GME/ObjectInspector/InspectorList.cpp Fri Oct 19 13:41:38 2018 (r2757)
+++ trunk/GME/ObjectInspector/InspectorList.cpp Fri Oct 19 13:41:42 2018 (r2758)
@@ -1333,6 +1333,6 @@
if (CListBox::OnCreate(lpCreateStruct) == -1)
return -1;
- m_Settings.m_nDivider = INSP_DIVIDER_POSITION * GetDC()->GetDeviceCaps(LOGPIXELSY) / 96;
+ m_Settings.m_nDivider = INSP_DIVIDER_POSITION * CClientDC(this).GetDeviceCaps(LOGPIXELSY) / 96;
return 0;
}
Modified: trunk/GME/ObjectInspector/SplitterBar.cpp
==============================================================================
--- trunk/GME/ObjectInspector/SplitterBar.cpp Fri Oct 19 13:41:38 2018 (r2757)
+++ trunk/GME/ObjectInspector/SplitterBar.cpp Fri Oct 19 13:41:42 2018 (r2758)
@@ -394,9 +394,8 @@
{
static int yDPI = 0;
if (yDPI == 0) {
- HDC dc = ::GetDC(NULL);
- yDPI = ::GetDeviceCaps(dc, LOGPIXELSY);
- ::ReleaseDC(NULL, dc);
+ CClientDC dc(this);
+ yDPI = dc.GetDeviceCaps(LOGPIXELSY);
}
int INSP_HELP_TITLE_HEIGHT = 15 * yDPI / 96 /* USER_DEFAULT_SCREEN_DPI */;
More information about the gme-commit
mailing list