mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Fixed messagebox and context menu layout with RTL languages
This commit is contained in:
parent
15380f1697
commit
0ce52f744a
@ -1160,7 +1160,7 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection
|
||||
{
|
||||
if (depth > 100) // Is 100 enough to assume the include loop never ends?
|
||||
{
|
||||
MessageBox(NULL, GetString(ID_STR_INCLUDEINFINITELOOP), APPNAME, MB_OK | MB_TOPMOST | MB_ICONERROR);
|
||||
Rainmeter->ShowMessage(NULL, GetString(ID_STR_INCLUDEINFINITELOOP), MB_OK | MB_ICONERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1414,7 +1414,7 @@ INT_PTR CDialogManage::CTabThemes::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
if (alreadyExists)
|
||||
{
|
||||
std::wstring text = GetFormattedString(ID_STR_THEMEALREADYEXISTS, theme.c_str());
|
||||
if (MessageBox(m_Window, text.c_str(), APPNAME, MB_ICONWARNING | MB_YESNO | MB_TOPMOST) != IDYES)
|
||||
if (Rainmeter->ShowMessage(m_Window, text.c_str(), MB_ICONWARNING | MB_YESNO) != IDYES)
|
||||
{
|
||||
// Cancel
|
||||
break;
|
||||
@ -1434,7 +1434,7 @@ INT_PTR CDialogManage::CTabThemes::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
if (!CSystem::CopyFiles(Rainmeter->GetIniFile(), path))
|
||||
{
|
||||
std::wstring text = GetFormattedString(ID_STR_THEMESAVEFAIL, path.c_str());
|
||||
MessageBox(m_Window, text.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONERROR);
|
||||
Rainmeter->ShowMessage(m_Window, text.c_str(), MB_OK | MB_ICONERROR);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1476,7 +1476,7 @@ INT_PTR CDialogManage::CTabThemes::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
if (file == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
std::wstring text = GetFormattedString(ID_STR_THEMESAVEFAIL, path.c_str());
|
||||
MessageBox(m_Window, text.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONERROR);
|
||||
Rainmeter->ShowMessage(m_Window, text.c_str(), MB_OK | MB_ICONERROR);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1521,7 +1521,7 @@ INT_PTR CDialogManage::CTabThemes::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
std::vector<std::wstring>& themes = const_cast<std::vector<std::wstring>&>(Rainmeter->GetAllThemes());
|
||||
|
||||
std::wstring text = GetFormattedString(ID_STR_THEMEDELETE, themes[sel].c_str());
|
||||
if (MessageBox(m_Window, text.c_str(), APPNAME, MB_ICONQUESTION | MB_YESNO | MB_TOPMOST) != IDYES)
|
||||
if (Rainmeter->ShowMessage(m_Window, text.c_str(), MB_ICONQUESTION | MB_YESNO) != IDYES)
|
||||
{
|
||||
// Cancel
|
||||
break;
|
||||
|
@ -1949,7 +1949,7 @@ bool CMeterWindow::ReadSkin()
|
||||
if (_waccess(iniFile.c_str(), 0) == -1)
|
||||
{
|
||||
std::wstring message = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, m_FolderPath.c_str(), m_FileName.c_str());
|
||||
MessageBox(m_Window, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||
Rainmeter->ShowMessage(m_Window, message.c_str(), MB_OK | MB_ICONEXCLAMATION);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1972,7 +1972,7 @@ bool CMeterWindow::ReadSkin()
|
||||
}
|
||||
|
||||
std::wstring text = GetFormattedString(ID_STR_NEWVERSIONREQUIRED, m_FolderPath.c_str(), m_FileName.c_str(), buffer);
|
||||
MessageBox(m_Window, text.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||
Rainmeter->ShowMessage(m_Window, text.c_str(), MB_OK | MB_ICONEXCLAMATION);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2226,7 +2226,7 @@ bool CMeterWindow::ReadSkin()
|
||||
if (m_Meters.empty())
|
||||
{
|
||||
std::wstring text = GetFormattedString(ID_STR_NOMETERSINSKIN, m_FolderPath.c_str(), m_FileName.c_str());
|
||||
MessageBox(m_Window, text.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||
Rainmeter->ShowMessage(m_Window, text.c_str(), MB_OK | MB_ICONEXCLAMATION);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
@ -965,7 +965,7 @@ int CRainmeter::Initialize(LPCWSTR iniPath)
|
||||
if (m_SkinFolders.empty())
|
||||
{
|
||||
std::wstring error = GetFormattedString(ID_STR_NOAVAILABLESKINS, m_SkinPath.c_str());
|
||||
MessageBox(NULL, error.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONERROR);
|
||||
ShowMessage(NULL, error.c_str(), MB_OK | MB_ICONERROR);
|
||||
}
|
||||
|
||||
ResetStats();
|
||||
@ -1340,7 +1340,7 @@ void CRainmeter::ActivateSkin(int folderIndex, int fileIndex)
|
||||
if (_waccess(skinIniPath.c_str(), 0) == -1)
|
||||
{
|
||||
std::wstring message = GetFormattedString(ID_STR_UNABLETOACTIVATESKIN, folderPath.c_str(), fileSz);
|
||||
MessageBox(NULL, message.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||
ShowMessage(NULL, message.c_str(), MB_OK | MB_ICONEXCLAMATION);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2464,7 +2464,7 @@ void CRainmeter::RefreshAll()
|
||||
DeactivateSkin(mw, index);
|
||||
|
||||
std::wstring error = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, skinFolder, skinIniFile);
|
||||
MessageBox(NULL, error.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||
ShowMessage(NULL, error.c_str(), MB_OK | MB_ICONEXCLAMATION);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -2472,7 +2472,7 @@ void CRainmeter::RefreshAll()
|
||||
DeactivateSkin(mw, -2); // -2 = Force deactivate
|
||||
|
||||
std::wstring error = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, skinFolder, L"");
|
||||
MessageBox(NULL, error.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONEXCLAMATION);
|
||||
ShowMessage(NULL, error.c_str(), MB_OK | MB_ICONEXCLAMATION);
|
||||
}
|
||||
|
||||
try
|
||||
@ -2738,6 +2738,22 @@ void CRainmeter::ResetStats()
|
||||
CMeasureNet::ResetStats();
|
||||
}
|
||||
|
||||
/*
|
||||
** Wraps MessageBox(). Sets RTL flag if necessary.
|
||||
**
|
||||
*/
|
||||
int CRainmeter::ShowMessage(HWND parent, const WCHAR* text, UINT type)
|
||||
{
|
||||
type |= MB_TOPMOST;
|
||||
|
||||
if (*GetString(ID_STR_ISRTL) == L'1')
|
||||
{
|
||||
type |= MB_RTLREADING;
|
||||
}
|
||||
|
||||
return MessageBox(parent, text, APPNAME, type);
|
||||
};
|
||||
|
||||
/*
|
||||
** Opens the context menu in given coordinates.
|
||||
**
|
||||
@ -2858,14 +2874,13 @@ void CRainmeter::ShowContextMenu(POINT pos, CMeterWindow* meterWindow)
|
||||
|
||||
// Show context menu
|
||||
TrackPopupMenu(
|
||||
subMenu,
|
||||
TPM_RIGHTBUTTON | TPM_LEFTALIGN,
|
||||
pos.x,
|
||||
pos.y,
|
||||
0,
|
||||
hWnd,
|
||||
NULL
|
||||
);
|
||||
subMenu,
|
||||
TPM_RIGHTBUTTON | TPM_LEFTALIGN | (*GetString(ID_STR_ISRTL) == L'1' ? TPM_LAYOUTRTL : 0),
|
||||
pos.x,
|
||||
pos.y,
|
||||
0,
|
||||
hWnd,
|
||||
NULL);
|
||||
|
||||
if (meterWindow)
|
||||
{
|
||||
@ -3209,7 +3224,7 @@ void CRainmeter::StartLogging()
|
||||
SetLogging(false);
|
||||
|
||||
std::wstring text = GetFormattedString(ID_STR_LOGFILECREATEFAIL, logFile);
|
||||
MessageBox(NULL, text.c_str(), APPNAME, MB_OK | MB_TOPMOST | MB_ICONERROR);
|
||||
ShowMessage(NULL, text.c_str(), MB_OK | MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -3240,7 +3255,7 @@ void CRainmeter::DeleteLogFile()
|
||||
if (_waccess(logFile, 0) != -1)
|
||||
{
|
||||
std::wstring text = GetFormattedString(ID_STR_LOGFILEDELETE, logFile);
|
||||
int res = MessageBox(NULL, text.c_str(), APPNAME, MB_YESNO | MB_TOPMOST | MB_ICONQUESTION);
|
||||
int res = ShowMessage(NULL, text.c_str(), MB_YESNO | MB_ICONQUESTION);
|
||||
if (res == IDYES)
|
||||
{
|
||||
// Disable logging
|
||||
@ -3306,7 +3321,7 @@ void CRainmeter::TestSettingsFile(bool bDefaultIniLocation)
|
||||
error += GetFormattedString(ID_STR_SETTINGSREADONLY, iniFile);
|
||||
}
|
||||
|
||||
MessageBox(NULL, error.c_str(), APPNAME, MB_OK | MB_ICONERROR);
|
||||
ShowMessage(NULL, error.c_str(), MB_OK | MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,6 +198,8 @@ public:
|
||||
|
||||
void SetDebug(bool debug);
|
||||
|
||||
int ShowMessage(HWND parent, const WCHAR* text, UINT type);
|
||||
|
||||
bool IsMenuActive() { return m_MenuActive; }
|
||||
void ShowContextMenu(POINT pos, CMeterWindow* meterWindow);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user