Remove ambiguous symbols (part 6)
Relace TCHAR, generic_string & TEXT("") par wchar_t, wstring & L"" respectively.
Follow up: 94af271
Close #15380
pull/15381/head
parent
3c897f892a
commit
f7d9e7c095
|
@ -33,13 +33,13 @@ protected:
|
||||||
return _isDescending;
|
return _isDescending;
|
||||||
};
|
};
|
||||||
|
|
||||||
generic_string getSortKey(const generic_string& input) {
|
std::wstring getSortKey(const std::wstring& input) {
|
||||||
if (isSortingSpecificColumns())
|
if (isSortingSpecificColumns())
|
||||||
{
|
{
|
||||||
if (input.length() < _fromColumn)
|
if (input.length() < _fromColumn)
|
||||||
{
|
{
|
||||||
// prevent an std::out_of_range exception
|
// prevent an std::out_of_range exception
|
||||||
return TEXT("");
|
return L"";
|
||||||
}
|
}
|
||||||
else if (_fromColumn == _toColumn)
|
else if (_fromColumn == _toColumn)
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,7 @@ public:
|
||||||
assert(_fromColumn <= _toColumn);
|
assert(_fromColumn <= _toColumn);
|
||||||
};
|
};
|
||||||
virtual ~ISorter() { };
|
virtual ~ISorter() { };
|
||||||
virtual void sort(std::vector<generic_string>& lines) = 0;
|
virtual void sort(std::vector<std::wstring>& lines) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implementation of lexicographic sorting of lines.
|
// Implementation of lexicographic sorting of lines.
|
||||||
|
@ -76,13 +76,13 @@ class LexicographicSorter : public ISorter
|
||||||
public:
|
public:
|
||||||
LexicographicSorter(bool isDescending, size_t fromColumn, size_t toColumn) : ISorter(isDescending, fromColumn, toColumn) { };
|
LexicographicSorter(bool isDescending, size_t fromColumn, size_t toColumn) : ISorter(isDescending, fromColumn, toColumn) { };
|
||||||
|
|
||||||
void sort(std::vector<generic_string>& lines) override {
|
void sort(std::vector<std::wstring>& lines) override {
|
||||||
// Note that both branches here are equivalent in the sense that they always give the same answer.
|
// Note that both branches here are equivalent in the sense that they always give the same answer.
|
||||||
// However, if we are *not* sorting specific columns, then we get a 40% speed improvement by not calling
|
// However, if we are *not* sorting specific columns, then we get a 40% speed improvement by not calling
|
||||||
// getSortKey() so many times.
|
// getSortKey() so many times.
|
||||||
if (isSortingSpecificColumns())
|
if (isSortingSpecificColumns())
|
||||||
{
|
{
|
||||||
std::stable_sort(lines.begin(), lines.end(), [this](generic_string a, generic_string b)
|
std::stable_sort(lines.begin(), lines.end(), [this](std::wstring a, std::wstring b)
|
||||||
{
|
{
|
||||||
if (isDescending())
|
if (isDescending())
|
||||||
{
|
{
|
||||||
|
@ -97,7 +97,7 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::sort(lines.begin(), lines.end(), [this](generic_string a, generic_string b)
|
std::sort(lines.begin(), lines.end(), [this](std::wstring a, std::wstring b)
|
||||||
{
|
{
|
||||||
if (isDescending())
|
if (isDescending())
|
||||||
{
|
{
|
||||||
|
@ -118,13 +118,13 @@ class LexicographicCaseInsensitiveSorter : public ISorter
|
||||||
public:
|
public:
|
||||||
LexicographicCaseInsensitiveSorter(bool isDescending, size_t fromColumn, size_t toColumn) : ISorter(isDescending, fromColumn, toColumn) { };
|
LexicographicCaseInsensitiveSorter(bool isDescending, size_t fromColumn, size_t toColumn) : ISorter(isDescending, fromColumn, toColumn) { };
|
||||||
|
|
||||||
void sort(std::vector<generic_string>& lines) override {
|
void sort(std::vector<std::wstring>& lines) override {
|
||||||
// Note that both branches here are equivalent in the sense that they always give the same answer.
|
// Note that both branches here are equivalent in the sense that they always give the same answer.
|
||||||
// However, if we are *not* sorting specific columns, then we get a 40% speed improvement by not calling
|
// However, if we are *not* sorting specific columns, then we get a 40% speed improvement by not calling
|
||||||
// getSortKey() so many times.
|
// getSortKey() so many times.
|
||||||
if (isSortingSpecificColumns())
|
if (isSortingSpecificColumns())
|
||||||
{
|
{
|
||||||
std::stable_sort(lines.begin(), lines.end(), [this](generic_string a, generic_string b)
|
std::stable_sort(lines.begin(), lines.end(), [this](std::wstring a, std::wstring b)
|
||||||
{
|
{
|
||||||
if (isDescending())
|
if (isDescending())
|
||||||
{
|
{
|
||||||
|
@ -138,7 +138,7 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::sort(lines.begin(), lines.end(), [this](generic_string a, generic_string b)
|
std::sort(lines.begin(), lines.end(), [this](std::wstring a, std::wstring b)
|
||||||
{
|
{
|
||||||
if (isDescending())
|
if (isDescending())
|
||||||
{
|
{
|
||||||
|
@ -158,13 +158,13 @@ class IntegerSorter : public ISorter
|
||||||
public:
|
public:
|
||||||
IntegerSorter(bool isDescending, size_t fromColumn, size_t toColumn) : ISorter(isDescending, fromColumn, toColumn) { };
|
IntegerSorter(bool isDescending, size_t fromColumn, size_t toColumn) : ISorter(isDescending, fromColumn, toColumn) { };
|
||||||
|
|
||||||
void sort(std::vector<generic_string>& lines) override {
|
void sort(std::vector<std::wstring>& lines) override {
|
||||||
if (isSortingSpecificColumns())
|
if (isSortingSpecificColumns())
|
||||||
{
|
{
|
||||||
std::stable_sort(lines.begin(), lines.end(), [this](generic_string aIn, generic_string bIn)
|
std::stable_sort(lines.begin(), lines.end(), [this](std::wstring aIn, std::wstring bIn)
|
||||||
{
|
{
|
||||||
generic_string a = getSortKey(aIn);
|
std::wstring a = getSortKey(aIn);
|
||||||
generic_string b = getSortKey(bIn);
|
std::wstring b = getSortKey(bIn);
|
||||||
|
|
||||||
long long compareResult = 0;
|
long long compareResult = 0;
|
||||||
size_t aNumIndex = 0;
|
size_t aNumIndex = 0;
|
||||||
|
@ -173,7 +173,7 @@ public:
|
||||||
{
|
{
|
||||||
if (aNumIndex >= a.length() || bNumIndex >= b.length())
|
if (aNumIndex >= a.length() || bNumIndex >= b.length())
|
||||||
{
|
{
|
||||||
compareResult = a.compare(std::min<size_t>(aNumIndex, a.length()), generic_string::npos, b, std::min<size_t>(bNumIndex, b.length()), generic_string::npos);
|
compareResult = a.compare(std::min<size_t>(aNumIndex, a.length()), std::wstring::npos, b, std::min<size_t>(bNumIndex, b.length()), std::wstring::npos);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,13 +232,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t aNumEnd = a.find_first_not_of(L"1234567890", aNumIndex);
|
size_t aNumEnd = a.find_first_not_of(L"1234567890", aNumIndex);
|
||||||
if (aNumEnd == generic_string::npos)
|
if (aNumEnd == std::wstring::npos)
|
||||||
{
|
{
|
||||||
aNumEnd = a.length();
|
aNumEnd = a.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t bNumEnd = b.find_first_not_of(L"1234567890", bNumIndex);
|
size_t bNumEnd = b.find_first_not_of(L"1234567890", bNumIndex);
|
||||||
if (bNumEnd == generic_string::npos)
|
if (bNumEnd == std::wstring::npos)
|
||||||
{
|
{
|
||||||
bNumEnd = b.length();
|
bNumEnd = b.length();
|
||||||
}
|
}
|
||||||
|
@ -328,10 +328,10 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::sort(lines.begin(), lines.end(), [this](generic_string aIn, generic_string bIn)
|
std::sort(lines.begin(), lines.end(), [this](std::wstring aIn, std::wstring bIn)
|
||||||
{
|
{
|
||||||
generic_string a = aIn;
|
std::wstring a = aIn;
|
||||||
generic_string b = bIn;
|
std::wstring b = bIn;
|
||||||
|
|
||||||
long long compareResult = 0;
|
long long compareResult = 0;
|
||||||
size_t aNumIndex = 0;
|
size_t aNumIndex = 0;
|
||||||
|
@ -340,7 +340,7 @@ public:
|
||||||
{
|
{
|
||||||
if (aNumIndex >= a.length() || bNumIndex >= b.length())
|
if (aNumIndex >= a.length() || bNumIndex >= b.length())
|
||||||
{
|
{
|
||||||
compareResult = a.compare(std::min<size_t>(aNumIndex, a.length()), generic_string::npos, b, std::min<size_t>(bNumIndex, b.length()), generic_string::npos);
|
compareResult = a.compare(std::min<size_t>(aNumIndex, a.length()), std::wstring::npos, b, std::min<size_t>(bNumIndex, b.length()), std::wstring::npos);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,13 +400,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t aNumEnd = a.find_first_not_of(L"1234567890", aNumIndex);
|
size_t aNumEnd = a.find_first_not_of(L"1234567890", aNumIndex);
|
||||||
if (aNumEnd == generic_string::npos)
|
if (aNumEnd == std::wstring::npos)
|
||||||
{
|
{
|
||||||
aNumEnd = a.length();
|
aNumEnd = a.length();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t bNumEnd = b.find_first_not_of(L"1234567890", bNumIndex);
|
size_t bNumEnd = b.find_first_not_of(L"1234567890", bNumIndex);
|
||||||
if (bNumEnd == generic_string::npos)
|
if (bNumEnd == std::wstring::npos)
|
||||||
{
|
{
|
||||||
bNumEnd = b.length();
|
bNumEnd = b.length();
|
||||||
}
|
}
|
||||||
|
@ -519,15 +519,15 @@ public:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void sort(std::vector<generic_string>& lines) override {
|
void sort(std::vector<std::wstring>& lines) override {
|
||||||
// Note that empty lines are filtered out and added back manually to the output at the end.
|
// Note that empty lines are filtered out and added back manually to the output at the end.
|
||||||
std::vector<std::pair<size_t, T_Num>> nonEmptyInputAsNumbers;
|
std::vector<std::pair<size_t, T_Num>> nonEmptyInputAsNumbers;
|
||||||
std::vector<generic_string> empties;
|
std::vector<std::wstring> empties;
|
||||||
nonEmptyInputAsNumbers.reserve(lines.size());
|
nonEmptyInputAsNumbers.reserve(lines.size());
|
||||||
for (size_t lineIndex = 0; lineIndex < lines.size(); ++lineIndex)
|
for (size_t lineIndex = 0; lineIndex < lines.size(); ++lineIndex)
|
||||||
{
|
{
|
||||||
const generic_string originalLine = lines[lineIndex];
|
const std::wstring originalLine = lines[lineIndex];
|
||||||
const generic_string preparedLine = prepareStringForConversion(originalLine);
|
const std::wstring preparedLine = prepareStringForConversion(originalLine);
|
||||||
if (considerStringEmpty(preparedLine))
|
if (considerStringEmpty(preparedLine))
|
||||||
{
|
{
|
||||||
empties.push_back(originalLine);
|
empties.push_back(originalLine);
|
||||||
|
@ -559,7 +559,7 @@ public:
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
std::vector<generic_string> output;
|
std::vector<std::wstring> output;
|
||||||
output.reserve(lines.size());
|
output.reserve(lines.size());
|
||||||
if (!isDescending())
|
if (!isDescending())
|
||||||
{
|
{
|
||||||
|
@ -581,17 +581,17 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool considerStringEmpty(const generic_string& input) {
|
bool considerStringEmpty(const std::wstring& input) {
|
||||||
// String has something else than just whitespace.
|
// String has something else than just whitespace.
|
||||||
return input.find_first_not_of(TEXT(" \t\r\n")) == std::string::npos;
|
return input.find_first_not_of(L" \t\r\n") == std::string::npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare the string for conversion to number.
|
// Prepare the string for conversion to number.
|
||||||
virtual generic_string prepareStringForConversion(const generic_string& input) = 0;
|
virtual std::wstring prepareStringForConversion(const std::wstring& input) = 0;
|
||||||
|
|
||||||
// Should convert the input string to a number of the correct type.
|
// Should convert the input string to a number of the correct type.
|
||||||
// If unable to convert, throw either std::invalid_argument or std::out_of_range.
|
// If unable to convert, throw either std::invalid_argument or std::out_of_range.
|
||||||
virtual T_Num convertStringToNumber(const generic_string& input) = 0;
|
virtual T_Num convertStringToNumber(const std::wstring& input) = 0;
|
||||||
|
|
||||||
// We need a fixed locale so we get the same string-to-double behavior across all computers.
|
// We need a fixed locale so we get the same string-to-double behavior across all computers.
|
||||||
// This is the "enUS" locale.
|
// This is the "enUS" locale.
|
||||||
|
@ -605,12 +605,12 @@ public:
|
||||||
DecimalCommaSorter(bool isDescending, size_t fromColumn, size_t toColumn) : NumericSorter<double>(isDescending, fromColumn, toColumn) { };
|
DecimalCommaSorter(bool isDescending, size_t fromColumn, size_t toColumn) : NumericSorter<double>(isDescending, fromColumn, toColumn) { };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
generic_string prepareStringForConversion(const generic_string& input) override {
|
std::wstring prepareStringForConversion(const std::wstring& input) override {
|
||||||
generic_string admissablePart = stringTakeWhileAdmissable(getSortKey(input), TEXT(" \t\r\n0123456789,-"));
|
std::wstring admissablePart = stringTakeWhileAdmissable(getSortKey(input), L" \t\r\n0123456789,-");
|
||||||
return stringReplace(admissablePart, TEXT(","), TEXT("."));
|
return stringReplace(admissablePart, L",", L".");
|
||||||
};
|
};
|
||||||
|
|
||||||
double convertStringToNumber(const generic_string& input) override {
|
double convertStringToNumber(const std::wstring& input) override {
|
||||||
return stodLocale(input, _usLocale);
|
return stodLocale(input, _usLocale);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -622,11 +622,11 @@ public:
|
||||||
DecimalDotSorter(bool isDescending, size_t fromColumn, size_t toColumn) : NumericSorter<double>(isDescending, fromColumn, toColumn) { };
|
DecimalDotSorter(bool isDescending, size_t fromColumn, size_t toColumn) : NumericSorter<double>(isDescending, fromColumn, toColumn) { };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
generic_string prepareStringForConversion(const generic_string& input) override {
|
std::wstring prepareStringForConversion(const std::wstring& input) override {
|
||||||
return stringTakeWhileAdmissable(getSortKey(input), TEXT(" \t\r\n0123456789.-"));
|
return stringTakeWhileAdmissable(getSortKey(input), L" \t\r\n0123456789.-");
|
||||||
};
|
};
|
||||||
|
|
||||||
double convertStringToNumber(const generic_string& input) override {
|
double convertStringToNumber(const std::wstring& input) override {
|
||||||
return stodLocale(input, _usLocale);
|
return stodLocale(input, _usLocale);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -636,7 +636,7 @@ class ReverseSorter : public ISorter
|
||||||
public:
|
public:
|
||||||
ReverseSorter(bool isDescending, size_t fromColumn, size_t toColumn) : ISorter(isDescending, fromColumn, toColumn) { };
|
ReverseSorter(bool isDescending, size_t fromColumn, size_t toColumn) : ISorter(isDescending, fromColumn, toColumn) { };
|
||||||
|
|
||||||
void sort(std::vector<generic_string>& lines) override {
|
void sort(std::vector<std::wstring>& lines) override {
|
||||||
std::reverse(lines.begin(), lines.end());
|
std::reverse(lines.begin(), lines.end());
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -650,7 +650,7 @@ public:
|
||||||
seed = static_cast<unsigned>(time(NULL));
|
seed = static_cast<unsigned>(time(NULL));
|
||||||
};
|
};
|
||||||
|
|
||||||
void sort(std::vector<generic_string>& lines) override {
|
void sort(std::vector<std::wstring>& lines) override {
|
||||||
std::shuffle(lines.begin(), lines.end(), std::default_random_engine(seed));
|
std::shuffle(lines.begin(), lines.end(), std::default_random_engine(seed));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -64,8 +64,9 @@ namespace // anonymous
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
Buffer::Buffer(FileManager * pManager, BufferID id, Document doc, DocFileStatus type, const TCHAR *fileName, bool isLargeFile)
|
Buffer::Buffer(FileManager * pManager, BufferID id, Document doc, DocFileStatus type, const wchar_t *fileName, bool isLargeFile)
|
||||||
// type must be either DOC_REGULAR or DOC_UNNAMED
|
// type must be either DOC_REGULAR or DOC_UNNAMED
|
||||||
: _pManager(pManager) , _id(id), _doc(doc), _lang(L_TEXT), _isLargeFile(isLargeFile)
|
: _pManager(pManager) , _id(id), _doc(doc), _lang(L_TEXT), _isLargeFile(isLargeFile)
|
||||||
{
|
{
|
||||||
|
@ -123,7 +124,7 @@ void Buffer::setUnicodeMode(UniMode mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Buffer::setLangType(LangType lang, const TCHAR* userLangName)
|
void Buffer::setLangType(LangType lang, const wchar_t* userLangName)
|
||||||
{
|
{
|
||||||
if (lang == _lang && lang != L_USER)
|
if (lang == _lang && lang != L_USER)
|
||||||
return;
|
return;
|
||||||
|
@ -159,9 +160,9 @@ void Buffer::updateTimeStamp()
|
||||||
NppParameters& nppParam = NppParameters::getInstance();
|
NppParameters& nppParam = NppParameters::getInstance();
|
||||||
if (nppParam.doNppLogNetworkDriveIssue())
|
if (nppParam.doNppLogNetworkDriveIssue())
|
||||||
{
|
{
|
||||||
generic_string issueFn = nppLogNetworkDriveIssue;
|
wstring issueFn = nppLogNetworkDriveIssue;
|
||||||
issueFn += TEXT(".log");
|
issueFn += L".log";
|
||||||
generic_string nppIssueLog = nppParam.getUserPath();
|
wstring nppIssueLog = nppParam.getUserPath();
|
||||||
pathAppend(nppIssueLog, issueFn);
|
pathAppend(nppIssueLog, issueFn);
|
||||||
|
|
||||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||||
|
@ -181,7 +182,7 @@ void Buffer::updateTimeStamp()
|
||||||
|
|
||||||
// Set full path file name in buffer object,
|
// Set full path file name in buffer object,
|
||||||
// and determinate its language by its extension.
|
// and determinate its language by its extension.
|
||||||
void Buffer::setFileName(const TCHAR *fn)
|
void Buffer::setFileName(const wchar_t *fn)
|
||||||
{
|
{
|
||||||
NppParameters& nppParamInst = NppParameters::getInstance();
|
NppParameters& nppParamInst = NppParameters::getInstance();
|
||||||
if (_fullPathName == fn)
|
if (_fullPathName == fn)
|
||||||
|
@ -196,13 +197,13 @@ void Buffer::setFileName(const TCHAR *fn)
|
||||||
|
|
||||||
// for _lang
|
// for _lang
|
||||||
LangType determinatedLang = L_TEXT;
|
LangType determinatedLang = L_TEXT;
|
||||||
TCHAR *ext = PathFindExtension(_fullPathName.c_str());
|
wchar_t *ext = PathFindExtension(_fullPathName.c_str());
|
||||||
if (*ext == '.') // extension found
|
if (*ext == '.') // extension found
|
||||||
{
|
{
|
||||||
ext += 1;
|
ext += 1;
|
||||||
|
|
||||||
// Define User Lang firstly
|
// Define User Lang firstly
|
||||||
const TCHAR* langName = nppParamInst.getUserDefinedLangNameFromExt(ext, _fileName);
|
const wchar_t* langName = nppParamInst.getUserDefinedLangNameFromExt(ext, _fileName);
|
||||||
if (langName)
|
if (langName)
|
||||||
{
|
{
|
||||||
determinatedLang = L_USER;
|
determinatedLang = L_USER;
|
||||||
|
@ -217,15 +218,15 @@ void Buffer::setFileName(const TCHAR *fn)
|
||||||
|
|
||||||
if (determinatedLang == L_TEXT) // language can probably be refined
|
if (determinatedLang == L_TEXT) // language can probably be refined
|
||||||
{
|
{
|
||||||
if ((wcsicmp(_fileName, TEXT("makefile")) == 0) || (wcsicmp(_fileName, TEXT("GNUmakefile")) == 0))
|
if ((wcsicmp(_fileName, L"makefile") == 0) || (wcsicmp(_fileName, L"GNUmakefile") == 0))
|
||||||
determinatedLang = L_MAKEFILE;
|
determinatedLang = L_MAKEFILE;
|
||||||
else if (wcsicmp(_fileName, TEXT("CmakeLists.txt")) == 0)
|
else if (wcsicmp(_fileName, L"CmakeLists.txt") == 0)
|
||||||
determinatedLang = L_CMAKE;
|
determinatedLang = L_CMAKE;
|
||||||
else if ((wcsicmp(_fileName, TEXT("SConstruct")) == 0) || (wcsicmp(_fileName, TEXT("SConscript")) == 0) || (wcsicmp(_fileName, TEXT("wscript")) == 0))
|
else if ((wcsicmp(_fileName, L"SConstruct") == 0) || (wcsicmp(_fileName, L"SConscript") == 0) || (wcsicmp(_fileName, L"wscript") == 0))
|
||||||
determinatedLang = L_PYTHON;
|
determinatedLang = L_PYTHON;
|
||||||
else if ((wcsicmp(_fileName, TEXT("Rakefile")) == 0) || (wcsicmp(_fileName, TEXT("Vagrantfile")) == 0))
|
else if ((wcsicmp(_fileName, L"Rakefile") == 0) || (wcsicmp(_fileName, L"Vagrantfile") == 0))
|
||||||
determinatedLang = L_RUBY;
|
determinatedLang = L_RUBY;
|
||||||
else if ((wcsicmp(_fileName, TEXT("crontab")) == 0) || (wcsicmp(_fileName, TEXT("PKGBUILD")) == 0) || (wcsicmp(_fileName, TEXT("APKBUILD")) == 0))
|
else if ((wcsicmp(_fileName, L"crontab") == 0) || (wcsicmp(_fileName, L"PKGBUILD") == 0) || (wcsicmp(_fileName, L"APKBUILD") == 0))
|
||||||
determinatedLang = L_BASH;
|
determinatedLang = L_BASH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,9 +329,9 @@ bool Buffer::checkFileState() // returns true if the status has been changed (it
|
||||||
NppParameters& nppParam = NppParameters::getInstance();
|
NppParameters& nppParam = NppParameters::getInstance();
|
||||||
if (nppParam.doNppLogNetworkDriveIssue())
|
if (nppParam.doNppLogNetworkDriveIssue())
|
||||||
{
|
{
|
||||||
generic_string issueFn = nppLogNetworkDriveIssue;
|
wstring issueFn = nppLogNetworkDriveIssue;
|
||||||
issueFn += TEXT(".log");
|
issueFn += L".log";
|
||||||
generic_string nppIssueLog = nppParam.getUserPath();
|
wstring nppIssueLog = nppParam.getUserPath();
|
||||||
pathAppend(nppIssueLog, issueFn);
|
pathAppend(nppIssueLog, issueFn);
|
||||||
|
|
||||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||||
|
@ -398,9 +399,9 @@ int64_t Buffer::getFileLength() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
generic_string Buffer::getFileTime(fileTimeType ftt) const
|
wstring Buffer::getFileTime(fileTimeType ftt) const
|
||||||
{
|
{
|
||||||
generic_string result;
|
wstring result;
|
||||||
|
|
||||||
if (_currentStatus != DOC_UNNAMED)
|
if (_currentStatus != DOC_UNNAMED)
|
||||||
{
|
{
|
||||||
|
@ -426,12 +427,12 @@ generic_string Buffer::getFileTime(fileTimeType ftt) const
|
||||||
SystemTimeToTzSpecificLocalTime(nullptr, &utcSystemTime, &localSystemTime);
|
SystemTimeToTzSpecificLocalTime(nullptr, &utcSystemTime, &localSystemTime);
|
||||||
|
|
||||||
const size_t dateTimeStrLen = 256;
|
const size_t dateTimeStrLen = 256;
|
||||||
TCHAR bufDate[dateTimeStrLen] = {'\0'};
|
wchar_t bufDate[dateTimeStrLen] = {'\0'};
|
||||||
GetDateFormat(LOCALE_USER_DEFAULT, 0, &localSystemTime, nullptr, bufDate, dateTimeStrLen);
|
GetDateFormat(LOCALE_USER_DEFAULT, 0, &localSystemTime, nullptr, bufDate, dateTimeStrLen);
|
||||||
result += bufDate;
|
result += bufDate;
|
||||||
result += ' ';
|
result += ' ';
|
||||||
|
|
||||||
TCHAR bufTime[dateTimeStrLen] = {'\0'};
|
wchar_t bufTime[dateTimeStrLen] = {'\0'};
|
||||||
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &localSystemTime, nullptr, bufTime, dateTimeStrLen);
|
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &localSystemTime, nullptr, bufTime, dateTimeStrLen);
|
||||||
result += bufTime;
|
result += bufTime;
|
||||||
}
|
}
|
||||||
|
@ -683,14 +684,14 @@ void FileManager::closeBuffer(BufferID id, ScintillaEditView * identifier)
|
||||||
|
|
||||||
|
|
||||||
// backupFileName is sentinel of backup mode: if it's not NULL, then we use it (load it). Otherwise we use filename
|
// backupFileName is sentinel of backup mode: if it's not NULL, then we use it (load it). Otherwise we use filename
|
||||||
BufferID FileManager::loadFile(const TCHAR* filename, Document doc, int encoding, const TCHAR* backupFileName, FILETIME fileNameTimestamp)
|
BufferID FileManager::loadFile(const wchar_t* filename, Document doc, int encoding, const wchar_t* backupFileName, FILETIME fileNameTimestamp)
|
||||||
{
|
{
|
||||||
if (!filename)
|
if (!filename)
|
||||||
return BUFFER_INVALID;
|
return BUFFER_INVALID;
|
||||||
|
|
||||||
//Get file size
|
//Get file size
|
||||||
int64_t fileSize = -1;
|
int64_t fileSize = -1;
|
||||||
const TCHAR* pPath = filename;
|
const wchar_t* pPath = filename;
|
||||||
if (!::PathFileExists(pPath))
|
if (!::PathFileExists(pPath))
|
||||||
{
|
{
|
||||||
pPath = backupFileName;
|
pPath = backupFileName;
|
||||||
|
@ -698,7 +699,7 @@ BufferID FileManager::loadFile(const TCHAR* filename, Document doc, int encoding
|
||||||
|
|
||||||
if (pPath)
|
if (pPath)
|
||||||
{
|
{
|
||||||
FILE* fp = _wfopen(pPath, TEXT("rb"));
|
FILE* fp = _wfopen(pPath, L"rb");
|
||||||
if (fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
_fseeki64(fp, 0, SEEK_END);
|
_fseeki64(fp, 0, SEEK_END);
|
||||||
|
@ -827,7 +828,7 @@ bool FileManager::reloadBuffer(BufferID id)
|
||||||
// Set _isLoadedDirty false before calling "_pscratchTilla->execute(SCI_CLEARALL);" in loadFileData() to avoid setDirty in SCN_SAVEPOINTREACHED / SCN_SAVEPOINTLEFT
|
// Set _isLoadedDirty false before calling "_pscratchTilla->execute(SCI_CLEARALL);" in loadFileData() to avoid setDirty in SCN_SAVEPOINTREACHED / SCN_SAVEPOINTLEFT
|
||||||
|
|
||||||
//Get file size
|
//Get file size
|
||||||
FILE* fp = _wfopen(buf->getFullPathName(), TEXT("rb"));
|
FILE* fp = _wfopen(buf->getFullPathName(), L"rb");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return false;
|
return false;
|
||||||
_fseeki64(fp, 0, SEEK_END);
|
_fseeki64(fp, 0, SEEK_END);
|
||||||
|
@ -893,7 +894,7 @@ bool FileManager::reloadBufferDeferred(BufferID id)
|
||||||
bool FileManager::deleteFile(BufferID id)
|
bool FileManager::deleteFile(BufferID id)
|
||||||
{
|
{
|
||||||
Buffer* buf = getBufferByID(id);
|
Buffer* buf = getBufferByID(id);
|
||||||
generic_string fileNamePath = buf->getFullPathName();
|
wstring fileNamePath = buf->getFullPathName();
|
||||||
|
|
||||||
// Make sure to form a string with double '\0' terminator.
|
// Make sure to form a string with double '\0' terminator.
|
||||||
fileNamePath.append(1, '\0');
|
fileNamePath.append(1, '\0');
|
||||||
|
@ -915,10 +916,10 @@ bool FileManager::deleteFile(BufferID id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FileManager::moveFile(BufferID id, const TCHAR * newFileName)
|
bool FileManager::moveFile(BufferID id, const wchar_t * newFileName)
|
||||||
{
|
{
|
||||||
Buffer* buf = getBufferByID(id);
|
Buffer* buf = getBufferByID(id);
|
||||||
const TCHAR *fileNamePath = buf->getFullPathName();
|
const wchar_t *fileNamePath = buf->getFullPathName();
|
||||||
if (::MoveFileEx(fileNamePath, newFileName, MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH) == 0)
|
if (::MoveFileEx(fileNamePath, newFileName, MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH) == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -995,12 +996,12 @@ bool FileManager::backupCurrentBuffer()
|
||||||
UnicodeConvertor.setEncoding(mode);
|
UnicodeConvertor.setEncoding(mode);
|
||||||
int encoding = buffer->getEncoding();
|
int encoding = buffer->getEncoding();
|
||||||
|
|
||||||
generic_string backupFilePath = buffer->getBackupFileName();
|
wstring backupFilePath = buffer->getBackupFileName();
|
||||||
if (backupFilePath.empty())
|
if (backupFilePath.empty())
|
||||||
{
|
{
|
||||||
// Create file
|
// Create file
|
||||||
backupFilePath = NppParameters::getInstance().getUserPath();
|
backupFilePath = NppParameters::getInstance().getUserPath();
|
||||||
backupFilePath += TEXT("\\backup\\");
|
backupFilePath += L"\\backup\\";
|
||||||
|
|
||||||
// if "backup" folder doesn't exist, create it.
|
// if "backup" folder doesn't exist, create it.
|
||||||
if (!PathFileExists(backupFilePath.c_str()))
|
if (!PathFileExists(backupFilePath.c_str()))
|
||||||
|
@ -1011,7 +1012,7 @@ bool FileManager::backupCurrentBuffer()
|
||||||
backupFilePath += buffer->getFileName();
|
backupFilePath += buffer->getFileName();
|
||||||
|
|
||||||
const int temBufLen = 32;
|
const int temBufLen = 32;
|
||||||
TCHAR tmpbuf[temBufLen];
|
wchar_t tmpbuf[temBufLen];
|
||||||
time_t ltime = time(0);
|
time_t ltime = time(0);
|
||||||
struct tm* today = localtime(<ime);
|
struct tm* today = localtime(<ime);
|
||||||
if (!today)
|
if (!today)
|
||||||
|
@ -1029,7 +1030,7 @@ bool FileManager::backupCurrentBuffer()
|
||||||
hasModifForSession = true;
|
hasModifForSession = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TCHAR fullpath[MAX_PATH]{};
|
wchar_t fullpath[MAX_PATH]{};
|
||||||
::GetFullPathName(backupFilePath.c_str(), MAX_PATH, fullpath, NULL);
|
::GetFullPathName(backupFilePath.c_str(), MAX_PATH, fullpath, NULL);
|
||||||
if (wcschr(fullpath, '~'))
|
if (wcschr(fullpath, '~'))
|
||||||
{
|
{
|
||||||
|
@ -1096,21 +1097,21 @@ bool FileManager::backupCurrentBuffer()
|
||||||
}
|
}
|
||||||
else // buffer not dirty, sync: delete the backup file
|
else // buffer not dirty, sync: delete the backup file
|
||||||
{
|
{
|
||||||
generic_string backupFilePath = buffer->getBackupFileName();
|
wstring backupFilePath = buffer->getBackupFileName();
|
||||||
if (!backupFilePath.empty())
|
if (!backupFilePath.empty())
|
||||||
{
|
{
|
||||||
// delete backup file
|
// delete backup file
|
||||||
generic_string file2Delete = buffer->getBackupFileName();
|
wstring file2Delete = buffer->getBackupFileName();
|
||||||
buffer->setBackupFileName(generic_string());
|
buffer->setBackupFileName(wstring());
|
||||||
result = (::DeleteFile(file2Delete.c_str()) != 0);
|
result = (::DeleteFile(file2Delete.c_str()) != 0);
|
||||||
|
|
||||||
// Session changes, save it
|
// Session changes, save it
|
||||||
hasModifForSession = true;
|
hasModifForSession = true;
|
||||||
}
|
}
|
||||||
//printStr(TEXT("backup deleted in backupCurrentBuffer"));
|
//printStr(L"backup deleted in backupCurrentBuffer"));
|
||||||
result = true; // no backup file to delete
|
result = true; // no backup file to delete
|
||||||
}
|
}
|
||||||
//printStr(TEXT("backup sync"));
|
//printStr(L"backup sync"));
|
||||||
|
|
||||||
if (result && hasModifForSession)
|
if (result && hasModifForSession)
|
||||||
{
|
{
|
||||||
|
@ -1124,11 +1125,11 @@ bool FileManager::deleteBufferBackup(BufferID id)
|
||||||
{
|
{
|
||||||
Buffer* buffer = getBufferByID(id);
|
Buffer* buffer = getBufferByID(id);
|
||||||
bool result = true;
|
bool result = true;
|
||||||
generic_string backupFilePath = buffer->getBackupFileName();
|
wstring backupFilePath = buffer->getBackupFileName();
|
||||||
if (!backupFilePath.empty())
|
if (!backupFilePath.empty())
|
||||||
{
|
{
|
||||||
// delete backup file
|
// delete backup file
|
||||||
buffer->setBackupFileName(generic_string());
|
buffer->setBackupFileName(wstring());
|
||||||
result = (::DeleteFile(backupFilePath.c_str()) != 0);
|
result = (::DeleteFile(backupFilePath.c_str()) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1137,7 +1138,7 @@ bool FileManager::deleteBufferBackup(BufferID id)
|
||||||
|
|
||||||
std::mutex save_mutex;
|
std::mutex save_mutex;
|
||||||
|
|
||||||
SavingStatus FileManager::saveBuffer(BufferID id, const TCHAR* filename, bool isCopy)
|
SavingStatus FileManager::saveBuffer(BufferID id, const wchar_t* filename, bool isCopy)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(save_mutex);
|
std::lock_guard<std::mutex> lock(save_mutex);
|
||||||
|
|
||||||
|
@ -1285,11 +1286,11 @@ SavingStatus FileManager::saveBuffer(BufferID id, const TCHAR* filename, bool is
|
||||||
_pscratchTilla->execute(SCI_SETSAVEPOINT);
|
_pscratchTilla->execute(SCI_SETSAVEPOINT);
|
||||||
_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault);
|
_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault);
|
||||||
|
|
||||||
generic_string backupFilePath = buffer->getBackupFileName();
|
wstring backupFilePath = buffer->getBackupFileName();
|
||||||
if (!backupFilePath.empty())
|
if (!backupFilePath.empty())
|
||||||
{
|
{
|
||||||
// delete backup file
|
// delete backup file
|
||||||
buffer->setBackupFileName(generic_string());
|
buffer->setBackupFileName(wstring());
|
||||||
::DeleteFile(backupFilePath.c_str());
|
::DeleteFile(backupFilePath.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1312,8 +1313,8 @@ size_t FileManager::nextUntitledNewNumber() const
|
||||||
// if untitled document is invisible, then don't put its number into array (so its number is available to be used)
|
// if untitled document is invisible, then don't put its number into array (so its number is available to be used)
|
||||||
if ((buf->_referees[0])->isVisible())
|
if ((buf->_referees[0])->isVisible())
|
||||||
{
|
{
|
||||||
generic_string newTitle = ((NppParameters::getInstance()).getNativeLangSpeaker())->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR);
|
wstring newTitle = ((NppParameters::getInstance()).getNativeLangSpeaker())->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR);
|
||||||
TCHAR *numberStr = buf->_fileName + newTitle.length();
|
wchar_t *numberStr = buf->_fileName + newTitle.length();
|
||||||
int usedNumber = _wtoi(numberStr);
|
int usedNumber = _wtoi(numberStr);
|
||||||
usedNumbers.push_back(usedNumber);
|
usedNumbers.push_back(usedNumber);
|
||||||
}
|
}
|
||||||
|
@ -1349,10 +1350,10 @@ size_t FileManager::nextUntitledNewNumber() const
|
||||||
|
|
||||||
BufferID FileManager::newEmptyDocument()
|
BufferID FileManager::newEmptyDocument()
|
||||||
{
|
{
|
||||||
generic_string newTitle = ((NppParameters::getInstance()).getNativeLangSpeaker())->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR);
|
wstring newTitle = ((NppParameters::getInstance()).getNativeLangSpeaker())->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR);
|
||||||
|
|
||||||
TCHAR nb[10];
|
wchar_t nb[10];
|
||||||
wsprintf(nb, TEXT("%d"), static_cast<int>(nextUntitledNewNumber()));
|
wsprintf(nb, L"%d"), static_cast<int>(nextUntitledNewNumber());
|
||||||
newTitle += nb;
|
newTitle += nb;
|
||||||
|
|
||||||
Document doc = static_cast<Document>(_pscratchTilla->execute(SCI_CREATEDOCUMENT, 0, SC_DOCUMENTOPTION_TEXT_LARGE)); // this already sets a reference for filemanager
|
Document doc = static_cast<Document>(_pscratchTilla->execute(SCI_CREATEDOCUMENT, 0, SC_DOCUMENTOPTION_TEXT_LARGE)); // this already sets a reference for filemanager
|
||||||
|
@ -1370,7 +1371,7 @@ BufferID FileManager::newEmptyDocument()
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferID FileManager::newPlaceholderDocument(const TCHAR* missingFilename, int whichOne, const wchar_t* userCreatedSessionName)
|
BufferID FileManager::newPlaceholderDocument(const wchar_t* missingFilename, int whichOne, const wchar_t* userCreatedSessionName)
|
||||||
{
|
{
|
||||||
NppParameters& nppParamInst = NppParameters::getInstance();
|
NppParameters& nppParamInst = NppParameters::getInstance();
|
||||||
|
|
||||||
|
@ -1422,7 +1423,7 @@ BufferID FileManager::bufferFromDocument(Document doc, bool isMainEditZone)
|
||||||
{
|
{
|
||||||
newTitle = (nppParamInst.getNativeLangSpeaker())->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR);
|
newTitle = (nppParamInst.getNativeLangSpeaker())->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR);
|
||||||
wchar_t nb[10];
|
wchar_t nb[10];
|
||||||
wsprintf(nb, TEXT("%d"), static_cast<int>(nextUntitledNewNumber()));
|
wsprintf(nb, L"%d", static_cast<int>(nextUntitledNewNumber()));
|
||||||
newTitle += nb;
|
newTitle += nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1545,9 +1546,9 @@ LangType FileManager::detectLanguageFromTextBegining(const unsigned char *data,
|
||||||
return L_TEXT;
|
return L_TEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileManager::loadFileData(Document doc, int64_t fileSize, const TCHAR * filename, char* data, Utf8_16_Read * unicodeConvertor, LoadedFileFormat& fileFormat)
|
bool FileManager::loadFileData(Document doc, int64_t fileSize, const wchar_t * filename, char* data, Utf8_16_Read * unicodeConvertor, LoadedFileFormat& fileFormat)
|
||||||
{
|
{
|
||||||
FILE *fp = _wfopen(filename, TEXT("rb"));
|
FILE *fp = _wfopen(filename, L"rb");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1564,8 +1565,8 @@ bool FileManager::loadFileData(Document doc, int64_t fileSize, const TCHAR * fil
|
||||||
{
|
{
|
||||||
pNativeSpeaker->messageBox("FileTooBigToOpen",
|
pNativeSpeaker->messageBox("FileTooBigToOpen",
|
||||||
_pNotepadPlus->_pEditView->getHSelf(),
|
_pNotepadPlus->_pEditView->getHSelf(),
|
||||||
TEXT("File is too big to be opened by Notepad++"),
|
L"File is too big to be opened by Notepad++",
|
||||||
TEXT("File size problem"),
|
L"File size problem",
|
||||||
MB_OK | MB_APPLMODAL);
|
MB_OK | MB_APPLMODAL);
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
@ -1578,8 +1579,8 @@ bool FileManager::loadFileData(Document doc, int64_t fileSize, const TCHAR * fil
|
||||||
{
|
{
|
||||||
int res = pNativeSpeaker->messageBox("WantToOpenHugeFile",
|
int res = pNativeSpeaker->messageBox("WantToOpenHugeFile",
|
||||||
_pNotepadPlus->_pEditView->getHSelf(),
|
_pNotepadPlus->_pEditView->getHSelf(),
|
||||||
TEXT("Opening a huge file of 2GB+ could take several minutes.\nDo you want to open it?"),
|
L"Opening a huge file of 2GB+ could take several minutes.\nDo you want to open it?",
|
||||||
TEXT("Opening huge file warning"),
|
L"Opening huge file warning",
|
||||||
MB_YESNO | MB_APPLMODAL);
|
MB_YESNO | MB_APPLMODAL);
|
||||||
|
|
||||||
if (res == IDYES)
|
if (res == IDYES)
|
||||||
|
@ -1627,7 +1628,7 @@ bool FileManager::loadFileData(Document doc, int64_t fileSize, const TCHAR * fil
|
||||||
bool success = true;
|
bool success = true;
|
||||||
EolType format = EolType::unknown;
|
EolType format = EolType::unknown;
|
||||||
int sciStatus = SC_STATUS_OK;
|
int sciStatus = SC_STATUS_OK;
|
||||||
TCHAR szException[64] = { '\0' };
|
wchar_t szException[64] = { '\0' };
|
||||||
__try
|
__try
|
||||||
{
|
{
|
||||||
// First allocate enough memory for the whole file (this will reduce memory copy during loading)
|
// First allocate enough memory for the whole file (this will reduce memory copy during loading)
|
||||||
|
@ -1725,31 +1726,31 @@ bool FileManager::loadFileData(Document doc, int64_t fileSize, const TCHAR * fil
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
// there is the std::current_exception() possibility, but getting the real exception code from there requires an ugly hack,
|
// there is the std::current_exception() possibility, but getting the real exception code from there requires an ugly hack,
|
||||||
// because of the std::exception_ptr has its members _Data1 (GetExceptionCode) and _Data2 (GetExceptionInformation) private
|
// because of the std::exception_ptr has its members _Data1 (GetExceptionCode) and _Data2 (GetExceptionInformation) private
|
||||||
_stprintf_s(szException, _countof(szException), TEXT("unknown exception"));
|
_stprintf_s(szException, _countof(szException), L"unknown exception");
|
||||||
#else
|
#else
|
||||||
_stprintf_s(szException, _countof(szException), TEXT("0x%X (SEH)"), ::GetExceptionCode());
|
_stprintf_s(szException, _countof(szException), L"0x%X (SEH)", ::GetExceptionCode());
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case SC_STATUS_BADALLOC:
|
case SC_STATUS_BADALLOC:
|
||||||
{
|
{
|
||||||
pNativeSpeaker->messageBox("FileMemoryAllocationFailed",
|
pNativeSpeaker->messageBox("FileMemoryAllocationFailed",
|
||||||
_pNotepadPlus->_pEditView->getHSelf(),
|
_pNotepadPlus->_pEditView->getHSelf(),
|
||||||
TEXT("There is probably not enough contiguous free memory for the file being loaded by Notepad++."),
|
L"There is probably not enough contiguous free memory for the file being loaded by Notepad++.",
|
||||||
TEXT("Exception: File memory allocation failed"),
|
L"Exception: File memory allocation failed",
|
||||||
MB_OK | MB_APPLMODAL);
|
MB_OK | MB_APPLMODAL);
|
||||||
}
|
}
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case SC_STATUS_FAILURE:
|
case SC_STATUS_FAILURE:
|
||||||
default:
|
default:
|
||||||
_stprintf_s(szException, _countof(szException), TEXT("%d (Scintilla)"), sciStatus);
|
_stprintf_s(szException, _countof(szException), L"%d (Scintilla)", sciStatus);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (sciStatus != SC_STATUS_BADALLOC)
|
if (sciStatus != SC_STATUS_BADALLOC)
|
||||||
{
|
{
|
||||||
pNativeSpeaker->messageBox("FileLoadingException",
|
pNativeSpeaker->messageBox("FileLoadingException",
|
||||||
_pNotepadPlus->_pEditView->getHSelf(),
|
_pNotepadPlus->_pEditView->getHSelf(),
|
||||||
TEXT("An error occurred while loading the file!"),
|
L"An error occurred while loading the file!",
|
||||||
TEXT("Exception code: $STR_REPLACE$"),
|
L"Exception code: $STR_REPLACE$",
|
||||||
MB_OK | MB_APPLMODAL,
|
MB_OK | MB_APPLMODAL,
|
||||||
0,
|
0,
|
||||||
szException);
|
szException);
|
||||||
|
@ -1791,7 +1792,7 @@ bool FileManager::loadFileData(Document doc, int64_t fileSize, const TCHAR * fil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BufferID FileManager::getBufferFromName(const TCHAR* name)
|
BufferID FileManager::getBufferFromName(const wchar_t* name)
|
||||||
{
|
{
|
||||||
for (auto buf : _buffers)
|
for (auto buf : _buffers)
|
||||||
{
|
{
|
||||||
|
@ -1818,14 +1819,14 @@ BufferID FileManager::getBufferFromDocument(Document doc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FileManager::createEmptyFile(const TCHAR * path)
|
bool FileManager::createEmptyFile(const wchar_t * path)
|
||||||
{
|
{
|
||||||
Win32_IO_File file(path);
|
Win32_IO_File file(path);
|
||||||
return file.isOpened();
|
return file.isOpened();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int FileManager::getFileNameFromBuffer(BufferID id, TCHAR * fn2copy)
|
int FileManager::getFileNameFromBuffer(BufferID id, wchar_t * fn2copy)
|
||||||
{
|
{
|
||||||
if (getBufferIndexByID(id) == -1)
|
if (getBufferIndexByID(id) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -66,7 +66,7 @@ struct BufferViewInfo {
|
||||||
BufferViewInfo(BufferID buf, int view) : _bufID(buf), _iView(view) {};
|
BufferViewInfo(BufferID buf, int view) : _bufID(buf), _iView(view) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
const TCHAR UNTITLED_STR[] = TEXT("new ");
|
const wchar_t UNTITLED_STR[] = L"new ";
|
||||||
|
|
||||||
//File manager class maintains all buffers
|
//File manager class maintains all buffers
|
||||||
class FileManager final {
|
class FileManager final {
|
||||||
|
@ -87,31 +87,31 @@ public:
|
||||||
|
|
||||||
void addBufferReference(BufferID id, ScintillaEditView * identifer); //called by Scintilla etc indirectly
|
void addBufferReference(BufferID id, ScintillaEditView * identifer); //called by Scintilla etc indirectly
|
||||||
|
|
||||||
BufferID loadFile(const TCHAR * filename, Document doc = static_cast<Document>(NULL), int encoding = -1, const TCHAR *backupFileName = nullptr, FILETIME fileNameTimestamp = {}); //ID == BUFFER_INVALID on failure. If Doc == NULL, a new file is created, otherwise data is loaded in given document
|
BufferID loadFile(const wchar_t * filename, Document doc = static_cast<Document>(NULL), int encoding = -1, const wchar_t *backupFileName = nullptr, FILETIME fileNameTimestamp = {}); //ID == BUFFER_INVALID on failure. If Doc == NULL, a new file is created, otherwise data is loaded in given document
|
||||||
BufferID newEmptyDocument();
|
BufferID newEmptyDocument();
|
||||||
// create an empty placeholder for a missing file when loading session
|
// create an empty placeholder for a missing file when loading session
|
||||||
BufferID newPlaceholderDocument(const TCHAR * missingFilename, int whichOne, const wchar_t* userCreatedSessionName);
|
BufferID newPlaceholderDocument(const wchar_t * missingFilename, int whichOne, const wchar_t* userCreatedSessionName);
|
||||||
|
|
||||||
//create Buffer from existing Scintilla, used from new Scintillas.
|
//create Buffer from existing Scintilla, used from new Scintillas.
|
||||||
BufferID bufferFromDocument(Document doc, bool isMainEditZone);
|
BufferID bufferFromDocument(Document doc, bool isMainEditZone);
|
||||||
|
|
||||||
BufferID getBufferFromName(const TCHAR * name);
|
BufferID getBufferFromName(const wchar_t * name);
|
||||||
BufferID getBufferFromDocument(Document doc);
|
BufferID getBufferFromDocument(Document doc);
|
||||||
|
|
||||||
void setLoadedBufferEncodingAndEol(Buffer* buf, const Utf8_16_Read& UnicodeConvertor, int encoding, EolType bkformat);
|
void setLoadedBufferEncodingAndEol(Buffer* buf, const Utf8_16_Read& UnicodeConvertor, int encoding, EolType bkformat);
|
||||||
bool reloadBuffer(BufferID id);
|
bool reloadBuffer(BufferID id);
|
||||||
bool reloadBufferDeferred(BufferID id);
|
bool reloadBufferDeferred(BufferID id);
|
||||||
SavingStatus saveBuffer(BufferID id, const TCHAR* filename, bool isCopy = false);
|
SavingStatus saveBuffer(BufferID id, const wchar_t* filename, bool isCopy = false);
|
||||||
bool backupCurrentBuffer();
|
bool backupCurrentBuffer();
|
||||||
bool deleteBufferBackup(BufferID id);
|
bool deleteBufferBackup(BufferID id);
|
||||||
bool deleteFile(BufferID id);
|
bool deleteFile(BufferID id);
|
||||||
bool moveFile(BufferID id, const TCHAR * newFilename);
|
bool moveFile(BufferID id, const wchar_t * newFilename);
|
||||||
bool createEmptyFile(const TCHAR * path);
|
bool createEmptyFile(const wchar_t * path);
|
||||||
static FileManager& getInstance() {
|
static FileManager& getInstance() {
|
||||||
static FileManager instance;
|
static FileManager instance;
|
||||||
return instance;
|
return instance;
|
||||||
};
|
};
|
||||||
int getFileNameFromBuffer(BufferID id, TCHAR * fn2copy);
|
int getFileNameFromBuffer(BufferID id, wchar_t * fn2copy);
|
||||||
size_t docLength(Buffer * buffer) const;
|
size_t docLength(Buffer * buffer) const;
|
||||||
size_t nextUntitledNewNumber() const;
|
size_t nextUntitledNewNumber() const;
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ private:
|
||||||
FileManager& operator=(FileManager&&) = delete;
|
FileManager& operator=(FileManager&&) = delete;
|
||||||
|
|
||||||
int detectCodepage(char* buf, size_t len);
|
int detectCodepage(char* buf, size_t len);
|
||||||
bool loadFileData(Document doc, int64_t fileSize, const TCHAR* filename, char* buffer, Utf8_16_Read* UnicodeConvertor, LoadedFileFormat& fileFormat);
|
bool loadFileData(Document doc, int64_t fileSize, const wchar_t* filename, char* buffer, Utf8_16_Read* UnicodeConvertor, LoadedFileFormat& fileFormat);
|
||||||
LangType detectLanguageFromTextBegining(const unsigned char *data, size_t dataLen);
|
LangType detectLanguageFromTextBegining(const unsigned char *data, size_t dataLen);
|
||||||
|
|
||||||
Notepad_plus* _pNotepadPlus = nullptr;
|
Notepad_plus* _pNotepadPlus = nullptr;
|
||||||
|
@ -158,16 +158,16 @@ public:
|
||||||
//Load the document into Scintilla/add to TabBar
|
//Load the document into Scintilla/add to TabBar
|
||||||
//The entire lifetime if the buffer, the Document has reference count of _atleast_ one
|
//The entire lifetime if the buffer, the Document has reference count of _atleast_ one
|
||||||
//Destructor makes sure its purged
|
//Destructor makes sure its purged
|
||||||
Buffer(FileManager * pManager, BufferID id, Document doc, DocFileStatus type, const TCHAR *fileName, bool isLargeFile);
|
Buffer(FileManager * pManager, BufferID id, Document doc, DocFileStatus type, const wchar_t *fileName, bool isLargeFile);
|
||||||
|
|
||||||
// this method 1. copies the file name
|
// this method 1. copies the file name
|
||||||
// 2. determinates the language from the ext of file name
|
// 2. determinates the language from the ext of file name
|
||||||
// 3. gets the last modified time
|
// 3. gets the last modified time
|
||||||
void setFileName(const TCHAR *fn);
|
void setFileName(const wchar_t *fn);
|
||||||
|
|
||||||
const TCHAR * getFullPathName() const { return _fullPathName.c_str(); }
|
const wchar_t * getFullPathName() const { return _fullPathName.c_str(); }
|
||||||
|
|
||||||
const TCHAR * getFileName() const { return _fileName; }
|
const wchar_t * getFileName() const { return _fileName; }
|
||||||
|
|
||||||
BufferID getID() const { return _id; }
|
BufferID getID() const { return _id; }
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ public:
|
||||||
|
|
||||||
LangType getLangType() const { return _lang; }
|
LangType getLangType() const { return _lang; }
|
||||||
|
|
||||||
void setLangType(LangType lang, const TCHAR * userLangName = TEXT(""));
|
void setLangType(LangType lang, const wchar_t * userLangName = L"");
|
||||||
|
|
||||||
UniMode getUnicodeMode() const { return _unicodeMode; }
|
UniMode getUnicodeMode() const { return _unicodeMode; }
|
||||||
|
|
||||||
|
@ -236,23 +236,23 @@ public:
|
||||||
|
|
||||||
bool isUserDefineLangExt() const { return (_userLangExt[0] != '\0'); }
|
bool isUserDefineLangExt() const { return (_userLangExt[0] != '\0'); }
|
||||||
|
|
||||||
const TCHAR * getUserDefineLangName() const { return _userLangExt.c_str(); }
|
const wchar_t * getUserDefineLangName() const { return _userLangExt.c_str(); }
|
||||||
|
|
||||||
const TCHAR * getCommentLineSymbol() const {
|
const wchar_t * getCommentLineSymbol() const {
|
||||||
Lang *l = getCurrentLang();
|
Lang *l = getCurrentLang();
|
||||||
if (!l)
|
if (!l)
|
||||||
return NULL;
|
return NULL;
|
||||||
return l->_pCommentLineSymbol;
|
return l->_pCommentLineSymbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TCHAR * getCommentStart() const {
|
const wchar_t * getCommentStart() const {
|
||||||
Lang *l = getCurrentLang();
|
Lang *l = getCurrentLang();
|
||||||
if (!l)
|
if (!l)
|
||||||
return NULL;
|
return NULL;
|
||||||
return l->_pCommentStart;
|
return l->_pCommentStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TCHAR * getCommentEnd() const {
|
const wchar_t * getCommentEnd() const {
|
||||||
Lang *l = getCurrentLang();
|
Lang *l = getCurrentLang();
|
||||||
if (!l)
|
if (!l)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -285,15 +285,15 @@ public:
|
||||||
int64_t getFileLength() const; // return file length. -1 if file is not existing.
|
int64_t getFileLength() const; // return file length. -1 if file is not existing.
|
||||||
|
|
||||||
enum fileTimeType { ft_created, ft_modified, ft_accessed };
|
enum fileTimeType { ft_created, ft_modified, ft_accessed };
|
||||||
generic_string getFileTime(fileTimeType ftt) const;
|
std::wstring getFileTime(fileTimeType ftt) const;
|
||||||
|
|
||||||
Lang * getCurrentLang() const;
|
Lang * getCurrentLang() const;
|
||||||
|
|
||||||
bool isModified() const { return _isModified; }
|
bool isModified() const { return _isModified; }
|
||||||
void setModifiedStatus(bool isModified) { _isModified = isModified; }
|
void setModifiedStatus(bool isModified) { _isModified = isModified; }
|
||||||
|
|
||||||
generic_string getBackupFileName() const { return _backupFileName; }
|
std::wstring getBackupFileName() const { return _backupFileName; }
|
||||||
void setBackupFileName(const generic_string& fileName) { _backupFileName = fileName; }
|
void setBackupFileName(const std::wstring& fileName) { _backupFileName = fileName; }
|
||||||
|
|
||||||
FILETIME getLastModifiedTimestamp() const { return _timeStamp; }
|
FILETIME getLastModifiedTimestamp() const { return _timeStamp; }
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ private:
|
||||||
//document properties
|
//document properties
|
||||||
Document _doc; //invariable
|
Document _doc; //invariable
|
||||||
LangType _lang = L_TEXT;
|
LangType _lang = L_TEXT;
|
||||||
generic_string _userLangExt; // it's useful if only (_lang == L_USER)
|
std::wstring _userLangExt; // it's useful if only (_lang == L_USER)
|
||||||
bool _isDirty = false;
|
bool _isDirty = false;
|
||||||
EolType _eolFormat = EolType::osdefault;
|
EolType _eolFormat = EolType::osdefault;
|
||||||
UniMode _unicodeMode = uniUTF8;
|
UniMode _unicodeMode = uniUTF8;
|
||||||
|
@ -387,8 +387,8 @@ private:
|
||||||
FILETIME _timeStamp = {}; // 0 if it's a new doc
|
FILETIME _timeStamp = {}; // 0 if it's a new doc
|
||||||
|
|
||||||
bool _isFileReadOnly = false;
|
bool _isFileReadOnly = false;
|
||||||
generic_string _fullPathName;
|
std::wstring _fullPathName;
|
||||||
TCHAR * _fileName = nullptr; // points to filename part in _fullPathName
|
wchar_t * _fileName = nullptr; // points to filename part in _fullPathName
|
||||||
bool _needReloading = false; // True if Buffer needs to be reloaded on activation
|
bool _needReloading = false; // True if Buffer needs to be reloaded on activation
|
||||||
|
|
||||||
long _recentTag = -1;
|
long _recentTag = -1;
|
||||||
|
@ -397,7 +397,7 @@ private:
|
||||||
int _docColorId = -1;
|
int _docColorId = -1;
|
||||||
|
|
||||||
// For backup system
|
// For backup system
|
||||||
generic_string _backupFileName;
|
std::wstring _backupFileName;
|
||||||
bool _isModified = false;
|
bool _isModified = false;
|
||||||
bool _isLoadedDirty = false; // it's the indicator for finding buffer's initial state
|
bool _isLoadedDirty = false; // it's the indicator for finding buffer's initial state
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ GlobalMappers & globalMappper()
|
||||||
return gm;
|
return gm;
|
||||||
}
|
}
|
||||||
|
|
||||||
void convertTo(TCHAR *dest, int destLen, const TCHAR *toConvert, const TCHAR *prefix)
|
void convertTo(wchar_t *dest, int destLen, const wchar_t *toConvert, const wchar_t *prefix)
|
||||||
{
|
{
|
||||||
bool inGroup = false;
|
bool inGroup = false;
|
||||||
int index = lstrlen(dest);
|
int index = lstrlen(dest);
|
||||||
|
@ -154,7 +154,7 @@ intptr_t CALLBACK FolderStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, LP
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
_pageLink.init(_hInst, _hSelf);
|
_pageLink.init(_hInst, _hSelf);
|
||||||
_pageLink.create(::GetDlgItem(_hSelf, IDC_WEB_HELP_LINK), TEXT("https://ivan-radic.github.io/udl-documentation/"));
|
_pageLink.create(::GetDlgItem(_hSelf, IDC_WEB_HELP_LINK), L"https://ivan-radic.github.io/udl-documentation/");
|
||||||
return SharedParametersDialog::run_dlgProc(Message, wParam, lParam);
|
return SharedParametersDialog::run_dlgProc(Message, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ void FolderStyleDialog::updateDlg()
|
||||||
::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_COMMENT_CLOSE_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_COMMENT_CLOSE]));
|
::SendDlgItemMessage(_hSelf, IDC_FOLDER_IN_COMMENT_CLOSE_EDIT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(_pUserLang->_keywordLists[SCE_USER_KWLIST_FOLDERS_IN_COMMENT_CLOSE]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FolderStyleDialog::retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *prefix) const
|
void FolderStyleDialog::retrieve(wchar_t *dest, const wchar_t *toRetrieve, wchar_t *prefix) const
|
||||||
{
|
{
|
||||||
int j = 0;
|
int j = 0;
|
||||||
bool begin2Copy = false;
|
bool begin2Copy = false;
|
||||||
|
@ -276,7 +276,7 @@ intptr_t CALLBACK KeyWordsStyleDialog::run_dlgProc(UINT Message, WPARAM wParam,
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
// extend Keyword edit boxes to hold 128k of TCHARs
|
// extend Keyword edit boxes to hold 128k of wchar_t
|
||||||
::SendMessage(::GetDlgItem(_hSelf,IDC_KEYWORD1_EDIT), EM_LIMITTEXT, WPARAM(128*1024), 0);
|
::SendMessage(::GetDlgItem(_hSelf,IDC_KEYWORD1_EDIT), EM_LIMITTEXT, WPARAM(128*1024), 0);
|
||||||
::SendMessage(::GetDlgItem(_hSelf,IDC_KEYWORD2_EDIT), EM_LIMITTEXT, WPARAM(128*1024), 0);
|
::SendMessage(::GetDlgItem(_hSelf,IDC_KEYWORD2_EDIT), EM_LIMITTEXT, WPARAM(128*1024), 0);
|
||||||
::SendMessage(::GetDlgItem(_hSelf,IDC_KEYWORD3_EDIT), EM_LIMITTEXT, WPARAM(128*1024), 0);
|
::SendMessage(::GetDlgItem(_hSelf,IDC_KEYWORD3_EDIT), EM_LIMITTEXT, WPARAM(128*1024), 0);
|
||||||
|
@ -524,9 +524,9 @@ void CommentStyleDialog::setKeywords2List(int id)
|
||||||
}
|
}
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
TCHAR* newList = new TCHAR[max_char];
|
wchar_t* newList = new wchar_t[max_char];
|
||||||
newList[0] = '\0';
|
newList[0] = '\0';
|
||||||
TCHAR* buffer = new TCHAR[max_char];
|
wchar_t* buffer = new wchar_t[max_char];
|
||||||
buffer[0] = '\0';
|
buffer[0] = '\0';
|
||||||
|
|
||||||
const int list[] = {
|
const int list[] = {
|
||||||
|
@ -537,7 +537,7 @@ void CommentStyleDialog::setKeywords2List(int id)
|
||||||
IDC_COMMENT_CLOSE_EDIT
|
IDC_COMMENT_CLOSE_EDIT
|
||||||
};
|
};
|
||||||
|
|
||||||
TCHAR intBuffer[10] = { '0', 0 };
|
wchar_t intBuffer[10] = { '0', 0 };
|
||||||
for (int i = 0; static_cast<size_t>(i) < sizeof(list) / sizeof(int); ++i)
|
for (int i = 0; static_cast<size_t>(i) < sizeof(list) / sizeof(int); ++i)
|
||||||
{
|
{
|
||||||
_itow(i, intBuffer + 1, 10);
|
_itow(i, intBuffer + 1, 10);
|
||||||
|
@ -551,7 +551,7 @@ void CommentStyleDialog::setKeywords2List(int id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommentStyleDialog::retrieve(TCHAR *dest, const TCHAR *toRetrieve, const TCHAR *prefix) const
|
void CommentStyleDialog::retrieve(wchar_t *dest, const wchar_t *toRetrieve, const wchar_t *prefix) const
|
||||||
{
|
{
|
||||||
int j = 0;
|
int j = 0;
|
||||||
bool begin2Copy = false;
|
bool begin2Copy = false;
|
||||||
|
@ -589,7 +589,7 @@ void CommentStyleDialog::retrieve(TCHAR *dest, const TCHAR *toRetrieve, const TC
|
||||||
|
|
||||||
void CommentStyleDialog::updateDlg()
|
void CommentStyleDialog::updateDlg()
|
||||||
{
|
{
|
||||||
TCHAR* buffer = new TCHAR[max_char];
|
wchar_t* buffer = new wchar_t[max_char];
|
||||||
buffer[0] = '\0';
|
buffer[0] = '\0';
|
||||||
|
|
||||||
const int list[] = {
|
const int list[] = {
|
||||||
|
@ -600,7 +600,7 @@ void CommentStyleDialog::updateDlg()
|
||||||
IDC_COMMENT_CLOSE_EDIT
|
IDC_COMMENT_CLOSE_EDIT
|
||||||
};
|
};
|
||||||
|
|
||||||
TCHAR intBuffer[10] = { '0', 0 };
|
wchar_t intBuffer[10] = { '0', 0 };
|
||||||
for (int i = 0; static_cast<size_t>(i) < sizeof(list) / sizeof(int); ++i)
|
for (int i = 0; static_cast<size_t>(i) < sizeof(list) / sizeof(int); ++i)
|
||||||
{
|
{
|
||||||
_itow(i, intBuffer + 1, 10);
|
_itow(i, intBuffer + 1, 10);
|
||||||
|
@ -631,7 +631,7 @@ void CommentStyleDialog::updateDlg()
|
||||||
|
|
||||||
void SymbolsStyleDialog::updateDlg()
|
void SymbolsStyleDialog::updateDlg()
|
||||||
{
|
{
|
||||||
TCHAR* buffer = new TCHAR[max_char];
|
wchar_t* buffer = new wchar_t[max_char];
|
||||||
buffer[0] = '\0';
|
buffer[0] = '\0';
|
||||||
const int list[] = {
|
const int list[] = {
|
||||||
IDC_DELIMITER1_BOUNDARYOPEN_EDIT,
|
IDC_DELIMITER1_BOUNDARYOPEN_EDIT,
|
||||||
|
@ -659,7 +659,7 @@ void SymbolsStyleDialog::updateDlg()
|
||||||
IDC_DELIMITER8_ESCAPE_EDIT,
|
IDC_DELIMITER8_ESCAPE_EDIT,
|
||||||
IDC_DELIMITER8_BOUNDARYCLOSE_EDIT
|
IDC_DELIMITER8_BOUNDARYCLOSE_EDIT
|
||||||
};
|
};
|
||||||
TCHAR intBuffer[10] = {'0', 0};
|
wchar_t intBuffer[10] = {'0', 0};
|
||||||
|
|
||||||
for (int i = 0; static_cast<size_t>(i) < sizeof(list)/sizeof(int); ++i)
|
for (int i = 0; static_cast<size_t>(i) < sizeof(list)/sizeof(int); ++i)
|
||||||
{
|
{
|
||||||
|
@ -750,7 +750,7 @@ intptr_t CALLBACK SymbolsStyleDialog::run_dlgProc(UINT Message, WPARAM wParam, L
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SymbolsStyleDialog::retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *prefix) const
|
void SymbolsStyleDialog::retrieve(wchar_t *dest, const wchar_t *toRetrieve, wchar_t *prefix) const
|
||||||
{
|
{
|
||||||
int j = 0;
|
int j = 0;
|
||||||
bool begin2Copy = false;
|
bool begin2Copy = false;
|
||||||
|
@ -822,11 +822,11 @@ void SymbolsStyleDialog::setKeywords2List(int id)
|
||||||
case IDC_DELIMITER8_ESCAPE_EDIT :
|
case IDC_DELIMITER8_ESCAPE_EDIT :
|
||||||
case IDC_DELIMITER8_BOUNDARYCLOSE_EDIT :
|
case IDC_DELIMITER8_BOUNDARYCLOSE_EDIT :
|
||||||
{
|
{
|
||||||
TCHAR* newList = new TCHAR[max_char];
|
wchar_t* newList = new wchar_t[max_char];
|
||||||
newList[0] = '\0';
|
newList[0] = '\0';
|
||||||
TCHAR* buffer = new TCHAR[max_char];
|
wchar_t* buffer = new wchar_t[max_char];
|
||||||
buffer[0] = '\0';
|
buffer[0] = '\0';
|
||||||
TCHAR intBuffer[10] = {'0', 0};
|
wchar_t intBuffer[10] = {'0', 0};
|
||||||
|
|
||||||
const int list[] = {
|
const int list[] = {
|
||||||
IDC_DELIMITER1_BOUNDARYOPEN_EDIT,
|
IDC_DELIMITER1_BOUNDARYOPEN_EDIT,
|
||||||
|
@ -916,7 +916,7 @@ void UserDefineDialog::reloadLangCombo()
|
||||||
{
|
{
|
||||||
NppParameters& nppParam = NppParameters::getInstance();
|
NppParameters& nppParam = NppParameters::getInstance();
|
||||||
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_RESETCONTENT, 0, 0);
|
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_RESETCONTENT, 0, 0);
|
||||||
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TEXT("User Defined Language")));
|
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"User Defined Language"));
|
||||||
for (int i = 0, nb = nppParam.getNbUserLang(); i < nb ; ++i)
|
for (int i = 0, nb = nppParam.getNbUserLang(); i < nb ; ++i)
|
||||||
{
|
{
|
||||||
UserLangContainer & userLangContainer = nppParam.getULCFromIndex(i);
|
UserLangContainer & userLangContainer = nppParam.getULCFromIndex(i);
|
||||||
|
@ -935,17 +935,17 @@ void UserDefineDialog::changeStyle()
|
||||||
if (targetNode)
|
if (targetNode)
|
||||||
targetNode = targetNode->FirstChildElement("UserDefine");
|
targetNode = targetNode->FirstChildElement("UserDefine");
|
||||||
}
|
}
|
||||||
generic_string dockButtonLabel;
|
wstring dockButtonLabel;
|
||||||
generic_string defauleLabel;
|
wstring defauleLabel;
|
||||||
string idStr;
|
string idStr;
|
||||||
if (_status == DOCK)
|
if (_status == DOCK)
|
||||||
{
|
{
|
||||||
defauleLabel = TEXT("Undock");
|
defauleLabel = L"Undock";
|
||||||
idStr = std::to_string(IDC_UNDOCK_BUTTON);
|
idStr = std::to_string(IDC_UNDOCK_BUTTON);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
defauleLabel = TEXT("Dock");
|
defauleLabel = L"Dock";
|
||||||
idStr = std::to_string(IDC_DOCK_BUTTON);
|
idStr = std::to_string(IDC_DOCK_BUTTON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -954,7 +954,7 @@ void UserDefineDialog::changeStyle()
|
||||||
|
|
||||||
auto style = ::GetWindowLongPtr(_hSelf, GWL_STYLE);
|
auto style = ::GetWindowLongPtr(_hSelf, GWL_STYLE);
|
||||||
if (!style)
|
if (!style)
|
||||||
::MessageBox(NULL, TEXT("GetWindowLongPtr failed in UserDefineDialog::changeStyle()"), TEXT(""), MB_OK);
|
::MessageBox(NULL, L"GetWindowLongPtr failed in UserDefineDialog::changeStyle()", L"", MB_OK);
|
||||||
|
|
||||||
style = (_status == DOCK)?
|
style = (_status == DOCK)?
|
||||||
((style & ~WS_POPUP) & ~DS_MODALFRAME & ~WS_CAPTION) | WS_CHILD :
|
((style & ~WS_POPUP) & ~DS_MODALFRAME & ~WS_CAPTION) | WS_CHILD :
|
||||||
|
@ -962,7 +962,7 @@ void UserDefineDialog::changeStyle()
|
||||||
|
|
||||||
auto result = ::SetWindowLongPtr(_hSelf, GWL_STYLE, style);
|
auto result = ::SetWindowLongPtr(_hSelf, GWL_STYLE, style);
|
||||||
if (!result)
|
if (!result)
|
||||||
::MessageBox(NULL, TEXT("SetWindowLongPtr failed in UserDefineDialog::changeStyle()"), TEXT(""), MB_OK);
|
::MessageBox(NULL, L"SetWindowLongPtr failed in UserDefineDialog::changeStyle()", L"", MB_OK);
|
||||||
|
|
||||||
if (_status == DOCK)
|
if (_status == DOCK)
|
||||||
getActualPosSize();
|
getActualPosSize();
|
||||||
|
@ -1031,10 +1031,10 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
|
||||||
_symbolsStyleDlg.create(IDD_SYMBOL_STYLE_DLG);
|
_symbolsStyleDlg.create(IDD_SYMBOL_STYLE_DLG);
|
||||||
_symbolsStyleDlg.display(false);
|
_symbolsStyleDlg.display(false);
|
||||||
|
|
||||||
_wVector.push_back(DlgInfo(&_folderStyleDlg, TEXT("Folder && Default")));
|
_wVector.push_back(DlgInfo(&_folderStyleDlg, L"Folder && Default"));
|
||||||
_wVector.push_back(DlgInfo(&_keyWordsStyleDlg, TEXT("Keywords Lists")));
|
_wVector.push_back(DlgInfo(&_keyWordsStyleDlg, L"Keywords Lists"));
|
||||||
_wVector.push_back(DlgInfo(&_commentStyleDlg, TEXT("Comment && Number")));
|
_wVector.push_back(DlgInfo(&_commentStyleDlg, L"Comment && Number"));
|
||||||
_wVector.push_back(DlgInfo(&_symbolsStyleDlg, TEXT("Operators && Delimiters")));
|
_wVector.push_back(DlgInfo(&_symbolsStyleDlg, L"Operators && Delimiters"));
|
||||||
|
|
||||||
_ctrlTab.createTabs(_wVector);
|
_ctrlTab.createTabs(_wVector);
|
||||||
_ctrlTab.display();
|
_ctrlTab.display();
|
||||||
|
@ -1080,14 +1080,14 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
|
||||||
si.nMax = 0;
|
si.nMax = 0;
|
||||||
::SetScrollInfo(_hSelf, SB_VERT, &si, TRUE);
|
::SetScrollInfo(_hSelf, SB_VERT, &si, TRUE);
|
||||||
|
|
||||||
TCHAR temp[32] = { '\0' };
|
wchar_t temp[32] = { '\0' };
|
||||||
generic_string udlVersion = TEXT("User Defined Language v.");
|
wstring udlVersion = L"User Defined Language v.";
|
||||||
udlVersion += _itow(SCE_UDL_VERSION_MAJOR, temp, 10);
|
udlVersion += _itow(SCE_UDL_VERSION_MAJOR, temp, 10);
|
||||||
udlVersion += TEXT(".");
|
udlVersion += L".";
|
||||||
udlVersion += _itow(SCE_UDL_VERSION_MINOR, temp, 10);
|
udlVersion += _itow(SCE_UDL_VERSION_MINOR, temp, 10);
|
||||||
udlVersion += TEXT(".");
|
udlVersion += L".";
|
||||||
udlVersion += _itow(SCE_UDL_VERSION_BUILD, temp, 10);
|
udlVersion += _itow(SCE_UDL_VERSION_BUILD, temp, 10);
|
||||||
udlVersion += TEXT(".");
|
udlVersion += L".";
|
||||||
udlVersion += _itow(SCE_UDL_VERSION_REVISION, temp, 10);
|
udlVersion += _itow(SCE_UDL_VERSION_REVISION, temp, 10);
|
||||||
|
|
||||||
::SetWindowText(_hSelf, udlVersion.c_str());
|
::SetWindowText(_hSelf, udlVersion.c_str());
|
||||||
|
@ -1166,7 +1166,7 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
|
||||||
{
|
{
|
||||||
if (HIWORD(wParam) == EN_CHANGE)
|
if (HIWORD(wParam) == EN_CHANGE)
|
||||||
{
|
{
|
||||||
TCHAR ext[extsLenMax] = { '\0' };
|
wchar_t ext[extsLenMax] = { '\0' };
|
||||||
::SendDlgItemMessage(_hSelf, IDC_EXT_EDIT, WM_GETTEXT, extsLenMax, reinterpret_cast<LPARAM>(ext));
|
::SendDlgItemMessage(_hSelf, IDC_EXT_EDIT, WM_GETTEXT, extsLenMax, reinterpret_cast<LPARAM>(ext));
|
||||||
_pUserLang->_ext = ext;
|
_pUserLang->_ext = ext;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1248,15 +1248,15 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
|
||||||
{
|
{
|
||||||
int result = nppParam.getNativeLangSpeaker()->messageBox("UDLRemoveCurrentLang",
|
int result = nppParam.getNativeLangSpeaker()->messageBox("UDLRemoveCurrentLang",
|
||||||
_hSelf,
|
_hSelf,
|
||||||
TEXT("Are you sure?"),
|
L"Are you sure?",
|
||||||
TEXT("Remove the current language"),
|
L"Remove the current language",
|
||||||
MB_YESNO);
|
MB_YESNO);
|
||||||
|
|
||||||
if (result == IDYES)
|
if (result == IDYES)
|
||||||
{
|
{
|
||||||
auto i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0);
|
auto i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0);
|
||||||
const size_t langNameLen = 256;
|
const size_t langNameLen = 256;
|
||||||
TCHAR langName[langNameLen + 1] = { '\0' };
|
wchar_t langName[langNameLen + 1] = { '\0' };
|
||||||
auto cbTextLen = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXTLEN, i, 0);
|
auto cbTextLen = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXTLEN, i, 0);
|
||||||
if (static_cast<size_t>(cbTextLen) > langNameLen)
|
if (static_cast<size_t>(cbTextLen) > langNameLen)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1285,20 +1285,20 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
|
||||||
{
|
{
|
||||||
auto i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0);
|
auto i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0);
|
||||||
const size_t langNameLen = 256;
|
const size_t langNameLen = 256;
|
||||||
TCHAR langName[langNameLen + 1] = { '\0' };
|
wchar_t langName[langNameLen + 1] = { '\0' };
|
||||||
auto cbTextLen = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXTLEN, i, 0);
|
auto cbTextLen = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXTLEN, i, 0);
|
||||||
if (static_cast<size_t>(cbTextLen) > langNameLen)
|
if (static_cast<size_t>(cbTextLen) > langNameLen)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXT, i, reinterpret_cast<LPARAM>(langName));
|
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXT, i, reinterpret_cast<LPARAM>(langName));
|
||||||
|
|
||||||
generic_string strName = pNativeSpeaker->getLocalizedStrFromID("common-name", TEXT("Name"));
|
wstring strName = pNativeSpeaker->getLocalizedStrFromID("common-name", L"Name");
|
||||||
generic_string strTitle = pNativeSpeaker->getLocalizedStrFromID("userdefined-title-rename", TEXT("Rename Current Language Name"));
|
wstring strTitle = pNativeSpeaker->getLocalizedStrFromID("userdefined-title-rename", L"Rename Current Language Name");
|
||||||
|
|
||||||
StringDlg strDlg;
|
StringDlg strDlg;
|
||||||
strDlg.init(_hInst, _hSelf, strTitle.c_str(), strName.c_str(), langName, langNameLenMax - 1);
|
strDlg.init(_hInst, _hSelf, strTitle.c_str(), strName.c_str(), langName, langNameLenMax - 1);
|
||||||
|
|
||||||
TCHAR *newName = (TCHAR *)strDlg.doDialog();
|
wchar_t *newName = (wchar_t *)strDlg.doDialog();
|
||||||
|
|
||||||
if (newName)
|
if (newName)
|
||||||
{
|
{
|
||||||
|
@ -1306,8 +1306,8 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
|
||||||
{
|
{
|
||||||
nppParam.getNativeLangSpeaker()->messageBox("UDLNewNameError",
|
nppParam.getNativeLangSpeaker()->messageBox("UDLNewNameError",
|
||||||
_hSelf,
|
_hSelf,
|
||||||
TEXT("This name is used by another language,\rplease give another one."),
|
L"This name is used by another language,\rplease give another one.",
|
||||||
TEXT("UDL Error"),
|
L"UDL Error",
|
||||||
MB_OK);
|
MB_OK);
|
||||||
::PostMessage(_hSelf, WM_COMMAND, IDC_RENAME_BUTTON, 0);
|
::PostMessage(_hSelf, WM_COMMAND, IDC_RENAME_BUTTON, 0);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1344,27 +1344,27 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
|
||||||
wParam = IDC_ADDNEW_BUTTON;
|
wParam = IDC_ADDNEW_BUTTON;
|
||||||
|
|
||||||
|
|
||||||
generic_string strName = pNativeSpeaker->getLocalizedStrFromID("common-name", TEXT("Name"));
|
wstring strName = pNativeSpeaker->getLocalizedStrFromID("common-name", L"Name");
|
||||||
generic_string strTitle = (wParam == IDC_SAVEAS_BUTTON) ?
|
wstring strTitle = (wParam == IDC_SAVEAS_BUTTON) ?
|
||||||
pNativeSpeaker->getLocalizedStrFromID("userdefined-title-save", TEXT("Save Current Language Name As...")) :
|
pNativeSpeaker->getLocalizedStrFromID("userdefined-title-save", L"Save Current Language Name As...") :
|
||||||
pNativeSpeaker->getLocalizedStrFromID("userdefined-title-new", TEXT("Create New Language..."));
|
pNativeSpeaker->getLocalizedStrFromID("userdefined-title-new", L"Create New Language...");
|
||||||
|
|
||||||
StringDlg strDlg;
|
StringDlg strDlg;
|
||||||
strDlg.init(_hInst, _hSelf, strTitle.c_str(), strName.c_str(), TEXT(""), langNameLenMax - 1);
|
strDlg.init(_hInst, _hSelf, strTitle.c_str(), strName.c_str(), L"", langNameLenMax - 1);
|
||||||
|
|
||||||
TCHAR *tmpName = reinterpret_cast<TCHAR *>(strDlg.doDialog());
|
wchar_t *tmpName = reinterpret_cast<wchar_t *>(strDlg.doDialog());
|
||||||
|
|
||||||
if (tmpName && tmpName[0])
|
if (tmpName && tmpName[0])
|
||||||
{
|
{
|
||||||
generic_string newNameString(tmpName);
|
wstring newNameString(tmpName);
|
||||||
const TCHAR *newName = newNameString.c_str();
|
const wchar_t *newName = newNameString.c_str();
|
||||||
|
|
||||||
if (nppParam.isExistingUserLangName(newName))
|
if (nppParam.isExistingUserLangName(newName))
|
||||||
{
|
{
|
||||||
pNativeSpeaker->messageBox("UDLNewNameError",
|
pNativeSpeaker->messageBox("UDLNewNameError",
|
||||||
_hSelf,
|
_hSelf,
|
||||||
TEXT("This name is used by another language,\rplease give another one."),
|
L"This name is used by another language,\rplease give another one.",
|
||||||
TEXT("UDL Error"),
|
L"UDL Error",
|
||||||
MB_OK);
|
MB_OK);
|
||||||
::PostMessage(_hSelf, WM_COMMAND, IDC_RENAME_BUTTON, 0);
|
::PostMessage(_hSelf, WM_COMMAND, IDC_RENAME_BUTTON, 0);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1393,8 +1393,8 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
|
||||||
case IDC_IMPORT_BUTTON :
|
case IDC_IMPORT_BUTTON :
|
||||||
{
|
{
|
||||||
CustomFileDialog fDlg(_hSelf);
|
CustomFileDialog fDlg(_hSelf);
|
||||||
fDlg.setExtFilter(TEXT("UDL"), TEXT(".xml"));
|
fDlg.setExtFilter(L"UDL", L".xml");
|
||||||
generic_string sourceFile = fDlg.doOpenSingleFileDlg();
|
wstring sourceFile = fDlg.doOpenSingleFileDlg();
|
||||||
if (sourceFile.empty()) break;
|
if (sourceFile.empty()) break;
|
||||||
|
|
||||||
bool isSuccessful = nppParam.importUDLFromFile(sourceFile);
|
bool isSuccessful = nppParam.importUDLFromFile(sourceFile);
|
||||||
|
@ -1403,11 +1403,11 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
|
||||||
auto i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0);
|
auto i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0);
|
||||||
reloadLangCombo();
|
reloadLangCombo();
|
||||||
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_SETCURSEL, i, 0);
|
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_SETCURSEL, i, 0);
|
||||||
printStr(TEXT("Import successful."));
|
printStr(L"Import successful.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printStr(TEXT("Fail to import."));
|
printStr(L"Fail to import.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1418,14 +1418,14 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
|
||||||
if (i2Export == 0)
|
if (i2Export == 0)
|
||||||
{
|
{
|
||||||
// maybe a better option would be to simply send IDC_SAVEAS_BUTTON message, and display "Save As..." dialog?
|
// maybe a better option would be to simply send IDC_SAVEAS_BUTTON message, and display "Save As..." dialog?
|
||||||
printStr(TEXT("Before exporting, save your language definition by clicking \"Save As...\" button"));
|
printStr(L"Before exporting, save your language definition by clicking \"Save As...\" button");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomFileDialog fDlg(_hSelf);
|
CustomFileDialog fDlg(_hSelf);
|
||||||
fDlg.setExtFilter(TEXT("UDL"), TEXT(".xml"));
|
fDlg.setExtFilter(L"UDL", L".xml");
|
||||||
fDlg.setExtIndex(0); // 0 Default index else file will be saved without extension
|
fDlg.setExtIndex(0); // 0 Default index else file will be saved without extension
|
||||||
generic_string fileName2save = fDlg.doSaveDlg();
|
wstring fileName2save = fDlg.doSaveDlg();
|
||||||
if (fileName2save.empty()) break;
|
if (fileName2save.empty()) break;
|
||||||
|
|
||||||
if (i2Export > 0)
|
if (i2Export > 0)
|
||||||
|
@ -1433,11 +1433,11 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
|
||||||
bool isSuccessful = nppParam.exportUDLToFile(i2Export - 1, fileName2save);
|
bool isSuccessful = nppParam.exportUDLToFile(i2Export - 1, fileName2save);
|
||||||
if (isSuccessful)
|
if (isSuccessful)
|
||||||
{
|
{
|
||||||
printStr(TEXT("Export successful"));
|
printStr(L"Export successful");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printStr(TEXT("Fail to export."));
|
printStr(L"Fail to export.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1590,8 +1590,8 @@ intptr_t CALLBACK StringDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
|
||||||
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
|
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
|
||||||
if (pNativeSpeaker)
|
if (pNativeSpeaker)
|
||||||
{
|
{
|
||||||
generic_string ok = pNativeSpeaker->getLocalizedStrFromID("common-ok", TEXT("OK"));
|
wstring ok = pNativeSpeaker->getLocalizedStrFromID("common-ok", L"OK");
|
||||||
generic_string cancel = pNativeSpeaker->getLocalizedStrFromID("common-cancel", TEXT("Cancel"));
|
wstring cancel = pNativeSpeaker->getLocalizedStrFromID("common-cancel", L"Cancel");
|
||||||
|
|
||||||
::SetDlgItemText(_hSelf, IDOK, ok.c_str());
|
::SetDlgItemText(_hSelf, IDOK, ok.c_str());
|
||||||
::SetDlgItemText(_hSelf, IDCANCEL, cancel.c_str());
|
::SetDlgItemText(_hSelf, IDCANCEL, cancel.c_str());
|
||||||
|
@ -1655,7 +1655,7 @@ intptr_t CALLBACK StringDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
|
||||||
{
|
{
|
||||||
case IDOK :
|
case IDOK :
|
||||||
{
|
{
|
||||||
TCHAR tmpName[langNameLenMax] = { '\0' };
|
wchar_t tmpName[langNameLenMax] = { '\0' };
|
||||||
::GetDlgItemText(_hSelf, IDC_STRING_EDIT, tmpName, langNameLenMax);
|
::GetDlgItemText(_hSelf, IDC_STRING_EDIT, tmpName, langNameLenMax);
|
||||||
_textValue = tmpName;
|
_textValue = tmpName;
|
||||||
::EndDialog(_hSelf, reinterpret_cast<intptr_t>(_textValue.c_str()));
|
::EndDialog(_hSelf, reinterpret_cast<intptr_t>(_textValue.c_str()));
|
||||||
|
@ -1705,7 +1705,7 @@ LRESULT StringDlg::customEditProc(HWND hEdit, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If Key pressed not permitted, then return 0
|
// If Key pressed not permitted, then return 0
|
||||||
if (!pSelf->isAllowed(reinterpret_cast<TCHAR*>(&wParam)))
|
if (!pSelf->isAllowed(reinterpret_cast<wchar_t*>(&wParam)))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1720,7 +1720,7 @@ LRESULT StringDlg::customEditProc(HWND hEdit, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
return CallWindowProc(pSelf->_oldEditProc, hEdit, msg, wParam, lParam);
|
return CallWindowProc(pSelf->_oldEditProc, hEdit, msg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StringDlg::isAllowed([[maybe_unused]] const generic_string & txt)
|
bool StringDlg::isAllowed([[maybe_unused]] const wstring & txt)
|
||||||
{
|
{
|
||||||
#ifndef __MINGW32__
|
#ifndef __MINGW32__
|
||||||
for (auto ch : txt)
|
for (auto ch : txt)
|
||||||
|
@ -1771,7 +1771,7 @@ void StylerDlg::move2CtrlRight(HWND hwndDlg, int ctrlID, HWND handle2Move, int h
|
||||||
|
|
||||||
intptr_t CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
intptr_t CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
StylerDlg * dlg = (StylerDlg *)::GetProp(hwnd, TEXT("Styler dialog prop"));
|
StylerDlg * dlg = (StylerDlg *)::GetProp(hwnd, L"Styler dialog prop");
|
||||||
NppParameters& nppParam = NppParameters::getInstance();
|
NppParameters& nppParam = NppParameters::getInstance();
|
||||||
|
|
||||||
switch (message)
|
switch (message)
|
||||||
|
@ -1784,8 +1784,8 @@ intptr_t CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPA
|
||||||
NativeLangSpeaker *pNativeLangSpeaker = nppParam.getNativeLangSpeaker();
|
NativeLangSpeaker *pNativeLangSpeaker = nppParam.getNativeLangSpeaker();
|
||||||
pNativeLangSpeaker->changeUserDefineLangPopupDlg(hwnd);
|
pNativeLangSpeaker->changeUserDefineLangPopupDlg(hwnd);
|
||||||
|
|
||||||
::SetProp(hwnd, TEXT("Styler dialog prop"), (HANDLE)lParam);
|
::SetProp(hwnd, L"Styler dialog prop", (HANDLE)lParam);
|
||||||
dlg = (StylerDlg *)::GetProp(hwnd, TEXT("Styler dialog prop"));
|
dlg = (StylerDlg *)::GetProp(hwnd, L"Styler dialog prop");
|
||||||
Style & style = SharedParametersDialog::_pUserLang->_styles.getStyler(dlg->_stylerIndex);
|
Style & style = SharedParametersDialog::_pUserLang->_styles.getStyler(dlg->_stylerIndex);
|
||||||
|
|
||||||
// move dialog over UDL GUI (position 0,0 of UDL window) so it wouldn't cover the code
|
// move dialog over UDL GUI (position 0,0 of UDL window) so it wouldn't cover the code
|
||||||
|
@ -1801,14 +1801,14 @@ intptr_t CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPA
|
||||||
|
|
||||||
// for the font size combo
|
// for the font size combo
|
||||||
HWND hFontSizeCombo = ::GetDlgItem(hwnd, IDC_STYLER_COMBO_FONT_SIZE);
|
HWND hFontSizeCombo = ::GetDlgItem(hwnd, IDC_STYLER_COMBO_FONT_SIZE);
|
||||||
for (size_t j = 0 ; j < int(sizeof(fontSizeStrs))/(3*sizeof(TCHAR)) ; ++j)
|
for (size_t j = 0 ; j < int(sizeof(fontSizeStrs))/(3*sizeof(wchar_t)) ; ++j)
|
||||||
::SendMessage(hFontSizeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontSizeStrs[j]));
|
::SendMessage(hFontSizeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontSizeStrs[j]));
|
||||||
|
|
||||||
TCHAR size[10] = { '\0' };
|
wchar_t size[10] = { '\0' };
|
||||||
if (style._fontSize == -1)
|
if (style._fontSize == -1)
|
||||||
size[0] = '\0';
|
size[0] = '\0';
|
||||||
else
|
else
|
||||||
wsprintf(size, TEXT("%d"),style._fontSize);
|
wsprintf(size, L"%d",style._fontSize);
|
||||||
|
|
||||||
auto i = ::SendMessage(hFontSizeCombo, CB_FINDSTRINGEXACT, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(size));
|
auto i = ::SendMessage(hFontSizeCombo, CB_FINDSTRINGEXACT, static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(size));
|
||||||
if (i != CB_ERR)
|
if (i != CB_ERR)
|
||||||
|
@ -1816,7 +1816,7 @@ intptr_t CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPA
|
||||||
|
|
||||||
// for the font name combo
|
// for the font name combo
|
||||||
HWND hFontNameCombo = ::GetDlgItem(hwnd, IDC_STYLER_COMBO_FONT_NAME);
|
HWND hFontNameCombo = ::GetDlgItem(hwnd, IDC_STYLER_COMBO_FONT_NAME);
|
||||||
const std::vector<generic_string> & fontlist = nppParam.getFontList();
|
const std::vector<wstring> & fontlist = nppParam.getFontList();
|
||||||
for (size_t j = 0, len = fontlist.size() ; j < len ; ++j)
|
for (size_t j = 0, len = fontlist.size() ; j < len ; ++j)
|
||||||
{
|
{
|
||||||
auto k = ::SendMessage(hFontNameCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontlist[j].c_str()));
|
auto k = ::SendMessage(hFontNameCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontlist[j].c_str()));
|
||||||
|
@ -1919,7 +1919,7 @@ intptr_t CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPA
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
const size_t intStrLen = 3;
|
const size_t intStrLen = 3;
|
||||||
TCHAR intStr[intStrLen] = { '\0' };
|
wchar_t intStr[intStrLen] = { '\0' };
|
||||||
auto lbTextLen = ::SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETLBTEXTLEN, i, 0);
|
auto lbTextLen = ::SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETLBTEXTLEN, i, 0);
|
||||||
if (static_cast<size_t>(lbTextLen) > intStrLen - 1)
|
if (static_cast<size_t>(lbTextLen) > intStrLen - 1)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1929,7 +1929,7 @@ intptr_t CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPA
|
||||||
style._fontSize = -1;
|
style._fontSize = -1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TCHAR *finStr = nullptr;
|
wchar_t *finStr = nullptr;
|
||||||
style._fontSize = wcstol(intStr, &finStr, 10);
|
style._fontSize = wcstol(intStr, &finStr, 10);
|
||||||
if (*finStr != '\0')
|
if (*finStr != '\0')
|
||||||
style._fontSize = -1;
|
style._fontSize = -1;
|
||||||
|
@ -1942,7 +1942,7 @@ intptr_t CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPA
|
||||||
}
|
}
|
||||||
else if (LOWORD(wParam) == IDC_STYLER_COMBO_FONT_NAME)
|
else if (LOWORD(wParam) == IDC_STYLER_COMBO_FONT_NAME)
|
||||||
{
|
{
|
||||||
style._fontName = (TCHAR *)::SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETITEMDATA, i, 0);
|
style._fontName = (wchar_t *)::SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETITEMDATA, i, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// show changes to user, re-color document
|
// show changes to user, re-color document
|
||||||
|
@ -1960,14 +1960,14 @@ intptr_t CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPA
|
||||||
if (SharedParametersDialog::_pScintilla->getCurrentBuffer()->getLangType() == L_USER)
|
if (SharedParametersDialog::_pScintilla->getCurrentBuffer()->getLangType() == L_USER)
|
||||||
SharedParametersDialog::_pScintilla->styleChange();
|
SharedParametersDialog::_pScintilla->styleChange();
|
||||||
|
|
||||||
::RemoveProp(hwnd, TEXT("Styler dialog prop"));
|
::RemoveProp(hwnd, L"Styler dialog prop");
|
||||||
::EndDialog(hwnd, IDCANCEL);
|
::EndDialog(hwnd, IDCANCEL);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wParam == IDOK)
|
if (wParam == IDOK)
|
||||||
{
|
{
|
||||||
::RemoveProp(hwnd, TEXT("Styler dialog prop"));
|
::RemoveProp(hwnd, L"Styler dialog prop");
|
||||||
::EndDialog(hwnd, IDOK);
|
::EndDialog(hwnd, IDOK);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,14 +37,14 @@ class GlobalMappers
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
std::unordered_map<generic_string, int> keywordIdMapper;
|
std::unordered_map<std::wstring, int> keywordIdMapper;
|
||||||
std::unordered_map<int, generic_string> keywordNameMapper;
|
std::unordered_map<int, std::wstring> keywordNameMapper;
|
||||||
|
|
||||||
std::unordered_map<generic_string, int> styleIdMapper;
|
std::unordered_map<std::wstring, int> styleIdMapper;
|
||||||
std::unordered_map<int, generic_string> styleNameMapper;
|
std::unordered_map<int, std::wstring> styleNameMapper;
|
||||||
|
|
||||||
std::unordered_map<generic_string, int> temp;
|
std::unordered_map<std::wstring, int> temp;
|
||||||
std::unordered_map<generic_string, int>::iterator iter;
|
std::unordered_map<std::wstring, int>::iterator iter;
|
||||||
|
|
||||||
std::unordered_map<int, int> nestingMapper;
|
std::unordered_map<int, int> nestingMapper;
|
||||||
std::unordered_map<int, int> dialogMapper;
|
std::unordered_map<int, int> dialogMapper;
|
||||||
|
@ -54,13 +54,13 @@ class GlobalMappers
|
||||||
GlobalMappers()
|
GlobalMappers()
|
||||||
{
|
{
|
||||||
// pre 2.0
|
// pre 2.0
|
||||||
temp[TEXT("Operators")] = SCE_USER_KWLIST_OPERATORS1;
|
temp[L"Operators"] = SCE_USER_KWLIST_OPERATORS1;
|
||||||
temp[TEXT("Folder+")] = SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN;
|
temp[L"Folder+"] = SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN;
|
||||||
temp[TEXT("Folder-")] = SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE;
|
temp[L"Folder-"] = SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE;
|
||||||
temp[TEXT("Words1")] = SCE_USER_KWLIST_KEYWORDS1;
|
temp[L"Words1"] = SCE_USER_KWLIST_KEYWORDS1;
|
||||||
temp[TEXT("Words2")] = SCE_USER_KWLIST_KEYWORDS2;
|
temp[L"Words2"] = SCE_USER_KWLIST_KEYWORDS2;
|
||||||
temp[TEXT("Words3")] = SCE_USER_KWLIST_KEYWORDS3;
|
temp[L"Words3"] = SCE_USER_KWLIST_KEYWORDS3;
|
||||||
temp[TEXT("Words4")] = SCE_USER_KWLIST_KEYWORDS4;
|
temp[L"Words4"] = SCE_USER_KWLIST_KEYWORDS4;
|
||||||
|
|
||||||
// in case of duplicate entries, newer string should overwrite old one !
|
// in case of duplicate entries, newer string should overwrite old one !
|
||||||
for (iter = temp.begin(); iter != temp.end(); ++iter)
|
for (iter = temp.begin(); iter != temp.end(); ++iter)
|
||||||
|
@ -69,31 +69,31 @@ class GlobalMappers
|
||||||
temp.clear();
|
temp.clear();
|
||||||
|
|
||||||
// 2.0
|
// 2.0
|
||||||
temp[TEXT("Comments")] = SCE_USER_KWLIST_COMMENTS;
|
temp[L"Comments"] = SCE_USER_KWLIST_COMMENTS;
|
||||||
temp[TEXT("Numbers, additional")] = SCE_USER_KWLIST_NUMBER_RANGE;
|
temp[L"Numbers, additional"] = SCE_USER_KWLIST_NUMBER_RANGE;
|
||||||
temp[TEXT("Numbers, prefixes")] = SCE_USER_KWLIST_NUMBER_PREFIX2;
|
temp[L"Numbers, prefixes"] = SCE_USER_KWLIST_NUMBER_PREFIX2;
|
||||||
temp[TEXT("Numbers, extras with prefixes")] = SCE_USER_KWLIST_NUMBER_EXTRAS2;
|
temp[L"Numbers, extras with prefixes"] = SCE_USER_KWLIST_NUMBER_EXTRAS2;
|
||||||
temp[TEXT("Numbers, suffixes")] = SCE_USER_KWLIST_NUMBER_SUFFIX2;
|
temp[L"Numbers, suffixes"] = SCE_USER_KWLIST_NUMBER_SUFFIX2;
|
||||||
temp[TEXT("Operators1")] = SCE_USER_KWLIST_OPERATORS1;
|
temp[L"Operators1"] = SCE_USER_KWLIST_OPERATORS1;
|
||||||
temp[TEXT("Operators2")] = SCE_USER_KWLIST_OPERATORS2;
|
temp[L"Operators2"] = SCE_USER_KWLIST_OPERATORS2;
|
||||||
temp[TEXT("Folders in code1, open")] = SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN;
|
temp[L"Folders in code1, open"] = SCE_USER_KWLIST_FOLDERS_IN_CODE1_OPEN;
|
||||||
temp[TEXT("Folders in code1, middle")] = SCE_USER_KWLIST_FOLDERS_IN_CODE1_MIDDLE;
|
temp[L"Folders in code1, middle"] = SCE_USER_KWLIST_FOLDERS_IN_CODE1_MIDDLE;
|
||||||
temp[TEXT("Folders in code1, close")] = SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE;
|
temp[L"Folders in code1, close"] = SCE_USER_KWLIST_FOLDERS_IN_CODE1_CLOSE;
|
||||||
temp[TEXT("Folders in code2, open")] = SCE_USER_KWLIST_FOLDERS_IN_CODE2_OPEN;
|
temp[L"Folders in code2, open"] = SCE_USER_KWLIST_FOLDERS_IN_CODE2_OPEN;
|
||||||
temp[TEXT("Folders in code2, middle")] = SCE_USER_KWLIST_FOLDERS_IN_CODE2_MIDDLE;
|
temp[L"Folders in code2, middle"] = SCE_USER_KWLIST_FOLDERS_IN_CODE2_MIDDLE;
|
||||||
temp[TEXT("Folders in code2, close")] = SCE_USER_KWLIST_FOLDERS_IN_CODE2_CLOSE;
|
temp[L"Folders in code2, close"] = SCE_USER_KWLIST_FOLDERS_IN_CODE2_CLOSE;
|
||||||
temp[TEXT("Folders in comment, open")] = SCE_USER_KWLIST_FOLDERS_IN_COMMENT_OPEN;
|
temp[L"Folders in comment, open"] = SCE_USER_KWLIST_FOLDERS_IN_COMMENT_OPEN;
|
||||||
temp[TEXT("Folders in comment, middle")] = SCE_USER_KWLIST_FOLDERS_IN_COMMENT_MIDDLE;
|
temp[L"Folders in comment, middle"] = SCE_USER_KWLIST_FOLDERS_IN_COMMENT_MIDDLE;
|
||||||
temp[TEXT("Folders in comment, close")] = SCE_USER_KWLIST_FOLDERS_IN_COMMENT_CLOSE;
|
temp[L"Folders in comment, close"] = SCE_USER_KWLIST_FOLDERS_IN_COMMENT_CLOSE;
|
||||||
temp[TEXT("Keywords1")] = SCE_USER_KWLIST_KEYWORDS1;
|
temp[L"Keywords1"] = SCE_USER_KWLIST_KEYWORDS1;
|
||||||
temp[TEXT("Keywords2")] = SCE_USER_KWLIST_KEYWORDS2;
|
temp[L"Keywords2"] = SCE_USER_KWLIST_KEYWORDS2;
|
||||||
temp[TEXT("Keywords3")] = SCE_USER_KWLIST_KEYWORDS3;
|
temp[L"Keywords3"] = SCE_USER_KWLIST_KEYWORDS3;
|
||||||
temp[TEXT("Keywords4")] = SCE_USER_KWLIST_KEYWORDS4;
|
temp[L"Keywords4"] = SCE_USER_KWLIST_KEYWORDS4;
|
||||||
temp[TEXT("Keywords5")] = SCE_USER_KWLIST_KEYWORDS5;
|
temp[L"Keywords5"] = SCE_USER_KWLIST_KEYWORDS5;
|
||||||
temp[TEXT("Keywords6")] = SCE_USER_KWLIST_KEYWORDS6;
|
temp[L"Keywords6"] = SCE_USER_KWLIST_KEYWORDS6;
|
||||||
temp[TEXT("Keywords7")] = SCE_USER_KWLIST_KEYWORDS7;
|
temp[L"Keywords7"] = SCE_USER_KWLIST_KEYWORDS7;
|
||||||
temp[TEXT("Keywords8")] = SCE_USER_KWLIST_KEYWORDS8;
|
temp[L"Keywords8"] = SCE_USER_KWLIST_KEYWORDS8;
|
||||||
temp[TEXT("Delimiters")] = SCE_USER_KWLIST_DELIMITERS;
|
temp[L"Delimiters"] = SCE_USER_KWLIST_DELIMITERS;
|
||||||
|
|
||||||
// in case of duplicate entries, newer string should overwrite old one !
|
// in case of duplicate entries, newer string should overwrite old one !
|
||||||
for (iter = temp.begin(); iter != temp.end(); ++iter)
|
for (iter = temp.begin(); iter != temp.end(); ++iter)
|
||||||
|
@ -102,13 +102,13 @@ class GlobalMappers
|
||||||
temp.clear();
|
temp.clear();
|
||||||
|
|
||||||
// 2.1
|
// 2.1
|
||||||
temp[TEXT("Numbers, prefix1")] = SCE_USER_KWLIST_NUMBER_PREFIX1;
|
temp[L"Numbers, prefix1"] = SCE_USER_KWLIST_NUMBER_PREFIX1;
|
||||||
temp[TEXT("Numbers, prefix2")] = SCE_USER_KWLIST_NUMBER_PREFIX2;
|
temp[L"Numbers, prefix2"] = SCE_USER_KWLIST_NUMBER_PREFIX2;
|
||||||
temp[TEXT("Numbers, extras1")] = SCE_USER_KWLIST_NUMBER_EXTRAS1;
|
temp[L"Numbers, extras1"] = SCE_USER_KWLIST_NUMBER_EXTRAS1;
|
||||||
temp[TEXT("Numbers, extras2")] = SCE_USER_KWLIST_NUMBER_EXTRAS2;
|
temp[L"Numbers, extras2"] = SCE_USER_KWLIST_NUMBER_EXTRAS2;
|
||||||
temp[TEXT("Numbers, suffix1")] = SCE_USER_KWLIST_NUMBER_SUFFIX1;
|
temp[L"Numbers, suffix1"] = SCE_USER_KWLIST_NUMBER_SUFFIX1;
|
||||||
temp[TEXT("Numbers, suffix2")] = SCE_USER_KWLIST_NUMBER_SUFFIX2;
|
temp[L"Numbers, suffix2"] = SCE_USER_KWLIST_NUMBER_SUFFIX2;
|
||||||
temp[TEXT("Numbers, range")] = SCE_USER_KWLIST_NUMBER_RANGE;
|
temp[L"Numbers, range"] = SCE_USER_KWLIST_NUMBER_RANGE;
|
||||||
|
|
||||||
// in case of duplicate entries, newer string should overwrite old one !
|
// in case of duplicate entries, newer string should overwrite old one !
|
||||||
for (iter = temp.begin(); iter != temp.end(); ++iter)
|
for (iter = temp.begin(); iter != temp.end(); ++iter)
|
||||||
|
@ -117,19 +117,19 @@ class GlobalMappers
|
||||||
temp.clear();
|
temp.clear();
|
||||||
|
|
||||||
// pre 2.0
|
// pre 2.0
|
||||||
temp[TEXT("FOLDEROPEN")] = SCE_USER_STYLE_FOLDER_IN_CODE1;
|
temp[L"FOLDEROPEN"] = SCE_USER_STYLE_FOLDER_IN_CODE1;
|
||||||
temp[TEXT("FOLDERCLOSE")] = SCE_USER_STYLE_FOLDER_IN_CODE1;
|
temp[L"FOLDERCLOSE"] = SCE_USER_STYLE_FOLDER_IN_CODE1;
|
||||||
temp[TEXT("KEYWORD1")] = SCE_USER_STYLE_KEYWORD1;
|
temp[L"KEYWORD1"] = SCE_USER_STYLE_KEYWORD1;
|
||||||
temp[TEXT("KEYWORD2")] = SCE_USER_STYLE_KEYWORD2;
|
temp[L"KEYWORD2"] = SCE_USER_STYLE_KEYWORD2;
|
||||||
temp[TEXT("KEYWORD3")] = SCE_USER_STYLE_KEYWORD3;
|
temp[L"KEYWORD3"] = SCE_USER_STYLE_KEYWORD3;
|
||||||
temp[TEXT("KEYWORD4")] = SCE_USER_STYLE_KEYWORD4;
|
temp[L"KEYWORD4"] = SCE_USER_STYLE_KEYWORD4;
|
||||||
temp[TEXT("COMMENT")] = SCE_USER_STYLE_COMMENT;
|
temp[L"COMMENT"] = SCE_USER_STYLE_COMMENT;
|
||||||
temp[TEXT("COMMENT LINE")] = SCE_USER_STYLE_COMMENTLINE;
|
temp[L"COMMENT LINE"] = SCE_USER_STYLE_COMMENTLINE;
|
||||||
temp[TEXT("NUMBER")] = SCE_USER_STYLE_NUMBER;
|
temp[L"NUMBER"] = SCE_USER_STYLE_NUMBER;
|
||||||
temp[TEXT("OPERATOR")] = SCE_USER_STYLE_OPERATOR;
|
temp[L"OPERATOR"] = SCE_USER_STYLE_OPERATOR;
|
||||||
temp[TEXT("DELIMINER1")] = SCE_USER_STYLE_DELIMITER1;
|
temp[L"DELIMINER1"] = SCE_USER_STYLE_DELIMITER1;
|
||||||
temp[TEXT("DELIMINER2")] = SCE_USER_STYLE_DELIMITER2;
|
temp[L"DELIMINER2"] = SCE_USER_STYLE_DELIMITER2;
|
||||||
temp[TEXT("DELIMINER3")] = SCE_USER_STYLE_DELIMITER3;
|
temp[L"DELIMINER3"] = SCE_USER_STYLE_DELIMITER3;
|
||||||
|
|
||||||
// in case of duplicate entries, newer string should overwrite old one !
|
// in case of duplicate entries, newer string should overwrite old one !
|
||||||
for (iter = temp.begin(); iter != temp.end(); ++iter)
|
for (iter = temp.begin(); iter != temp.end(); ++iter)
|
||||||
|
@ -138,30 +138,30 @@ class GlobalMappers
|
||||||
temp.clear();
|
temp.clear();
|
||||||
|
|
||||||
// post 2.0
|
// post 2.0
|
||||||
temp[TEXT("DEFAULT")] = SCE_USER_STYLE_DEFAULT;
|
temp[L"DEFAULT"] = SCE_USER_STYLE_DEFAULT;
|
||||||
temp[TEXT("COMMENTS")] = SCE_USER_STYLE_COMMENT;
|
temp[L"COMMENTS"] = SCE_USER_STYLE_COMMENT;
|
||||||
temp[TEXT("LINE COMMENTS")] = SCE_USER_STYLE_COMMENTLINE;
|
temp[L"LINE COMMENTS"] = SCE_USER_STYLE_COMMENTLINE;
|
||||||
temp[TEXT("NUMBERS")] = SCE_USER_STYLE_NUMBER;
|
temp[L"NUMBERS"] = SCE_USER_STYLE_NUMBER;
|
||||||
temp[TEXT("KEYWORDS1")] = SCE_USER_STYLE_KEYWORD1;
|
temp[L"KEYWORDS1"] = SCE_USER_STYLE_KEYWORD1;
|
||||||
temp[TEXT("KEYWORDS2")] = SCE_USER_STYLE_KEYWORD2;
|
temp[L"KEYWORDS2"] = SCE_USER_STYLE_KEYWORD2;
|
||||||
temp[TEXT("KEYWORDS3")] = SCE_USER_STYLE_KEYWORD3;
|
temp[L"KEYWORDS3"] = SCE_USER_STYLE_KEYWORD3;
|
||||||
temp[TEXT("KEYWORDS4")] = SCE_USER_STYLE_KEYWORD4;
|
temp[L"KEYWORDS4"] = SCE_USER_STYLE_KEYWORD4;
|
||||||
temp[TEXT("KEYWORDS5")] = SCE_USER_STYLE_KEYWORD5;
|
temp[L"KEYWORDS5"] = SCE_USER_STYLE_KEYWORD5;
|
||||||
temp[TEXT("KEYWORDS6")] = SCE_USER_STYLE_KEYWORD6;
|
temp[L"KEYWORDS6"] = SCE_USER_STYLE_KEYWORD6;
|
||||||
temp[TEXT("KEYWORDS7")] = SCE_USER_STYLE_KEYWORD7;
|
temp[L"KEYWORDS7"] = SCE_USER_STYLE_KEYWORD7;
|
||||||
temp[TEXT("KEYWORDS8")] = SCE_USER_STYLE_KEYWORD8;
|
temp[L"KEYWORDS8"] = SCE_USER_STYLE_KEYWORD8;
|
||||||
temp[TEXT("OPERATORS")] = SCE_USER_STYLE_OPERATOR;
|
temp[L"OPERATORS"] = SCE_USER_STYLE_OPERATOR;
|
||||||
temp[TEXT("FOLDER IN CODE1")] = SCE_USER_STYLE_FOLDER_IN_CODE1;
|
temp[L"FOLDER IN CODE1"] = SCE_USER_STYLE_FOLDER_IN_CODE1;
|
||||||
temp[TEXT("FOLDER IN CODE2")] = SCE_USER_STYLE_FOLDER_IN_CODE2;
|
temp[L"FOLDER IN CODE2"] = SCE_USER_STYLE_FOLDER_IN_CODE2;
|
||||||
temp[TEXT("FOLDER IN COMMENT")] = SCE_USER_STYLE_FOLDER_IN_COMMENT;
|
temp[L"FOLDER IN COMMENT"] = SCE_USER_STYLE_FOLDER_IN_COMMENT;
|
||||||
temp[TEXT("DELIMITERS1")] = SCE_USER_STYLE_DELIMITER1;
|
temp[L"DELIMITERS1"] = SCE_USER_STYLE_DELIMITER1;
|
||||||
temp[TEXT("DELIMITERS2")] = SCE_USER_STYLE_DELIMITER2;
|
temp[L"DELIMITERS2"] = SCE_USER_STYLE_DELIMITER2;
|
||||||
temp[TEXT("DELIMITERS3")] = SCE_USER_STYLE_DELIMITER3;
|
temp[L"DELIMITERS3"] = SCE_USER_STYLE_DELIMITER3;
|
||||||
temp[TEXT("DELIMITERS4")] = SCE_USER_STYLE_DELIMITER4;
|
temp[L"DELIMITERS4"] = SCE_USER_STYLE_DELIMITER4;
|
||||||
temp[TEXT("DELIMITERS5")] = SCE_USER_STYLE_DELIMITER5;
|
temp[L"DELIMITERS5"] = SCE_USER_STYLE_DELIMITER5;
|
||||||
temp[TEXT("DELIMITERS6")] = SCE_USER_STYLE_DELIMITER6;
|
temp[L"DELIMITERS6"] = SCE_USER_STYLE_DELIMITER6;
|
||||||
temp[TEXT("DELIMITERS7")] = SCE_USER_STYLE_DELIMITER7;
|
temp[L"DELIMITERS7"] = SCE_USER_STYLE_DELIMITER7;
|
||||||
temp[TEXT("DELIMITERS8")] = SCE_USER_STYLE_DELIMITER8;
|
temp[L"DELIMITERS8"] = SCE_USER_STYLE_DELIMITER8;
|
||||||
|
|
||||||
// in case of duplicate entries, newer string should overwrite old one !
|
// in case of duplicate entries, newer string should overwrite old one !
|
||||||
for (iter = temp.begin(); iter != temp.end(); ++iter)
|
for (iter = temp.begin(); iter != temp.end(); ++iter)
|
||||||
|
@ -260,7 +260,7 @@ protected :
|
||||||
intptr_t CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) override;
|
intptr_t CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) override;
|
||||||
void setKeywords2List(int ctrlID) override;
|
void setKeywords2List(int ctrlID) override;
|
||||||
private :
|
private :
|
||||||
void retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *prefix) const;
|
void retrieve(wchar_t *dest, const wchar_t *toRetrieve, wchar_t *prefix) const;
|
||||||
URLCtrl _pageLink;
|
URLCtrl _pageLink;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ protected :
|
||||||
intptr_t CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) override;
|
intptr_t CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) override;
|
||||||
void setKeywords2List(int id) override;
|
void setKeywords2List(int id) override;
|
||||||
private :
|
private :
|
||||||
void retrieve(TCHAR *dest, const TCHAR *toRetrieve, const TCHAR *prefix) const;
|
void retrieve(wchar_t *dest, const wchar_t *toRetrieve, const wchar_t *prefix) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SymbolsStyleDialog : public SharedParametersDialog
|
class SymbolsStyleDialog : public SharedParametersDialog
|
||||||
|
@ -295,7 +295,7 @@ protected :
|
||||||
intptr_t CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) override;
|
intptr_t CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) override;
|
||||||
void setKeywords2List(int id) override;
|
void setKeywords2List(int id) override;
|
||||||
private :
|
private :
|
||||||
void retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *prefix) const;
|
void retrieve(wchar_t *dest, const wchar_t *toRetrieve, wchar_t *prefix) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class UserDefineDialog : public SharedParametersDialog
|
class UserDefineDialog : public SharedParametersDialog
|
||||||
|
@ -351,7 +351,7 @@ public :
|
||||||
HWND getSymbolHandle() const {
|
HWND getSymbolHandle() const {
|
||||||
return _symbolsStyleDlg.getHSelf();
|
return _symbolsStyleDlg.getHSelf();
|
||||||
};
|
};
|
||||||
void setTabName(int index, const TCHAR *name2set) {
|
void setTabName(int index, const wchar_t *name2set) {
|
||||||
_ctrlTab.renameTab(index, name2set);
|
_ctrlTab.renameTab(index, name2set);
|
||||||
};
|
};
|
||||||
protected :
|
protected :
|
||||||
|
@ -385,7 +385,7 @@ class StringDlg : public StaticDialog
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
StringDlg() = default;
|
StringDlg() = default;
|
||||||
void init(HINSTANCE hInst, HWND parent, const TCHAR *title, const TCHAR *staticName, const TCHAR *text2Set, int txtLen = 0, const TCHAR* restrictedChars = nullptr, bool bGotoCenter = false) {
|
void init(HINSTANCE hInst, HWND parent, const wchar_t *title, const wchar_t *staticName, const wchar_t *text2Set, int txtLen = 0, const wchar_t* restrictedChars = nullptr, bool bGotoCenter = false) {
|
||||||
Window::init(hInst, parent);
|
Window::init(hInst, parent);
|
||||||
_title = title;
|
_title = title;
|
||||||
_static = staticName;
|
_static = staticName;
|
||||||
|
@ -410,14 +410,14 @@ protected :
|
||||||
// Custom proc to subclass edit control
|
// Custom proc to subclass edit control
|
||||||
LRESULT static CALLBACK customEditProc(HWND hEdit, UINT msg, WPARAM wParam, LPARAM lParam);
|
LRESULT static CALLBACK customEditProc(HWND hEdit, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
bool isAllowed(const generic_string& txt);
|
bool isAllowed(const std::wstring& txt);
|
||||||
void HandlePaste(HWND hEdit);
|
void HandlePaste(HWND hEdit);
|
||||||
|
|
||||||
private :
|
private :
|
||||||
generic_string _title;
|
std::wstring _title;
|
||||||
generic_string _textValue;
|
std::wstring _textValue;
|
||||||
generic_string _static;
|
std::wstring _static;
|
||||||
generic_string _restrictedChars;
|
std::wstring _restrictedChars;
|
||||||
int _txtLen = 0;
|
int _txtLen = 0;
|
||||||
bool _shouldGotoCenter = false;
|
bool _shouldGotoCenter = false;
|
||||||
WNDPROC _oldEditProc = nullptr;
|
WNDPROC _oldEditProc = nullptr;
|
||||||
|
|
|
@ -88,14 +88,14 @@ void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_STRING* outString )
|
||||||
{
|
{
|
||||||
// Easy pass at non-alpha/numeric/symbol
|
// Easy pass at non-alpha/numeric/symbol
|
||||||
// 127 is the delete key. Below 32 is symbolic.
|
// 127 is the delete key. Below 32 is symbolic.
|
||||||
TCHAR buf[32];
|
wchar_t buf[32];
|
||||||
wsprintf( buf, TEXT("&#x%04X;"), static_cast<unsigned int>(c & 0xffff) );
|
wsprintf( buf, L"&#x%04X;", static_cast<unsigned int>(c & 0xffff) );
|
||||||
outString->append( buf, lstrlen( buf ) );
|
outString->append( buf, lstrlen( buf ) );
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TCHAR realc = static_cast<TCHAR>(c);
|
wchar_t realc = static_cast<wchar_t>(c);
|
||||||
outString->append( &realc, 1 );
|
outString->append( &realc, 1 );
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_STRING* outString )
|
||||||
TiXmlBase::StringToBuffer::StringToBuffer( const TIXML_STRING& str )
|
TiXmlBase::StringToBuffer::StringToBuffer( const TIXML_STRING& str )
|
||||||
{
|
{
|
||||||
const size_t strLen = str.length() + 1;
|
const size_t strLen = str.length() + 1;
|
||||||
buffer = new TCHAR[strLen];
|
buffer = new wchar_t[strLen];
|
||||||
if (buffer)
|
if (buffer)
|
||||||
{
|
{
|
||||||
wcscpy_s(buffer, strLen, str.c_str());
|
wcscpy_s(buffer, strLen, str.c_str());
|
||||||
|
@ -294,7 +294,7 @@ bool TiXmlNode::RemoveChild( TiXmlNode* removeThis )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlNode* TiXmlNode::FirstChild( const TCHAR * _value ) const
|
TiXmlNode* TiXmlNode::FirstChild( const wchar_t * _value ) const
|
||||||
{
|
{
|
||||||
TiXmlNode* node;
|
TiXmlNode* node;
|
||||||
for ( node = firstChild; node; node = node->next )
|
for ( node = firstChild; node; node = node->next )
|
||||||
|
@ -305,7 +305,7 @@ TiXmlNode* TiXmlNode::FirstChild( const TCHAR * _value ) const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlNode* TiXmlNode::LastChild( const TCHAR * _value ) const
|
TiXmlNode* TiXmlNode::LastChild( const wchar_t * _value ) const
|
||||||
{
|
{
|
||||||
TiXmlNode* node;
|
TiXmlNode* node;
|
||||||
for ( node = lastChild; node; node = node->prev )
|
for ( node = lastChild; node; node = node->prev )
|
||||||
|
@ -329,7 +329,7 @@ TiXmlNode* TiXmlNode::IterateChildren( TiXmlNode* previous ) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlNode* TiXmlNode::IterateChildren( const TCHAR * val, TiXmlNode* previous ) const
|
TiXmlNode* TiXmlNode::IterateChildren( const wchar_t * val, TiXmlNode* previous ) const
|
||||||
{
|
{
|
||||||
if ( !previous )
|
if ( !previous )
|
||||||
{
|
{
|
||||||
|
@ -342,7 +342,7 @@ TiXmlNode* TiXmlNode::IterateChildren( const TCHAR * val, TiXmlNode* previous )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlNode* TiXmlNode::NextSibling( const TCHAR * _value ) const
|
TiXmlNode* TiXmlNode::NextSibling( const wchar_t * _value ) const
|
||||||
{
|
{
|
||||||
TiXmlNode* node;
|
TiXmlNode* node;
|
||||||
for ( node = next; node; node = node->next )
|
for ( node = next; node; node = node->next )
|
||||||
|
@ -354,7 +354,7 @@ TiXmlNode* TiXmlNode::NextSibling( const TCHAR * _value ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TiXmlNode* TiXmlNode::PreviousSibling( const TCHAR * _value ) const
|
TiXmlNode* TiXmlNode::PreviousSibling( const wchar_t * _value ) const
|
||||||
{
|
{
|
||||||
TiXmlNode* node;
|
TiXmlNode* node;
|
||||||
for ( node = prev; node; node = node->prev )
|
for ( node = prev; node; node = node->prev )
|
||||||
|
@ -365,7 +365,7 @@ TiXmlNode* TiXmlNode::PreviousSibling( const TCHAR * _value ) const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TiXmlElement::RemoveAttribute( const TCHAR * name )
|
void TiXmlElement::RemoveAttribute( const wchar_t * name )
|
||||||
{
|
{
|
||||||
TiXmlAttribute* node = attributeSet.Find( name );
|
TiXmlAttribute* node = attributeSet.Find( name );
|
||||||
if ( node )
|
if ( node )
|
||||||
|
@ -389,7 +389,7 @@ TiXmlElement* TiXmlNode::FirstChildElement() const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlElement* TiXmlNode::FirstChildElement( const TCHAR * _value ) const
|
TiXmlElement* TiXmlNode::FirstChildElement( const wchar_t * _value ) const
|
||||||
{
|
{
|
||||||
TiXmlNode* node;
|
TiXmlNode* node;
|
||||||
|
|
||||||
|
@ -418,7 +418,7 @@ TiXmlElement* TiXmlNode::NextSiblingElement() const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlElement* TiXmlNode::NextSiblingElement( const TCHAR * _value ) const
|
TiXmlElement* TiXmlNode::NextSiblingElement( const wchar_t * _value ) const
|
||||||
{
|
{
|
||||||
TiXmlNode* node;
|
TiXmlNode* node;
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ TiXmlDocument* TiXmlNode::GetDocument() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TiXmlElement::TiXmlElement (const TCHAR * _value)
|
TiXmlElement::TiXmlElement (const wchar_t * _value)
|
||||||
: TiXmlNode( TiXmlNode::ELEMENT )
|
: TiXmlNode( TiXmlNode::ELEMENT )
|
||||||
{
|
{
|
||||||
firstChild = lastChild = 0;
|
firstChild = lastChild = 0;
|
||||||
|
@ -464,7 +464,7 @@ TiXmlElement::~TiXmlElement()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const TCHAR * TiXmlElement::Attribute( const TCHAR * name ) const
|
const wchar_t * TiXmlElement::Attribute( const wchar_t * name ) const
|
||||||
{
|
{
|
||||||
TiXmlAttribute* node = attributeSet.Find( name );
|
TiXmlAttribute* node = attributeSet.Find( name );
|
||||||
|
|
||||||
|
@ -475,9 +475,9 @@ const TCHAR * TiXmlElement::Attribute( const TCHAR * name ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const TCHAR * TiXmlElement::Attribute( const TCHAR * name, int* i ) const
|
const wchar_t * TiXmlElement::Attribute( const wchar_t * name, int* i ) const
|
||||||
{
|
{
|
||||||
const TCHAR * s = Attribute( name );
|
const wchar_t * s = Attribute( name );
|
||||||
if ( i )
|
if ( i )
|
||||||
{
|
{
|
||||||
if ( s )
|
if ( s )
|
||||||
|
@ -489,9 +489,9 @@ const TCHAR * TiXmlElement::Attribute( const TCHAR * name, int* i ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const TCHAR * TiXmlElement::Attribute( const TCHAR * name, double* d ) const
|
const wchar_t * TiXmlElement::Attribute( const wchar_t * name, double* d ) const
|
||||||
{
|
{
|
||||||
const TCHAR * s = Attribute( name );
|
const wchar_t * s = Attribute( name );
|
||||||
if ( d )
|
if ( d )
|
||||||
{
|
{
|
||||||
if ( s )
|
if ( s )
|
||||||
|
@ -503,7 +503,7 @@ const TCHAR * TiXmlElement::Attribute( const TCHAR * name, double* d ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int TiXmlElement::QueryIntAttribute( const TCHAR* name, int* ival ) const
|
int TiXmlElement::QueryIntAttribute( const wchar_t* name, int* ival ) const
|
||||||
{
|
{
|
||||||
TiXmlAttribute* node = attributeSet.Find( name );
|
TiXmlAttribute* node = attributeSet.Find( name );
|
||||||
if ( !node )
|
if ( !node )
|
||||||
|
@ -513,7 +513,7 @@ int TiXmlElement::QueryIntAttribute( const TCHAR* name, int* ival ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int TiXmlElement::QueryDoubleAttribute( const TCHAR* name, double* dval ) const
|
int TiXmlElement::QueryDoubleAttribute( const wchar_t* name, double* dval ) const
|
||||||
{
|
{
|
||||||
TiXmlAttribute* node = attributeSet.Find( name );
|
TiXmlAttribute* node = attributeSet.Find( name );
|
||||||
if ( !node )
|
if ( !node )
|
||||||
|
@ -523,15 +523,15 @@ int TiXmlElement::QueryDoubleAttribute( const TCHAR* name, double* dval ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TiXmlElement::SetAttribute( const TCHAR * name, int val )
|
void TiXmlElement::SetAttribute( const wchar_t * name, int val )
|
||||||
{
|
{
|
||||||
TCHAR buf[64];
|
wchar_t buf[64];
|
||||||
wsprintf( buf, TEXT("%d"), val );
|
wsprintf( buf, L"%d", val );
|
||||||
SetAttribute( name, buf );
|
SetAttribute( name, buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TiXmlElement::SetAttribute( const TCHAR * name, const TCHAR * _value )
|
void TiXmlElement::SetAttribute( const wchar_t * name, const wchar_t * _value )
|
||||||
{
|
{
|
||||||
TiXmlAttribute* node = attributeSet.Find( name );
|
TiXmlAttribute* node = attributeSet.Find( name );
|
||||||
if ( node )
|
if ( node )
|
||||||
|
@ -614,12 +614,12 @@ void TiXmlElement::Print( std::string& outputStream, int depth ) const
|
||||||
|
|
||||||
void TiXmlElement::StreamOut( TIXML_OSTREAM * stream ) const
|
void TiXmlElement::StreamOut( TIXML_OSTREAM * stream ) const
|
||||||
{
|
{
|
||||||
(*stream) << TEXT("<") << value;
|
(*stream) << L"<" << value;
|
||||||
|
|
||||||
TiXmlAttribute* attrib;
|
TiXmlAttribute* attrib;
|
||||||
for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
|
for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
|
||||||
{
|
{
|
||||||
(*stream) << TEXT(" ");
|
(*stream) << L" ";
|
||||||
attrib->StreamOut( stream );
|
attrib->StreamOut( stream );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -628,17 +628,17 @@ void TiXmlElement::StreamOut( TIXML_OSTREAM * stream ) const
|
||||||
TiXmlNode* node;
|
TiXmlNode* node;
|
||||||
if ( firstChild )
|
if ( firstChild )
|
||||||
{
|
{
|
||||||
(*stream) << TEXT(">");
|
(*stream) << L">";
|
||||||
|
|
||||||
for ( node = firstChild; node; node=node->NextSibling() )
|
for ( node = firstChild; node; node=node->NextSibling() )
|
||||||
{
|
{
|
||||||
node->StreamOut( stream );
|
node->StreamOut( stream );
|
||||||
}
|
}
|
||||||
(*stream) << TEXT("</") << value << TEXT(">");
|
(*stream) << L"</" << value << L">";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
(*stream) << TEXT(" />");
|
(*stream) << L" />";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -674,7 +674,7 @@ TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::DOCUMENT )
|
||||||
ClearError();
|
ClearError();
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlDocument::TiXmlDocument( const TCHAR * documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
|
TiXmlDocument::TiXmlDocument( const wchar_t * documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
|
||||||
{
|
{
|
||||||
tabsize = 4;
|
tabsize = 4;
|
||||||
value = documentName;
|
value = documentName;
|
||||||
|
@ -704,7 +704,7 @@ bool TiXmlDocument::SaveFile() const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TiXmlDocument::LoadFile( const TCHAR* filename )
|
bool TiXmlDocument::LoadFile( const wchar_t* filename )
|
||||||
{
|
{
|
||||||
// Delete the existing data:
|
// Delete the existing data:
|
||||||
Clear();
|
Clear();
|
||||||
|
@ -720,7 +720,7 @@ bool TiXmlDocument::LoadFile( const TCHAR* filename )
|
||||||
// Fixed with the StringToBuffer class.
|
// Fixed with the StringToBuffer class.
|
||||||
value = filename;
|
value = filename;
|
||||||
|
|
||||||
FILE* file = _wfopen( value.c_str (), TEXT("r") );
|
FILE* file = _wfopen( value.c_str (), L"r" );
|
||||||
|
|
||||||
if ( file )
|
if ( file )
|
||||||
{
|
{
|
||||||
|
@ -762,11 +762,11 @@ bool TiXmlDocument::LoadFile( const TCHAR* filename )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TiXmlDocument::SaveFile( const TCHAR * filename ) const
|
bool TiXmlDocument::SaveFile( const wchar_t * filename ) const
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
// The old c stuff lives on...
|
// The old c stuff lives on...
|
||||||
FILE* fp = _wfopen( filename, TEXT("wc") );
|
FILE* fp = _wfopen( filename, L"wc") );
|
||||||
if ( fp )
|
if ( fp )
|
||||||
{
|
{
|
||||||
Print( fp, 0 );
|
Print( fp, 0 );
|
||||||
|
@ -886,16 +886,16 @@ void TiXmlAttribute::StreamOut( TIXML_OSTREAM * stream ) const
|
||||||
if (value.find( '\"' ) != TIXML_STRING::npos)
|
if (value.find( '\"' ) != TIXML_STRING::npos)
|
||||||
{
|
{
|
||||||
PutString( name, stream );
|
PutString( name, stream );
|
||||||
(*stream) << TEXT("=") << TEXT("'");
|
(*stream) << L"=" << L"'";
|
||||||
PutString( value, stream );
|
PutString( value, stream );
|
||||||
(*stream) << TEXT("'");
|
(*stream) << L"'";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PutString( name, stream );
|
PutString( name, stream );
|
||||||
(*stream) << TEXT("=") << TEXT("\"");
|
(*stream) << L"=" << L"\"";
|
||||||
PutString( value, stream );
|
PutString( value, stream );
|
||||||
(*stream) << TEXT("\"");
|
(*stream) << L"\"";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -915,15 +915,15 @@ int TiXmlAttribute::QueryDoubleValue( double* dval ) const
|
||||||
|
|
||||||
void TiXmlAttribute::SetIntValue( int _value )
|
void TiXmlAttribute::SetIntValue( int _value )
|
||||||
{
|
{
|
||||||
TCHAR buf [64];
|
wchar_t buf [64];
|
||||||
wsprintf (buf, TEXT("%d"), _value);
|
wsprintf (buf, L"%d", _value);
|
||||||
SetValue (buf);
|
SetValue (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TiXmlAttribute::SetDoubleValue( double _value )
|
void TiXmlAttribute::SetDoubleValue( double _value )
|
||||||
{
|
{
|
||||||
TCHAR buf [64];
|
wchar_t buf [64];
|
||||||
wsprintf (buf, TEXT("%lf"), _value);
|
wsprintf (buf, L"%lf", _value);
|
||||||
SetValue (buf);
|
SetValue (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -952,9 +952,9 @@ void TiXmlComment::Print( std::string& outputStream, int depth ) const
|
||||||
|
|
||||||
void TiXmlComment::StreamOut( TIXML_OSTREAM * stream ) const
|
void TiXmlComment::StreamOut( TIXML_OSTREAM * stream ) const
|
||||||
{
|
{
|
||||||
(*stream) << TEXT("<!--");
|
(*stream) << L"<!--";
|
||||||
PutString( value, stream );
|
PutString( value, stream );
|
||||||
(*stream) << TEXT("-->");
|
(*stream) << L"-->";
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlNode* TiXmlComment::Clone() const
|
TiXmlNode* TiXmlComment::Clone() const
|
||||||
|
@ -987,7 +987,7 @@ void TiXmlText::StreamOut( TIXML_OSTREAM * stream ) const
|
||||||
TiXmlNode* TiXmlText::Clone() const
|
TiXmlNode* TiXmlText::Clone() const
|
||||||
{
|
{
|
||||||
TiXmlText* clone = 0;
|
TiXmlText* clone = 0;
|
||||||
clone = new TiXmlText( TEXT("") );
|
clone = new TiXmlText( L"" );
|
||||||
|
|
||||||
if ( !clone )
|
if ( !clone )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -997,9 +997,9 @@ TiXmlNode* TiXmlText::Clone() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TiXmlDeclaration::TiXmlDeclaration( const TCHAR * _version,
|
TiXmlDeclaration::TiXmlDeclaration( const wchar_t * _version,
|
||||||
const TCHAR * _encoding,
|
const wchar_t * _encoding,
|
||||||
const TCHAR * _standalone )
|
const wchar_t * _standalone )
|
||||||
: TiXmlNode( TiXmlNode::DECLARATION )
|
: TiXmlNode( TiXmlNode::DECLARATION )
|
||||||
{
|
{
|
||||||
version = _version;
|
version = _version;
|
||||||
|
@ -1037,27 +1037,27 @@ void TiXmlDeclaration::Print( std::string& outputStream, int /*depth*/ ) const
|
||||||
|
|
||||||
void TiXmlDeclaration::StreamOut( TIXML_OSTREAM * stream ) const
|
void TiXmlDeclaration::StreamOut( TIXML_OSTREAM * stream ) const
|
||||||
{
|
{
|
||||||
(*stream) << TEXT("<?xml ");
|
(*stream) << L"<?xml ";
|
||||||
|
|
||||||
if ( !version.empty() )
|
if ( !version.empty() )
|
||||||
{
|
{
|
||||||
(*stream) << TEXT("version=\"");
|
(*stream) << L"version=\"";
|
||||||
PutString( version, stream );
|
PutString( version, stream );
|
||||||
(*stream) << TEXT("\" ");
|
(*stream) << L"\" ";
|
||||||
}
|
}
|
||||||
if ( !encoding.empty() )
|
if ( !encoding.empty() )
|
||||||
{
|
{
|
||||||
(*stream) << TEXT("encoding=\"");
|
(*stream) << L"encoding=\"";
|
||||||
PutString( encoding, stream );
|
PutString( encoding, stream );
|
||||||
(*stream ) << TEXT("\" ");
|
(*stream ) << L"\" ";
|
||||||
}
|
}
|
||||||
if ( !standalone.empty() )
|
if ( !standalone.empty() )
|
||||||
{
|
{
|
||||||
(*stream) << TEXT("standalone=\"");
|
(*stream) << L"standalone=\"";
|
||||||
PutString( standalone, stream );
|
PutString( standalone, stream );
|
||||||
(*stream) << TEXT("\" ");
|
(*stream) << L"\" ";
|
||||||
}
|
}
|
||||||
(*stream) << TEXT("?>");
|
(*stream) << L"?>";
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlNode* TiXmlDeclaration::Clone() const
|
TiXmlNode* TiXmlDeclaration::Clone() const
|
||||||
|
@ -1085,7 +1085,7 @@ void TiXmlUnknown::Print( std::string& outputStream, int depth ) const
|
||||||
|
|
||||||
void TiXmlUnknown::StreamOut( TIXML_OSTREAM * stream ) const
|
void TiXmlUnknown::StreamOut( TIXML_OSTREAM * stream ) const
|
||||||
{
|
{
|
||||||
(*stream) << TEXT("<") << value << TEXT(">"); // Don't use entities hear! It is unknown.
|
(*stream) << L"<" << value << L">"; // Don't use entities hear! It is unknown.
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlNode* TiXmlUnknown::Clone() const
|
TiXmlNode* TiXmlUnknown::Clone() const
|
||||||
|
@ -1143,7 +1143,7 @@ void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe )
|
||||||
assert( 0 ); // we tried to remove a non-linked attribute.
|
assert( 0 ); // we tried to remove a non-linked attribute.
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlAttribute* TiXmlAttributeSet::Find( const TCHAR * name ) const
|
TiXmlAttribute* TiXmlAttributeSet::Find( const wchar_t * name ) const
|
||||||
{
|
{
|
||||||
TiXmlAttribute* node;
|
TiXmlAttribute* node;
|
||||||
|
|
||||||
|
@ -1177,11 +1177,11 @@ TIXML_OSTREAM & operator<< (TIXML_OSTREAM & out, const TiXmlNode & base)
|
||||||
|
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
generic_string & operator<< (generic_string& out, const TiXmlNode& base )
|
std::wstring & operator<< (std::wstring& out, const TiXmlNode& base )
|
||||||
{
|
{
|
||||||
|
|
||||||
//std::ostringstream os_stream( std::ostringstream::out );
|
//std::ostringstream os_stream( std::ostringstream::out );
|
||||||
std::basic_ostringstream<TCHAR> os_stream( std::ostringstream::out );
|
std::basic_ostringstream<wchar_t> os_stream( std::ostringstream::out );
|
||||||
base.StreamOut( &os_stream );
|
base.StreamOut( &os_stream );
|
||||||
|
|
||||||
out.append( os_stream.str() );
|
out.append( os_stream.str() );
|
||||||
|
@ -1202,7 +1202,7 @@ TiXmlHandle TiXmlHandle::FirstChild() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TiXmlHandle TiXmlHandle::FirstChild( const TCHAR * value ) const
|
TiXmlHandle TiXmlHandle::FirstChild( const wchar_t * value ) const
|
||||||
{
|
{
|
||||||
if ( node )
|
if ( node )
|
||||||
{
|
{
|
||||||
|
@ -1226,7 +1226,7 @@ TiXmlHandle TiXmlHandle::FirstChildElement() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TiXmlHandle TiXmlHandle::FirstChildElement( const TCHAR * value ) const
|
TiXmlHandle TiXmlHandle::FirstChildElement( const wchar_t * value ) const
|
||||||
{
|
{
|
||||||
if ( node )
|
if ( node )
|
||||||
{
|
{
|
||||||
|
@ -1256,7 +1256,7 @@ TiXmlHandle TiXmlHandle::Child( int count ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TiXmlHandle TiXmlHandle::Child( const TCHAR* value, int count ) const
|
TiXmlHandle TiXmlHandle::Child( const wchar_t* value, int count ) const
|
||||||
{
|
{
|
||||||
if ( node )
|
if ( node )
|
||||||
{
|
{
|
||||||
|
@ -1294,7 +1294,7 @@ TiXmlHandle TiXmlHandle::ChildElement( int count ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TiXmlHandle TiXmlHandle::ChildElement( const TCHAR* value, int count ) const
|
TiXmlHandle TiXmlHandle::ChildElement( const wchar_t* value, int count ) const
|
||||||
{
|
{
|
||||||
if ( node )
|
if ( node )
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,9 +47,9 @@ distribution.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
#define TIXML_STRING generic_string
|
#define TIXML_STRING std::wstring
|
||||||
#define TIXML_ISTREAM std::basic_istream<TCHAR>
|
#define TIXML_ISTREAM std::basic_istream<wchar_t>
|
||||||
#define TIXML_OSTREAM std::basic_ostream<TCHAR>
|
#define TIXML_OSTREAM std::basic_ostream<wchar_t>
|
||||||
#else
|
#else
|
||||||
#include "tinystr.h"
|
#include "tinystr.h"
|
||||||
#define TIXML_STRING TiXmlString
|
#define TIXML_STRING TiXmlString
|
||||||
|
@ -174,11 +174,11 @@ protected:
|
||||||
public:
|
public:
|
||||||
StringToBuffer( const TIXML_STRING& str );
|
StringToBuffer( const TIXML_STRING& str );
|
||||||
~StringToBuffer();
|
~StringToBuffer();
|
||||||
TCHAR* buffer;
|
wchar_t* buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const TCHAR* SkipWhiteSpace( const TCHAR* );
|
static const wchar_t* SkipWhiteSpace( const wchar_t* );
|
||||||
inline static bool IsWhiteSpace( int c ) { return ( _istspace( static_cast<TCHAR>(c) ) || c == '\n' || c == '\r' ); }
|
inline static bool IsWhiteSpace( int c ) { return ( _istspace( static_cast<wchar_t>(c) ) || c == '\n' || c == '\r' ); }
|
||||||
|
|
||||||
virtual void StreamOut (TIXML_OSTREAM *) const = 0;
|
virtual void StreamOut (TIXML_OSTREAM *) const = 0;
|
||||||
|
|
||||||
|
@ -187,28 +187,28 @@ protected:
|
||||||
static bool StreamTo( TIXML_ISTREAM * in, int character, TIXML_STRING * tag );
|
static bool StreamTo( TIXML_ISTREAM * in, int character, TIXML_STRING * tag );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Reads an XML name into the generic_string provided. Returns
|
/* Reads an XML name into the std::wstring provided. Returns
|
||||||
a pointer just past the last character of the name,
|
a pointer just past the last character of the name,
|
||||||
or 0 if the function has an error.
|
or 0 if the function has an error.
|
||||||
*/
|
*/
|
||||||
static const TCHAR* ReadName( const TCHAR* p, TIXML_STRING* name );
|
static const wchar_t* ReadName( const wchar_t* p, TIXML_STRING* name );
|
||||||
|
|
||||||
/* Reads text. Returns a pointer past the given end tag.
|
/* Reads text. Returns a pointer past the given end tag.
|
||||||
Wickedly complex options, but it keeps the (sensitive) code in one place.
|
Wickedly complex options, but it keeps the (sensitive) code in one place.
|
||||||
*/
|
*/
|
||||||
static const TCHAR* ReadText( const TCHAR* in, // where to start
|
static const wchar_t* ReadText( const wchar_t* in, // where to start
|
||||||
TIXML_STRING* text, // the generic_string read
|
TIXML_STRING* text, // the std::wstring read
|
||||||
bool ignoreWhiteSpace, // whether to keep the white space
|
bool ignoreWhiteSpace, // whether to keep the white space
|
||||||
const TCHAR* endTag, // what ends this text
|
const wchar_t* endTag, // what ends this text
|
||||||
bool ignoreCase ); // whether to ignore case in the end tag
|
bool ignoreCase ); // whether to ignore case in the end tag
|
||||||
|
|
||||||
virtual const TCHAR* Parse( const TCHAR* p, TiXmlParsingData* data ) = 0;
|
virtual const wchar_t* Parse( const wchar_t* p, TiXmlParsingData* data ) = 0;
|
||||||
|
|
||||||
// If an entity has been found, transform it into a character.
|
// If an entity has been found, transform it into a character.
|
||||||
static const TCHAR* GetEntity( const TCHAR* in, TCHAR* value );
|
static const wchar_t* GetEntity( const wchar_t* in, wchar_t* value );
|
||||||
|
|
||||||
// Get a character, while interpreting entities.
|
// Get a character, while interpreting entities.
|
||||||
inline static const TCHAR* GetChar( const TCHAR* p, TCHAR* _value )
|
inline static const wchar_t* GetChar( const wchar_t* p, wchar_t* _value )
|
||||||
{
|
{
|
||||||
assert( p );
|
assert( p );
|
||||||
if ( *p == '&' )
|
if ( *p == '&' )
|
||||||
|
@ -222,15 +222,15 @@ protected:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Puts a generic_string to a stream, expanding entities as it goes.
|
// Puts a std::wstring to a stream, expanding entities as it goes.
|
||||||
// Note this should not contian the '<', '>', etc, or they will be transformed into entities!
|
// Note this should not contian the '<', '>', etc, or they will be transformed into entities!
|
||||||
static void PutString( const TIXML_STRING& str, TIXML_OSTREAM* out );
|
static void PutString( const TIXML_STRING& str, TIXML_OSTREAM* out );
|
||||||
|
|
||||||
static void PutString( const TIXML_STRING& str, TIXML_STRING* out );
|
static void PutString( const TIXML_STRING& str, TIXML_STRING* out );
|
||||||
|
|
||||||
// Return true if the next characters in the stream are any of the endTag sequences.
|
// Return true if the next characters in the stream are any of the endTag sequences.
|
||||||
static bool StringEqual( const TCHAR* p,
|
static bool StringEqual( const wchar_t* p,
|
||||||
const TCHAR* endTag,
|
const wchar_t* endTag,
|
||||||
bool ignoreCase );
|
bool ignoreCase );
|
||||||
|
|
||||||
|
|
||||||
|
@ -253,16 +253,16 @@ protected:
|
||||||
|
|
||||||
TIXML_ERROR_STRING_COUNT
|
TIXML_ERROR_STRING_COUNT
|
||||||
};
|
};
|
||||||
static const TCHAR* errorString[ TIXML_ERROR_STRING_COUNT ];
|
static const wchar_t* errorString[ TIXML_ERROR_STRING_COUNT ];
|
||||||
|
|
||||||
TiXmlCursor location;
|
TiXmlCursor location;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Entity
|
struct Entity
|
||||||
{
|
{
|
||||||
const TCHAR* str;
|
const wchar_t* str;
|
||||||
unsigned int strLength;
|
unsigned int strLength;
|
||||||
TCHAR chr;
|
wchar_t chr;
|
||||||
};
|
};
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -292,7 +292,7 @@ public:
|
||||||
/** An input stream operator, for every class. Tolerant of newlines and
|
/** An input stream operator, for every class. Tolerant of newlines and
|
||||||
formatting, but doesn't expect them.
|
formatting, but doesn't expect them.
|
||||||
*/
|
*/
|
||||||
friend std::basic_istream<TCHAR>& operator >> (std::basic_istream<TCHAR>& in, TiXmlNode& base);
|
friend std::basic_istream<wchar_t>& operator >> (std::basic_istream<wchar_t>& in, TiXmlNode& base);
|
||||||
|
|
||||||
/** An output stream operator, for every class. Note that this outputs
|
/** An output stream operator, for every class. Note that this outputs
|
||||||
without any newlines or formatting, as opposed to Print(), which
|
without any newlines or formatting, as opposed to Print(), which
|
||||||
|
@ -310,10 +310,10 @@ public:
|
||||||
A TiXmlDocument will read nodes until it reads a root element, and
|
A TiXmlDocument will read nodes until it reads a root element, and
|
||||||
all the children of that root element.
|
all the children of that root element.
|
||||||
*/
|
*/
|
||||||
friend std::basic_ostream<TCHAR>& operator<< (std::basic_ostream<TCHAR>& out, const TiXmlNode& base);
|
friend std::basic_ostream<wchar_t>& operator<< (std::basic_ostream<wchar_t>& out, const TiXmlNode& base);
|
||||||
|
|
||||||
/// Appends the XML node or attribute to a string.
|
/// Appends the XML node or attribute to a string.
|
||||||
friend generic_string& operator<< (generic_string& out, const TiXmlNode& base );
|
friend std::wstring& operator<< (std::wstring& out, const TiXmlNode& base );
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// Used internally, not part of the public API.
|
// Used internally, not part of the public API.
|
||||||
|
@ -343,12 +343,12 @@ public:
|
||||||
Element: name of the element
|
Element: name of the element
|
||||||
Comment: the comment text
|
Comment: the comment text
|
||||||
Unknown: the tag contents
|
Unknown: the tag contents
|
||||||
Text: the text generic_string
|
Text: the text std::wstring
|
||||||
@endverbatim
|
@endverbatim
|
||||||
|
|
||||||
The subclasses will wrap this function.
|
The subclasses will wrap this function.
|
||||||
*/
|
*/
|
||||||
const TCHAR * Value() const { return value.c_str (); }
|
const wchar_t * Value() const { return value.c_str (); }
|
||||||
|
|
||||||
/** Changes the value of the node. Defined as:
|
/** Changes the value of the node. Defined as:
|
||||||
@verbatim
|
@verbatim
|
||||||
|
@ -356,14 +356,14 @@ public:
|
||||||
Element: name of the element
|
Element: name of the element
|
||||||
Comment: the comment text
|
Comment: the comment text
|
||||||
Unknown: the tag contents
|
Unknown: the tag contents
|
||||||
Text: the text generic_string
|
Text: the text std::wstring
|
||||||
@endverbatim
|
@endverbatim
|
||||||
*/
|
*/
|
||||||
void SetValue(const TCHAR * _value) { value = _value;}
|
void SetValue(const wchar_t * _value) { value = _value;}
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
/// STL string form.
|
/// STL string form.
|
||||||
void SetValue( const generic_string& _value )
|
void SetValue( const std::wstring& _value )
|
||||||
{
|
{
|
||||||
StringToBuffer buf( _value );
|
StringToBuffer buf( _value );
|
||||||
SetValue( buf.buffer ? buf.buffer : TEXT("") );
|
SetValue( buf.buffer ? buf.buffer : TEXT("") );
|
||||||
|
@ -377,14 +377,14 @@ public:
|
||||||
TiXmlNode* Parent() const { return parent; }
|
TiXmlNode* Parent() const { return parent; }
|
||||||
|
|
||||||
TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children.
|
TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children.
|
||||||
TiXmlNode* FirstChild( const TCHAR * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found.
|
TiXmlNode* FirstChild( const wchar_t * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found.
|
||||||
|
|
||||||
TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children.
|
TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children.
|
||||||
TiXmlNode* LastChild( const TCHAR * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children.
|
TiXmlNode* LastChild( const wchar_t * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children.
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
TiXmlNode* FirstChild( const generic_string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::generic_string form.
|
TiXmlNode* FirstChild( const std::wstring& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::std::wstring form.
|
||||||
TiXmlNode* LastChild( const generic_string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::generic_string form.
|
TiXmlNode* LastChild( const std::wstring& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::std::wstring form.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** An alternate way to walk the children of a node.
|
/** An alternate way to walk the children of a node.
|
||||||
|
@ -406,10 +406,10 @@ public:
|
||||||
TiXmlNode* IterateChildren( TiXmlNode* previous ) const;
|
TiXmlNode* IterateChildren( TiXmlNode* previous ) const;
|
||||||
|
|
||||||
/// This flavor of IterateChildren searches for children with a particular 'value'
|
/// This flavor of IterateChildren searches for children with a particular 'value'
|
||||||
TiXmlNode* IterateChildren( const TCHAR * value, TiXmlNode* previous ) const;
|
TiXmlNode* IterateChildren( const wchar_t * value, TiXmlNode* previous ) const;
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
TiXmlNode* IterateChildren( const generic_string& _value, TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::generic_string form.
|
TiXmlNode* IterateChildren( const std::wstring& _value, TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::std::wstring form.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Add a new node related to this. Adds a child past the LastChild.
|
/** Add a new node related to this. Adds a child past the LastChild.
|
||||||
|
@ -451,18 +451,18 @@ public:
|
||||||
TiXmlNode* PreviousSibling() const { return prev; }
|
TiXmlNode* PreviousSibling() const { return prev; }
|
||||||
|
|
||||||
/// Navigate to a sibling node.
|
/// Navigate to a sibling node.
|
||||||
TiXmlNode* PreviousSibling( const TCHAR * ) const;
|
TiXmlNode* PreviousSibling( const wchar_t * ) const;
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
TiXmlNode* PreviousSibling( const generic_string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::generic_string form.
|
TiXmlNode* PreviousSibling( const std::wstring& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::std::wstring form.
|
||||||
TiXmlNode* NextSibling( const generic_string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::generic_string form.
|
TiXmlNode* NextSibling( const std::wstring& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::std::wstring form.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Navigate to a sibling node.
|
/// Navigate to a sibling node.
|
||||||
TiXmlNode* NextSibling() const { return next; }
|
TiXmlNode* NextSibling() const { return next; }
|
||||||
|
|
||||||
/// Navigate to a sibling node with the given 'value'.
|
/// Navigate to a sibling node with the given 'value'.
|
||||||
TiXmlNode* NextSibling( const TCHAR * ) const;
|
TiXmlNode* NextSibling( const wchar_t * ) const;
|
||||||
|
|
||||||
/** Convenience function to get through elements.
|
/** Convenience function to get through elements.
|
||||||
Calls NextSibling and ToElement. Will skip all non-Element
|
Calls NextSibling and ToElement. Will skip all non-Element
|
||||||
|
@ -474,20 +474,20 @@ public:
|
||||||
Calls NextSibling and ToElement. Will skip all non-Element
|
Calls NextSibling and ToElement. Will skip all non-Element
|
||||||
nodes. Returns 0 if there is not another element.
|
nodes. Returns 0 if there is not another element.
|
||||||
*/
|
*/
|
||||||
TiXmlElement* NextSiblingElement( const TCHAR * ) const;
|
TiXmlElement* NextSiblingElement( const wchar_t * ) const;
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
TiXmlElement* NextSiblingElement( const generic_string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::generic_string form.
|
TiXmlElement* NextSiblingElement( const std::wstring& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::std::wstring form.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Convenience function to get through elements.
|
/// Convenience function to get through elements.
|
||||||
TiXmlElement* FirstChildElement() const;
|
TiXmlElement* FirstChildElement() const;
|
||||||
|
|
||||||
/// Convenience function to get through elements.
|
/// Convenience function to get through elements.
|
||||||
TiXmlElement* FirstChildElement( const TCHAR * value ) const;
|
TiXmlElement* FirstChildElement( const wchar_t * value ) const;
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
TiXmlElement* FirstChildElement( const generic_string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::generic_string form.
|
TiXmlElement* FirstChildElement( const std::wstring& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::std::wstring form.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Query the type (as an enumerated value, above) of this node.
|
/** Query the type (as an enumerated value, above) of this node.
|
||||||
|
@ -525,7 +525,7 @@ protected:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Figure out what is at *p, and parse it. Returns null if it is not an xml node.
|
// Figure out what is at *p, and parse it. Returns null if it is not an xml node.
|
||||||
TiXmlNode* Identify( const TCHAR* start );
|
TiXmlNode* Identify( const wchar_t* start );
|
||||||
void CopyToClone( TiXmlNode* target ) const { target->SetValue (value.c_str() );
|
void CopyToClone( TiXmlNode* target ) const { target->SetValue (value.c_str() );
|
||||||
target->userData = userData; }
|
target->userData = userData; }
|
||||||
|
|
||||||
|
@ -567,7 +567,7 @@ public:
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
/// string constructor.
|
/// string constructor.
|
||||||
TiXmlAttribute( const generic_string& _name, const generic_string& _value )
|
TiXmlAttribute( const std::wstring& _name, const std::wstring& _value )
|
||||||
{
|
{
|
||||||
name = _name;
|
name = _name;
|
||||||
value = _value;
|
value = _value;
|
||||||
|
@ -577,7 +577,7 @@ public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Construct an attribute with a name and value.
|
/// Construct an attribute with a name and value.
|
||||||
TiXmlAttribute( const TCHAR * _name, const TCHAR * _value )
|
TiXmlAttribute( const wchar_t * _name, const wchar_t * _value )
|
||||||
{
|
{
|
||||||
name = _name;
|
name = _name;
|
||||||
value = _value;
|
value = _value;
|
||||||
|
@ -585,12 +585,12 @@ public:
|
||||||
prev = next = 0;
|
prev = next = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TCHAR* Name() const { return name.c_str (); } ///< Return the name of this attribute.
|
const wchar_t* Name() const { return name.c_str (); } ///< Return the name of this attribute.
|
||||||
const TCHAR* Value() const { return value.c_str (); } ///< Return the value of this attribute.
|
const wchar_t* Value() const { return value.c_str (); } ///< Return the value of this attribute.
|
||||||
int IntValue() const; ///< Return the value of this attribute, converted to an integer.
|
int IntValue() const; ///< Return the value of this attribute, converted to an integer.
|
||||||
double DoubleValue() const; ///< Return the value of this attribute, converted to a double.
|
double DoubleValue() const; ///< Return the value of this attribute, converted to a double.
|
||||||
|
|
||||||
/** QueryIntValue examines the value generic_string. It is an alternative to the
|
/** QueryIntValue examines the value std::wstring. It is an alternative to the
|
||||||
IntValue() method with richer error checking.
|
IntValue() method with richer error checking.
|
||||||
If the value is an integer, it is stored in 'value' and
|
If the value is an integer, it is stored in 'value' and
|
||||||
the call returns TIXML_SUCCESS. If it is not
|
the call returns TIXML_SUCCESS. If it is not
|
||||||
|
@ -600,24 +600,24 @@ public:
|
||||||
which is the opposite of almost all other TinyXml calls.
|
which is the opposite of almost all other TinyXml calls.
|
||||||
*/
|
*/
|
||||||
int QueryIntValue( int* value ) const;
|
int QueryIntValue( int* value ) const;
|
||||||
/// QueryDoubleValue examines the value generic_string. See QueryIntValue().
|
/// QueryDoubleValue examines the value std::wstring. See QueryIntValue().
|
||||||
int QueryDoubleValue( double* value ) const;
|
int QueryDoubleValue( double* value ) const;
|
||||||
|
|
||||||
void SetName( const TCHAR* _name ) { name = _name; } ///< Set the name of this attribute.
|
void SetName( const wchar_t* _name ) { name = _name; } ///< Set the name of this attribute.
|
||||||
void SetValue( const TCHAR* _value ) { value = _value; } ///< Set the value.
|
void SetValue( const wchar_t* _value ) { value = _value; } ///< Set the value.
|
||||||
|
|
||||||
void SetIntValue( int value ); ///< Set the value from an integer.
|
void SetIntValue( int value ); ///< Set the value from an integer.
|
||||||
void SetDoubleValue( double value ); ///< Set the value from a double.
|
void SetDoubleValue( double value ); ///< Set the value from a double.
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
/// STL string form.
|
/// STL string form.
|
||||||
void SetName( const generic_string& _name )
|
void SetName( const std::wstring& _name )
|
||||||
{
|
{
|
||||||
StringToBuffer buf( _name );
|
StringToBuffer buf( _name );
|
||||||
SetName ( buf.buffer ? buf.buffer : TEXT("error") );
|
SetName ( buf.buffer ? buf.buffer : TEXT("error") );
|
||||||
}
|
}
|
||||||
/// STL string form.
|
/// STL string form.
|
||||||
void SetValue( const generic_string& _value )
|
void SetValue( const std::wstring& _value )
|
||||||
{
|
{
|
||||||
StringToBuffer buf( _value );
|
StringToBuffer buf( _value );
|
||||||
SetValue( buf.buffer ? buf.buffer : TEXT("error") );
|
SetValue( buf.buffer ? buf.buffer : TEXT("error") );
|
||||||
|
@ -635,9 +635,9 @@ public:
|
||||||
|
|
||||||
/* [internal use]
|
/* [internal use]
|
||||||
Attribtue parsing starts: first letter of the name
|
Attribtue parsing starts: first letter of the name
|
||||||
returns: the next TCHAR after the value end quote
|
returns: the next wchar_t after the value end quote
|
||||||
*/
|
*/
|
||||||
virtual const TCHAR* Parse( const TCHAR* p, TiXmlParsingData* data );
|
virtual const wchar_t* Parse( const wchar_t* p, TiXmlParsingData* data );
|
||||||
|
|
||||||
// [internal use]
|
// [internal use]
|
||||||
virtual void Print( std::string& outputStream, int depth ) const;
|
virtual void Print( std::string& outputStream, int depth ) const;
|
||||||
|
@ -679,7 +679,7 @@ public:
|
||||||
|
|
||||||
TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
|
TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; }
|
||||||
TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
|
TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; }
|
||||||
TiXmlAttribute* Find( const TCHAR * name ) const;
|
TiXmlAttribute* Find( const wchar_t * name ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TiXmlAttribute sentinel;
|
TiXmlAttribute sentinel;
|
||||||
|
@ -694,11 +694,11 @@ class TiXmlElement : public TiXmlNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Construct an element.
|
/// Construct an element.
|
||||||
TiXmlElement (const TCHAR * in_value);
|
TiXmlElement (const wchar_t * in_value);
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
/// string constructor.
|
/// string constructor.
|
||||||
TiXmlElement( const generic_string& _value ) : TiXmlNode( TiXmlNode::ELEMENT )
|
TiXmlElement( const std::wstring& _value ) : TiXmlNode( TiXmlNode::ELEMENT )
|
||||||
{
|
{
|
||||||
firstChild = lastChild = 0;
|
firstChild = lastChild = 0;
|
||||||
value = _value;
|
value = _value;
|
||||||
|
@ -710,7 +710,7 @@ public:
|
||||||
/** Given an attribute name, Attribute() returns the value
|
/** Given an attribute name, Attribute() returns the value
|
||||||
for the attribute of that name, or null if none exists.
|
for the attribute of that name, or null if none exists.
|
||||||
*/
|
*/
|
||||||
const TCHAR* Attribute( const TCHAR* name ) const;
|
const wchar_t* Attribute( const wchar_t* name ) const;
|
||||||
|
|
||||||
/** Given an attribute name, Attribute() returns the value
|
/** Given an attribute name, Attribute() returns the value
|
||||||
for the attribute of that name, or null if none exists.
|
for the attribute of that name, or null if none exists.
|
||||||
|
@ -718,7 +718,7 @@ public:
|
||||||
the integer value will be put in the return 'i', if 'i'
|
the integer value will be put in the return 'i', if 'i'
|
||||||
is non-null.
|
is non-null.
|
||||||
*/
|
*/
|
||||||
const TCHAR* Attribute( const TCHAR* name, int* i ) const;
|
const wchar_t* Attribute( const wchar_t* name, int* i ) const;
|
||||||
|
|
||||||
/** Given an attribute name, Attribute() returns the value
|
/** Given an attribute name, Attribute() returns the value
|
||||||
for the attribute of that name, or null if none exists.
|
for the attribute of that name, or null if none exists.
|
||||||
|
@ -726,7 +726,7 @@ public:
|
||||||
the double value will be put in the return 'd', if 'd'
|
the double value will be put in the return 'd', if 'd'
|
||||||
is non-null.
|
is non-null.
|
||||||
*/
|
*/
|
||||||
const TCHAR* Attribute( const TCHAR* name, double* d ) const;
|
const wchar_t* Attribute( const wchar_t* name, double* d ) const;
|
||||||
|
|
||||||
/** QueryIntAttribute examines the attribute - it is an alternative to the
|
/** QueryIntAttribute examines the attribute - it is an alternative to the
|
||||||
Attribute() method with richer error checking.
|
Attribute() method with richer error checking.
|
||||||
|
@ -735,21 +735,21 @@ public:
|
||||||
an integer, it returns TIXML_WRONG_TYPE. If the attribute
|
an integer, it returns TIXML_WRONG_TYPE. If the attribute
|
||||||
does not exist, then TIXML_NO_ATTRIBUTE is returned.
|
does not exist, then TIXML_NO_ATTRIBUTE is returned.
|
||||||
*/
|
*/
|
||||||
int QueryIntAttribute( const TCHAR* name, int* value ) const;
|
int QueryIntAttribute( const wchar_t* name, int* value ) const;
|
||||||
/// QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
|
/// QueryDoubleAttribute examines the attribute - see QueryIntAttribute().
|
||||||
int QueryDoubleAttribute( const TCHAR* name, double* value ) const;
|
int QueryDoubleAttribute( const wchar_t* name, double* value ) const;
|
||||||
|
|
||||||
/** Sets an attribute of name to a given value. The attribute
|
/** Sets an attribute of name to a given value. The attribute
|
||||||
will be created if it does not exist, or changed if it does.
|
will be created if it does not exist, or changed if it does.
|
||||||
*/
|
*/
|
||||||
void SetAttribute( const TCHAR* name, const TCHAR * value );
|
void SetAttribute( const wchar_t* name, const wchar_t * value );
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
const TCHAR* Attribute( const generic_string& name ) const { return Attribute( name.c_str() ); }
|
const wchar_t* Attribute( const std::wstring& name ) const { return Attribute( name.c_str() ); }
|
||||||
const TCHAR* Attribute( const generic_string& name, int* i ) const { return Attribute( name.c_str(), i ); }
|
const wchar_t* Attribute( const std::wstring& name, int* i ) const { return Attribute( name.c_str(), i ); }
|
||||||
|
|
||||||
/// STL string form.
|
/// STL string form.
|
||||||
void SetAttribute( const generic_string& name, const generic_string& _value )
|
void SetAttribute( const std::wstring& name, const std::wstring& _value )
|
||||||
{
|
{
|
||||||
StringToBuffer n( name );
|
StringToBuffer n( name );
|
||||||
StringToBuffer v( _value );
|
StringToBuffer v( _value );
|
||||||
|
@ -757,7 +757,7 @@ public:
|
||||||
SetAttribute (n.buffer, v.buffer );
|
SetAttribute (n.buffer, v.buffer );
|
||||||
}
|
}
|
||||||
///< STL string form.
|
///< STL string form.
|
||||||
void SetAttribute( const generic_string& name, int _value )
|
void SetAttribute( const std::wstring& name, int _value )
|
||||||
{
|
{
|
||||||
StringToBuffer n( name );
|
StringToBuffer n( name );
|
||||||
if ( n.buffer )
|
if ( n.buffer )
|
||||||
|
@ -768,13 +768,13 @@ public:
|
||||||
/** Sets an attribute of name to a given value. The attribute
|
/** Sets an attribute of name to a given value. The attribute
|
||||||
will be created if it does not exist, or changed if it does.
|
will be created if it does not exist, or changed if it does.
|
||||||
*/
|
*/
|
||||||
void SetAttribute( const TCHAR * name, int value );
|
void SetAttribute( const wchar_t * name, int value );
|
||||||
|
|
||||||
/** Deletes an attribute with the given name.
|
/** Deletes an attribute with the given name.
|
||||||
*/
|
*/
|
||||||
void RemoveAttribute( const TCHAR * name );
|
void RemoveAttribute( const wchar_t * name );
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
void RemoveAttribute( const generic_string& name ) { RemoveAttribute (name.c_str ()); } ///< STL string form.
|
void RemoveAttribute( const std::wstring& name ) { RemoveAttribute (name.c_str ()); } ///< STL string form.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element.
|
TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element.
|
||||||
|
@ -795,16 +795,16 @@ protected:
|
||||||
virtual void StreamOut( TIXML_OSTREAM * out ) const;
|
virtual void StreamOut( TIXML_OSTREAM * out ) const;
|
||||||
|
|
||||||
/* [internal use]
|
/* [internal use]
|
||||||
Attribtue parsing starts: next TCHAR past '<'
|
Attribtue parsing starts: next wchar_t past '<'
|
||||||
returns: next TCHAR past '>'
|
returns: next wchar_t past '>'
|
||||||
*/
|
*/
|
||||||
virtual const TCHAR* Parse( const TCHAR* p, TiXmlParsingData* data );
|
virtual const wchar_t* Parse( const wchar_t* p, TiXmlParsingData* data );
|
||||||
|
|
||||||
/* [internal use]
|
/* [internal use]
|
||||||
Reads the "value" of the element -- another element, or text.
|
Reads the "value" of the element -- another element, or text.
|
||||||
This should terminate with the current end tag.
|
This should terminate with the current end tag.
|
||||||
*/
|
*/
|
||||||
const TCHAR* ReadValue( const TCHAR* in, TiXmlParsingData* prevData );
|
const wchar_t* ReadValue( const wchar_t* in, TiXmlParsingData* prevData );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TiXmlAttributeSet attributeSet;
|
TiXmlAttributeSet attributeSet;
|
||||||
|
@ -832,9 +832,9 @@ protected:
|
||||||
virtual void StreamOut( TIXML_OSTREAM * out ) const;
|
virtual void StreamOut( TIXML_OSTREAM * out ) const;
|
||||||
/* [internal use]
|
/* [internal use]
|
||||||
Attribtue parsing starts: at the ! of the !--
|
Attribtue parsing starts: at the ! of the !--
|
||||||
returns: next TCHAR past '>'
|
returns: next wchar_t past '>'
|
||||||
*/
|
*/
|
||||||
virtual const TCHAR* Parse( const TCHAR* p, TiXmlParsingData* data );
|
virtual const wchar_t* Parse( const wchar_t* p, TiXmlParsingData* data );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -845,7 +845,7 @@ class TiXmlText : public TiXmlNode
|
||||||
friend class TiXmlElement;
|
friend class TiXmlElement;
|
||||||
public:
|
public:
|
||||||
/// Constructor.
|
/// Constructor.
|
||||||
TiXmlText (const TCHAR * initValue) : TiXmlNode (TiXmlNode::TEXT)
|
TiXmlText (const wchar_t * initValue) : TiXmlNode (TiXmlNode::TEXT)
|
||||||
{
|
{
|
||||||
SetValue( initValue );
|
SetValue( initValue );
|
||||||
}
|
}
|
||||||
|
@ -853,7 +853,7 @@ public:
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
/// Constructor.
|
/// Constructor.
|
||||||
TiXmlText( const generic_string& initValue ) : TiXmlNode (TiXmlNode::TEXT)
|
TiXmlText( const std::wstring& initValue ) : TiXmlNode (TiXmlNode::TEXT)
|
||||||
{
|
{
|
||||||
SetValue( initValue );
|
SetValue( initValue );
|
||||||
}
|
}
|
||||||
|
@ -869,10 +869,10 @@ protected :
|
||||||
// [internal use]
|
// [internal use]
|
||||||
bool Blank() const; // returns true if all white space and new lines
|
bool Blank() const; // returns true if all white space and new lines
|
||||||
/* [internal use]
|
/* [internal use]
|
||||||
Attribtue parsing starts: First TCHAR of the text
|
Attribtue parsing starts: First wchar_t of the text
|
||||||
returns: next TCHAR past '>'
|
returns: next wchar_t past '>'
|
||||||
*/
|
*/
|
||||||
virtual const TCHAR* Parse( const TCHAR* p, TiXmlParsingData* data );
|
virtual const wchar_t* Parse( const wchar_t* p, TiXmlParsingData* data );
|
||||||
// [internal use]
|
// [internal use]
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
|
virtual void StreamIn( TIXML_ISTREAM * in, TIXML_STRING * tag );
|
||||||
|
@ -901,9 +901,9 @@ public:
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
/// Constructor.
|
/// Constructor.
|
||||||
TiXmlDeclaration( const generic_string& _version,
|
TiXmlDeclaration( const std::wstring& _version,
|
||||||
const generic_string& _encoding,
|
const std::wstring& _encoding,
|
||||||
const generic_string& _standalone )
|
const std::wstring& _standalone )
|
||||||
: TiXmlNode( TiXmlNode::DECLARATION )
|
: TiXmlNode( TiXmlNode::DECLARATION )
|
||||||
{
|
{
|
||||||
version = _version;
|
version = _version;
|
||||||
|
@ -913,18 +913,18 @@ public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Construct.
|
/// Construct.
|
||||||
TiXmlDeclaration( const TCHAR* _version,
|
TiXmlDeclaration( const wchar_t* _version,
|
||||||
const TCHAR* _encoding,
|
const wchar_t* _encoding,
|
||||||
const TCHAR* _standalone );
|
const wchar_t* _standalone );
|
||||||
|
|
||||||
virtual ~TiXmlDeclaration() {}
|
virtual ~TiXmlDeclaration() {}
|
||||||
|
|
||||||
/// Version. Will return empty if none was found.
|
/// Version. Will return empty if none was found.
|
||||||
const TCHAR * Version() const { return version.c_str (); }
|
const wchar_t * Version() const { return version.c_str (); }
|
||||||
/// Encoding. Will return empty if none was found.
|
/// Encoding. Will return empty if none was found.
|
||||||
const TCHAR * Encoding() const { return encoding.c_str (); }
|
const wchar_t * Encoding() const { return encoding.c_str (); }
|
||||||
/// Is this a standalone document?
|
/// Is this a standalone document?
|
||||||
const TCHAR * Standalone() const { return standalone.c_str (); }
|
const wchar_t * Standalone() const { return standalone.c_str (); }
|
||||||
|
|
||||||
// [internal use] Creates a new Element and returs it.
|
// [internal use] Creates a new Element and returs it.
|
||||||
virtual TiXmlNode* Clone() const;
|
virtual TiXmlNode* Clone() const;
|
||||||
|
@ -938,10 +938,10 @@ protected:
|
||||||
#endif
|
#endif
|
||||||
virtual void StreamOut ( TIXML_OSTREAM * out) const;
|
virtual void StreamOut ( TIXML_OSTREAM * out) const;
|
||||||
// [internal use]
|
// [internal use]
|
||||||
// Attribtue parsing starts: next TCHAR past '<'
|
// Attribtue parsing starts: next wchar_t past '<'
|
||||||
// returns: next TCHAR past '>'
|
// returns: next wchar_t past '>'
|
||||||
|
|
||||||
virtual const TCHAR* Parse( const TCHAR* p, TiXmlParsingData* data );
|
virtual const wchar_t* Parse( const wchar_t* p, TiXmlParsingData* data );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TIXML_STRING version;
|
TIXML_STRING version;
|
||||||
|
@ -971,10 +971,10 @@ protected:
|
||||||
#endif
|
#endif
|
||||||
virtual void StreamOut ( TIXML_OSTREAM * out ) const;
|
virtual void StreamOut ( TIXML_OSTREAM * out ) const;
|
||||||
/* [internal use]
|
/* [internal use]
|
||||||
Attribute parsing starts: First TCHAR of the text
|
Attribute parsing starts: First wchar_t of the text
|
||||||
returns: next TCHAR past '>'
|
returns: next wchar_t past '>'
|
||||||
*/
|
*/
|
||||||
virtual const TCHAR* Parse( const TCHAR* p, TiXmlParsingData* data );
|
virtual const wchar_t* Parse( const wchar_t* p, TiXmlParsingData* data );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -988,11 +988,11 @@ public:
|
||||||
/// Create an empty document, that has no name.
|
/// Create an empty document, that has no name.
|
||||||
TiXmlDocument();
|
TiXmlDocument();
|
||||||
/// Create a document with a name. The name of the document is also the filename of the xml.
|
/// Create a document with a name. The name of the document is also the filename of the xml.
|
||||||
TiXmlDocument( const TCHAR * documentName );
|
TiXmlDocument( const wchar_t * documentName );
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
/// Constructor.
|
/// Constructor.
|
||||||
TiXmlDocument( const generic_string& documentName ) :
|
TiXmlDocument( const std::wstring& documentName ) :
|
||||||
TiXmlNode( TiXmlNode::DOCUMENT )
|
TiXmlNode( TiXmlNode::DOCUMENT )
|
||||||
{
|
{
|
||||||
tabsize = 4;
|
tabsize = 4;
|
||||||
|
@ -1011,17 +1011,17 @@ public:
|
||||||
/// Save a file using the current document value. Returns true if successful.
|
/// Save a file using the current document value. Returns true if successful.
|
||||||
bool SaveFile() const;
|
bool SaveFile() const;
|
||||||
/// Load a file using the given filename. Returns true if successful.
|
/// Load a file using the given filename. Returns true if successful.
|
||||||
bool LoadFile( const TCHAR * filename );
|
bool LoadFile( const wchar_t * filename );
|
||||||
/// Save a file using the given filename. Returns true if successful.
|
/// Save a file using the given filename. Returns true if successful.
|
||||||
bool SaveFile( const TCHAR * filename ) const;
|
bool SaveFile( const wchar_t * filename ) const;
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
bool LoadFile( const generic_string& filename ) ///< STL string version.
|
bool LoadFile( const std::wstring& filename ) ///< STL string version.
|
||||||
{
|
{
|
||||||
StringToBuffer f( filename );
|
StringToBuffer f( filename );
|
||||||
return ( f.buffer && LoadFile( f.buffer ));
|
return ( f.buffer && LoadFile( f.buffer ));
|
||||||
}
|
}
|
||||||
bool SaveFile( const generic_string& filename ) const ///< STL string version.
|
bool SaveFile( const std::wstring& filename ) const ///< STL string version.
|
||||||
{
|
{
|
||||||
StringToBuffer f( filename );
|
StringToBuffer f( filename );
|
||||||
return ( f.buffer && SaveFile( f.buffer ));
|
return ( f.buffer && SaveFile( f.buffer ));
|
||||||
|
@ -1030,7 +1030,7 @@ public:
|
||||||
|
|
||||||
/** Parse the given null terminated block of xml data.
|
/** Parse the given null terminated block of xml data.
|
||||||
*/
|
*/
|
||||||
virtual const TCHAR* Parse( const TCHAR* p, TiXmlParsingData* data = 0 );
|
virtual const wchar_t* Parse( const wchar_t* p, TiXmlParsingData* data = 0 );
|
||||||
|
|
||||||
/** Get the root element -- the only top level element -- of the document.
|
/** Get the root element -- the only top level element -- of the document.
|
||||||
In well formed XML, there should only be one. TinyXml is tolerant of
|
In well formed XML, there should only be one. TinyXml is tolerant of
|
||||||
|
@ -1046,9 +1046,9 @@ public:
|
||||||
bool Error() const { return error; }
|
bool Error() const { return error; }
|
||||||
|
|
||||||
/// Contains a textual (english) description of the error if one occurs.
|
/// Contains a textual (english) description of the error if one occurs.
|
||||||
const TCHAR * ErrorDesc() const { return errorDesc.c_str (); }
|
const wchar_t * ErrorDesc() const { return errorDesc.c_str (); }
|
||||||
|
|
||||||
/** Generally, you probably want the error generic_string ( ErrorDesc() ). But if you
|
/** Generally, you probably want the error std::wstring ( ErrorDesc() ). But if you
|
||||||
prefer the ErrorId, this function will fetch it.
|
prefer the ErrorId, this function will fetch it.
|
||||||
*/
|
*/
|
||||||
int ErrorId() const { return errorId; }
|
int ErrorId() const { return errorId; }
|
||||||
|
@ -1103,7 +1103,7 @@ public:
|
||||||
// [internal use]
|
// [internal use]
|
||||||
virtual void Print( std::string& outputStream, int depth = 0 ) const;
|
virtual void Print( std::string& outputStream, int depth = 0 ) const;
|
||||||
// [internal use]
|
// [internal use]
|
||||||
void SetError( int err, const TCHAR* errorLocation, TiXmlParsingData* prevData );
|
void SetError( int err, const wchar_t* errorLocation, TiXmlParsingData* prevData );
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
virtual void StreamOut ( TIXML_OSTREAM * out) const;
|
virtual void StreamOut ( TIXML_OSTREAM * out) const;
|
||||||
|
@ -1213,16 +1213,16 @@ public:
|
||||||
/// Return a handle to the first child node.
|
/// Return a handle to the first child node.
|
||||||
TiXmlHandle FirstChild() const;
|
TiXmlHandle FirstChild() const;
|
||||||
/// Return a handle to the first child node with the given name.
|
/// Return a handle to the first child node with the given name.
|
||||||
TiXmlHandle FirstChild( const TCHAR * value ) const;
|
TiXmlHandle FirstChild( const wchar_t * value ) const;
|
||||||
/// Return a handle to the first child element.
|
/// Return a handle to the first child element.
|
||||||
TiXmlHandle FirstChildElement() const;
|
TiXmlHandle FirstChildElement() const;
|
||||||
/// Return a handle to the first child element with the given name.
|
/// Return a handle to the first child element with the given name.
|
||||||
TiXmlHandle FirstChildElement( const TCHAR * value ) const;
|
TiXmlHandle FirstChildElement( const wchar_t * value ) const;
|
||||||
|
|
||||||
/** Return a handle to the "index" child with the given name.
|
/** Return a handle to the "index" child with the given name.
|
||||||
The first child is 0, the second 1, etc.
|
The first child is 0, the second 1, etc.
|
||||||
*/
|
*/
|
||||||
TiXmlHandle Child( const TCHAR* value, int index ) const;
|
TiXmlHandle Child( const wchar_t* value, int index ) const;
|
||||||
/** Return a handle to the "index" child.
|
/** Return a handle to the "index" child.
|
||||||
The first child is 0, the second 1, etc.
|
The first child is 0, the second 1, etc.
|
||||||
*/
|
*/
|
||||||
|
@ -1231,7 +1231,7 @@ public:
|
||||||
The first child element is 0, the second 1, etc. Note that only TiXmlElements
|
The first child element is 0, the second 1, etc. Note that only TiXmlElements
|
||||||
are indexed: other types are not counted.
|
are indexed: other types are not counted.
|
||||||
*/
|
*/
|
||||||
TiXmlHandle ChildElement( const TCHAR* value, int index ) const;
|
TiXmlHandle ChildElement( const wchar_t* value, int index ) const;
|
||||||
/** Return a handle to the "index" child element.
|
/** Return a handle to the "index" child element.
|
||||||
The first child element is 0, the second 1, etc. Note that only TiXmlElements
|
The first child element is 0, the second 1, etc. Note that only TiXmlElements
|
||||||
are indexed: other types are not counted.
|
are indexed: other types are not counted.
|
||||||
|
@ -1239,11 +1239,11 @@ public:
|
||||||
TiXmlHandle ChildElement( int index ) const;
|
TiXmlHandle ChildElement( int index ) const;
|
||||||
|
|
||||||
#ifdef TIXML_USE_STL
|
#ifdef TIXML_USE_STL
|
||||||
TiXmlHandle FirstChild( const generic_string& _value ) const { return FirstChild( _value.c_str() ); }
|
TiXmlHandle FirstChild( const std::wstring& _value ) const { return FirstChild( _value.c_str() ); }
|
||||||
TiXmlHandle FirstChildElement( const generic_string& _value ) const { return FirstChildElement( _value.c_str() ); }
|
TiXmlHandle FirstChildElement( const std::wstring& _value ) const { return FirstChildElement( _value.c_str() ); }
|
||||||
|
|
||||||
TiXmlHandle Child( const generic_string& _value, int index ) const { return Child( _value.c_str(), index ); }
|
TiXmlHandle Child( const std::wstring& _value, int index ) const { return Child( _value.c_str(), index ); }
|
||||||
TiXmlHandle ChildElement( const generic_string& _value, int index ) const { return ChildElement( _value.c_str(), index ); }
|
TiXmlHandle ChildElement( const std::wstring& _value, int index ) const { return ChildElement( _value.c_str(), index ); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Return the handle as a TiXmlNode. This may return null.
|
/// Return the handle as a TiXmlNode. This may return null.
|
||||||
|
|
|
@ -65,9 +65,9 @@ FileBrowser::~FileBrowser()
|
||||||
_iconListVector.clear();
|
_iconListVector.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<generic_string> split(const generic_string & string2split, TCHAR sep)
|
vector<wstring> split(const wstring & string2split, wchar_t sep)
|
||||||
{
|
{
|
||||||
vector<generic_string> splitedStrings;
|
vector<wstring> splitedStrings;
|
||||||
size_t len = string2split.length();
|
size_t len = string2split.length();
|
||||||
size_t beginPos = 0;
|
size_t beginPos = 0;
|
||||||
for (size_t i = 0; i < len + 1; ++i)
|
for (size_t i = 0; i < len + 1; ++i)
|
||||||
|
@ -81,7 +81,7 @@ vector<generic_string> split(const generic_string & string2split, TCHAR sep)
|
||||||
return splitedStrings;
|
return splitedStrings;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isRelatedRootFolder(const generic_string & relatedRoot, const generic_string & subFolder)
|
bool isRelatedRootFolder(const wstring & relatedRoot, const wstring & subFolder)
|
||||||
{
|
{
|
||||||
if (relatedRoot.empty())
|
if (relatedRoot.empty())
|
||||||
return false;
|
return false;
|
||||||
|
@ -93,8 +93,8 @@ bool isRelatedRootFolder(const generic_string & relatedRoot, const generic_strin
|
||||||
if (pos != 0) // pos == 0 is the necessary condition, but not enough
|
if (pos != 0) // pos == 0 is the necessary condition, but not enough
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
vector<generic_string> relatedRootArray = split(relatedRoot, '\\');
|
vector<wstring> relatedRootArray = split(relatedRoot, '\\');
|
||||||
vector<generic_string> subFolderArray = split(subFolder, '\\');
|
vector<wstring> subFolderArray = split(subFolder, '\\');
|
||||||
|
|
||||||
size_t index2Compare = relatedRootArray.size() - 1;
|
size_t index2Compare = relatedRootArray.size() - 1;
|
||||||
|
|
||||||
|
@ -319,31 +319,31 @@ intptr_t CALLBACK FileBrowser::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
|
||||||
|
|
||||||
case FB_RNFILE:
|
case FB_RNFILE:
|
||||||
{
|
{
|
||||||
const std::vector<generic_string> file2Change = *(std::vector<generic_string> *)lParam;
|
const std::vector<wstring> file2Change = *(std::vector<wstring> *)lParam;
|
||||||
generic_string separator = TEXT("\\\\");
|
wstring separator = L"\\\\";
|
||||||
|
|
||||||
size_t sepPos = file2Change[0].find(separator);
|
size_t sepPos = file2Change[0].find(separator);
|
||||||
if (sepPos == generic_string::npos)
|
if (sepPos == wstring::npos)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
generic_string pathSuffix = file2Change[0].substr(sepPos + separator.length(), file2Change[0].length() - 1);
|
wstring pathSuffix = file2Change[0].substr(sepPos + separator.length(), file2Change[0].length() - 1);
|
||||||
|
|
||||||
// remove prefix of file/folder in changeInfo, splite the remained path
|
// remove prefix of file/folder in changeInfo, splite the remained path
|
||||||
vector<generic_string> linarPathArray = split(pathSuffix, '\\');
|
vector<wstring> linarPathArray = split(pathSuffix, '\\');
|
||||||
|
|
||||||
generic_string rootPath = file2Change[0].substr(0, sepPos);
|
wstring rootPath = file2Change[0].substr(0, sepPos);
|
||||||
|
|
||||||
size_t sepPos2 = file2Change[1].find(separator);
|
size_t sepPos2 = file2Change[1].find(separator);
|
||||||
if (sepPos2 == generic_string::npos)
|
if (sepPos2 == wstring::npos)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
generic_string pathSuffix2 = file2Change[1].substr(sepPos2 + separator.length(), file2Change[1].length() - 1);
|
wstring pathSuffix2 = file2Change[1].substr(sepPos2 + separator.length(), file2Change[1].length() - 1);
|
||||||
vector<generic_string> linarPathArray2 = split(pathSuffix2, '\\');
|
vector<wstring> linarPathArray2 = split(pathSuffix2, '\\');
|
||||||
|
|
||||||
bool isRenamed = renameInTree(rootPath, nullptr, linarPathArray, linarPathArray2[linarPathArray2.size() - 1]);
|
bool isRenamed = renameInTree(rootPath, nullptr, linarPathArray, linarPathArray2[linarPathArray2.size() - 1]);
|
||||||
if (!isRenamed)
|
if (!isRenamed)
|
||||||
{
|
{
|
||||||
//MessageBox(NULL, file2Change[0].c_str(), TEXT("file/folder is not removed"), MB_OK);
|
//MessageBox(NULL, file2Change[0].c_str(), L"file/folder is not removed", MB_OK);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -358,16 +358,16 @@ void FileBrowser::initPopupMenus()
|
||||||
{
|
{
|
||||||
NativeLangSpeaker* pNativeSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
|
NativeLangSpeaker* pNativeSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
|
||||||
|
|
||||||
generic_string addRoot = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_ADDROOT, FB_ADDROOT);
|
wstring addRoot = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_ADDROOT, FB_ADDROOT);
|
||||||
generic_string removeAllRoot = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_REMOVEALLROOTS, FB_REMOVEALLROOTS);
|
wstring removeAllRoot = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_REMOVEALLROOTS, FB_REMOVEALLROOTS);
|
||||||
generic_string removeRootFolder = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_REMOVEROOTFOLDER, FB_REMOVEROOTFOLDER);
|
wstring removeRootFolder = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_REMOVEROOTFOLDER, FB_REMOVEROOTFOLDER);
|
||||||
generic_string copyPath = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_COPYPATH, FB_COPYPATH);
|
wstring copyPath = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_COPYPATH, FB_COPYPATH);
|
||||||
generic_string copyFileName = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_COPYFILENAME, FB_COPYFILENAME);
|
wstring copyFileName = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_COPYFILENAME, FB_COPYFILENAME);
|
||||||
generic_string findInFile = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_FINDINFILES, FB_FINDINFILES);
|
wstring findInFile = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_FINDINFILES, FB_FINDINFILES);
|
||||||
generic_string explorerHere = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_EXPLORERHERE, FB_EXPLORERHERE);
|
wstring explorerHere = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_EXPLORERHERE, FB_EXPLORERHERE);
|
||||||
generic_string cmdHere = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_CMDHERE, FB_CMDHERE);
|
wstring cmdHere = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_CMDHERE, FB_CMDHERE);
|
||||||
generic_string openInNpp = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_OPENINNPP, FB_OPENINNPP);
|
wstring openInNpp = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_OPENINNPP, FB_OPENINNPP);
|
||||||
generic_string shellExecute = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_SHELLEXECUTE, FB_SHELLEXECUTE);
|
wstring shellExecute = pNativeSpeaker->getDlgLangMenuStr(FOLDERASWORKSPACE_NODE, nullptr, IDM_FILEBROWSER_SHELLEXECUTE, FB_SHELLEXECUTE);
|
||||||
|
|
||||||
_hGlobalMenu = ::CreatePopupMenu();
|
_hGlobalMenu = ::CreatePopupMenu();
|
||||||
::InsertMenu(_hGlobalMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_ADDROOT, addRoot.c_str());
|
::InsertMenu(_hGlobalMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_ADDROOT, addRoot.c_str());
|
||||||
|
@ -400,7 +400,7 @@ void FileBrowser::initPopupMenus()
|
||||||
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_CMDHERE, cmdHere.c_str());
|
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_CMDHERE, cmdHere.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileBrowser::selectItemFromPath(const generic_string& itemPath) const
|
bool FileBrowser::selectItemFromPath(const wstring& itemPath) const
|
||||||
{
|
{
|
||||||
if (itemPath.empty())
|
if (itemPath.empty())
|
||||||
return false;
|
return false;
|
||||||
|
@ -411,19 +411,19 @@ bool FileBrowser::selectItemFromPath(const generic_string& itemPath) const
|
||||||
{
|
{
|
||||||
if (isRelatedRootFolder(f->_rootFolder._rootPath, itemPath))
|
if (isRelatedRootFolder(f->_rootFolder._rootPath, itemPath))
|
||||||
{
|
{
|
||||||
generic_string rootPath = f->_rootFolder._rootPath;
|
wstring rootPath = f->_rootFolder._rootPath;
|
||||||
size_t rootPathLen = rootPath.size();
|
size_t rootPathLen = rootPath.size();
|
||||||
if (rootPathLen > itemPathLen) // It should never happen
|
if (rootPathLen > itemPathLen) // It should never happen
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
vector<generic_string> linarPathArray;
|
vector<wstring> linarPathArray;
|
||||||
if (rootPathLen == itemPathLen)
|
if (rootPathLen == itemPathLen)
|
||||||
{
|
{
|
||||||
// Do nothing and use empty linarPathArray
|
// Do nothing and use empty linarPathArray
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
generic_string pathSuffix = itemPath.substr(rootPathLen + 1, itemPathLen - rootPathLen);
|
wstring pathSuffix = itemPath.substr(rootPathLen + 1, itemPathLen - rootPathLen);
|
||||||
linarPathArray = split(pathSuffix, '\\');
|
linarPathArray = split(pathSuffix, '\\');
|
||||||
}
|
}
|
||||||
HTREEITEM foundItem = findInTree(rootPath, nullptr, linarPathArray);
|
HTREEITEM foundItem = findInTree(rootPath, nullptr, linarPathArray);
|
||||||
|
@ -441,9 +441,9 @@ bool FileBrowser::selectItemFromPath(const generic_string& itemPath) const
|
||||||
|
|
||||||
bool FileBrowser::selectCurrentEditingFile() const
|
bool FileBrowser::selectCurrentEditingFile() const
|
||||||
{
|
{
|
||||||
TCHAR currentDocPath[MAX_PATH] = { '\0' };
|
wchar_t currentDocPath[MAX_PATH] = { '\0' };
|
||||||
::SendMessage(_hParent, NPPM_GETFULLCURRENTPATH, MAX_PATH, reinterpret_cast<LPARAM>(currentDocPath));
|
::SendMessage(_hParent, NPPM_GETFULLCURRENTPATH, MAX_PATH, reinterpret_cast<LPARAM>(currentDocPath));
|
||||||
generic_string currentDocPathStr = currentDocPath;
|
wstring currentDocPathStr = currentDocPath;
|
||||||
|
|
||||||
return selectItemFromPath(currentDocPathStr);
|
return selectItemFromPath(currentDocPathStr);
|
||||||
}
|
}
|
||||||
|
@ -456,18 +456,18 @@ void FileBrowser::destroyMenus()
|
||||||
::DestroyMenu(_hFileMenu);
|
::DestroyMenu(_hFileMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
generic_string FileBrowser::getNodePath(HTREEITEM node) const
|
wstring FileBrowser::getNodePath(HTREEITEM node) const
|
||||||
{
|
{
|
||||||
if (!node) return TEXT("");
|
if (!node) return L"";
|
||||||
|
|
||||||
vector<generic_string> fullPathArray;
|
vector<wstring> fullPathArray;
|
||||||
generic_string fullPath;
|
wstring fullPath;
|
||||||
|
|
||||||
// go up until to root, then get the full path
|
// go up until to root, then get the full path
|
||||||
HTREEITEM parent = node;
|
HTREEITEM parent = node;
|
||||||
for (; parent != nullptr;)
|
for (; parent != nullptr;)
|
||||||
{
|
{
|
||||||
generic_string folderName = _treeView.getItemDisplayName(parent);
|
wstring folderName = _treeView.getItemDisplayName(parent);
|
||||||
|
|
||||||
HTREEITEM temp = _treeView.getParent(parent);
|
HTREEITEM temp = _treeView.getParent(parent);
|
||||||
if (temp == nullptr)
|
if (temp == nullptr)
|
||||||
|
@ -484,15 +484,15 @@ generic_string FileBrowser::getNodePath(HTREEITEM node) const
|
||||||
{
|
{
|
||||||
fullPath += fullPathArray[i];
|
fullPath += fullPathArray[i];
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
fullPath += TEXT("\\");
|
fullPath += L"\\";
|
||||||
}
|
}
|
||||||
|
|
||||||
return fullPath;
|
return fullPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
generic_string FileBrowser::getNodeName(HTREEITEM node) const
|
wstring FileBrowser::getNodeName(HTREEITEM node) const
|
||||||
{
|
{
|
||||||
return node ? _treeView.getItemDisplayName(node) : TEXT("");
|
return node ? _treeView.getItemDisplayName(node) : L"";
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBrowser::openSelectFile()
|
void FileBrowser::openSelectFile()
|
||||||
|
@ -539,7 +539,7 @@ void FileBrowser::notified(LPNMHDR notification)
|
||||||
}
|
}
|
||||||
else if (notification->hwndFrom == _treeView.getHSelf())
|
else if (notification->hwndFrom == _treeView.getHSelf())
|
||||||
{
|
{
|
||||||
TCHAR textBuffer[MAX_PATH] = { '\0' };
|
wchar_t textBuffer[MAX_PATH] = { '\0' };
|
||||||
TVITEM tvItem{};
|
TVITEM tvItem{};
|
||||||
tvItem.mask = TVIF_TEXT | TVIF_PARAM;
|
tvItem.mask = TVIF_TEXT | TVIF_PARAM;
|
||||||
tvItem.pszText = textBuffer;
|
tvItem.pszText = textBuffer;
|
||||||
|
@ -571,11 +571,11 @@ void FileBrowser::notified(LPNMHDR notification)
|
||||||
|
|
||||||
// Find the position of old label in File path
|
// Find the position of old label in File path
|
||||||
SortingData4lParam* customData = reinterpret_cast<SortingData4lParam*>(tvnotif->item.lParam);
|
SortingData4lParam* customData = reinterpret_cast<SortingData4lParam*>(tvnotif->item.lParam);
|
||||||
generic_string *filePath = &(customData->_rootPath);
|
wstring *filePath = &(customData->_rootPath);
|
||||||
size_t found = filePath->rfind(tvItem.pszText);
|
size_t found = filePath->rfind(tvItem.pszText);
|
||||||
|
|
||||||
// If found the old label, replace it with the modified one
|
// If found the old label, replace it with the modified one
|
||||||
if (found != generic_string::npos)
|
if (found != wstring::npos)
|
||||||
filePath->replace(found, len, tvnotif->item.pszText);
|
filePath->replace(found, len, tvnotif->item.pszText);
|
||||||
|
|
||||||
// Check the validity of modified file path
|
// Check the validity of modified file path
|
||||||
|
@ -600,11 +600,11 @@ void FileBrowser::notified(LPNMHDR notification)
|
||||||
case TVN_GETINFOTIP:
|
case TVN_GETINFOTIP:
|
||||||
{
|
{
|
||||||
LPNMTVGETINFOTIP lpGetInfoTip = (LPNMTVGETINFOTIP)notification;
|
LPNMTVGETINFOTIP lpGetInfoTip = (LPNMTVGETINFOTIP)notification;
|
||||||
static generic_string tipStr;
|
static wstring tipStr;
|
||||||
BrowserNodeType nType = getNodeType(lpGetInfoTip->hItem);
|
BrowserNodeType nType = getNodeType(lpGetInfoTip->hItem);
|
||||||
if (nType == browserNodeType_root)
|
if (nType == browserNodeType_root)
|
||||||
{
|
{
|
||||||
tipStr = *((generic_string *)lpGetInfoTip->lParam);
|
tipStr = *((wstring *)lpGetInfoTip->lParam);
|
||||||
}
|
}
|
||||||
else if (nType == browserNodeType_file)
|
else if (nType == browserNodeType_file)
|
||||||
{
|
{
|
||||||
|
@ -801,14 +801,14 @@ void FileBrowser::popupMenuCmd(int cmdID)
|
||||||
{
|
{
|
||||||
if (!selectedNode) return;
|
if (!selectedNode) return;
|
||||||
|
|
||||||
generic_string path = getNodePath(selectedNode);
|
wstring path = getNodePath(selectedNode);
|
||||||
if (::PathFileExists(path.c_str()))
|
if (::PathFileExists(path.c_str()))
|
||||||
{
|
{
|
||||||
TCHAR cmdStr[1024] = {};
|
wchar_t cmdStr[1024] = {};
|
||||||
if (getNodeType(selectedNode) == browserNodeType_file)
|
if (getNodeType(selectedNode) == browserNodeType_file)
|
||||||
wsprintf(cmdStr, TEXT("explorer /select,\"%s\""), path.c_str());
|
wsprintf(cmdStr, L"explorer /select,\"%s\"", path.c_str());
|
||||||
else
|
else
|
||||||
wsprintf(cmdStr, TEXT("explorer \"%s\""), path.c_str());
|
wsprintf(cmdStr, L"explorer \"%s\"", path.c_str());
|
||||||
Command cmd(cmdStr);
|
Command cmd(cmdStr);
|
||||||
cmd.run(nullptr);
|
cmd.run(nullptr);
|
||||||
}
|
}
|
||||||
|
@ -822,7 +822,7 @@ void FileBrowser::popupMenuCmd(int cmdID)
|
||||||
if (getNodeType(selectedNode) == browserNodeType_file)
|
if (getNodeType(selectedNode) == browserNodeType_file)
|
||||||
selectedNode = _treeView.getParent(selectedNode);
|
selectedNode = _treeView.getParent(selectedNode);
|
||||||
|
|
||||||
generic_string path = getNodePath(selectedNode);
|
wstring path = getNodePath(selectedNode);
|
||||||
if (::PathFileExists(path.c_str()))
|
if (::PathFileExists(path.c_str()))
|
||||||
{
|
{
|
||||||
Command cmd(NppParameters::getInstance().getNppGUI()._commandLineInterpreter.c_str());
|
Command cmd(NppParameters::getInstance().getNppGUI()._commandLineInterpreter.c_str());
|
||||||
|
@ -834,7 +834,7 @@ void FileBrowser::popupMenuCmd(int cmdID)
|
||||||
case IDM_FILEBROWSER_COPYPATH:
|
case IDM_FILEBROWSER_COPYPATH:
|
||||||
{
|
{
|
||||||
if (!selectedNode) return;
|
if (!selectedNode) return;
|
||||||
generic_string path = getNodePath(selectedNode);
|
wstring path = getNodePath(selectedNode);
|
||||||
str2Clipboard(path, _hParent);
|
str2Clipboard(path, _hParent);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -842,7 +842,7 @@ void FileBrowser::popupMenuCmd(int cmdID)
|
||||||
case IDM_FILEBROWSER_COPYFILENAME:
|
case IDM_FILEBROWSER_COPYFILENAME:
|
||||||
{
|
{
|
||||||
if (!selectedNode) return;
|
if (!selectedNode) return;
|
||||||
generic_string fileName = getNodeName(selectedNode);
|
wstring fileName = getNodeName(selectedNode);
|
||||||
str2Clipboard(fileName, _hParent);
|
str2Clipboard(fileName, _hParent);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -850,7 +850,7 @@ void FileBrowser::popupMenuCmd(int cmdID)
|
||||||
case IDM_FILEBROWSER_FINDINFILES:
|
case IDM_FILEBROWSER_FINDINFILES:
|
||||||
{
|
{
|
||||||
if (!selectedNode) return;
|
if (!selectedNode) return;
|
||||||
generic_string path = getNodePath(selectedNode);
|
wstring path = getNodePath(selectedNode);
|
||||||
::SendMessage(_hParent, NPPM_LAUNCHFINDINFILESDLG, reinterpret_cast<WPARAM>(path.c_str()), 0);
|
::SendMessage(_hParent, NPPM_LAUNCHFINDINFILESDLG, reinterpret_cast<WPARAM>(path.c_str()), 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -879,8 +879,8 @@ void FileBrowser::popupMenuCmd(int cmdID)
|
||||||
case IDM_FILEBROWSER_ADDROOT:
|
case IDM_FILEBROWSER_ADDROOT:
|
||||||
{
|
{
|
||||||
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
|
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
|
||||||
generic_string openWorkspaceStr = pNativeSpeaker->getAttrNameStr(TEXT("Select a folder to add in Folder as Workspace panel"), FOLDERASWORKSPACE_NODE, "SelectFolderFromBrowserString");
|
wstring openWorkspaceStr = pNativeSpeaker->getAttrNameStr(L"Select a folder to add in Folder as Workspace panel", FOLDERASWORKSPACE_NODE, "SelectFolderFromBrowserString");
|
||||||
generic_string folderPath = folderBrowser(_hParent, openWorkspaceStr);
|
wstring folderPath = folderBrowser(_hParent, openWorkspaceStr);
|
||||||
if (!folderPath.empty())
|
if (!folderPath.empty())
|
||||||
{
|
{
|
||||||
addRootFolder(folderPath);
|
addRootFolder(folderPath);
|
||||||
|
@ -891,10 +891,10 @@ void FileBrowser::popupMenuCmd(int cmdID)
|
||||||
case IDM_FILEBROWSER_SHELLEXECUTE:
|
case IDM_FILEBROWSER_SHELLEXECUTE:
|
||||||
{
|
{
|
||||||
if (!selectedNode) return;
|
if (!selectedNode) return;
|
||||||
generic_string path = getNodePath(selectedNode);
|
wstring path = getNodePath(selectedNode);
|
||||||
|
|
||||||
if (::PathFileExists(path.c_str()))
|
if (::PathFileExists(path.c_str()))
|
||||||
::ShellExecute(NULL, TEXT("open"), path.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
::ShellExecute(NULL, L"open", path.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -902,15 +902,15 @@ void FileBrowser::popupMenuCmd(int cmdID)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void FileBrowser::getDirectoryStructure(const TCHAR *dir, const std::vector<generic_string> & patterns, FolderInfo & directoryStructure, bool isRecursive, bool isInHiddenDir)
|
void FileBrowser::getDirectoryStructure(const wchar_t *dir, const std::vector<wstring> & patterns, FolderInfo & directoryStructure, bool isRecursive, bool isInHiddenDir)
|
||||||
{
|
{
|
||||||
if (directoryStructure._parent == nullptr) // Root!
|
if (directoryStructure._parent == nullptr) // Root!
|
||||||
directoryStructure.setRootPath(dir);
|
directoryStructure.setRootPath(dir);
|
||||||
|
|
||||||
generic_string dirFilter(dir);
|
wstring dirFilter(dir);
|
||||||
if (dirFilter[dirFilter.length() - 1] != '\\')
|
if (dirFilter[dirFilter.length() - 1] != '\\')
|
||||||
dirFilter += TEXT("\\");
|
dirFilter += L"\\";
|
||||||
dirFilter += TEXT("*.*");
|
dirFilter += L"*.*";
|
||||||
WIN32_FIND_DATA foundData;
|
WIN32_FIND_DATA foundData;
|
||||||
|
|
||||||
HANDLE hFindFile = ::FindFirstFile(dirFilter.c_str(), &foundData);
|
HANDLE hFindFile = ::FindFirstFile(dirFilter.c_str(), &foundData);
|
||||||
|
@ -926,14 +926,14 @@ void FileBrowser::getDirectoryStructure(const TCHAR *dir, const std::vector<gene
|
||||||
}
|
}
|
||||||
else if (isRecursive)
|
else if (isRecursive)
|
||||||
{
|
{
|
||||||
if ((wcscmp(foundData.cFileName, TEXT(".")) != 0) &&
|
if ((wcscmp(foundData.cFileName, L".") != 0) &&
|
||||||
(wcscmp(foundData.cFileName, TEXT("..")) != 0))
|
(wcscmp(foundData.cFileName, L"..") != 0))
|
||||||
{
|
{
|
||||||
generic_string pathDir(dir);
|
wstring pathDir(dir);
|
||||||
if (pathDir[pathDir.length() - 1] != '\\')
|
if (pathDir[pathDir.length() - 1] != '\\')
|
||||||
pathDir += TEXT("\\");
|
pathDir += L"\\";
|
||||||
pathDir += foundData.cFileName;
|
pathDir += foundData.cFileName;
|
||||||
pathDir += TEXT("\\");
|
pathDir += L"\\";
|
||||||
|
|
||||||
FolderInfo subDirectoryStructure(foundData.cFileName, &directoryStructure);
|
FolderInfo subDirectoryStructure(foundData.cFileName, &directoryStructure);
|
||||||
getDirectoryStructure(pathDir.c_str(), patterns, subDirectoryStructure, isRecursive, isInHiddenDir);
|
getDirectoryStructure(pathDir.c_str(), patterns, subDirectoryStructure, isRecursive, isInHiddenDir);
|
||||||
|
@ -953,7 +953,7 @@ void FileBrowser::getDirectoryStructure(const TCHAR *dir, const std::vector<gene
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBrowser::addRootFolder(generic_string rootFolderPath)
|
void FileBrowser::addRootFolder(wstring rootFolderPath)
|
||||||
{
|
{
|
||||||
if (!::PathFileExists(rootFolderPath.c_str()))
|
if (!::PathFileExists(rootFolderPath.c_str()))
|
||||||
return;
|
return;
|
||||||
|
@ -976,9 +976,9 @@ void FileBrowser::addRootFolder(generic_string rootFolderPath)
|
||||||
if (isRelatedRootFolder(f->_rootFolder._rootPath, rootFolderPath))
|
if (isRelatedRootFolder(f->_rootFolder._rootPath, rootFolderPath))
|
||||||
{
|
{
|
||||||
//do nothing, go down to select the dir
|
//do nothing, go down to select the dir
|
||||||
generic_string rootPath = f->_rootFolder._rootPath;
|
wstring rootPath = f->_rootFolder._rootPath;
|
||||||
generic_string pathSuffix = rootFolderPath.substr(rootPath.size() + 1, rootFolderPath.size() - rootPath.size());
|
wstring pathSuffix = rootFolderPath.substr(rootPath.size() + 1, rootFolderPath.size() - rootPath.size());
|
||||||
vector<generic_string> linarPathArray = split(pathSuffix, '\\');
|
vector<wstring> linarPathArray = split(pathSuffix, '\\');
|
||||||
|
|
||||||
HTREEITEM foundItem = findInTree(rootPath, nullptr, linarPathArray);
|
HTREEITEM foundItem = findInTree(rootPath, nullptr, linarPathArray);
|
||||||
if (foundItem)
|
if (foundItem)
|
||||||
|
@ -990,8 +990,8 @@ void FileBrowser::addRootFolder(generic_string rootFolderPath)
|
||||||
{
|
{
|
||||||
NppParameters::getInstance().getNativeLangSpeaker()->messageBox("FolderAsWorspaceSubfolderExists",
|
NppParameters::getInstance().getNativeLangSpeaker()->messageBox("FolderAsWorspaceSubfolderExists",
|
||||||
_hParent,
|
_hParent,
|
||||||
TEXT("A sub-folder of the folder you want to add exists.\rPlease remove its root from the panel before you add folder \"$STR_REPLACE$\"."),
|
L"A sub-folder of the folder you want to add exists.\rPlease remove its root from the panel before you add folder \"$STR_REPLACE$\".",
|
||||||
TEXT("Folder as Workspace adding folder problem"),
|
L"Folder as Workspace adding folder problem",
|
||||||
MB_OK,
|
MB_OK,
|
||||||
0, // not used
|
0, // not used
|
||||||
rootFolderPath.c_str());
|
rootFolderPath.c_str());
|
||||||
|
@ -1000,11 +1000,11 @@ void FileBrowser::addRootFolder(generic_string rootFolderPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<generic_string> patterns2Match;
|
std::vector<wstring> patterns2Match;
|
||||||
patterns2Match.push_back(TEXT("*.*"));
|
patterns2Match.push_back(L"*.*");
|
||||||
|
|
||||||
TCHAR *label = ::PathFindFileName(rootFolderPath.c_str());
|
wchar_t *label = ::PathFindFileName(rootFolderPath.c_str());
|
||||||
TCHAR rootLabel[MAX_PATH] = {'\0'};
|
wchar_t rootLabel[MAX_PATH] = {'\0'};
|
||||||
wcscpy_s(rootLabel, label);
|
wcscpy_s(rootLabel, label);
|
||||||
size_t len = lstrlen(rootLabel);
|
size_t len = lstrlen(rootLabel);
|
||||||
if (rootLabel[len - 1] == '\\')
|
if (rootLabel[len - 1] == '\\')
|
||||||
|
@ -1023,20 +1023,20 @@ HTREEITEM FileBrowser::createFolderItemsFromDirStruct(HTREEITEM hParentItem, con
|
||||||
HTREEITEM hFolderItem = nullptr;
|
HTREEITEM hFolderItem = nullptr;
|
||||||
if (directoryStructure._parent == nullptr && hParentItem == nullptr)
|
if (directoryStructure._parent == nullptr && hParentItem == nullptr)
|
||||||
{
|
{
|
||||||
TCHAR rootPath[MAX_PATH] = { '\0' };
|
wchar_t rootPath[MAX_PATH] = { '\0' };
|
||||||
wcscpy_s(rootPath, directoryStructure._rootPath.c_str());
|
wcscpy_s(rootPath, directoryStructure._rootPath.c_str());
|
||||||
size_t len = lstrlen(rootPath);
|
size_t len = lstrlen(rootPath);
|
||||||
if (rootPath[len - 1] == '\\')
|
if (rootPath[len - 1] == '\\')
|
||||||
rootPath[len - 1] = '\0';
|
rootPath[len - 1] = '\0';
|
||||||
|
|
||||||
SortingData4lParam* customData = new SortingData4lParam(rootPath, TEXT(""), true);
|
SortingData4lParam* customData = new SortingData4lParam(rootPath, L"", true);
|
||||||
sortingDataArray.push_back(customData);
|
sortingDataArray.push_back(customData);
|
||||||
|
|
||||||
hFolderItem = _treeView.addItem(directoryStructure._name.c_str(), TVI_ROOT, INDEX_CLOSE_ROOT, reinterpret_cast<LPARAM>(customData));
|
hFolderItem = _treeView.addItem(directoryStructure._name.c_str(), TVI_ROOT, INDEX_CLOSE_ROOT, reinterpret_cast<LPARAM>(customData));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SortingData4lParam* customData = new SortingData4lParam(TEXT(""), directoryStructure._name, true);
|
SortingData4lParam* customData = new SortingData4lParam(L"", directoryStructure._name, true);
|
||||||
sortingDataArray.push_back(customData);
|
sortingDataArray.push_back(customData);
|
||||||
|
|
||||||
hFolderItem = _treeView.addItem(directoryStructure._name.c_str(), hParentItem, INDEX_CLOSE_NODE, reinterpret_cast<LPARAM>(customData));
|
hFolderItem = _treeView.addItem(directoryStructure._name.c_str(), hParentItem, INDEX_CLOSE_NODE, reinterpret_cast<LPARAM>(customData));
|
||||||
|
@ -1049,7 +1049,7 @@ HTREEITEM FileBrowser::createFolderItemsFromDirStruct(HTREEITEM hParentItem, con
|
||||||
|
|
||||||
for (const auto& file : directoryStructure._files)
|
for (const auto& file : directoryStructure._files)
|
||||||
{
|
{
|
||||||
SortingData4lParam* customData = new SortingData4lParam(TEXT(""), file._name, false);
|
SortingData4lParam* customData = new SortingData4lParam(L"", file._name, false);
|
||||||
sortingDataArray.push_back(customData);
|
sortingDataArray.push_back(customData);
|
||||||
|
|
||||||
_treeView.addItem(file._name.c_str(), hFolderItem, INDEX_LEAF, reinterpret_cast<LPARAM>(customData));
|
_treeView.addItem(file._name.c_str(), hFolderItem, INDEX_LEAF, reinterpret_cast<LPARAM>(customData));
|
||||||
|
@ -1060,7 +1060,7 @@ HTREEITEM FileBrowser::createFolderItemsFromDirStruct(HTREEITEM hParentItem, con
|
||||||
return hFolderItem;
|
return hFolderItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
HTREEITEM FileBrowser::getRootFromFullPath(const generic_string & rootPath) const
|
HTREEITEM FileBrowser::getRootFromFullPath(const wstring & rootPath) const
|
||||||
{
|
{
|
||||||
HTREEITEM node = nullptr;
|
HTREEITEM node = nullptr;
|
||||||
for (HTREEITEM hItemNode = _treeView.getRoot();
|
for (HTREEITEM hItemNode = _treeView.getRoot();
|
||||||
|
@ -1079,13 +1079,13 @@ HTREEITEM FileBrowser::getRootFromFullPath(const generic_string & rootPath) cons
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
HTREEITEM FileBrowser::findChildNodeFromName(HTREEITEM parent, const generic_string& label) const
|
HTREEITEM FileBrowser::findChildNodeFromName(HTREEITEM parent, const wstring& label) const
|
||||||
{
|
{
|
||||||
for (HTREEITEM hItemNode = _treeView.getChildFrom(parent);
|
for (HTREEITEM hItemNode = _treeView.getChildFrom(parent);
|
||||||
hItemNode != NULL;
|
hItemNode != NULL;
|
||||||
hItemNode = _treeView.getNextSibling(hItemNode))
|
hItemNode = _treeView.getNextSibling(hItemNode))
|
||||||
{
|
{
|
||||||
TCHAR textBuffer[MAX_PATH] = { '\0' };
|
wchar_t textBuffer[MAX_PATH] = { '\0' };
|
||||||
TVITEM tvItem{};
|
TVITEM tvItem{};
|
||||||
tvItem.mask = TVIF_TEXT;
|
tvItem.mask = TVIF_TEXT;
|
||||||
tvItem.pszText = textBuffer;
|
tvItem.pszText = textBuffer;
|
||||||
|
@ -1101,9 +1101,9 @@ HTREEITEM FileBrowser::findChildNodeFromName(HTREEITEM parent, const generic_str
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<generic_string> FileBrowser::getRoots() const
|
vector<wstring> FileBrowser::getRoots() const
|
||||||
{
|
{
|
||||||
vector<generic_string> roots;
|
vector<wstring> roots;
|
||||||
|
|
||||||
for (HTREEITEM hItemNode = _treeView.getRoot();
|
for (HTREEITEM hItemNode = _treeView.getRoot();
|
||||||
hItemNode != nullptr;
|
hItemNode != nullptr;
|
||||||
|
@ -1120,9 +1120,9 @@ vector<generic_string> FileBrowser::getRoots() const
|
||||||
return roots;
|
return roots;
|
||||||
}
|
}
|
||||||
|
|
||||||
generic_string FileBrowser::getSelectedItemPath() const
|
wstring FileBrowser::getSelectedItemPath() const
|
||||||
{
|
{
|
||||||
generic_string itemPath;
|
wstring itemPath;
|
||||||
HTREEITEM hItemNode = _treeView.getSelection();
|
HTREEITEM hItemNode = _treeView.getSelection();
|
||||||
if (hItemNode)
|
if (hItemNode)
|
||||||
{
|
{
|
||||||
|
@ -1133,38 +1133,38 @@ generic_string FileBrowser::getSelectedItemPath() const
|
||||||
|
|
||||||
std::vector<FileBrowser::FilesToChange> FileBrowser::getFilesFromParam(LPARAM lParam) const
|
std::vector<FileBrowser::FilesToChange> FileBrowser::getFilesFromParam(LPARAM lParam) const
|
||||||
{
|
{
|
||||||
const std::vector<generic_string> filesToChange = *(std::vector<generic_string>*)lParam;
|
const std::vector<wstring> filesToChange = *(std::vector<wstring>*)lParam;
|
||||||
const generic_string separator = TEXT("\\\\");
|
const wstring separator = L"\\\\";
|
||||||
const size_t separatorLength = separator.length();
|
const size_t separatorLength = separator.length();
|
||||||
|
|
||||||
std::vector<FilesToChange> groupedFiles;
|
std::vector<FilesToChange> groupedFiles;
|
||||||
for (size_t i = 0; i < filesToChange.size(); i++)
|
for (size_t i = 0; i < filesToChange.size(); i++)
|
||||||
{
|
{
|
||||||
const size_t sepPos = filesToChange[i].find(separator);
|
const size_t sepPos = filesToChange[i].find(separator);
|
||||||
if (sepPos == generic_string::npos)
|
if (sepPos == wstring::npos)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const generic_string pathSuffix = filesToChange[i].substr(sepPos + separatorLength, filesToChange[i].length() - 1);
|
const wstring pathSuffix = filesToChange[i].substr(sepPos + separatorLength, filesToChange[i].length() - 1);
|
||||||
|
|
||||||
// remove prefix of file/folder in changeInfo, split the remained path
|
// remove prefix of file/folder in changeInfo, split the remained path
|
||||||
vector<generic_string> linarPathArray = split(pathSuffix, '\\');
|
vector<wstring> linarPathArray = split(pathSuffix, '\\');
|
||||||
|
|
||||||
const generic_string lastElement = linarPathArray.back();
|
const wstring lastElement = linarPathArray.back();
|
||||||
linarPathArray.pop_back();
|
linarPathArray.pop_back();
|
||||||
|
|
||||||
const generic_string rootPath = filesToChange[i].substr(0, sepPos);
|
const wstring rootPath = filesToChange[i].substr(0, sepPos);
|
||||||
|
|
||||||
const generic_string addedFilePath = filesToChange[i].substr(0, sepPos + 1) + pathSuffix;
|
const wstring addedFilePath = filesToChange[i].substr(0, sepPos + 1) + pathSuffix;
|
||||||
|
|
||||||
generic_string commonPath = rootPath;
|
wstring commonPath = rootPath;
|
||||||
|
|
||||||
for (const auto & element : linarPathArray)
|
for (const auto & element : linarPathArray)
|
||||||
{
|
{
|
||||||
commonPath.append(TEXT("\\"));
|
commonPath.append(L"\\");
|
||||||
commonPath.append(element);
|
commonPath.append(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
commonPath.append(TEXT("\\"));
|
commonPath.append(L"\\");
|
||||||
|
|
||||||
const auto it = std::find_if(groupedFiles.begin(), groupedFiles.end(), [&commonPath](const auto & group) { return group._commonPath == commonPath; });
|
const auto it = std::find_if(groupedFiles.begin(), groupedFiles.end(), [&commonPath](const auto & group) { return group._commonPath == commonPath; });
|
||||||
|
|
||||||
|
@ -1223,14 +1223,14 @@ bool FileBrowser::addToTree(FilesToChange & group, HTREEITEM node)
|
||||||
for (auto & file : group._files) {
|
for (auto & file : group._files) {
|
||||||
if (::PathIsDirectory((group._commonPath + file).c_str()))
|
if (::PathIsDirectory((group._commonPath + file).c_str()))
|
||||||
{
|
{
|
||||||
SortingData4lParam* customData = new SortingData4lParam(TEXT(""), file, true);
|
SortingData4lParam* customData = new SortingData4lParam(L"", file, true);
|
||||||
sortingDataArray.push_back(customData);
|
sortingDataArray.push_back(customData);
|
||||||
|
|
||||||
_treeView.addItem(file.c_str(), node, INDEX_CLOSE_NODE, reinterpret_cast<LPARAM>(customData));
|
_treeView.addItem(file.c_str(), node, INDEX_CLOSE_NODE, reinterpret_cast<LPARAM>(customData));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SortingData4lParam* customData = new SortingData4lParam(TEXT(""), file, false);
|
SortingData4lParam* customData = new SortingData4lParam(L"", file, false);
|
||||||
sortingDataArray.push_back(customData);
|
sortingDataArray.push_back(customData);
|
||||||
|
|
||||||
_treeView.addItem(file.c_str(), node, INDEX_LEAF, reinterpret_cast<LPARAM>(customData));
|
_treeView.addItem(file.c_str(), node, INDEX_LEAF, reinterpret_cast<LPARAM>(customData));
|
||||||
|
@ -1245,7 +1245,7 @@ bool FileBrowser::addToTree(FilesToChange & group, HTREEITEM node)
|
||||||
hItemNode != NULL;
|
hItemNode != NULL;
|
||||||
hItemNode = _treeView.getNextSibling(hItemNode))
|
hItemNode = _treeView.getNextSibling(hItemNode))
|
||||||
{
|
{
|
||||||
TCHAR textBuffer[MAX_PATH] = { '\0' };
|
wchar_t textBuffer[MAX_PATH] = { '\0' };
|
||||||
TVITEM tvItem{};
|
TVITEM tvItem{};
|
||||||
tvItem.mask = TVIF_TEXT;
|
tvItem.mask = TVIF_TEXT;
|
||||||
tvItem.pszText = textBuffer;
|
tvItem.pszText = textBuffer;
|
||||||
|
@ -1282,7 +1282,7 @@ bool FileBrowser::deleteFromTree(FilesToChange & group)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
HTREEITEM FileBrowser::findInTree(const generic_string& rootPath, HTREEITEM node, std::vector<generic_string> linarPathArray) const
|
HTREEITEM FileBrowser::findInTree(const wstring& rootPath, HTREEITEM node, std::vector<wstring> linarPathArray) const
|
||||||
{
|
{
|
||||||
if (node == nullptr) // it's a root. Search the right root with rootPath
|
if (node == nullptr) // it's a root. Search the right root with rootPath
|
||||||
{
|
{
|
||||||
|
@ -1306,7 +1306,7 @@ HTREEITEM FileBrowser::findInTree(const generic_string& rootPath, HTREEITEM node
|
||||||
hItemNode != NULL;
|
hItemNode != NULL;
|
||||||
hItemNode = _treeView.getNextSibling(hItemNode))
|
hItemNode = _treeView.getNextSibling(hItemNode))
|
||||||
{
|
{
|
||||||
TCHAR textBuffer[MAX_PATH] = { '\0' };
|
wchar_t textBuffer[MAX_PATH] = { '\0' };
|
||||||
TVITEM tvItem{};
|
TVITEM tvItem{};
|
||||||
tvItem.mask = TVIF_TEXT;
|
tvItem.mask = TVIF_TEXT;
|
||||||
tvItem.pszText = textBuffer;
|
tvItem.pszText = textBuffer;
|
||||||
|
@ -1347,7 +1347,7 @@ std::vector<HTREEITEM> FileBrowser::findInTree(FilesToChange & group, HTREEITEM
|
||||||
hItemNode != NULL;
|
hItemNode != NULL;
|
||||||
hItemNode = _treeView.getNextSibling(hItemNode))
|
hItemNode = _treeView.getNextSibling(hItemNode))
|
||||||
{
|
{
|
||||||
TCHAR textBuffer[MAX_PATH] = {'\0'};
|
wchar_t textBuffer[MAX_PATH] = {'\0'};
|
||||||
TVITEM tvItem{};
|
TVITEM tvItem{};
|
||||||
tvItem.mask = TVIF_TEXT;
|
tvItem.mask = TVIF_TEXT;
|
||||||
tvItem.pszText = textBuffer;
|
tvItem.pszText = textBuffer;
|
||||||
|
@ -1366,7 +1366,7 @@ std::vector<HTREEITEM> FileBrowser::findInTree(FilesToChange & group, HTREEITEM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<HTREEITEM> FileBrowser::findChildNodesFromNames(HTREEITEM parent, std::vector<generic_string> & labels) const
|
std::vector<HTREEITEM> FileBrowser::findChildNodesFromNames(HTREEITEM parent, std::vector<wstring> & labels) const
|
||||||
{
|
{
|
||||||
std::vector<HTREEITEM> itemNodes;
|
std::vector<HTREEITEM> itemNodes;
|
||||||
|
|
||||||
|
@ -1375,7 +1375,7 @@ std::vector<HTREEITEM> FileBrowser::findChildNodesFromNames(HTREEITEM parent, st
|
||||||
hItemNode = _treeView.getNextSibling(hItemNode)
|
hItemNode = _treeView.getNextSibling(hItemNode)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
TCHAR textBuffer[MAX_PATH]{};
|
wchar_t textBuffer[MAX_PATH]{};
|
||||||
TVITEM tvItem{};
|
TVITEM tvItem{};
|
||||||
tvItem.mask = TVIF_TEXT;
|
tvItem.mask = TVIF_TEXT;
|
||||||
tvItem.pszText = textBuffer;
|
tvItem.pszText = textBuffer;
|
||||||
|
@ -1393,7 +1393,7 @@ std::vector<HTREEITEM> FileBrowser::findChildNodesFromNames(HTREEITEM parent, st
|
||||||
return itemNodes;
|
return itemNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBrowser::removeNamesAlreadyInNode(HTREEITEM parent, std::vector<generic_string> & labels) const
|
void FileBrowser::removeNamesAlreadyInNode(HTREEITEM parent, std::vector<wstring> & labels) const
|
||||||
{
|
{
|
||||||
// We have to search for the labels in the child nodes of parent, and remove the ones that already exist
|
// We have to search for the labels in the child nodes of parent, and remove the ones that already exist
|
||||||
for (HTREEITEM hItemNode = _treeView.getChildFrom(parent);
|
for (HTREEITEM hItemNode = _treeView.getChildFrom(parent);
|
||||||
|
@ -1401,7 +1401,7 @@ void FileBrowser::removeNamesAlreadyInNode(HTREEITEM parent, std::vector<generic
|
||||||
hItemNode = _treeView.getNextSibling(hItemNode)
|
hItemNode = _treeView.getNextSibling(hItemNode)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
TCHAR textBuffer[MAX_PATH]{};
|
wchar_t textBuffer[MAX_PATH]{};
|
||||||
TVITEM tvItem{};
|
TVITEM tvItem{};
|
||||||
tvItem.mask = TVIF_TEXT;
|
tvItem.mask = TVIF_TEXT;
|
||||||
tvItem.pszText = textBuffer;
|
tvItem.pszText = textBuffer;
|
||||||
|
@ -1417,7 +1417,7 @@ void FileBrowser::removeNamesAlreadyInNode(HTREEITEM parent, std::vector<generic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileBrowser::renameInTree(const generic_string& rootPath, HTREEITEM node, const std::vector<generic_string>& linarPathArrayFrom, const generic_string & renameTo)
|
bool FileBrowser::renameInTree(const wstring& rootPath, HTREEITEM node, const std::vector<wstring>& linarPathArrayFrom, const wstring & renameTo)
|
||||||
{
|
{
|
||||||
HTREEITEM foundItem = findInTree(rootPath, node, linarPathArrayFrom);
|
HTREEITEM foundItem = findInTree(rootPath, node, linarPathArrayFrom);
|
||||||
if (foundItem == nullptr)
|
if (foundItem == nullptr)
|
||||||
|
@ -1448,11 +1448,11 @@ int CALLBACK FileBrowser::categorySortFunc(LPARAM lParam1, LPARAM lParam2, LPARA
|
||||||
return lstrcmpi(item1->_label.c_str(), item2->_label.c_str());
|
return lstrcmpi(item1->_label.c_str(), item2->_label.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FolderInfo::addToStructure(generic_string & fullpath, std::vector<generic_string> linarPathArray)
|
bool FolderInfo::addToStructure(wstring & fullpath, std::vector<wstring> linarPathArray)
|
||||||
{
|
{
|
||||||
if (linarPathArray.size() == 1) // could be file or folder
|
if (linarPathArray.size() == 1) // could be file or folder
|
||||||
{
|
{
|
||||||
fullpath += TEXT("\\");
|
fullpath += L"\\";
|
||||||
fullpath += linarPathArray[0];
|
fullpath += linarPathArray[0];
|
||||||
if (PathIsDirectory(fullpath.c_str()))
|
if (PathIsDirectory(fullpath.c_str()))
|
||||||
{
|
{
|
||||||
|
@ -1483,7 +1483,7 @@ bool FolderInfo::addToStructure(generic_string & fullpath, std::vector<generic_s
|
||||||
{
|
{
|
||||||
if (folder.getName() == linarPathArray[0])
|
if (folder.getName() == linarPathArray[0])
|
||||||
{
|
{
|
||||||
fullpath += TEXT("\\");
|
fullpath += L"\\";
|
||||||
fullpath += linarPathArray[0];
|
fullpath += linarPathArray[0];
|
||||||
linarPathArray.erase(linarPathArray.begin());
|
linarPathArray.erase(linarPathArray.begin());
|
||||||
return folder.addToStructure(fullpath, linarPathArray);
|
return folder.addToStructure(fullpath, linarPathArray);
|
||||||
|
@ -1493,7 +1493,7 @@ bool FolderInfo::addToStructure(generic_string & fullpath, std::vector<generic_s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FolderInfo::removeFromStructure(std::vector<generic_string> linarPathArray)
|
bool FolderInfo::removeFromStructure(std::vector<wstring> linarPathArray)
|
||||||
{
|
{
|
||||||
if (linarPathArray.size() == 1) // could be file or folder
|
if (linarPathArray.size() == 1) // could be file or folder
|
||||||
{
|
{
|
||||||
|
@ -1531,7 +1531,7 @@ bool FolderInfo::removeFromStructure(std::vector<generic_string> linarPathArray)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FolderInfo::renameInStructure(std::vector<generic_string> linarPathArrayFrom, std::vector<generic_string> linarPathArrayTo)
|
bool FolderInfo::renameInStructure(std::vector<wstring> linarPathArrayFrom, std::vector<wstring> linarPathArrayTo)
|
||||||
{
|
{
|
||||||
if (linarPathArrayFrom.size() == 1) // could be file or folder
|
if (linarPathArrayFrom.size() == 1) // could be file or folder
|
||||||
{
|
{
|
||||||
|
@ -1609,9 +1609,9 @@ DWORD WINAPI FolderUpdater::watching(void *params)
|
||||||
{
|
{
|
||||||
FolderUpdater *thisFolderUpdater = (FolderUpdater *)params;
|
FolderUpdater *thisFolderUpdater = (FolderUpdater *)params;
|
||||||
|
|
||||||
generic_string dir2Watch = (thisFolderUpdater->_rootFolder)._rootPath;
|
wstring dir2Watch = (thisFolderUpdater->_rootFolder)._rootPath;
|
||||||
if (dir2Watch[dir2Watch.length() - 1] != '\\')
|
if (dir2Watch[dir2Watch.length() - 1] != '\\')
|
||||||
dir2Watch += TEXT("\\"); // CReadDirectoryChanges will add another '\' so we will get "\\" as a separator (of monitored root) in the notification
|
dir2Watch += L"\\"; // CReadDirectoryChanges will add another '\' so we will get "\\" as a separator (of monitored root) in the notification
|
||||||
|
|
||||||
const DWORD dwNotificationFlags = FILE_NOTIFY_CHANGE_CREATION | FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_FILE_NAME;
|
const DWORD dwNotificationFlags = FILE_NOTIFY_CHANGE_CREATION | FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_FILE_NAME;
|
||||||
|
|
||||||
|
@ -1640,9 +1640,9 @@ DWORD WINAPI FolderUpdater::watching(void *params)
|
||||||
|
|
||||||
DWORD dwPreviousAction = 0;
|
DWORD dwPreviousAction = 0;
|
||||||
DWORD dwAction;
|
DWORD dwAction;
|
||||||
generic_string wstrFilename;
|
wstring wstrFilename;
|
||||||
|
|
||||||
std::vector<generic_string> filesToChange;
|
std::vector<wstring> filesToChange;
|
||||||
// Process all available changes, ignore User actions
|
// Process all available changes, ignore User actions
|
||||||
while (changes.Pop(dwAction, wstrFilename))
|
while (changes.Pop(dwAction, wstrFilename))
|
||||||
{
|
{
|
||||||
|
@ -1703,26 +1703,26 @@ DWORD WINAPI FolderUpdater::watching(void *params)
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FolderUpdater::processChange(DWORD dwAction, std::vector<generic_string> filesToChange, FolderUpdater* thisFolderUpdater)
|
void FolderUpdater::processChange(DWORD dwAction, std::vector<wstring> filesToChange, FolderUpdater* thisFolderUpdater)
|
||||||
{
|
{
|
||||||
static generic_string oldName;
|
static wstring oldName;
|
||||||
|
|
||||||
switch (dwAction)
|
switch (dwAction)
|
||||||
{
|
{
|
||||||
case FILE_ACTION_ADDED:
|
case FILE_ACTION_ADDED:
|
||||||
|
|
||||||
::SendMessage((thisFolderUpdater->_pFileBrowser)->getHSelf(), FB_ADDFILE, reinterpret_cast<WPARAM>(nullptr), reinterpret_cast<LPARAM>(&filesToChange));
|
::SendMessage((thisFolderUpdater->_pFileBrowser)->getHSelf(), FB_ADDFILE, reinterpret_cast<WPARAM>(nullptr), reinterpret_cast<LPARAM>(&filesToChange));
|
||||||
oldName = TEXT("");
|
oldName = L"";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FILE_ACTION_REMOVED:
|
case FILE_ACTION_REMOVED:
|
||||||
|
|
||||||
::SendMessage((thisFolderUpdater->_pFileBrowser)->getHSelf(), FB_RMFILE, reinterpret_cast<WPARAM>(nullptr), reinterpret_cast<LPARAM>(&filesToChange));
|
::SendMessage((thisFolderUpdater->_pFileBrowser)->getHSelf(), FB_RMFILE, reinterpret_cast<WPARAM>(nullptr), reinterpret_cast<LPARAM>(&filesToChange));
|
||||||
oldName = TEXT("");
|
oldName = L"";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FILE_ACTION_MODIFIED:
|
case FILE_ACTION_MODIFIED:
|
||||||
oldName = TEXT("");
|
oldName = L"";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FILE_ACTION_RENAMED_OLD_NAME:
|
case FILE_ACTION_RENAMED_OLD_NAME:
|
||||||
|
@ -1732,17 +1732,17 @@ void FolderUpdater::processChange(DWORD dwAction, std::vector<generic_string> fi
|
||||||
case FILE_ACTION_RENAMED_NEW_NAME:
|
case FILE_ACTION_RENAMED_NEW_NAME:
|
||||||
if (!oldName.empty())
|
if (!oldName.empty())
|
||||||
{
|
{
|
||||||
std::vector<generic_string> fileRename;
|
std::vector<wstring> fileRename;
|
||||||
fileRename.push_back(oldName);
|
fileRename.push_back(oldName);
|
||||||
fileRename.push_back(filesToChange.back());
|
fileRename.push_back(filesToChange.back());
|
||||||
//thisFolderUpdater->updateTree(dwAction, fileRename);
|
//thisFolderUpdater->updateTree(dwAction, fileRename);
|
||||||
::SendMessage((thisFolderUpdater->_pFileBrowser)->getHSelf(), FB_RNFILE, reinterpret_cast<WPARAM>(nullptr), reinterpret_cast<LPARAM>(&fileRename));
|
::SendMessage((thisFolderUpdater->_pFileBrowser)->getHSelf(), FB_RNFILE, reinterpret_cast<WPARAM>(nullptr), reinterpret_cast<LPARAM>(&fileRename));
|
||||||
}
|
}
|
||||||
oldName = TEXT("");
|
oldName = L"";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
oldName = TEXT("");
|
oldName = L"";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,17 +21,17 @@
|
||||||
#include "TreeView.h"
|
#include "TreeView.h"
|
||||||
#include "fileBrowser_rc.h"
|
#include "fileBrowser_rc.h"
|
||||||
|
|
||||||
#define FB_PANELTITLE TEXT("Folder as Workspace")
|
#define FB_PANELTITLE L"Folder as Workspace"
|
||||||
#define FB_ADDROOT TEXT("Add")
|
#define FB_ADDROOT L"Add"
|
||||||
#define FB_REMOVEALLROOTS TEXT("Remove All")
|
#define FB_REMOVEALLROOTS L"Remove All"
|
||||||
#define FB_REMOVEROOTFOLDER TEXT("Remove")
|
#define FB_REMOVEROOTFOLDER L"Remove"
|
||||||
#define FB_COPYPATH TEXT("Copy path")
|
#define FB_COPYPATH L"Copy path"
|
||||||
#define FB_COPYFILENAME TEXT("Copy file name")
|
#define FB_COPYFILENAME L"Copy file name"
|
||||||
#define FB_FINDINFILES TEXT("Find in Files...")
|
#define FB_FINDINFILES L"Find in Files..."
|
||||||
#define FB_EXPLORERHERE TEXT("Explorer here")
|
#define FB_EXPLORERHERE L"Explorer here"
|
||||||
#define FB_CMDHERE TEXT("CMD here")
|
#define FB_CMDHERE L"CMD here"
|
||||||
#define FB_OPENINNPP TEXT("Open")
|
#define FB_OPENINNPP L"Open"
|
||||||
#define FB_SHELLEXECUTE TEXT("Run by system")
|
#define FB_SHELLEXECUTE L"Run by system"
|
||||||
|
|
||||||
#define FOLDERASWORKSPACE_NODE "FolderAsWorkspace"
|
#define FOLDERASWORKSPACE_NODE "FolderAsWorkspace"
|
||||||
|
|
||||||
|
@ -47,12 +47,12 @@ friend class FolderInfo;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FileInfo() = delete; // constructor by default is forbidden
|
FileInfo() = delete; // constructor by default is forbidden
|
||||||
FileInfo(const generic_string & name, FolderInfo *parent) : _name(name), _parent(parent) {};
|
FileInfo(const std::wstring & name, FolderInfo *parent) : _name(name), _parent(parent) {};
|
||||||
generic_string getName() const { return _name; };
|
std::wstring getName() const { return _name; };
|
||||||
void setName(generic_string name) { _name = name; };
|
void setName(std::wstring name) { _name = name; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
generic_string _name;
|
std::wstring _name;
|
||||||
FolderInfo *_parent = nullptr;
|
FolderInfo *_parent = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -64,24 +64,24 @@ friend class FolderUpdater;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FolderInfo() = delete; // constructor by default is forbidden
|
FolderInfo() = delete; // constructor by default is forbidden
|
||||||
FolderInfo(const generic_string & name, FolderInfo *parent) : _name(name), _parent(parent) {};
|
FolderInfo(const std::wstring & name, FolderInfo *parent) : _name(name), _parent(parent) {};
|
||||||
void setRootPath(const generic_string& rootPath) { _rootPath = rootPath; };
|
void setRootPath(const std::wstring& rootPath) { _rootPath = rootPath; };
|
||||||
generic_string getRootPath() const { return _rootPath; };
|
std::wstring getRootPath() const { return _rootPath; };
|
||||||
void setName(const generic_string& name) { _name = name; };
|
void setName(const std::wstring& name) { _name = name; };
|
||||||
generic_string getName() const { return _name; };
|
std::wstring getName() const { return _name; };
|
||||||
void addFile(const generic_string& fn) { _files.push_back(FileInfo(fn, this)); };
|
void addFile(const std::wstring& fn) { _files.push_back(FileInfo(fn, this)); };
|
||||||
void addSubFolder(FolderInfo subDirectoryStructure) { _subFolders.push_back(subDirectoryStructure); };
|
void addSubFolder(FolderInfo subDirectoryStructure) { _subFolders.push_back(subDirectoryStructure); };
|
||||||
|
|
||||||
bool addToStructure(generic_string & fullpath, std::vector<generic_string> linarPathArray);
|
bool addToStructure(std::wstring & fullpath, std::vector<std::wstring> linarPathArray);
|
||||||
bool removeFromStructure(std::vector<generic_string> linarPathArray);
|
bool removeFromStructure(std::vector<std::wstring> linarPathArray);
|
||||||
bool renameInStructure(std::vector<generic_string> linarPathArrayFrom, std::vector<generic_string> linarPathArrayTo);
|
bool renameInStructure(std::vector<std::wstring> linarPathArrayFrom, std::vector<std::wstring> linarPathArrayTo);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<FolderInfo> _subFolders;
|
std::vector<FolderInfo> _subFolders;
|
||||||
std::vector<FileInfo> _files;
|
std::vector<FileInfo> _files;
|
||||||
generic_string _name;
|
std::wstring _name;
|
||||||
FolderInfo* _parent = nullptr;
|
FolderInfo* _parent = nullptr;
|
||||||
generic_string _rootPath; // set only for root folder; empty for normal folder
|
std::wstring _rootPath; // set only for root folder; empty for normal folder
|
||||||
};
|
};
|
||||||
|
|
||||||
enum BrowserNodeType {
|
enum BrowserNodeType {
|
||||||
|
@ -104,15 +104,15 @@ private:
|
||||||
HANDLE _EventHandle = nullptr;
|
HANDLE _EventHandle = nullptr;
|
||||||
static DWORD WINAPI watching(void *param);
|
static DWORD WINAPI watching(void *param);
|
||||||
|
|
||||||
static void processChange(DWORD dwAction, std::vector<generic_string> filesToChange, FolderUpdater* thisFolderUpdater);
|
static void processChange(DWORD dwAction, std::vector<std::wstring> filesToChange, FolderUpdater* thisFolderUpdater);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SortingData4lParam {
|
struct SortingData4lParam {
|
||||||
generic_string _rootPath; // Only for the root. It should be empty if it's not root
|
std::wstring _rootPath; // Only for the root. It should be empty if it's not root
|
||||||
generic_string _label; // TreeView item label
|
std::wstring _label; // TreeView item label
|
||||||
bool _isFolder = false; // if it's not a folder, then it's a file
|
bool _isFolder = false; // if it's not a folder, then it's a file
|
||||||
|
|
||||||
SortingData4lParam(generic_string rootPath, generic_string label, bool isFolder) : _rootPath(rootPath), _label(label), _isFolder(isFolder) {}
|
SortingData4lParam(std::wstring rootPath, std::wstring label, bool isFolder) : _rootPath(rootPath), _label(label), _isFolder(isFolder) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,25 +133,25 @@ public:
|
||||||
TreeView_SetTextColor(_treeView.getHSelf(), fgColour);
|
TreeView_SetTextColor(_treeView.getHSelf(), fgColour);
|
||||||
};
|
};
|
||||||
|
|
||||||
generic_string getNodePath(HTREEITEM node) const;
|
std::wstring getNodePath(HTREEITEM node) const;
|
||||||
generic_string getNodeName(HTREEITEM node) const;
|
std::wstring getNodeName(HTREEITEM node) const;
|
||||||
void addRootFolder(generic_string rootFolderPath);
|
void addRootFolder(std::wstring rootFolderPath);
|
||||||
|
|
||||||
HTREEITEM getRootFromFullPath(const generic_string & rootPath) const;
|
HTREEITEM getRootFromFullPath(const std::wstring & rootPath) const;
|
||||||
HTREEITEM findChildNodeFromName(HTREEITEM parent, const generic_string& label) const;
|
HTREEITEM findChildNodeFromName(HTREEITEM parent, const std::wstring& label) const;
|
||||||
|
|
||||||
HTREEITEM findInTree(const generic_string& rootPath, HTREEITEM node, std::vector<generic_string> linarPathArray) const;
|
HTREEITEM findInTree(const std::wstring& rootPath, HTREEITEM node, std::vector<std::wstring> linarPathArray) const;
|
||||||
|
|
||||||
void deleteAllFromTree() {
|
void deleteAllFromTree() {
|
||||||
popupMenuCmd(IDM_FILEBROWSER_REMOVEALLROOTS);
|
popupMenuCmd(IDM_FILEBROWSER_REMOVEALLROOTS);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool renameInTree(const generic_string& rootPath, HTREEITEM node, const std::vector<generic_string>& linarPathArrayFrom, const generic_string & renameTo);
|
bool renameInTree(const std::wstring& rootPath, HTREEITEM node, const std::vector<std::wstring>& linarPathArrayFrom, const std::wstring & renameTo);
|
||||||
|
|
||||||
std::vector<generic_string> getRoots() const;
|
std::vector<std::wstring> getRoots() const;
|
||||||
generic_string getSelectedItemPath() const;
|
std::wstring getSelectedItemPath() const;
|
||||||
|
|
||||||
bool selectItemFromPath(const generic_string& itemPath) const;
|
bool selectItemFromPath(const std::wstring& itemPath) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
HWND _hToolbarMenu = nullptr;
|
HWND _hToolbarMenu = nullptr;
|
||||||
|
@ -166,13 +166,13 @@ protected:
|
||||||
HMENU _hFileMenu = NULL;
|
HMENU _hFileMenu = NULL;
|
||||||
std::vector<FolderUpdater *> _folderUpdaters;
|
std::vector<FolderUpdater *> _folderUpdaters;
|
||||||
|
|
||||||
generic_string _selectedNodeFullPath; // this member is used only for PostMessage call
|
std::wstring _selectedNodeFullPath; // this member is used only for PostMessage call
|
||||||
|
|
||||||
std::vector<SortingData4lParam*> sortingDataArray;
|
std::vector<SortingData4lParam*> sortingDataArray;
|
||||||
|
|
||||||
generic_string _expandAllFolders = TEXT("Unfold all");
|
std::wstring _expandAllFolders = L"Unfold all";
|
||||||
generic_string _collapseAllFolders = TEXT("Fold all");
|
std::wstring _collapseAllFolders = L"Fold all";
|
||||||
generic_string _locateCurrentFile = TEXT("Locate current file");
|
std::wstring _locateCurrentFile = L"Locate current file";
|
||||||
|
|
||||||
void initPopupMenus();
|
void initPopupMenus();
|
||||||
void destroyMenus();
|
void destroyMenus();
|
||||||
|
@ -183,10 +183,10 @@ protected:
|
||||||
bool selectCurrentEditingFile() const;
|
bool selectCurrentEditingFile() const;
|
||||||
|
|
||||||
struct FilesToChange {
|
struct FilesToChange {
|
||||||
generic_string _commonPath; // Common path between all the files. _rootPath + _linarWithoutLastPathElement
|
std::wstring _commonPath; // Common path between all the files. _rootPath + _linarWithoutLastPathElement
|
||||||
generic_string _rootPath;
|
std::wstring _rootPath;
|
||||||
std::vector<generic_string> _linarWithoutLastPathElement;
|
std::vector<std::wstring> _linarWithoutLastPathElement;
|
||||||
std::vector<generic_string> _files; // file/folder names
|
std::vector<std::wstring> _files; // file/folder names
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<FilesToChange> getFilesFromParam(LPARAM lParam) const;
|
std::vector<FilesToChange> getFilesFromParam(LPARAM lParam) const;
|
||||||
|
@ -197,15 +197,15 @@ protected:
|
||||||
|
|
||||||
std::vector<HTREEITEM> findInTree(FilesToChange & group, HTREEITEM node) const;
|
std::vector<HTREEITEM> findInTree(FilesToChange & group, HTREEITEM node) const;
|
||||||
|
|
||||||
std::vector<HTREEITEM> findChildNodesFromNames(HTREEITEM parent, std::vector<generic_string> & labels) const;
|
std::vector<HTREEITEM> findChildNodesFromNames(HTREEITEM parent, std::vector<std::wstring> & labels) const;
|
||||||
|
|
||||||
void removeNamesAlreadyInNode(HTREEITEM parent, std::vector<generic_string> & labels) const;
|
void removeNamesAlreadyInNode(HTREEITEM parent, std::vector<std::wstring> & labels) const;
|
||||||
|
|
||||||
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
|
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
|
||||||
void notified(LPNMHDR notification);
|
void notified(LPNMHDR notification);
|
||||||
void showContextMenu(int x, int y);
|
void showContextMenu(int x, int y);
|
||||||
void openSelectFile();
|
void openSelectFile();
|
||||||
void getDirectoryStructure(const TCHAR *dir, const std::vector<generic_string> & patterns, FolderInfo & directoryStructure, bool isRecursive, bool isInHiddenDir);
|
void getDirectoryStructure(const wchar_t *dir, const std::vector<std::wstring> & patterns, FolderInfo & directoryStructure, bool isRecursive, bool isInHiddenDir);
|
||||||
HTREEITEM createFolderItemsFromDirStruct(HTREEITEM hParentItem, const FolderInfo & directoryStructure);
|
HTREEITEM createFolderItemsFromDirStruct(HTREEITEM hParentItem, const FolderInfo & directoryStructure);
|
||||||
static int CALLBACK categorySortFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
|
static int CALLBACK categorySortFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue