Fix dockable panels display issue in RTL direction

Fix #9241
This commit is contained in:
Don HO 2020-12-11 20:09:55 +01:00
parent 4768fec82d
commit db4a6f5ec6
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
3 changed files with 47 additions and 42 deletions

View File

@ -6346,8 +6346,10 @@ void Notepad_plus::launchClipboardHistoryPanel()
_pClipboardHistoryPanel->init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), &_pEditView);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
bool isRTL = pNativeSpeaker->isRTL();
tTbData data = {0};
_pClipboardHistoryPanel->create(&data);
_pClipboardHistoryPanel->create(&data, isRTL);
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>(_pClipboardHistoryPanel->getHSelf()));
// define the default docking behaviour
@ -6359,7 +6361,7 @@ void Notepad_plus::launchClipboardHistoryPanel()
// in this case is DOCKABLE_DEMO_INDEX
// In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog
data.dlgID = IDM_EDIT_CLIPBOARDHISTORY_PANEL;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string title_temp = pNativeSpeaker->getAttrNameStr(CH_PROJECTPANELTITLE, "ClipboardHistory", "PanelTitle");
static TCHAR title[32];
if (title_temp.length() < 32)
@ -6387,9 +6389,10 @@ void Notepad_plus::launchFileSwitcherPanel()
_pFileSwitcherPanel = new VerticalFileSwitcher;
HIMAGELIST hImgLst = _docTabIconList.getHandle();
_pFileSwitcherPanel->init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), hImgLst);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
bool isRTL = pNativeSpeaker->isRTL();
tTbData data = {0};
_pFileSwitcherPanel->create(&data);
_pFileSwitcherPanel->create(&data, isRTL);
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>(_pFileSwitcherPanel->getHSelf()));
// define the default docking behaviour
@ -6402,7 +6405,6 @@ void Notepad_plus::launchFileSwitcherPanel()
// In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog
data.dlgID = IDM_VIEW_FILESWITCHER_PANEL;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string title_temp = pNativeSpeaker->getAttrNameStr(FS_PROJECTPANELTITLE, "DocSwitcher", "PanelTitle");
static TCHAR title[32];
if (title_temp.length() < 32)
@ -6429,8 +6431,10 @@ void Notepad_plus::launchAnsiCharPanel()
_pAnsiCharPanel = new AnsiCharPanel();
_pAnsiCharPanel->init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), &_pEditView);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
bool isRTL = pNativeSpeaker->isRTL();
tTbData data = {0};
_pAnsiCharPanel->create(&data);
_pAnsiCharPanel->create(&data, isRTL);
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>(_pAnsiCharPanel->getHSelf()));
// define the default docking behaviour
@ -6443,7 +6447,6 @@ void Notepad_plus::launchAnsiCharPanel()
// In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog
data.dlgID = IDM_EDIT_CHAR_PANEL;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string title_temp = pNativeSpeaker->getAttrNameStr(AI_PROJECTPANELTITLE, "AsciiInsertion", "PanelTitle");
static TCHAR title[85];
if (title_temp.length() < 85)
@ -6472,7 +6475,7 @@ void Notepad_plus::launchFileBrowser(const vector<generic_string> & folders, con
tTbData data;
memset(&data, 0, sizeof(data));
_pFileBrowser->create(&data);
_pFileBrowser->create(&data, _nativeLangSpeaker.isRTL());
data.pszName = TEXT("ST");
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>(_pFileBrowser->getHSelf()));
@ -6569,10 +6572,11 @@ void Notepad_plus::launchProjectPanel(int cmdID, ProjectPanel ** pProjPanel, int
(*pProjPanel) = new ProjectPanel;
(*pProjPanel)->init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), panelID);
(*pProjPanel)->setWorkSpaceFilePath(nppParam.getWorkSpaceFilePath(panelID));
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
bool isRTL = pNativeSpeaker->isRTL();
tTbData data;
memset(&data, 0, sizeof(data));
(*pProjPanel)->create(&data);
(*pProjPanel)->create(&data, isRTL);
data.pszName = TEXT("ST");
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>((*pProjPanel)->getHSelf()));
@ -6586,7 +6590,6 @@ void Notepad_plus::launchProjectPanel(int cmdID, ProjectPanel ** pProjPanel, int
// In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog
data.dlgID = cmdID;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string title_no = to_wstring (panelID + 1);
generic_string title_temp = pNativeSpeaker->getAttrNameStr(PM_PROJECTPANELTITLE, "ProjectManager", "PanelTitle") + TEXT(" ") + title_no;
(*pProjPanel)->setPanelTitle(title_temp);
@ -6669,8 +6672,10 @@ void Notepad_plus::launchFunctionList()
_pFuncList = new FunctionListPanel();
_pFuncList->init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), &_pEditView);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
bool isRTL = pNativeSpeaker->isRTL();
tTbData data = {0};
_pFuncList->create(&data);
_pFuncList->create(&data, isRTL);
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>(_pFuncList->getHSelf()));
// define the default docking behaviour
@ -6683,7 +6688,6 @@ void Notepad_plus::launchFunctionList()
// In the case of Notepad++ internal function, it'll be the command ID which triggers this dialog
data.dlgID = IDM_VIEW_FUNC_LIST;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string title_temp = pNativeSpeaker->getAttrNameStr(FL_PANELTITLE, FL_FUCTIONLISTROOTNODE, "PanelTitle");
static TCHAR title[32];

View File

@ -2359,9 +2359,13 @@ void FindReplaceDlg::findAllIn(InWhat op)
_pFinder = new Finder();
_pFinder->init(_hInst, (*_ppEditView)->getHParent(), _ppEditView);
_pFinder->setVolatiled(false);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
bool isRTL = pNativeSpeaker->isRTL();
tTbData data = {0};
_pFinder->create(&data, false);
_pFinder->create(&data, isRTL);
::SendMessage(_hParent, NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>(_pFinder->getHSelf()));
// define the default docking behaviour
data.uMask = DWS_DF_CONT_BOTTOM | DWS_ICONTAB | DWS_ADDINFO;
@ -2374,8 +2378,8 @@ void FindReplaceDlg::findAllIn(InWhat op)
// in this case is DOCKABLE_DEMO_INDEX
data.dlgID = 0;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string text = pNativeSpeaker->getLocalizedStrFromID("find-result-caption", TEXT(""));
if (!text.empty())
{
_findResTitle = text;
@ -2385,6 +2389,7 @@ void FindReplaceDlg::findAllIn(InWhat op)
::SendMessage(_hParent, NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
_pFinder->_scintView.init(_hInst, _pFinder->getHSelf());
_pFinder->_scintView.changeTextDirection(isRTL);
// Subclass the ScintillaEditView for the Finder (Scintilla doesn't notify all key presses)
originalFinderProc = SetWindowLongPtr(_pFinder->_scintView.getHSelf(), GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(finderProc));
@ -2471,11 +2476,14 @@ void FindReplaceDlg::findAllIn(InWhat op)
Finder * FindReplaceDlg::createFinder()
{
Finder *pFinder = new Finder();
pFinder->init(_hInst, (*_ppEditView)->getHParent(), _ppEditView);
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
bool isRTL = pNativeSpeaker->isRTL();
tTbData data = { 0 };
pFinder->create(&data, false);
pFinder->create(&data, isRTL);
::SendMessage(_hParent, NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<WPARAM>(pFinder->getHSelf()));
// define the default docking behaviour
data.uMask = DWS_DF_CONT_BOTTOM | DWS_ICONTAB | DWS_ADDINFO;
@ -2488,7 +2496,6 @@ Finder * FindReplaceDlg::createFinder()
// in this case is DOCKABLE_DEMO_INDEX
data.dlgID = 0;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string text = pNativeSpeaker->getLocalizedStrFromID("find-result-caption", TEXT(""));
if (!text.empty())
{
@ -2499,6 +2506,7 @@ Finder * FindReplaceDlg::createFinder()
::SendMessage(_hParent, NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
pFinder->_scintView.init(_hInst, pFinder->getHSelf());
pFinder->_scintView.changeTextDirection(isRTL);
// Subclass the ScintillaEditView for the Finder (Scintilla doesn't notify all key presses)
originalFinderProc = SetWindowLongPtr(pFinder->_scintView.getHSelf(), GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(finderProc));

View File

@ -43,16 +43,14 @@ public:
DockingDlgInterface() = default;
explicit DockingDlgInterface(int dlgID): _dlgID(dlgID) {}
virtual void init(HINSTANCE hInst, HWND parent)
{
virtual void init(HINSTANCE hInst, HWND parent) {
StaticDialog::init(hInst, parent);
TCHAR temp[MAX_PATH];
::GetModuleFileName(reinterpret_cast<HMODULE>(hInst), temp, MAX_PATH);
_moduleName = ::PathFindFileName(temp);
}
void create(tTbData * data, bool isRTL = false)
{
void create(tTbData* data, bool isRTL = false) {
assert(data != nullptr);
StaticDialog::create(_dlgID, isRTL);
TCHAR temp[MAX_PATH];
@ -60,18 +58,17 @@ public:
_pluginName = temp;
// user information
data->hClient = _hSelf;
data->pszName = _pluginName.c_str();
data->hClient = _hSelf;
data->pszName = _pluginName.c_str();
// supported features by plugin
data->uMask = 0;
data->uMask = 0;
// additional info
data->pszAddInfo = NULL;
data->pszAddInfo = NULL;
}
virtual void updateDockingDlg()
{
virtual void updateDockingDlg() {
::SendMessage(_hParent, NPPM_DMMUPDATEDISPINFO, 0, reinterpret_cast<LPARAM>(_hSelf));
}
@ -97,11 +94,16 @@ public:
}
protected :
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM, LPARAM lParam)
{
switch (message)
{
int _dlgID = -1;
bool _isFloating = true;
int _iDockedPos = 0;
generic_string _moduleName;
generic_string _pluginName;
bool _isClosed = false;
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM, LPARAM lParam) {
switch (message)
{
case WM_NOTIFY:
{
LPNMHDR pnmh = reinterpret_cast<LPNMHDR>(lParam);
@ -136,13 +138,4 @@ protected :
}
return FALSE;
};
// Handles
HWND _HSource = NULL;
int _dlgID = -1;
bool _isFloating = true;
int _iDockedPos = 0;
generic_string _moduleName;
generic_string _pluginName;
bool _isClosed = false;
};