mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Manage Settings: Changed to remove ConfigEditor if it matches associated editor
This commit is contained in:
parent
89fcfeb4e6
commit
fd5de00955
@ -1827,9 +1827,11 @@ INT_PTR CDialogManage::CTabSettings::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||||||
case IDC_MANAGESETTINGS_CONFIGEDITOR_TEXT:
|
case IDC_MANAGESETTINGS_CONFIGEDITOR_TEXT:
|
||||||
if (HIWORD(wParam) == EN_CHANGE)
|
if (HIWORD(wParam) == EN_CHANGE)
|
||||||
{
|
{
|
||||||
WCHAR buffer[MAX_LINE_LENGTH];
|
WCHAR buffer[MAX_PATH];
|
||||||
std::wstring editor = (GetWindowText((HWND)lParam, buffer, MAX_LINE_LENGTH) > 0) ? buffer : L"";
|
if (GetWindowText((HWND)lParam, buffer, _countof(buffer)) > 0)
|
||||||
Rainmeter->SetSkinEditor(editor);
|
{
|
||||||
|
Rainmeter->SetSkinEditor(buffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1503,23 +1503,22 @@ void CRainmeter::SetSkinPath(const std::wstring& skinPath)
|
|||||||
WritePrivateProfileString(L"Rainmeter", L"SkinPath", skinPath.c_str(), m_IniFile.c_str());
|
WritePrivateProfileString(L"Rainmeter", L"SkinPath", skinPath.c_str(), m_IniFile.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRainmeter::SetSkinEditor(const std::wstring& editor)
|
void CRainmeter::SetSkinEditor(const std::wstring& path)
|
||||||
{
|
{
|
||||||
LPCWSTR tmp = editor.empty() ? NULL : editor.c_str();
|
assert(!path.empty());
|
||||||
if (!tmp)
|
|
||||||
|
const WCHAR* pathSz = path.c_str();
|
||||||
|
WCHAR buffer[MAX_PATH];
|
||||||
|
DWORD cchOut = MAX_PATH;
|
||||||
|
HRESULT hr = AssocQueryString(ASSOCF_NOTRUNCATE, ASSOCSTR_EXECUTABLE, L".ini", L"open", buffer, &cchOut);
|
||||||
|
if (SUCCEEDED(hr) && _wcsicmp(pathSz, buffer) == 0)
|
||||||
{
|
{
|
||||||
// Get the program path associated with .ini files
|
// The selected editor and the associated editor is the same, so remove from Rainmeter.ini.
|
||||||
WCHAR buffer[MAX_PATH];
|
pathSz = NULL;
|
||||||
DWORD cchOut = MAX_PATH;
|
|
||||||
HRESULT hr = AssocQueryString(ASSOCF_NOTRUNCATE, ASSOCSTR_EXECUTABLE, L".ini", L"open", buffer, &cchOut);
|
|
||||||
m_SkinEditor = (SUCCEEDED(hr) && cchOut > 0) ? buffer : L"Notepad";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_SkinEditor = editor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WritePrivateProfileString(L"Rainmeter", L"ConfigEditor", tmp, m_IniFile.c_str());
|
m_SkinEditor = path;
|
||||||
|
WritePrivateProfileString(L"Rainmeter", L"ConfigEditor", pathSz, m_IniFile.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRainmeter::WriteActive(const std::wstring& folderPath, int fileIndex)
|
void CRainmeter::WriteActive(const std::wstring& folderPath, int fileIndex)
|
||||||
|
@ -154,7 +154,7 @@ public:
|
|||||||
const std::wstring& GetDrive() { return m_Drive; }
|
const std::wstring& GetDrive() { return m_Drive; }
|
||||||
|
|
||||||
const std::wstring& GetSkinEditor() { return m_SkinEditor; }
|
const std::wstring& GetSkinEditor() { return m_SkinEditor; }
|
||||||
void SetSkinEditor(const std::wstring& editor);
|
void SetSkinEditor(const std::wstring& path);
|
||||||
const std::wstring& GetStatsDate() { return m_StatsDate; }
|
const std::wstring& GetStatsDate() { return m_StatsDate; }
|
||||||
|
|
||||||
HWND GetWindow() { return m_Window; }
|
HWND GetWindow() { return m_Window; }
|
||||||
|
Loading…
Reference in New Issue
Block a user