Skip to content

Commit

Permalink
Support full RTL mirroring; for Hebrew and Arabic, this is the default;
Browse files Browse the repository at this point in the history
other languages can set an option in winfile.ini to experience RTL;
added hidden controls to the Preferences dialog to simplify verification;
used more descriptive names for wfloc.c functions;
made winfile.ini setting consistent in all languages.
  • Loading branch information
peterooch authored and craigwi committed May 16, 2018
1 parent d131732 commit 10b8a10
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/lang/winfile_en-US.dlg
Expand Up @@ -829,6 +829,7 @@ BEGIN
CONTROL "...", IDC_EDITOR, "button", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 14, 20, 14
CONTROL "Disable toolbar visual styling", IDC_VSTYLE, "button", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 16, 38, 119, 14
CONTROL "Create &Goto Index on Launch", IDC_GOTO, "button", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 16, 50, 119, 14
CONTROL "Mirror application content", IDC_MIRROR, "button", BS_AUTOCHECKBOX | WS_CHILD /* | WS_VISIBLE | WS_TABSTOP */, 0, 0, 0, 0 // invisible, not a tabsop; here to satisfy VerifyResources tool.
CONTROL "Language:", IDD_TEXT, "static", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 70, 35, 14
CONTROL "", IDC_LANGCB, "combobox", CBS_DROPDOWNLIST | WS_BORDER | WS_VSCROLL | WS_TABSTOP | WS_CHILD, 50, 68, 150, 14
CONTROL "Please note that some settings require you to restart the\napplication in order to take effect.",
Expand Down
15 changes: 8 additions & 7 deletions src/lang/winfile_he-IL.dlg
Expand Up @@ -853,7 +853,7 @@ BEGIN
PUSHBUTTON "ביטול", IDCANCEL, 418, 30, 40, 14, WS_GROUP
END

PREFDLG DIALOGEX LOADONCALL MOVEABLE DISCARDABLE 20, 20, 229, 140
PREFDLG DIALOGEX LOADONCALL MOVEABLE DISCARDABLE 20, 20, 229, 152
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_LAYOUTRTL
CAPTION "העדפות"
Expand All @@ -864,13 +864,14 @@ BEGIN
CONTROL "...", IDC_EDITOR, "button", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 201, 14, 20, 14
CONTROL "הפסק סגנון ויזואלי על סרגל הכלים", IDC_VSTYLE, "button", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 16, 38, 180, 14
CONTROL "צור מפתח מעבר תיקיות בעת הפעלה", IDC_GOTO, "button", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 16, 50, 180, 14
CONTROL "שפה:", IDD_TEXT, "static", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 70, 35, 14
CONTROL "", IDC_LANGCB, "combobox", CBS_DROPDOWNLIST | WS_BORDER | WS_VSCROLL | WS_TABSTOP | WS_CHILD, 50, 68, 150, 14
CONTROL "מנע יישור ממשק המשתמש מימין לשמאל", IDC_MIRROR, "button", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 16, 62, 180, 14
CONTROL "שפה:", IDD_TEXT, "static", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 82, 35, 14
CONTROL "", IDC_LANGCB, "combobox", CBS_DROPDOWNLIST | WS_BORDER | WS_VSCROLL | WS_TABSTOP | WS_CHILD, 50, 80, 150, 14
CONTROL "נא לשים לב ששינוים מסוימים יהיו פעילים\nרק אחרי פתיחה מחדש של התכנית.",
IDD_TEXT, "static", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 90, 180, 20
CONTROL "אישור", IDOK, "button", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 55, 120, 40, 14
CONTROL "ביטול", IDCANCEL, "button", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 103, 120, 40, 14
CONTROL "&עזרה", IDD_HELP, "button", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 149, 120, 40, 14
IDD_TEXT, "static", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 102, 180, 20
CONTROL "אישור", IDOK, "button", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 55, 132, 40, 14
CONTROL "ביטול", IDCANCEL, "button", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 103, 132, 40, 14
CONTROL "&עזרה", IDD_HELP, "button", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 149, 132, 40, 14
END

ABOUTDLG DIALOGEX 13, 54, 250, 75
Expand Down
1 change: 1 addition & 0 deletions src/lang/winfile_ja-JP.dlg
Expand Up @@ -829,6 +829,7 @@ BEGIN
CONTROL "...", IDC_EDITOR, "button", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 14, 20, 14
CONTROL "ツール バーのスタイルを無効", IDC_VSTYLE, "button", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 16, 38, 119, 14
CONTROL "起動時に移動先インデックスを作成(&G)", IDC_GOTO, "button", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 16, 50, 220, 14
CONTROL "Mirror application content", IDC_MIRROR, "button", BS_AUTOCHECKBOX | WS_CHILD /* | WS_VISIBLE | WS_TABSTOP */, 0, 0, 0, 0 // invisible, not a tabsop; here to satisfy VerifyResources tool.
CONTROL "言語:", IDD_TEXT, "static", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 70, 35, 14
CONTROL "", IDC_LANGCB, "combobox", CBS_DROPDOWNLIST | WS_BORDER | WS_VSCROLL | WS_TABSTOP | WS_CHILD, 50, 68, 150, 14
CONTROL "これらの変更の中には再起動後に有効になる物があります。\n注意して下さい。",
Expand Down
1 change: 1 addition & 0 deletions src/lang/winfile_pl-PL.dlg
Expand Up @@ -829,6 +829,7 @@ BEGIN
CONTROL "...", IDC_EDITOR, "button", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 205, 14, 20, 14
CONTROL "Wyłącz &kompozycje paska narzędzi", IDC_VSTYLE, "button", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 16, 38, 210, 14
CONTROL "Twórz indeks katalogów przy &uruchomieniu", IDC_GOTO, "button", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 16, 50, 210, 14
CONTROL "Mirror application content", IDC_MIRROR, "button", BS_AUTOCHECKBOX | WS_CHILD /* | WS_VISIBLE | WS_TABSTOP */, 0, 0, 0, 0 // invisible, not a tabsop; here to satisfy VerifyResources tool.
CONTROL "Język:", IDD_TEXT, "static", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 70, 35, 14
CONTROL "", IDC_LANGCB, "combobox", CBS_DROPDOWNLIST | WS_BORDER | WS_VSCROLL | WS_TABSTOP | WS_CHILD, 50, 68, 160, 13
CONTROL "Proszę pamiętać, że część zmian zostanie wprowadzona \npo ponownym uruchomieniu programu.",
Expand Down
1 change: 1 addition & 0 deletions src/lang/winfile_zh-CN.dlg
Expand Up @@ -829,6 +829,7 @@ BEGIN
CONTROL "...", IDC_EDITOR, "button", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 195, 14, 20, 14
CONTROL "禁用工具栏的可视化风格", IDC_VSTYLE, "button", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 16, 38, 119, 14
CONTROL "在启动时创建“转到目录“索引(&G)", IDC_GOTO, "button", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 16, 50, 119, 14
CONTROL "Mirror application content", IDC_MIRROR, "button", BS_AUTOCHECKBOX | WS_CHILD /* | WS_VISIBLE | WS_TABSTOP */, 0, 0, 0, 0 // invisible, not a tabsop; here to satisfy VerifyResources tool.
CONTROL "语言:", IDD_TEXT, "static", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 15, 70, 35, 14
CONTROL "", IDC_LANGCB, "combobox", CBS_DROPDOWNLIST | WS_BORDER | WS_VSCROLL | WS_TABSTOP | WS_CHILD, 50, 68, 150, 14
CONTROL "请注意某些更改仅在重新打开程序后生效。",
Expand Down
2 changes: 2 additions & 0 deletions src/tbar.c
Expand Up @@ -461,6 +461,8 @@ PaintDriveLine(DRAWITEMSTRUCT FAR *lpdis)
DWORD clrBackground;
RECT rc2;

PreserveBitmapInRTL(hdc);

//
// Check rectangle: if > 1 line and dwLines > 1 then use multiline
// else use abbreviated
Expand Down
2 changes: 2 additions & 0 deletions src/treectl.c
Expand Up @@ -1519,6 +1519,8 @@ TCWP_DrawItem(
hdc = lpLBItem->hDC;
pNode = (PDNODE)lpLBItem->itemData;

PreserveBitmapInRTL(hdc);

/*
* Save the real extent.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/wfdir.c
Expand Up @@ -67,6 +67,8 @@ DrawItem(

HDC hDC = lpLBItem->hDC;

PreserveBitmapInRTL(hDC);

HWND hwndListParms = (HWND)GetWindowLongPtr(hwnd, GWL_LISTPARMS);
BOOL bLower;

Expand Down
6 changes: 5 additions & 1 deletion src/wfdlgs.c
Expand Up @@ -740,6 +740,7 @@ INT_PTR CALLBACK PrefDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam)

CheckDlgButton(hDlg, IDC_VSTYLE, bDisableVisualStyles);
CheckDlgButton(hDlg, IDC_GOTO, bIndexOnLaunch);
CheckDlgButton(hDlg, IDC_MIRROR, bMirrorContent);
break;

case WM_COMMAND:
Expand All @@ -766,9 +767,12 @@ INT_PTR CALLBACK PrefDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM lParam)
WritePrivateProfileString(szSettings, szEditorPath, szTempEditPath, szTheINIFile);

bDisableVisualStyles = IsDlgButtonChecked(hDlg, IDC_VSTYLE);
bIndexOnLaunch = IsDlgButtonChecked(hDlg, IDC_GOTO);
bIndexOnLaunch = IsDlgButtonChecked(hDlg, IDC_GOTO);
bMirrorContent = IsDlgButtonChecked(hDlg, IDC_MIRROR);

WritePrivateProfileBool(szDisableVisualStyles, bDisableVisualStyles);
WritePrivateProfileBool(szIndexOnLaunch, bIndexOnLaunch);
WritePrivateProfileBool(szMirrorContent, bMirrorContent);

EndDialog(hDlg, TRUE);
break;
Expand Down
1 change: 1 addition & 0 deletions src/wfdlgs.h
Expand Up @@ -163,6 +163,7 @@
#define IDC_VSTYLE 276
#define IDC_LANGCB 277
#define IDC_GOTO 278
#define IDC_MIRROR 280

#define IDD_ENCRYPTED 279

Expand Down
2 changes: 1 addition & 1 deletion src/wfdrives.c
Expand Up @@ -343,7 +343,7 @@ DrawDrive(HDC hdc, INT x, INT y, DRIVEIND driveInd, BOOL bCurrent, BOOL bFocus)
SetTextColor(hdc, rgb);

BitBlt(hdc, x + 4*dyBorder, y + (dyDrive - dyDriveBitmap) / 2, dxDriveBitmap, dyDriveBitmap,
hdcMem, aDriveInfo[drive].iOffset, 2 * dyFolder, SRCCOPY);
hdcMem, aDriveInfo[drive].iOffset, 2 * dyFolder, SRCCOPY | NOMIRRORBITMAP);
}


Expand Down
6 changes: 5 additions & 1 deletion src/wfinit.c
Expand Up @@ -219,6 +219,7 @@ GetSettings()
wTextAttribs = (WORD)GetPrivateProfileInt(szSettings, szLowerCase, wTextAttribs, szTheINIFile);
bStatusBar = GetPrivateProfileInt(szSettings, szStatusBar, bStatusBar, szTheINIFile);
bDisableVisualStyles = GetPrivateProfileInt(szSettings, szDisableVisualStyles, bDisableVisualStyles, szTheINIFile);
bMirrorContent = GetPrivateProfileInt(szSettings, szMirrorContent, DefaultLayoutRTL(), szTheINIFile);

bDriveBar = GetPrivateProfileInt(szSettings, szDriveBar, bDriveBar, szTheINIFile);
bToolbar = GetPrivateProfileInt(szSettings, szToolbar, bToolbar, szTheINIFile);
Expand Down Expand Up @@ -928,6 +929,7 @@ InitFileManager(

HANDLE hThread;
DWORD dwRetval;
DWORD dwExStyle = 0L;

hThread = GetCurrentThread();

Expand Down Expand Up @@ -1024,6 +1026,8 @@ JAPANEND
//
GetSettings();

dwExStyle = MainWindowExStyle();

dyBorder = GetSystemMetrics(SM_CYBORDER);
dyBorderx2 = dyBorder * 2;
dxFrame = GetSystemMetrics(SM_CXFRAME) - dyBorder;
Expand Down Expand Up @@ -1291,7 +1295,7 @@ JAPANEND
}


if (!CreateWindowEx(0L, szFrameClass, szTitle, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
if (!CreateWindowEx(dwExStyle, szFrameClass, szTitle, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
win.rc.left, win.rc.top, win.rc.right, win.rc.bottom,
NULL, NULL, hInstance, NULL)) {

Expand Down
41 changes: 41 additions & 0 deletions src/wfloc.c
Expand Up @@ -55,3 +55,44 @@ VOID SaveLang(HWND hCBox)

WritePrivateProfileString(szSettings, szUILanguage, szLCIDs[iIndex], szTheINIFile);
}

// returns whether the current language is default RTL; ARABIC, HEBREW: true; else false;
// ideally this would call GetLocalInfoEx with LOCALE_IREADINGLAYOUT, but that API was >= Win7
BOOL DefaultLayoutRTL()
{
switch (PRIMARYLANGID(LANGIDFROMLCID(lcid)))
{
/* Additional Languages can be added */
case LANG_ARABIC:
case LANG_HEBREW:
return TRUE;
default:
return FALSE;
}
}

// returns the extended style bits for the main window;
// if bMirrorContent, essentially reverses the RTL setting (but not the main layout in RTL langauges)
DWORD MainWindowExStyle()
{
DWORD exStyle = 0L;

if (DefaultLayoutRTL())
{
exStyle = WS_EX_LAYOUTRTL;
if (!bMirrorContent)
exStyle |= WS_EX_NOINHERITLAYOUT;
}
else
{
exStyle = bMirrorContent ? WS_EX_LAYOUTRTL : 0;
}

return exStyle;
}

VOID PreserveBitmapInRTL(HDC hdc)
{
if (GetLayout(hdc) == LAYOUT_RTL)
SetLayout(hdc, LAYOUT_RTL | LAYOUT_BITMAPORIENTATIONPRESERVED);
}
6 changes: 5 additions & 1 deletion src/winfile.h
Expand Up @@ -616,7 +616,9 @@ BOOL GetRootPath(LPTSTR szPath, LPTSTR szReturn);
//WFLOC.C
VOID InitLangList(HWND hCBox);
VOID SaveLang(HWND hCBox);

BOOL DefaultLayoutRTL();
DWORD MainWindowExStyle(VOID);
VOID PreserveBitmapInRTL(HDC hdc);

// TBAR.C

Expand Down Expand Up @@ -1141,6 +1143,7 @@ Extern BOOL bDriveBar EQ( TRUE );
Extern BOOL bToolbar EQ( TRUE );
Extern BOOL bNewWinOnConnect EQ( TRUE );
Extern BOOL bDisableVisualStyles EQ( FALSE );
Extern BOOL bMirrorContent EQ( FALSE );

Extern BOOL bExitWindows EQ( FALSE );
Extern BOOL bConfirmDelete EQ( TRUE );
Expand Down Expand Up @@ -1172,6 +1175,7 @@ Extern TCHAR szNewWinOnNetConnect[] EQ( TEXT("NewWinOnNetConnect") );
Extern TCHAR szDisableVisualStyles[] EQ( TEXT("DisableVisualStyles") );
Extern TCHAR szUILanguage[] EQ( TEXT("UILanguage") );
Extern TCHAR szEditorPath[] EQ( TEXT("EditorPath"));
Extern TCHAR szMirrorContent[] EQ( TEXT("MirrorContent") );

Extern TCHAR szMinOnRun[] EQ( TEXT("MinOnRun") );
Extern TCHAR szIndexOnLaunch[] EQ( TEXT("IndexOnLaunch") );
Expand Down

0 comments on commit 10b8a10

Please sign in to comment.