Fix docked/float panels in RTL layout issue

Fixed Npp RTL context menu for Document List, Project Panels, Folder Workspace, Search Results Window,
and fixed Floating Dockable Window RTL direction.

Fix #10488, close #10535
pull/10545/head
Ashfaaq18 3 years ago committed by Don Ho
parent f6bea32003
commit 73b41ec74f

@ -4453,7 +4453,9 @@ INT_PTR CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
scintillaContextmenu.checkItem(NPPM_INTERNAL_SCINTILLAFINDERWRAP, _longLinesAreWrapped); scintillaContextmenu.checkItem(NPPM_INTERNAL_SCINTILLAFINDERWRAP, _longLinesAreWrapped);
scintillaContextmenu.display(p); ::TrackPopupMenu(scintillaContextmenu.getMenuHandle(),
NppParameters::getInstance().getNativeLangSpeaker()->isRTL() ? TPM_RIGHTALIGN | TPM_LAYOUTRTL : TPM_LEFTALIGN,
p.x, p.y, 0, _hSelf, NULL);
return TRUE; return TRUE;
} }
return ::DefWindowProc(_hSelf, message, wParam, lParam); return ::DefWindowProc(_hSelf, message, wParam, lParam);

@ -95,14 +95,15 @@ void DockingCont::doDialog(bool willBeShown, bool isFloating)
{ {
if (!isCreated()) if (!isCreated())
{ {
create(IDD_CONTAINER_DLG); NativeLangSpeaker* pNativeSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
create(IDD_CONTAINER_DLG, pNativeSpeaker->isRTL());
_isFloating = isFloating; _isFloating = isFloating;
if (_isFloating) if (_isFloating)
{ {
::SetWindowLongPtr(_hSelf, GWL_STYLE, POPUP_STYLES); ::SetWindowLongPtr(_hSelf, GWL_STYLE, POPUP_STYLES);
::SetWindowLongPtr(_hSelf, GWL_EXSTYLE, POPUP_EXSTYLES); ::SetWindowLongPtr(_hSelf, GWL_EXSTYLE, pNativeSpeaker->isRTL()? POPUP_EXSTYLES | WS_EX_LAYOUTRTL : POPUP_EXSTYLES);
::ShowWindow(_hCaption, SW_HIDE); ::ShowWindow(_hCaption, SW_HIDE);
} }
else else
@ -633,7 +634,7 @@ eMousePos DockingCont::isInRect(HWND hwnd, int x, int y)
eMousePos ret = posOutside; eMousePos ret = posOutside;
::GetWindowRect(hwnd, &rc); ::GetWindowRect(hwnd, &rc);
ScreenRectToClientRect(hwnd, &rc); ::MapWindowPoints(NULL, hwnd, (LPPOINT)&rc, 2);
if (_isTopCaption == TRUE) if (_isTopCaption == TRUE)
{ {

@ -777,7 +777,9 @@ void FileBrowser::showContextMenu(int x, int y)
if (tvHitInfo.hItem == nullptr) if (tvHitInfo.hItem == nullptr)
{ {
TrackPopupMenu(_hGlobalMenu, TPM_LEFTALIGN, x, y, 0, _hSelf, NULL); TrackPopupMenu(_hGlobalMenu,
NppParameters::getInstance().getNativeLangSpeaker()->isRTL() ? TPM_RIGHTALIGN | TPM_LAYOUTRTL : TPM_LEFTALIGN,
x, y, 0, _hSelf, NULL);
} }
else else
{ {
@ -794,7 +796,9 @@ void FileBrowser::showContextMenu(int x, int y)
else //nodeType_file else //nodeType_file
hMenu = _hFileMenu; hMenu = _hFileMenu;
TrackPopupMenu(hMenu, TPM_LEFTALIGN, x, y, 0, _hSelf, NULL); TrackPopupMenu(hMenu,
NppParameters::getInstance().getNativeLangSpeaker()->isRTL() ? TPM_RIGHTALIGN | TPM_LAYOUTRTL : TPM_LEFTALIGN,
x, y, 0, _hSelf, NULL);
} }
} }

@ -882,7 +882,9 @@ void ProjectPanel::showContextMenu(int x, int y)
// Make item selected // Make item selected
_treeView.selectItem(tvHitInfo.hItem); _treeView.selectItem(tvHitInfo.hItem);
HMENU hMenu = getMenuHandler(tvHitInfo.hItem); HMENU hMenu = getMenuHandler(tvHitInfo.hItem);
TrackPopupMenu(hMenu, TPM_LEFTALIGN, x, y, 0, _hSelf, NULL); TrackPopupMenu(hMenu,
NppParameters::getInstance().getNativeLangSpeaker()->isRTL() ? TPM_RIGHTALIGN | TPM_LAYOUTRTL : TPM_LEFTALIGN,
x, y, 0, _hSelf, NULL);
} }
} }
@ -897,7 +899,9 @@ void ProjectPanel::showContextMenuFromMenuKey(HTREEITEM selectedItem, int x, int
if (selectedItem != NULL) if (selectedItem != NULL)
{ {
HMENU hMenu = getMenuHandler(selectedItem); HMENU hMenu = getMenuHandler(selectedItem);
TrackPopupMenu(hMenu, TPM_LEFTALIGN, p.x, p.y, 0, _hSelf, NULL); TrackPopupMenu(hMenu,
NppParameters::getInstance().getNativeLangSpeaker()->isRTL() ? TPM_RIGHTALIGN | TPM_LAYOUTRTL : TPM_LEFTALIGN,
x, y, 0, _hSelf, NULL);
} }
} }
@ -987,7 +991,9 @@ void ProjectPanel::popupMenuCmd(int cmdID)
case IDB_PROJECT_BTN: case IDB_PROJECT_BTN:
{ {
POINT p = getMenuDisplayPoint(0); POINT p = getMenuDisplayPoint(0);
TrackPopupMenu(_hWorkSpaceMenu, TPM_LEFTALIGN, p.x, p.y, 0, _hSelf, NULL); TrackPopupMenu(_hWorkSpaceMenu,
NppParameters::getInstance().getNativeLangSpeaker()->isRTL() ? TPM_RIGHTALIGN | TPM_LAYOUTRTL : TPM_LEFTALIGN,
p.x, p.y, 0, _hSelf, NULL);
} }
break; break;
@ -1003,7 +1009,9 @@ void ProjectPanel::popupMenuCmd(int cmdID)
else if (nodeType == nodeType_file) else if (nodeType == nodeType_file)
hMenu = _hFileMenu; hMenu = _hFileMenu;
if (hMenu) if (hMenu)
TrackPopupMenu(hMenu, TPM_LEFTALIGN, p.x, p.y, 0, _hSelf, NULL); TrackPopupMenu(hMenu,
NppParameters::getInstance().getNativeLangSpeaker()->isRTL() ? TPM_RIGHTALIGN | TPM_LAYOUTRTL : TPM_LEFTALIGN,
p.x, p.y, 0, _hSelf, NULL);
} }
break; break;

@ -262,7 +262,9 @@ INT_PTR CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam,
{ {
if (nbSelectedFiles() == 0 || colHeaderRClick) if (nbSelectedFiles() == 0 || colHeaderRClick)
{ {
::TrackPopupMenu(_hGlobalMenu, TPM_LEFTALIGN, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, _hSelf, NULL); ::TrackPopupMenu(_hGlobalMenu,
NppParameters::getInstance().getNativeLangSpeaker()->isRTL() ? TPM_RIGHTALIGN | TPM_LAYOUTRTL : TPM_LEFTALIGN,
GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, _hSelf, NULL);
colHeaderRClick = false; colHeaderRClick = false;
} }
return TRUE; return TRUE;

Loading…
Cancel
Save