diff --git a/AdvGeneral.cpp b/AdvGeneral.cpp index 0c18e84..04f8e63 100644 --- a/AdvGeneral.cpp +++ b/AdvGeneral.cpp @@ -138,6 +138,7 @@ END_MESSAGE_MAP() #define SETTING_DISABLE_FRIENDS 87 #define SETTING_IGNORE_FALSE_COPIES_DEALY 88 #define SETTING_REFRESH_VIEW_AFTER_PASTE 89 +#define SETTING_SLUGIFY_SEPARATOR 90 BOOL CAdvGeneral::OnInitDialog() @@ -254,6 +255,8 @@ BOOL CAdvGeneral::OnInitDialog() AddTrueFalse(pGroupTest, _T("Show text for first ten copy hot keys"), CGetSetOptions::GetShowTextForFirstTenHotKeys(), SETTING_TEXT_FIRST_TEN); AddTrueFalse(pGroupTest, _T("Show thumbnails(for CF_DIB types) (could increase memory usage and display speed)"), CGetSetOptions::GetDrawThumbnail(), SETTING_DRAW_THUMBNAILS); + pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("Slugify Separator (default: -)"), CGetSetOptions::GetSlugifySeparator(), _T(""), SETTING_SLUGIFY_SEPARATOR)); + pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("Text lines per clip"), CGetSetOptions::GetLinesPerRow(), _T(""), SETTING_LINES_PER_ROW)); pGroupTest->AddSubItem(new CMFCPropertyGridProperty(_T("Tooltip display time(ms) max of 32000 (-1 default (5 seconds), 0 to turn off)"), g_Opt.m_tooltipTimeout, _T(""), SETTING_TOOLTIP_TIMEOUT)); @@ -760,6 +763,12 @@ void CAdvGeneral::OnBnClickedOk() CGetSetOptions::SetDefaultCutString(pNewValue->bstrVal); } break; + case SETTING_SLUGIFY_SEPARATOR: + if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0) + { + CGetSetOptions::SetSlugifySeparator(pNewValue->bstrVal); + } + break; case SETTING_REVERT_TO_TOP_LEVEL_GROUP: if (wcscmp(pNewValue->bstrVal, pOrigValue->bstrVal) != 0) { diff --git a/DittoSetup/BuildDitto.bld b/DittoSetup/BuildDitto.bld index 1b1d499..645d632 100644 --- a/DittoSetup/BuildDitto.bld +++ b/DittoSetup/BuildDitto.bld @@ -316,7 +316,7 @@ DittoSetup*]]> ".\Ditto\Language\French.xml" "Language\French.xml" ".\Ditto\Language\Greek.xml" "Language\Greek.xml" ".\Ditto\Language\Hebrew.xml" "Language\Hebrew.xml" -".\Ditto\Language\italiano.xml" "Language\italiano.xml" +".\Ditto\Language\Italian.xml" "Language\Italian.xml" ".\Ditto\Language\Japanese.xml" "Language\Japanese.xml" ".\Ditto\Language\Korean.xml" "Language\Korean.xml" ".\Ditto\Language\Persian.xml" "Language\Persian.xml" diff --git a/OleClipSource.cpp b/OleClipSource.cpp index 1cbd69d..aacde81 100644 --- a/OleClipSource.cpp +++ b/OleClipSource.cpp @@ -1358,7 +1358,7 @@ void COleClipSource::Slugify(CClip &clip) //free the old text we are going to replace it below with an upper case version unicodeTextFormat->Free(); - CString newString = slugify(cs.GetString()).c_str(); + CString newString = slugify(cs.GetString(), CGetSetOptions::GetSlugifySeparator().GetString()).c_str(); long len = newString.GetLength(); HGLOBAL hGlobal = NewGlobalP(newString.GetBuffer(), ((len + 1) * sizeof(wchar_t))); diff --git a/Options.cpp b/Options.cpp index 77163a0..29e1bfd 100644 --- a/Options.cpp +++ b/Options.cpp @@ -2961,4 +2961,16 @@ void CGetSetOptions::SetRefreshViewAfterPasting(BOOL val) { m_refreshViewAfterPasting = val; SetProfileLong("RefreshViewAfterPasting", val); -} \ No newline at end of file +} + + +CString CGetSetOptions::GetSlugifySeparator() +{ + return GetProfileString("SlugifySeparator", _T("-")); +} + +void CGetSetOptions::SetSlugifySeparator(CString val) +{ + SetProfileString("SlugifySeparator", val); +} + diff --git a/Options.h b/Options.h index 183ca18..9c07d7e 100644 --- a/Options.h +++ b/Options.h @@ -669,6 +669,9 @@ class CGetSetOptions static BOOL m_refreshViewAfterPasting; static BOOL GetRefreshViewAfterPasting(); static void SetRefreshViewAfterPasting(BOOL val); + + static CString GetSlugifySeparator(); + static void SetSlugifySeparator(CString val); }; // global for easy access and for initialization of fast access variables diff --git a/Slugify.h b/Slugify.h index 7dce20e..35dbcc9 100644 --- a/Slugify.h +++ b/Slugify.h @@ -29,7 +29,7 @@ std::wstring trim(const std::wstring &s) } // SLUGIFY -std::wstring slugify(std::wstring input) +std::wstring slugify(std::wstring input, std::wstring separator) { std::unordered_map charMap{ // latin @@ -117,9 +117,11 @@ std::wstring slugify(std::wstring input) trim(input); - //replace spaces with hyphens - std::wregex e3(_T("[-\\s]+")); - input = std::regex_replace(input, e3, _T("-")); + auto replaceSpacesAndSep = _T("[") + separator + _T("\\s]+"); + + //replace spaces with separator + std::wregex e3(replaceSpacesAndSep); + input = std::regex_replace(input, e3, separator); return input; }; \ No newline at end of file