- Better RTL support:
* use RTL reading wherever possible (shows the dots, commas, etc. in the correct order) * Message boxes are now RTL too * Fixed RTL for links in InstallOptions - Fixed tab order in StartMenu - Made StartMenu use SHGetSpecialFolderLocation (soon to be in NSIS core too) git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3259 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
740ae21f2d
commit
4eb2881b5b
11 changed files with 186 additions and 158 deletions
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
#include "DialogTemplate.h"
|
||||
#include <commctrl.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Utilities
|
||||
|
@ -424,10 +425,9 @@ void CDialogTemplate::CTrimToString(WORD id, char *str, int margins) {
|
|||
void CDialogTemplate::ConvertToRTL() {
|
||||
for (unsigned int i = 0; i < m_vItems.size(); i++) {
|
||||
bool addExStyle = false;
|
||||
if (m_vItems[i]->dwExtStyle & WS_EX_LEFT)
|
||||
addExStyle = true;
|
||||
|
||||
// Button
|
||||
else if (int(m_vItems[i]->szClass) == 0x80) {
|
||||
if (int(m_vItems[i]->szClass) == 0x80) {
|
||||
m_vItems[i]->dwStyle ^= BS_LEFTTEXT;
|
||||
m_vItems[i]->dwStyle ^= BS_RIGHT;
|
||||
m_vItems[i]->dwStyle ^= BS_LEFT;
|
||||
|
@ -435,14 +435,16 @@ void CDialogTemplate::ConvertToRTL() {
|
|||
if ((m_vItems[i]->dwStyle & (BS_LEFT|BS_RIGHT)) == (BS_LEFT|BS_RIGHT)) {
|
||||
m_vItems[i]->dwStyle ^= BS_LEFT;
|
||||
m_vItems[i]->dwStyle ^= BS_RIGHT;
|
||||
if (m_vItems[i]->dwStyle & (BS_RADIOBUTTON|BS_CHECKBOX|BS_USERBUTTON))
|
||||
if (m_vItems[i]->dwStyle & (BS_RADIOBUTTON|BS_CHECKBOX|BS_USERBUTTON)) {
|
||||
m_vItems[i]->dwStyle |= BS_RIGHT;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Edit
|
||||
else if (int(m_vItems[i]->szClass) == 0x81) {
|
||||
if ((m_vItems[i]->dwStyle & ES_CENTER) == 0)
|
||||
if ((m_vItems[i]->dwStyle & ES_CENTER) == 0) {
|
||||
m_vItems[i]->dwStyle ^= ES_RIGHT;
|
||||
}
|
||||
}
|
||||
// Static
|
||||
else if (int(m_vItems[i]->szClass) == 0x82) {
|
||||
|
@ -455,14 +457,21 @@ void CDialogTemplate::ConvertToRTL() {
|
|||
m_vItems[i]->dwStyle |= SS_CENTERIMAGE;
|
||||
}
|
||||
}
|
||||
else if (!IS_INTRESOURCE(m_vItems[i]->szClass) && strcmpi(m_vItems[i]->szClass, "RichEdit20A")) {
|
||||
if ((m_vItems[i]->dwStyle & ES_CENTER) == 0)
|
||||
else if (!IS_INTRESOURCE(m_vItems[i]->szClass) && !strcmpi(m_vItems[i]->szClass, "RichEdit20A")) {
|
||||
if ((m_vItems[i]->dwStyle & ES_CENTER) == 0) {
|
||||
m_vItems[i]->dwStyle ^= ES_RIGHT;
|
||||
}
|
||||
}
|
||||
else if (!IS_INTRESOURCE(m_vItems[i]->szClass) && !strcmpi(m_vItems[i]->szClass, "SysTreeView32")) {
|
||||
m_vItems[i]->dwStyle |= TVS_RTLREADING;
|
||||
addExStyle = true;
|
||||
}
|
||||
else addExStyle = true;
|
||||
|
||||
if (addExStyle)
|
||||
m_vItems[i]->dwExtStyle |= WS_EX_RIGHT | WS_EX_RTLREADING;
|
||||
m_vItems[i]->dwExtStyle |= WS_EX_RIGHT;
|
||||
|
||||
m_vItems[i]->dwExtStyle |= WS_EX_RTLREADING;
|
||||
|
||||
m_vItems[i]->sX = m_sWidth - m_vItems[i]->sWidth - m_vItems[i]->sX;
|
||||
}
|
||||
|
|
|
@ -146,7 +146,8 @@ lang_again:
|
|||
language_table=((char*)g_blocks[NB_LANGTABLES].offset)+lang_num*g_header->langtable_size;
|
||||
if (!((lang ^ *(LANGID*)language_table) & lang_mask)) {
|
||||
dlg_offset=*(int*)(language_table+sizeof(LANGID));
|
||||
cur_langtable=(int*)(language_table+sizeof(LANGID)+sizeof(int));
|
||||
g_exec_flags.rtl=*(int*)(language_table+sizeof(LANGID)+sizeof(int));
|
||||
cur_langtable=(int*)(language_table+sizeof(LANGID)+2*sizeof(int));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -467,6 +467,7 @@ union exec_flags {
|
|||
int silent;
|
||||
#endif
|
||||
int instdir_error;
|
||||
int rtl;
|
||||
};
|
||||
int flags[1];
|
||||
};
|
||||
|
|
|
@ -85,7 +85,10 @@ int NSISCALL my_MessageBox(const char *text, UINT type) {
|
|||
if (g_exec_flags.silent && type >> 20)
|
||||
return type >> 20;
|
||||
// no silent or no default, just show
|
||||
return MessageBox(g_hwnd, text, g_caption, type & 0x000FFFFF);
|
||||
if (!g_exec_flags.rtl)
|
||||
return MessageBox(g_hwnd, text, g_caption, type & 0x000FFFFF);
|
||||
else
|
||||
return MessageBox(g_hwnd, text, g_caption, (type & 0x000FFFFF) ^ (MB_RIGHT | MB_RTLREADING));
|
||||
}
|
||||
|
||||
void * NSISCALL my_GlobalAlloc(DWORD dwBytes) {
|
||||
|
|
|
@ -405,6 +405,10 @@ int CEXEBuild::GenerateLangTables() {
|
|||
while (i--) {
|
||||
build_langtables.add(<[i].lang_id, sizeof(LANGID));
|
||||
build_langtables.add(<[i].dlg_offset, sizeof(int));
|
||||
{
|
||||
int rtl = lt[i].nlf.m_bRTL ? 1 : 0;
|
||||
build_langtables.add(&rtl, sizeof(int));
|
||||
}
|
||||
|
||||
int *lst = (int *)((char *)build_langtables.get() + build_langtables.getlen());
|
||||
cnt = 0;
|
||||
|
@ -488,6 +492,10 @@ int CEXEBuild::GenerateLangTables() {
|
|||
while (i--) {
|
||||
ubuild_langtables.add(<[i].lang_id, sizeof(LANGID));
|
||||
ubuild_langtables.add(<[i].dlg_offset, sizeof(int));
|
||||
{
|
||||
int rtl = lt[i].nlf.m_bRTL ? 1 : 0;
|
||||
ubuild_langtables.add(&rtl, sizeof(int));
|
||||
}
|
||||
|
||||
int *lst = (int *)((char *)ubuild_langtables.get() + ubuild_langtables.getlen());
|
||||
cnt = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue