[commit] r1710 - trunk/GME/ObjectInspector
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Thu Dec 1 10:40:27 CST 2011
Author: ksmyth
Date: Thu Dec 1 10:40:27 2011
New Revision: 1710
Log:
Fix item height under high DPI
Modified:
trunk/GME/ObjectInspector/Attribute.cpp
trunk/GME/ObjectInspector/InspectorDefs.h
trunk/GME/ObjectInspector/InspectorList.cpp
trunk/GME/ObjectInspector/InspectorList.h
Modified: trunk/GME/ObjectInspector/Attribute.cpp
==============================================================================
--- trunk/GME/ObjectInspector/Attribute.cpp Wed Nov 30 12:56:19 2011 (r1709)
+++ trunk/GME/ObjectInspector/Attribute.cpp Thu Dec 1 10:40:27 2011 (r1710)
@@ -315,8 +315,6 @@
// Converting to int
CString strLineNum(bstrMultiLinePref);
int nLineNumMin = _tstoi(strLineNum);
- const int nLineNumMax = 15;
- static_assert(nLineNumMax * INSP_DEFAULT_ITEM_HEIGHT <= 255, "nLineNumMax is too big for SetItemHeight");
if(nLineNumMin<2) // Single line edit box
{
@@ -333,14 +331,14 @@
CString strValue=CComBSTR(ccvtValue.bstrVal);
CStringArray strValueArray;
str_split(strValue, strValueArray);
- int nLineNum = min(max(nLineNumMin, strValueArray.GetCount()),nLineNumMax);
+ int nLineNum = max(nLineNumMin, strValueArray.GetCount());
ListItem.Value.SetStringValue(strValueArray, nLineNum);
// Setting default value
CString strDefValue=CComBSTR(ccvtDefValue.bstrVal);
CStringArray strDefValueArray;
strDefValueArray.Add(strDefValue);
- nLineNum = max(nLineNum,min(max(nLineNumMin, strDefValueArray.GetCount()),nLineNumMax));
+ nLineNum = max(nLineNum, max(nLineNumMin, strDefValueArray.GetCount()));
ListItem.DefValue.SetStringValue(strDefValueArray, nLineNum);
}
Modified: trunk/GME/ObjectInspector/InspectorDefs.h
==============================================================================
--- trunk/GME/ObjectInspector/InspectorDefs.h Wed Nov 30 12:56:19 2011 (r1709)
+++ trunk/GME/ObjectInspector/InspectorDefs.h Thu Dec 1 10:40:27 2011 (r1710)
@@ -23,7 +23,6 @@
#define INSP_DIVIDER_POSITION 100
#define INSP_MOUSE_RADIUS 1
#define INSP_PLUS_MINUS_BUTTON_SIZE 9
-#define INSP_DEFAULT_ITEM_HEIGHT 16
#define INSP_ENTRY_FONT_FACE _T("MS Sans Serif")
@@ -32,10 +31,6 @@
typedef enum { INSP_ATTR_PANEL=0, INSP_PREF_PANEL, INSP_PROP_PANEL, INSP_PANEL_NUM } InspPanelID;
-
-#define INSP_MULTIEDIT_LINE_HEIGHT 13
-#define INSP_MULTIEDIT_OFFSET 6
-
#define INSP_COMBOBOX_LINE_HEIGHT 13
#define INSP_COMBOBOX_OFFSET 6
Modified: trunk/GME/ObjectInspector/InspectorList.cpp
==============================================================================
--- trunk/GME/ObjectInspector/InspectorList.cpp Wed Nov 30 12:56:19 2011 (r1709)
+++ trunk/GME/ObjectInspector/InspectorList.cpp Thu Dec 1 10:40:27 2011 (r1710)
@@ -19,6 +19,13 @@
CInspectorList::CInspectorList(bool bCategories):m_bCategories(bCategories),m_InPlaceManager(this)
{
m_bIsDividerDrag=FALSE;
+ m_ItemHeight = 16;
+ HDC hdc = ::GetDC(NULL);
+ if (hdc)
+ {
+ m_ItemHeight = m_ItemHeight * GetDeviceCaps(hdc, LOGPIXELSY) / 96;
+ ::ReleaseDC(NULL, hdc);
+ }
}
CInspectorList::~CInspectorList()
@@ -295,17 +302,17 @@
int nLineNum=m_ListItemArray[nIndex].Value.cLineNum;
if(nLineNum==1)
{
- lpMeasureItemStruct->itemHeight = INSP_DEFAULT_ITEM_HEIGHT;
+ lpMeasureItemStruct->itemHeight = m_ItemHeight;
}
else
{
- lpMeasureItemStruct->itemHeight = nLineNum*INSP_MULTIEDIT_LINE_HEIGHT+INSP_MULTIEDIT_OFFSET;
+ lpMeasureItemStruct->itemHeight = min(255, nLineNum * m_ItemHeight);
}
}
else
{
- lpMeasureItemStruct->itemHeight = INSP_DEFAULT_ITEM_HEIGHT;
+ lpMeasureItemStruct->itemHeight = m_ItemHeight;
}
}
@@ -738,17 +745,17 @@
int nLineNum=srcListItem.Value.cLineNum;
if(nLineNum==1)
{
- SetItemHeight(nIndex, INSP_DEFAULT_ITEM_HEIGHT);
+ SetItemHeight(nIndex, m_ItemHeight);
}
else
{
- VERIFY(SetItemHeight(nIndex, nLineNum * INSP_DEFAULT_ITEM_HEIGHT) == LB_OKAY);
+ VERIFY(SetItemHeight(nIndex, min(255, nLineNum * m_ItemHeight)) == LB_OKAY);
}
}
else
{
- SetItemHeight(nIndex, INSP_DEFAULT_ITEM_HEIGHT);
+ SetItemHeight(nIndex, m_ItemHeight);
}
// Modification End - Volgyesi
}
Modified: trunk/GME/ObjectInspector/InspectorList.h
==============================================================================
--- trunk/GME/ObjectInspector/InspectorList.h Wed Nov 30 12:56:19 2011 (r1709)
+++ trunk/GME/ObjectInspector/InspectorList.h Thu Dec 1 10:40:27 2011 (r1710)
@@ -117,7 +117,7 @@
CListItemArray m_ListItemArray;
-
+ int m_ItemHeight;
};
/////////////////////////////////////////////////////////////////////////////
More information about the gme-commit
mailing list