[commit] r1943 - trunk/SDK/DecoratorLib
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Thu Jun 28 14:07:46 CDT 2012
Author: ksmyth
Date: Thu Jun 28 14:07:45 2012
New Revision: 1943
Log:
Refactor loading icon paths
Modified:
trunk/SDK/DecoratorLib/DecoratorLib.vcxproj
trunk/SDK/DecoratorLib/DecoratorLib.vcxproj.filters
trunk/SDK/DecoratorLib/DecoratorUtil.cpp
trunk/SDK/DecoratorLib/DecoratorUtil.h
Modified: trunk/SDK/DecoratorLib/DecoratorLib.vcxproj
==============================================================================
--- trunk/SDK/DecoratorLib/DecoratorLib.vcxproj Thu Jun 28 14:07:32 2012 (r1942)
+++ trunk/SDK/DecoratorLib/DecoratorLib.vcxproj Thu Jun 28 14:07:45 2012 (r1943)
@@ -478,6 +478,7 @@
<ClInclude Include="ObjectAndTextPart.h" />
<ClInclude Include="PartBase.h" />
<ClInclude Include="PartInterface.h" />
+ <ClInclude Include="PathUtil.h" />
<ClInclude Include="PortBitmapPart.h" />
<ClInclude Include="PortLabelPart.h" />
<ClInclude Include="PortPart.h" />
Modified: trunk/SDK/DecoratorLib/DecoratorLib.vcxproj.filters
==============================================================================
--- trunk/SDK/DecoratorLib/DecoratorLib.vcxproj.filters Thu Jun 28 14:07:32 2012 (r1942)
+++ trunk/SDK/DecoratorLib/DecoratorLib.vcxproj.filters Thu Jun 28 14:07:45 2012 (r1943)
@@ -335,6 +335,9 @@
<ClInclude Include="DecoratorLibResource.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="PathUtil.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="res\atom.bmp">
Modified: trunk/SDK/DecoratorLib/DecoratorUtil.cpp
==============================================================================
--- trunk/SDK/DecoratorLib/DecoratorUtil.cpp Thu Jun 28 14:07:32 2012 (r1942)
+++ trunk/SDK/DecoratorLib/DecoratorUtil.cpp Thu Jun 28 14:07:45 2012 (r1943)
@@ -119,7 +119,7 @@
//################################################################################################
Facilities::Facilities()
- : m_bArePathesValid( false ), m_spProject( NULL )
+ : m_spProject( NULL )
{
m_nullDC.CreateCompatibleDC(NULL);
m_gdip = NULL; // Create the Gdiplus::Graphics object later, cause at this point GdiplusStartup may not be called by GMEApp
@@ -225,100 +225,22 @@
m_gdip->SetTextRenderingHint(m_eFontAntiAlias);
}
- if ( ! m_spProject || ! m_spProject.IsEqualObject( pProject ) )
+ if (!m_spProject || !m_spProject.IsEqualObject(pProject))
m_spProject = pProject;
- else
- return m_bArePathesValid = true;
-
- if ( bRefresh ) {
- m_vecPathes.clear();
- m_bArePathesValid = false;
-
- if ( pProject ) {
- long lStatus;
- COMTHROW( pProject->get_ProjectStatus( &lStatus ) );
- if ( (lStatus & 0x01L) != 0 ) {
- CComBSTR bstrParadigm;
- COMTHROW( pProject->get_ParadigmConnStr( &bstrParadigm ) );
- m_strParadigmPath = CString( bstrParadigm );
- if ( m_strParadigmPath.Find( _T("MGA=") ) == 0 ) {
- int iPos = m_strParadigmPath.ReverseFind( _T('\\') );
- if( iPos >= 4 ) {
- m_strParadigmPath = m_strParadigmPath.Mid( 4, iPos - 4 );
- if( m_strParadigmPath.IsEmpty() )
- m_strParadigmPath = '\\';
- }
- }
-
- CComBSTR bstrProject;
- COMTHROW( pProject->get_ProjectConnStr( &bstrProject ) );
- m_strProjectPath = CString( bstrProject );
- if ( m_strProjectPath.Find( _T("MGA=") ) == 0 ) {
- int iPos = m_strProjectPath.ReverseFind( _T('\\') );
- if( iPos >= 4 ) {
- m_strProjectPath = m_strProjectPath.Mid( 4, iPos - 4 );
- if( m_strProjectPath.IsEmpty() )
- m_strProjectPath = '\\';
- }
- }
- }
- }
- }
-
- if ( ! m_bArePathesValid ) {
-
- CString strPath;
- try {
- CComPtr<IMgaRegistrar> spRegistrar;
- COMTHROW( spRegistrar.CoCreateInstance( OLESTR( "Mga.MgaRegistrar" ) ) );
- CComBSTR bstrPath;
- COMTHROW( spRegistrar->get_IconPath( REGACCESS_BOTH, &bstrPath ) );
-
- strPath = bstrPath;
- }
- catch ( hresult_exception & ) {
- }
-
- strPath.Replace( _T("$PARADIGMDIR"), m_strParadigmPath );
- strPath.Replace( _T("$PROJECTDIR"), m_strProjectPath );
-
- while( ! strPath.IsEmpty() ) {
- int iPos = strPath.Find( ';' );
- if( iPos == 0) // zolmol: if accidentaly there are two semicolons, or the path starts with a semicolon
- {
- strPath = strPath.Right( strPath.GetLength() - 1 );
- continue;
- }
- CString strDir;
- if ( iPos != -1 ) {
- strDir = strPath.Left( iPos );
- strPath = strPath.Right( strPath.GetLength() - iPos - 1 );
- }
- else {
- strDir = strPath;
- strPath.Empty();
- }
- strDir.Replace( '/', '\\' );
- if ( strDir.GetAt( strDir.GetLength() - 1 ) != '\\' )
- strDir += _T("\\");
- m_vecPathes.push_back( strDir );
- }
- m_vecPathes.push_back( _T(".\\") );
-
- m_bArePathesValid = true;
- }
+ else if (m_pathUtil.arePathesValid())
+ return true;
- return m_bArePathesValid;
+ return m_pathUtil.loadPaths(pProject, bRefresh);
}
bool Facilities::arePathesValid() const
{
- return m_bArePathesValid;
+ return m_pathUtil.arePathsValid();
}
std::vector<CString> Facilities::getPathes() const
{
- return m_vecPathes;
+ return m_pathUtil.getPaths();
}
Gdiplus::Graphics* Facilities::getGraphics(void) const
Modified: trunk/SDK/DecoratorLib/DecoratorUtil.h
==============================================================================
--- trunk/SDK/DecoratorLib/DecoratorUtil.h Thu Jun 28 14:07:32 2012 (r1942)
+++ trunk/SDK/DecoratorLib/DecoratorUtil.h Thu Jun 28 14:07:45 2012 (r1943)
@@ -19,6 +19,8 @@
#include "DecoratorDefs.h"
+#include "PathUtil.h"
+
namespace DecoratorSDK
{
class BitmapBase;
@@ -39,10 +41,7 @@
{
private :
CComPtr<IMgaProject> m_spProject;
- std::vector<CString> m_vecPathes;
- bool m_bArePathesValid;
- CString m_strParadigmPath;
- CString m_strProjectPath;
+ PathUtil m_pathUtil;
CDC m_nullDC;
Gdiplus::Graphics* m_gdip;
Gdiplus::SmoothingMode m_eEdgeAntiAlias; // Edge smoothing mode
More information about the gme-commit
mailing list