Skip to content

Commit 4f98f6b

Browse files
authored
Merge pull request #48 from ChrisHal/always-use-C-locale-for-Igor
use locale manager to set "C" locale for igor wavenote creation
2 parents 75d3ca3 + 121d0d5 commit 4f98f6b

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

QtPMbrowser/pmbrowserwindow.cpp

+1-12
Original file line numberDiff line numberDiff line change
@@ -793,17 +793,6 @@ void PMbrowserWindow::on_actionExport_All_as_IBW_triggered()
793793
}
794794
}
795795

796-
class locale_manager {
797-
std::locale old_locale{};
798-
public:
799-
void setLocale(const char* name){
800-
old_locale = std::locale::global(std::locale(name));
801-
}
802-
~locale_manager() {
803-
std::locale::global(old_locale);
804-
}
805-
};
806-
807796
void PMbrowserWindow::on_actionExport_Metadata_as_Table_triggered()
808797
{
809798
if (!assertDatFileOpen()) {
@@ -812,7 +801,7 @@ void PMbrowserWindow::on_actionExport_Metadata_as_Table_triggered()
812801
DlgExportMetadata dlg(this);
813802
if (dlg.exec()) {
814803
try {
815-
locale_manager lm;
804+
hkLib::locale_manager lm;
816805
if (dlg.useSystemLocale()) {
817806
lm.setLocale(""); // set default locale
818807
}

hekatoolslib/exportIBW.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ namespace hkLib {
6464

6565
std::string MakeWaveNote(hkTreeNode& TrRecord)
6666
{
67+
locale_manager lm;
68+
lm.setLocale("C"); // always use C locale for Igor wavenotes
6769
std::stringstream note;
6870
formatParamListExportIBW(*TrRecord.getParent()->getParent()->getParent()->getParent(), parametersRoot, note);
6971
formatParamListExportIBW(*TrRecord.getParent()->getParent()->getParent(), parametersGroup, note);

hekatoolslib/helpers.h

+12
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,17 @@ namespace hkLib {
6868
/// <param name="count">count of trace (starting from 1)</param>
6969
/// <returns>string containing canonical trace-name</returns>
7070
std::string formTraceName(const hkTreeNode& tr, int count);
71+
72+
73+
class locale_manager {
74+
std::locale old_locale{};
75+
public:
76+
void setLocale(const char* name) {
77+
old_locale = std::locale::global(std::locale(name));
78+
}
79+
~locale_manager() {
80+
std::locale::global(old_locale);
81+
}
82+
};
7183
}
7284
#endif // !HELPERS_H

0 commit comments

Comments
 (0)