diff --git a/src/xmlcopyeditor.cpp b/src/xmlcopyeditor.cpp index 85981bf..ef62f3a 100755 --- a/src/xmlcopyeditor.cpp +++ b/src/xmlcopyeditor.cpp @@ -5646,20 +5646,22 @@ void MyFrame::xmliseWideTextNode ( wxString& s ) int MyFrame::getFileType ( const wxString& fileName ) { - std::string fileNameLocal, fileNameLocalLC; - fileNameLocal = fileName.mb_str ( wxConvLocal ); - fileNameLocalLC = CaseHandler::lowerCase ( fileNameLocal ); + wxString extension; + wxFileName::SplitPath ( fileName, NULL/*Path*/, NULL/*Name*/, &extension ); + if ( extension.size() != 3 ) + return FILE_TYPE_XML; - if ( fileNameLocalLC.find ( ".dtd" ) != std::string::npos || - fileNameLocalLC.find ( ".ent" ) != std::string::npos ) + extension.MakeLower(); + + if ( extension == _T ( "dtd" ) || extension == _T ( "ent" ) ) return FILE_TYPE_DTD; - else if ( fileNameLocalLC.find ( ".css" ) != std::string::npos ) + else if ( extension == _T ( "css" ) ) return FILE_TYPE_CSS; - else if ( fileNameLocalLC.find ( ".php" ) != std::string::npos ) + else if ( extension == _T ( "php" ) ) return FILE_TYPE_PHP; - else if ( fileNameLocalLC.find ( ".exe" ) != std::string::npos ) + else if ( extension == _T ( "exe" ) ) return FILE_TYPE_BINARY; - else if ( fileNameLocalLC.find ( ".rnc" ) != std::string::npos ) + else if ( extension == _T ( "rnc" ) ) return FILE_TYPE_RNC; return FILE_TYPE_XML; } diff --git a/src/xmlctrl.cpp b/src/xmlctrl.cpp index e577759..94dcd36 100755 --- a/src/xmlctrl.cpp +++ b/src/xmlctrl.cpp @@ -45,7 +45,7 @@ wxCriticalSection xmlcopyeditorCriticalSection; XmlCtrl::XmlCtrl ( wxWindow *parent, - XmlCtrlProperties propertiesParameter, + const XmlCtrlProperties &propertiesParameter, bool *protectTagsParameter, int visibilityStateParameter, int typeParameter, @@ -1065,7 +1065,7 @@ void XmlCtrl::updatePromptMaps ( const char *buffer, size_t bufferLen ) } void XmlCtrl::applyProperties ( - XmlCtrlProperties propertiesParameter, + const XmlCtrlProperties &propertiesParameter, bool zoomOnly ) { properties = propertiesParameter; diff --git a/src/xmlctrl.h b/src/xmlctrl.h index 49c8aac..66af9e2 100755 --- a/src/xmlctrl.h +++ b/src/xmlctrl.h @@ -94,7 +94,7 @@ class XmlCtrl: public wxStyledTextCtrl public: XmlCtrl ( wxWindow *parent, - XmlCtrlProperties propertiesParameter, + const XmlCtrlProperties &propertiesParameter, bool *protectTagsParameter, int visibilityStateParameter = SHOW_TAGS, int typeParameter = FILE_TYPE_XML, @@ -112,7 +112,7 @@ class XmlCtrl: public wxStyledTextCtrl int getType(); int getParentCloseAngleBracket ( int pos, int range = USHRT_MAX * 4 ); void applyProperties ( - XmlCtrlProperties propertiesParameter, + const XmlCtrlProperties &propertiesParameter, bool zoomOnly = false ); void applyVisibilityState ( int state = SHOW_TAGS ); void updatePromptMaps();