[commit] r2587 - branches/GME-449/SDK/DecoratorLib

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Wed Feb 18 09:49:50 CST 2015


Author: lattmann
Date: Wed Feb 18 09:49:50 2015
New Revision: 2587

Log:
GME-449 tiff, emf, and wmf support for models. (emf and wmf may not be resizable)

Modified:
   branches/GME-449/SDK/DecoratorLib/ModelComplexPart.cpp

Modified: branches/GME-449/SDK/DecoratorLib/ModelComplexPart.cpp
==============================================================================
--- branches/GME-449/SDK/DecoratorLib/ModelComplexPart.cpp	Wed Feb 18 08:03:31 2015	(r2586)
+++ branches/GME-449/SDK/DecoratorLib/ModelComplexPart.cpp	Wed Feb 18 09:49:50 2015	(r2587)
@@ -166,10 +166,10 @@
 	bool hasStoredCustomSize = (size.cx * size.cy != 0);
 
 	if (!hasStoredCustomSize && m_LeftPorts.empty() && m_RightPorts.empty()) {
-		if (!m_pBitmap) {
+		if (!m_bmp) {
 			return CSize(WIDTH_MODEL, HEIGHT_MODEL);
 		} else {
-			return TypeableBitmapPart::GetPreferredSize();
+			return CSize(m_bmp->GetWidth(), m_bmp->GetHeight());
 		}
 	}
 
@@ -332,6 +332,12 @@
 	preferences[PREF_TILESUNDEF]	= PreferenceVariant(getFacilities().getTileVector(TILE_PORTDEFAULT));
 
 	if (pFCO) {
+		CString strIcon;
+		getFacilities().getPreference(pFCO, PREF_ICON, strIcon);
+		if (!strIcon.IsEmpty()) {
+			preferences[PREF_ICON] = PreferenceVariant(strIcon);
+		}
+
 		PreferenceMap::iterator it = preferences.find(PREF_PORTLABELCOLOR);
 		if (it != preferences.end())
 			m_crPortText = it->second.uValue.crValue;
@@ -368,22 +374,24 @@
 		m_pTileVector = getFacilities().getTileVector(TILE_ATOMDEFAULT);
 
 	PreferenceMap::iterator iconint = preferences.find("iconint");
+	PreferenceMap::iterator icon = preferences.find(PREF_ICON);
 	if (iconint != preferences.end())
 	{
 		m_bmp = std::unique_ptr<Gdiplus::Bitmap>(new Gdiplus::Bitmap(((HINSTANCE)&__ImageBase), (WCHAR*) MAKEINTRESOURCE(iconint->second.uValue.lValue)));
 	}
-	else if (m_pBitmap->getName() != createResString(IDB_MODEL) && TypeableBitmapPart::m_bActive)
+	else if (icon != preferences.end() && TypeableBitmapPart::m_bActive)
 	{
 		if ( ! getFacilities().arePathesValid() )
 			return;
 		std::vector<CString> vecPathes = getFacilities().getPathes();
 
 		bool success = false;
-		CString& strFName = m_pBitmap->getName();
+		CString& strFName = *icon->second.uValue.pstrValue;
 
 		for (unsigned int i = 0; i < vecPathes.size() ; i++ )
 		{
 			CString imageFileName = vecPathes[ i ] + strFName;
+			// The graphics file formats supported by GDI+ are BMP, GIF, JPEG, PNG, TIFF, Exif, WMF, and EMF.
 			m_bmp = std::unique_ptr<Gdiplus::Bitmap>(Gdiplus::Bitmap::FromFile(CStringW(imageFileName)));
 			if( m_bmp && m_bmp->GetLastStatus() == Gdiplus::Ok)
 			{
@@ -1278,7 +1286,7 @@
 	cRect.BottomRight() -= CPoint(1, 1);
 
 	CRect location = cRect;
-	if (m_pBitmap->getName() != createResString(IDB_MODEL) && TypeableBitmapPart::m_bActive)
+	if (m_bmp && TypeableBitmapPart::m_bActive)
 	{
 		//if (m_LeftPorts.size() != 0 || m_RightPorts.size() != 0)
 		// draw this type of background only if icon is defined


More information about the gme-commit mailing list