git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33705
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
bool wxFileTypeImpl::SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt)
{
bool wxFileTypeImpl::SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt)
{
+ wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") );
+
return FALSE;
}
bool wxFileTypeImpl::SetDefaultIcon(const wxString& strIcon, int index)
{
return FALSE;
}
bool wxFileTypeImpl::SetDefaultIcon(const wxString& strIcon, int index)
{
+ wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") );
+
wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
{
wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
{
- wxASSERT(m_manager);
-
- if(!m_manager)
- return wxEmptyString;
+ wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") );
if(verb == wxT("open"))
{
if(verb == wxT("open"))
{
wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
{
wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
{
- wxASSERT(m_manager);
-
- if(!m_manager)
- return wxEmptyString;
+ wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") );
if(verb == wxT("open"))
{
if(verb == wxT("open"))
{
bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
{
bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
{
- if(!m_manager)
- return false;
+ wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") );
ICMapEntry entry;
ICGetMapEntry( (ICInstance) m_manager->m_hIC,
ICMapEntry entry;
ICGetMapEntry( (ICInstance) m_manager->m_hIC,
bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const
{
bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const
{
- if(!m_manager)
- return false;
+ wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") );
ICMapEntry entry;
ICGetMapEntry( (ICInstance) m_manager->m_hIC,
ICMapEntry entry;
ICGetMapEntry( (ICInstance) m_manager->m_hIC,
bool wxFileTypeImpl::GetIcon(wxIconLocation *WXUNUSED(icon)) const
{
bool wxFileTypeImpl::GetIcon(wxIconLocation *WXUNUSED(icon)) const
{
+ wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") );
+
// no such file type or no value or incorrect icon entry
return FALSE;
}
bool wxFileTypeImpl::GetDescription(wxString *desc) const
{
// no such file type or no value or incorrect icon entry
return FALSE;
}
bool wxFileTypeImpl::GetDescription(wxString *desc) const
{
- if(!m_manager)
- return false;
+ wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") );
ICMapEntry entry;
ICGetMapEntry( (ICInstance) m_manager->m_hIC,
ICMapEntry entry;
ICGetMapEntry( (ICInstance) m_manager->m_hIC,
size_t wxFileTypeImpl::GetAllCommands(wxArrayString * verbs, wxArrayString * commands,
const wxFileType::MessageParameters& params) const
{
size_t wxFileTypeImpl::GetAllCommands(wxArrayString * verbs, wxArrayString * commands,
const wxFileType::MessageParameters& params) const
{
- wxFAIL_MSG( _T("wxFileTypeImpl::GetAllCommands() not yet implemented") );
- return 0;
+ wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") );
+
+ wxString sCommand;
+ size_t ulCount = 0;
+
+ if(GetOpenCommand(&sCommand, params))
+ {
+ verbs->Add(wxString(wxT("open")));
+ commands->Add(sCommand);
+ ++ulCount;
+ }
+
+ return ulCount;
}
void wxMimeTypesManagerImpl::Initialize(int mailcapStyles, const wxString& extraDir)
}
void wxMimeTypesManagerImpl::Initialize(int mailcapStyles, const wxString& extraDir)
{
wxLogDebug(wxT("Could not initialize wxMimeTypesManager!"));
wxASSERT( false );
{
wxLogDebug(wxT("Could not initialize wxMimeTypesManager!"));
wxASSERT( false );
+//
+// Q) Iterating through the map - why does it use if (err == noErr) instead of just asserting?
+// A) Some intermediate indexes are bad while subsequent ones may be good. Its wierd, I know.
+//
+
// extension -> file type
wxFileType* wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& e)
{
// extension -> file type
wxFileType* wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& e)
{
//low level functions - iterate through the database
ICMapEntry entry;
//low level functions - iterate through the database
ICMapEntry entry;
long pos;
for(long i = 1; i <= m_lCount; ++i)
long pos;
for(long i = 1; i <= m_lCount; ++i)
wxString sCurrentExtension = wxMacMakeStringFromPascal(entry.extension);
if( sCurrentExtension.Right(sCurrentExtension.Length()-1) == e ) //entry has period in it
{
wxString sCurrentExtension = wxMacMakeStringFromPascal(entry.extension);
if( sCurrentExtension.Right(sCurrentExtension.Length()-1) == e ) //entry has period in it
{
- pFileType = new wxFileType();
+ wxFileType* pFileType = new wxFileType();
pFileType->m_impl->Init((wxMimeTypesManagerImpl*)this, pos);
pFileType->m_impl->Init((wxMimeTypesManagerImpl*)this, pos);
}
// MIME type -> extension -> file type
}
// MIME type -> extension -> file type
//low level functions - iterate through the database
ICMapEntry entry;
//low level functions - iterate through the database
ICMapEntry entry;
- wxFileType* pFileType;
-
long pos;
for(long i = 1; i <= m_lCount; ++i)
long pos;
for(long i = 1; i <= m_lCount; ++i)
{
if( wxMacMakeStringFromPascal(entry.MIMEType) == mimeType)
{
{
if( wxMacMakeStringFromPascal(entry.MIMEType) == mimeType)
{
- pFileType = new wxFileType();
+ wxFileType* pFileType = new wxFileType();
pFileType->m_impl->Init((wxMimeTypesManagerImpl*)this, pos);
pFileType->m_impl->Init((wxMimeTypesManagerImpl*)this, pos);
}
size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& mimetypes)
}
size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& mimetypes)
//low level functions - iterate through the database
ICMapEntry entry;
//low level functions - iterate through the database
ICMapEntry entry;
long lStartCount = (long) mimetypes.GetCount();
for(long i = 1; i <= m_lCount; ++i)
long lStartCount = (long) mimetypes.GetCount();
for(long i = 1; i <= m_lCount; ++i)