[commit] r2586 - branches/GME-449/SDK/DecoratorLib
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Wed Feb 18 08:03:32 CST 2015
Author: lattmann
Date: Wed Feb 18 08:03:31 2015
New Revision: 2586
Log:
GME-449 never stretch icons on models and references. Get rid of m_bStretchIcon flag.
Modified:
branches/GME-449/SDK/DecoratorLib/DecoratorDefs.h
branches/GME-449/SDK/DecoratorLib/MaskedBitmapPart.cpp
branches/GME-449/SDK/DecoratorLib/ModelComplexPart.cpp
branches/GME-449/SDK/DecoratorLib/ModelComplexPart.h
Modified: branches/GME-449/SDK/DecoratorLib/DecoratorDefs.h
==============================================================================
--- branches/GME-449/SDK/DecoratorLib/DecoratorDefs.h Wed Feb 18 07:56:08 2015 (r2585)
+++ branches/GME-449/SDK/DecoratorLib/DecoratorDefs.h Wed Feb 18 08:03:31 2015 (r2586)
@@ -80,7 +80,6 @@
};
static const char* PREF_LABELLOCATION = "namePosition";
- static const char* PREF_STRETCHICON = "stretchIcon"; // NOTE: it is currently not used
static const char* PREF_ICON = "icon";
static const char* PREF_PORTICON = "porticon";
static const char* PREF_SUBTYPEICON = "subTypeIcon";
Modified: branches/GME-449/SDK/DecoratorLib/MaskedBitmapPart.cpp
==============================================================================
--- branches/GME-449/SDK/DecoratorLib/MaskedBitmapPart.cpp Wed Feb 18 07:56:08 2015 (r2585)
+++ branches/GME-449/SDK/DecoratorLib/MaskedBitmapPart.cpp Wed Feb 18 08:03:31 2015 (r2586)
@@ -47,7 +47,6 @@
preferences[PREF_TILESUNDEF] = PreferenceVariant(getFacilities().getTileVector(TILE_ATOMDEFAULT));
preferences[PREF_TILES] = PreferenceVariant(getFacilities().getTileVector(TILE_ATOMDEFAULT));
- preferences[PREF_STRETCHICON] = PreferenceVariant(true); // preserve default behavior // NOTE: it is currently not used
preferences[PREF_ICON] = PreferenceVariant(m_lBitmapResID);
preferences[PREF_TRANSPARENTCOLOR] = PreferenceVariant(m_crTransparent);
preferences[PREF_GRAYEDOUTCOLOR] = PreferenceVariant(m_crGrayedOut);
Modified: branches/GME-449/SDK/DecoratorLib/ModelComplexPart.cpp
==============================================================================
--- branches/GME-449/SDK/DecoratorLib/ModelComplexPart.cpp Wed Feb 18 07:56:08 2015 (r2585)
+++ branches/GME-449/SDK/DecoratorLib/ModelComplexPart.cpp Wed Feb 18 08:03:31 2015 (r2586)
@@ -344,11 +344,6 @@
else
getFacilities().getPreference(pFCO, PREF_PORTLABELINSIDE, m_bPortLabelInside);
- // [Zsolt] having problems to get this registry node, therefore the icons are not streched for now
- // (Search for the comment below, when you implement the correct behavior)
- bool m_bStretch = true; // NOTE: it is currently not used
- getFacilities().getPreference(pFCO, PREF_STRETCHICON, m_bStretch);
-
long o = m_iMaxPortTextLength;
it = preferences.find(PREF_PORTLABELLENGTH);
if (it != preferences.end()) {
@@ -1278,77 +1273,68 @@
CSize cExtentD = pDC->GetViewportExt();
CSize cExtentL = pDC->GetWindowExt();
int prominent_x = m_bmp.get() ? 0 : m_LeftPortsMaxLabelLength;
- m_bStretch = false; // TODO: read this from the registry, do we want to ever stretch the icons?
- if (m_bStretch && m_bmp.get())
- {
- CRect cRect = TypeableBitmapPart::GetBoxLocation(false);
- Gdiplus::Rect grect(cRect.left, cRect.top, cRect.Width(), cRect.Height());
- gdip->DrawImage(m_bmp.get(), grect, 0, 0, m_bmp->GetWidth(), m_bmp->GetHeight(), Gdiplus::UnitPixel);
- }
- else
- {
- CRect cRect = TypeableBitmapPart::GetBoxLocation(false);
- cRect.BottomRight() -= CPoint(1, 1);
- CRect location = cRect;
+ CRect cRect = TypeableBitmapPart::GetBoxLocation(false);
+ cRect.BottomRight() -= CPoint(1, 1);
+
+ CRect location = cRect;
+ if (m_pBitmap->getName() != createResString(IDB_MODEL) && TypeableBitmapPart::m_bActive)
+ {
//if (m_LeftPorts.size() != 0 || m_RightPorts.size() != 0)
- if (m_pBitmap->getName() != createResString(IDB_MODEL) && TypeableBitmapPart::m_bActive)
- {
- // draw this type of background only if icon is defined
- Gdiplus::Rect rect(cRect.left, cRect.top, cRect.Width(), cRect.Height());
- Gdiplus::LinearGradientBrush linearGradientBrush(rect,
- Gdiplus::Color(GetRValue(m_crBrush), GetGValue(m_crBrush), GetBValue(m_crBrush)),
- Gdiplus::Color(GetRValue(m_crGradient), GetGValue(m_crGradient), GetBValue(m_crGradient)),
- m_iGradientDirection);
+ // draw this type of background only if icon is defined
+ Gdiplus::Rect rect(cRect.left, cRect.top, cRect.Width(), cRect.Height());
+ Gdiplus::LinearGradientBrush linearGradientBrush(rect,
+ Gdiplus::Color(GetRValue(m_crBrush), GetGValue(m_crBrush), GetBValue(m_crBrush)),
+ Gdiplus::Color(GetRValue(m_crGradient), GetGValue(m_crGradient), GetBValue(m_crGradient)),
+ m_iGradientDirection);
- Gdiplus::SolidBrush solidBrush(Gdiplus::Color(GetRValue(m_crBrush), GetGValue(m_crBrush), GetBValue(m_crBrush)));
+ Gdiplus::SolidBrush solidBrush(Gdiplus::Color(GetRValue(m_crBrush), GetGValue(m_crBrush), GetBValue(m_crBrush)));
- Gdiplus::Brush& brush = m_bGradientFill ? (Gdiplus::Brush&)linearGradientBrush : (Gdiplus::Brush&)solidBrush;
+ Gdiplus::Brush& brush = m_bGradientFill ? (Gdiplus::Brush&)linearGradientBrush : (Gdiplus::Brush&)solidBrush;
- Gdiplus::GraphicsPath path;
- path.AddArc(location.left, location.top, m_iRoundCornerRadius, m_iRoundCornerRadius, 180, 90);
- path.AddArc(location.right - m_iRoundCornerRadius, location.top, m_iRoundCornerRadius, m_iRoundCornerRadius, 270, 90);
- path.AddArc(location.right - m_iRoundCornerRadius, location.bottom - m_iRoundCornerRadius, m_iRoundCornerRadius, m_iRoundCornerRadius, 0, 90);
- path.AddArc(location.left, location.bottom - m_iRoundCornerRadius, m_iRoundCornerRadius, m_iRoundCornerRadius, 90, 90);
- gdip->FillPath(&brush, &path);
- } else {
- // use the old model style if no icon is defined
- int iDepth = (m_bReferenced) ? 2 : ((m_iTypeInfo == 3) ? 4 : 8);
- CRect cRect2 = cRect;
- cRect2.InflateRect(1, 1);
- getFacilities().DrawBox(gdip, cRect2, (!m_bActive) ? COLOR_LIGHTGRAY : (m_bOverlay) ? m_crOverlay : COLOR_GRAY,
- iDepth, m_bRoundCornerRect, m_bRoundCornerRadius);
- getFacilities().DrawRect(gdip, cRect, (m_bActive) ? m_crBorder : COLOR_GRAY, 1, m_bRoundCornerRect,
- m_bRoundCornerRadius);
- }
-
- if (m_bmp.get())
- {
- int height = m_bmp->GetHeight();
- int width = m_bmp->GetWidth();
+ Gdiplus::GraphicsPath path;
+ path.AddArc(location.left, location.top, m_iRoundCornerRadius, m_iRoundCornerRadius, 180, 90);
+ path.AddArc(location.right - m_iRoundCornerRadius, location.top, m_iRoundCornerRadius, m_iRoundCornerRadius, 270, 90);
+ path.AddArc(location.right - m_iRoundCornerRadius, location.bottom - m_iRoundCornerRadius, m_iRoundCornerRadius, m_iRoundCornerRadius, 0, 90);
+ path.AddArc(location.left, location.bottom - m_iRoundCornerRadius, m_iRoundCornerRadius, m_iRoundCornerRadius, 90, 90);
+ gdip->FillPath(&brush, &path);
+ } else {
+ // use the old model style if no icon is defined
+ int iDepth = (m_bReferenced) ? 2 : ((m_iTypeInfo == 3) ? 4 : 8);
+ CRect cRect2 = cRect;
+ cRect2.InflateRect(1, 1);
+ getFacilities().DrawBox(gdip, cRect2, (!m_bActive) ? COLOR_LIGHTGRAY : (m_bOverlay) ? m_crOverlay : COLOR_GRAY,
+ iDepth, m_bRoundCornerRect, m_bRoundCornerRadius);
+ getFacilities().DrawRect(gdip, cRect, (m_bActive) ? m_crBorder : COLOR_GRAY, 1, m_bRoundCornerRect,
+ m_bRoundCornerRadius);
+ }
- int x; // Render according to m_LeftPortsMaxLabelLength if the image fits inside the rounded rectangle
- // if not, just center it
- int gutter = min(m_LeftPortsMaxLabelLength + m_RightPortsMaxLabelLength, cRect.Width() - width);
- int x_margin = (int)(gutter * (double)m_LeftPortsMaxLabelLength / (m_LeftPortsMaxLabelLength + m_RightPortsMaxLabelLength));
- int left_corner = m_iRoundCornerRadius;
- int right_corner = cRect.Width() - m_iRoundCornerRadius;
- if (x_margin < left_corner - 1 /*slop*/ || x_margin > right_corner - width + 1 /*slop*/)
- {
- // center
- x = cRect.Width() / 2 - (int)m_bmp->GetWidth() / 2;
- }
- else
- {
- x = x_margin;
- }
- x += max(0, m_prominentAttrsSize.cx - (int)m_bmp->GetWidth()) / 2;
- prominent_x = x;
+ if (m_bmp.get())
+ {
+ int height = m_bmp->GetHeight();
+ int width = m_bmp->GetWidth();
- Gdiplus::Rect grect((int)cRect.left + x, (int)cRect.top + (cRect.Height() - m_prominentAttrsSize.cy) / 2 - (int)m_bmp->GetHeight() / 2,
- width, height);
- gdip->DrawImage(m_bmp.get(), grect, 0, 0, (int)m_bmp->GetWidth(), (int)m_bmp->GetHeight(), Gdiplus::UnitPixel);
+ int x; // Render according to m_LeftPortsMaxLabelLength if the image fits inside the rounded rectangle
+ // if not, just center it
+ int gutter = min(m_LeftPortsMaxLabelLength + m_RightPortsMaxLabelLength, cRect.Width() - width);
+ int x_margin = (int)(gutter * (double)m_LeftPortsMaxLabelLength / (m_LeftPortsMaxLabelLength + m_RightPortsMaxLabelLength));
+ int left_corner = m_iRoundCornerRadius;
+ int right_corner = cRect.Width() - m_iRoundCornerRadius;
+ if (x_margin < left_corner - 1 /*slop*/ || x_margin > right_corner - width + 1 /*slop*/)
+ {
+ // center
+ x = cRect.Width() / 2 - (int)m_bmp->GetWidth() / 2;
+ }
+ else
+ {
+ x = x_margin;
}
+ x += max(0, m_prominentAttrsSize.cx - (int)m_bmp->GetWidth()) / 2;
+ prominent_x = x;
+
+ Gdiplus::Rect grect((int)cRect.left + x, (int)cRect.top + (cRect.Height() - m_prominentAttrsSize.cy) / 2 - (int)m_bmp->GetHeight() / 2,
+ width, height);
+ gdip->DrawImage(m_bmp.get(), grect, 0, 0, (int)m_bmp->GetWidth(), (int)m_bmp->GetHeight(), Gdiplus::UnitPixel);
}
for (std::vector<PortPart*>::iterator ii = m_LeftPorts.begin(); ii != m_LeftPorts.end(); ++ii) {
Modified: branches/GME-449/SDK/DecoratorLib/ModelComplexPart.h
==============================================================================
--- branches/GME-449/SDK/DecoratorLib/ModelComplexPart.h Wed Feb 18 07:56:08 2015 (r2585)
+++ branches/GME-449/SDK/DecoratorLib/ModelComplexPart.h Wed Feb 18 08:03:31 2015 (r2586)
@@ -37,7 +37,6 @@
COLORREF m_crPortText;
bool m_bPortLabelInside;
long m_iLongestPortTextLength;
- bool m_bStretch;
std::unique_ptr<Gdiplus::Bitmap> m_bmp;
More information about the gme-commit
mailing list