X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dda2e4fdca3c3d892ce28c8567a40271562e1c9f..e41e579f40ec15c8c20aa3118b7367281ae4f95b:/utils/tex2rtf/src/texutils.cpp diff --git a/utils/tex2rtf/src/texutils.cpp b/utils/tex2rtf/src/texutils.cpp index 3c159839a9..30ce714099 100644 --- a/utils/tex2rtf/src/texutils.cpp +++ b/utils/tex2rtf/src/texutils.cpp @@ -21,7 +21,7 @@ #endif #ifndef WX_PRECOMP -#include "wx/wx.h" + #include "wx/log.h" #endif #include "wx/hash.h" @@ -36,11 +36,22 @@ #else #include #include +using namespace std; #endif #include #include "tex2any.h" +#if !WXWIN_COMPATIBILITY_2_4 +static inline wxChar* copystring(const wxChar* s) + { return wxStrcpy(new wxChar[wxStrlen(s) + 1], s); } +static inline void StringToInt (const wxChar *s, int *number) +{ + if (s && *s && number) + *number = (int) wxStrtol (s, (wxChar **) NULL, 10); +} +#endif + wxHashTable TexReferences(wxKEY_STRING); wxList BibList(wxKEY_STRING); wxStringList CitationList; @@ -1143,7 +1154,7 @@ char *RegisterSetting(char *settingName, char *settingValue, bool interactive) else if (StringMatch(settingName, "authorFontSize", FALSE, TRUE)) StringToInt(settingValue, &authorFont); else if (StringMatch(settingName, "ignoreInput", FALSE, TRUE)) - IgnorableInputFiles.Add(FileNameFromPath(settingValue)); + IgnorableInputFiles.Add(wxFileNameFromPath(settingValue)); else if (StringMatch(settingName, "mirrorMargins", FALSE, TRUE)) mirrorMargins = StringTobool(settingValue); else if (StringMatch(settingName, "runTwice", FALSE, TRUE)) @@ -1671,3 +1682,25 @@ char *ConvertCase(char *s) buf[i] = 0; return buf; } + +#if !WXWIN_COMPATIBILITY_2 +// if substring is TRUE, search for str1 in str2 +bool StringMatch(const wxChar *str1, const wxChar *str2, bool subString, + bool exact) +{ + if (subString) + { + wxString Sstr1(str1); + wxString Sstr2(str2); + if (!exact) + { + Sstr1.MakeUpper(); + Sstr2.MakeUpper(); + } + return Sstr2.Index(Sstr1) != (size_t)wxNOT_FOUND; + } + else + return exact ? wxString(str2).Cmp(str1) == 0 : + wxString(str2).CmpNoCase(str1) == 0; +} +#endif