diff --git a/PowerEditor/installer/nativeLang/abkhazian.xml b/PowerEditor/installer/nativeLang/abkhazian.xml index f1208252c..dc85ab502 100644 --- a/PowerEditor/installer/nativeLang/abkhazian.xml +++ b/PowerEditor/installer/nativeLang/abkhazian.xml @@ -1484,7 +1484,6 @@ Updated to v8.2.1: - diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index 0fe080f94..d624501c9 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -1720,9 +1720,9 @@ Find in all files but exclude all folders log or logs recursively: - + - + diff --git a/PowerEditor/installer/nativeLang/english_customizable.xml b/PowerEditor/installer/nativeLang/english_customizable.xml index 3e3703fab..8c6a7f955 100644 --- a/PowerEditor/installer/nativeLang/english_customizable.xml +++ b/PowerEditor/installer/nativeLang/english_customizable.xml @@ -1718,9 +1718,9 @@ Find in all files but exclude all folders log or logs recursively: - + - + diff --git a/PowerEditor/installer/nativeLang/russian.xml b/PowerEditor/installer/nativeLang/russian.xml index dc5913419..b2225da24 100644 --- a/PowerEditor/installer/nativeLang/russian.xml +++ b/PowerEditor/installer/nativeLang/russian.xml @@ -1762,7 +1762,6 @@ Notepad++ сделает резервную копию вашего старог - diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 9165c0cf9..cc8be2af0 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -880,7 +880,7 @@ LRESULT Notepad_plus::init(HWND hwnd) activateBuffer(_mainEditView.getCurrentBufferID(), MAIN_VIEW); activateBuffer(_subEditView.getCurrentBufferID(), SUB_VIEW); - _mainEditView.getFocus(); + _mainEditView.grabFocus(); return TRUE; } @@ -2566,7 +2566,20 @@ void Notepad_plus::checkClipboard() if (!NppParameters::getInstance().getSVP()._lineCopyCutWithoutSelection) { enableCommand(IDM_EDIT_CUT, hasSelection, MENU | TOOLBAR); - enableCommand(IDM_EDIT_COPY, hasSelection, MENU | TOOLBAR); + + if (hasSelection) + { + enableCommand(IDM_EDIT_COPY, true, MENU | TOOLBAR); + } + else if (_findReplaceDlg.allowCopyAction()) + { + enableCommand(IDM_EDIT_COPY, false, TOOLBAR); + enableCommand(IDM_EDIT_COPY, true, MENU); + } + else + { + enableCommand(IDM_EDIT_COPY, false, MENU | TOOLBAR); + } } enableCommand(IDM_EDIT_PASTE, canPaste, MENU | TOOLBAR); enableCommand(IDM_EDIT_DELETE, hasSelection, MENU | TOOLBAR); @@ -4752,7 +4765,7 @@ int Notepad_plus::switchEditViewTo(int gid) if (currentView() == gid) { //make sure focus is ok, then leave - _pEditView->getFocus(); //set the focus + _pEditView->grabFocus(); //set the focus return gid; } @@ -4768,7 +4781,7 @@ int Notepad_plus::switchEditViewTo(int gid) std::swap(_pEditView, _pNonEditView); _pEditView->beSwitched(); - _pEditView->getFocus(); //set the focus + _pEditView->grabFocus(); //set the focus if (_pDocMap) { @@ -5939,7 +5952,7 @@ void Notepad_plus::fullScreenToggle() int y = nppRect.top; ::MoveWindow(_restoreButton.getHSelf(), x, y, w, h, FALSE); - _pEditView->getFocus(); + _pEditView->grabFocus(); } else //toggle fullscreen off { @@ -6073,7 +6086,7 @@ void Notepad_plus::postItToggle() int y = nppRect.top + 1; ::MoveWindow(_restoreButton.getHSelf(), x, y, w, h, FALSE); - _pEditView->getFocus(); + _pEditView->grabFocus(); } else //PostIt enabled, disable it { @@ -7697,7 +7710,7 @@ void Notepad_plus::launchDocMap() _pDocMap->wrapMap(); _pDocMap->display(); - _pEditView->getFocus(); + _pEditView->grabFocus(); } diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index c3dd2e321..5df0ca6e7 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -2257,7 +2257,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa { if (wParam != WA_INACTIVE && _pEditView && _pNonEditView) { - _pEditView->getFocus(); + _pEditView->grabFocus(); auto x = _pEditView->execute(SCI_GETXOFFSET); _pEditView->execute(SCI_SETXOFFSET, x); x = _pNonEditView->execute(SCI_GETXOFFSET); @@ -2880,7 +2880,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa //case WM_LBUTTONDBLCLK: case WM_LBUTTONUP : { - _pEditView->getFocus(); + _pEditView->grabFocus(); ::ShowWindow(hwnd, SW_SHOW); _dockingManager.showFloatingContainers(true); restoreMinimizeDialogs(); diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 2a1db337a..f7a820304 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -895,7 +895,7 @@ void Notepad_plus::command(int id) { if (_pDocumentListPanel && _pDocumentListPanel->isVisible()) { - _pDocumentListPanel->getFocus(); + _pDocumentListPanel->grabFocus(); } else { @@ -1035,7 +1035,7 @@ void Notepad_plus::command(int id) { if (_pFuncList && _pFuncList->isVisible()) { - _pFuncList->getFocus(); + _pFuncList->grabFocus(); } else { diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index c59f8ca6f..8742c0101 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -1396,12 +1396,12 @@ struct HLSColour void loadFromRGB(COLORREF rgb) { ColorRGBToHLS(rgb, &_hue, &_lightness, &_saturation); } COLORREF toRGB() const { return ColorHLSToRGB(_hue, _lightness, _saturation); } - COLORREF toRGB4DarkModWithTuning(int lightnessMore, int saturationLess) const { + COLORREF toRGB4DarkModeWithTuning(int lightnessMore, int saturationLess) const { return ColorHLSToRGB(_hue, static_cast(static_cast(_lightness) + lightnessMore), static_cast(static_cast(_saturation) - saturationLess)); } - COLORREF toRGB4DarkMod() const { return toRGB4DarkModWithTuning(50, 20); } + COLORREF toRGB4DarkMod() const { return toRGB4DarkModeWithTuning(50, 20); } }; struct UdlXmlFileState final { diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index 10f594ddf..fb7a9fc12 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp @@ -577,10 +577,15 @@ bool Finder::notify(SCNotification *notification) case SCN_PAINTED : if (isDoubleClicked) { - (*_ppEditView)->getFocus(); + (*_ppEditView)->grabFocus(); isDoubleClicked = false; } break; + + case SCN_UPDATEUI: + ::SendMessage(_hParent, NPPM_INTERNAL_CHECKUNDOREDOSTATE, 0, 0); + break; + } return false; } @@ -698,29 +703,30 @@ vector Finder::getResultFilePaths(bool onlyInSelectedText) const toLine = _scintView.execute(SCI_GETLINECOUNT) - 1; } + size_t len = _pMainFoundInfos->size(); // First, get the number of elements in the container for (size_t line = fromLine; line <= toLine; ++line) { + bool found = false; // Was it found? const int lineFoldLevel = _scintView.execute(SCI_GETFOLDLEVEL, line) & SC_FOLDLEVELNUMBERMASK; if (lineFoldLevel == fileHeaderLevel) { - wstring lineStr = _scintView.getLine(line); - - // fileHeaderLevel line format examples: - // spacespaceD:\folder\file.ext (2 hits) - // spacespacenew 1 (1 hit) - const size_t startIndex = 2; // for number of leading spaces - auto endIndex = lineStr.find_last_of(L'('); - --endIndex; // adjust for space in front of ( - wstring path = lineStr.substr(startIndex, endIndex - startIndex); - - // make sure that path is not already in before adding - if (std::find(paths.begin(), paths.end(), path) == paths.end()) - { - paths.push_back(path); - } + line++; // Move to the next line + if (line < len) + found = true; // Found it + } + else if (lineFoldLevel == resultLevel) + { + if (line < len) + found = true; // Found it + } + if (found) + { + wstring& path = (*_pMainFoundInfos)[line]._fullPath; // Get the path from the container + paths.push_back(path); } } + return paths; } @@ -2352,7 +2358,7 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA setStatusbarMessage(result, FSMessage, reasonMsg); } - getFocus(); + grabFocus(); } } return TRUE; @@ -2401,7 +2407,7 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND); - getFocus(); + grabFocus(); } } return TRUE; @@ -2451,7 +2457,7 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA setStatusbarMessage(result, FSMessage, reasonMsg); } - getFocus(); + grabFocus(); } } return TRUE; @@ -2874,7 +2880,7 @@ bool FindReplaceDlg::processFindNext(const wchar_t *txt2find, const FindOption * // if the dialog is not shown, pass the focus to his parent(ie. Notepad++) if (!::IsWindowVisible(_hSelf)) { - (*_ppEditView)->getFocus(); + (*_ppEditView)->grabFocus(); } else { @@ -3676,7 +3682,7 @@ void FindReplaceDlg::findAllIn(InWhat op) { // Show finder _pFinder->display(); - getFocus(); // no hits + grabFocus(); // no hits } } else // error - search folder doesn't exist @@ -3776,7 +3782,7 @@ Finder * FindReplaceDlg::createFinder() // Show finder pFinder->display(); - pFinder->_scintView.getFocus(); + pFinder->_scintView.grabFocus(); return pFinder; } @@ -5731,12 +5737,12 @@ intptr_t CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam wstring copyLines = pNativeSpeaker->getLocalizedStrFromID("finder-copy", L"Copy Selected Line(s)"); wstring copyVerbatim = pNativeSpeaker->getNativeLangMenuString(IDM_EDIT_COPY, L"Copy", true); copyVerbatim += L"\tCtrl+C"; - wstring copyPaths = pNativeSpeaker->getLocalizedStrFromID("finder-copy-paths", L"Copy Selected Pathname(s)"); + wstring copyPaths = pNativeSpeaker->getLocalizedStrFromID("finder-copy-selected-paths", L"Copy Selected Pathname(s)"); wstring selectAll = pNativeSpeaker->getNativeLangMenuString(IDM_EDIT_SELECTALL, L"Select all", true); selectAll += L"\tCtrl+A"; wstring clearAll = pNativeSpeaker->getLocalizedStrFromID("finder-clear-all", L"Clear all"); wstring purgeForEverySearch = pNativeSpeaker->getLocalizedStrFromID("finder-purge-for-every-search", L"Purge for every search"); - wstring openAll = pNativeSpeaker->getLocalizedStrFromID("finder-open-all", L"Open Selected Pathname(s)"); + wstring openAll = pNativeSpeaker->getLocalizedStrFromID("finder-open-selected-paths", L"Open Selected Pathname(s)"); wstring wrapLongLines = pNativeSpeaker->getLocalizedStrFromID("finder-wrap-long-lines", L"Word wrap long lines"); tmp.push_back(MenuItemUnit(NPPM_INTERNAL_FINDINFINDERDLG, findInFinder)); @@ -5905,7 +5911,7 @@ intptr_t CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPA { case IDCANCEL : (*(_pFRDlg->_ppEditView))->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_INC); - (*(_pFRDlg->_ppEditView))->getFocus(); + (*(_pFRDlg->_ppEditView))->grabFocus(); display(false); return TRUE; diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h index 62b438cc7..36c278bfe 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h @@ -352,10 +352,21 @@ public : if (_pFinder) { _pFinder->display(); - _pFinder->_scintView.getFocus(); + _pFinder->_scintView.grabFocus(); } }; + bool allowCopyAction() { + HWND focusedHwnd = GetFocus(); + Finder* finder = getFinderFrom(focusedHwnd); + + if (finder) + { + return finder->_scintView.hasSelection(); + } + return false; + }; + HWND getHFindResults() { if (_pFinder) return _pFinder->_scintView.getHSelf(); diff --git a/PowerEditor/src/ScintillaComponent/GoToLineDlg.cpp b/PowerEditor/src/ScintillaComponent/GoToLineDlg.cpp index 2ddbcfc86..2f40c4ee7 100644 --- a/PowerEditor/src/ScintillaComponent/GoToLineDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/GoToLineDlg.cpp @@ -118,7 +118,7 @@ intptr_t CALLBACK GoToLineDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM l notification.nmhdr.idFrom = ::GetDlgCtrlID(_hSelf); ::SendMessage(_hParent, WM_NOTIFY, LINKTRIGGERED, reinterpret_cast(¬ification)); - (*_ppEditView)->getFocus(); + (*_ppEditView)->grabFocus(); return TRUE; } diff --git a/PowerEditor/src/ScintillaComponent/columnEditor.cpp b/PowerEditor/src/ScintillaComponent/columnEditor.cpp index c26302357..f963443a3 100644 --- a/PowerEditor/src/ScintillaComponent/columnEditor.cpp +++ b/PowerEditor/src/ScintillaComponent/columnEditor.cpp @@ -353,7 +353,7 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR } } (*_ppEditView)->execute(SCI_ENDUNDOACTION); - (*_ppEditView)->getFocus(); + (*_ppEditView)->grabFocus(); return TRUE; } case IDC_COL_TEXT_RADIO : diff --git a/PowerEditor/src/WinControls/AnsiCharPanel/ansiCharPanel.cpp b/PowerEditor/src/WinControls/AnsiCharPanel/ansiCharPanel.cpp index 019402560..df3637444 100644 --- a/PowerEditor/src/WinControls/AnsiCharPanel/ansiCharPanel.cpp +++ b/PowerEditor/src/WinControls/AnsiCharPanel/ansiCharPanel.cpp @@ -176,7 +176,7 @@ void AnsiCharPanel::insertChar(unsigned char char2insert) const (*_ppEditView)->execute(SCI_REPLACESEL, 0, reinterpret_cast("")); size_t len = (char2insert < 128) ? 1 : strlen(multiByteStr); (*_ppEditView)->execute(SCI_ADDTEXT, len, reinterpret_cast(multiByteStr)); - (*_ppEditView)->getFocus(); + (*_ppEditView)->grabFocus(); } void AnsiCharPanel::insertString(LPWSTR string2insert) const @@ -203,5 +203,5 @@ void AnsiCharPanel::insertString(LPWSTR string2insert) const (*_ppEditView)->execute(SCI_REPLACESEL, 0, reinterpret_cast("")); size_t len = strlen(multiByteStr); (*_ppEditView)->execute(SCI_ADDTEXT, len, reinterpret_cast(multiByteStr)); - (*_ppEditView)->getFocus(); + (*_ppEditView)->grabFocus(); } diff --git a/PowerEditor/src/WinControls/ClipboardHistory/clipboardHistoryPanel.cpp b/PowerEditor/src/WinControls/ClipboardHistory/clipboardHistoryPanel.cpp index efdffb6cb..7814c3a8a 100644 --- a/PowerEditor/src/WinControls/ClipboardHistory/clipboardHistoryPanel.cpp +++ b/PowerEditor/src/WinControls/ClipboardHistory/clipboardHistoryPanel.cpp @@ -287,7 +287,7 @@ intptr_t CALLBACK ClipboardHistoryPanel::run_dlgProc(UINT message, WPARAM wParam (*_ppEditView)->execute(SCI_REPLACESEL, 0, reinterpret_cast("")); (*_ppEditView)->execute(SCI_ADDTEXT, strlen(c), reinterpret_cast(c)); - (*_ppEditView)->getFocus(); + (*_ppEditView)->grabFocus(); delete[] c; } } diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp index 2b636fbcb..198768ef1 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp @@ -1008,7 +1008,7 @@ bool WordStyleDlg::goToSection(const wchar_t* sectionNames) ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_SETCURSEL, i, 0); setVisualFromStyleList(); - getFocus(); + grabFocus(); return true; } diff --git a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp index 1494fb57e..e1818b037 100644 --- a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp +++ b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp @@ -449,7 +449,7 @@ bool FileBrowser::selectItemFromPath(const wstring& itemPath) const if (foundItem) { _treeView.selectItem(foundItem); - _treeView.getFocus(); + _treeView.grabFocus(); return true; } } diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index fa849211c..a8b4ea289 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -104,7 +104,7 @@ bool PreferenceDlg::goToSection(size_t iPage, intptr_t ctrlID) { ::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_SETCURSEL, iPage, 0); showDialogByIndex(iPage); - getFocus(); + grabFocus(); if (ctrlID != -1) { @@ -2047,7 +2047,7 @@ intptr_t CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA } NppDarkMode::refreshDarkMode(_hSelf, forceRefresh); - getFocus(); // to make black mode title bar appear + grabFocus(); // to make black mode title bar appear return TRUE; } diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.cpp b/PowerEditor/src/WinControls/TabBar/TabBar.cpp index 37336ea2b..fd6357b6f 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.cpp +++ b/PowerEditor/src/WinControls/TabBar/TabBar.cpp @@ -1479,7 +1479,7 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT* pDrawItemStruct, bool isDarkMode) if (_currentHoverTabItem == nTab && brushColour != colorActiveBg) // hover on a "darker" inactive tab { HLSColour hls(brushColour); - brushColour = hls.toRGB4DarkModWithTuning(15, 0); // make it lighter slightly + brushColour = hls.toRGB4DarkModeWithTuning(15, 0); // make it lighter slightly } hBrush = ::CreateSolidBrush(brushColour); diff --git a/PowerEditor/src/WinControls/Window.h b/PowerEditor/src/WinControls/Window.h index 5f929792a..79a7fa349 100644 --- a/PowerEditor/src/WinControls/Window.h +++ b/PowerEditor/src/WinControls/Window.h @@ -29,61 +29,52 @@ public: //@} - virtual void init(HINSTANCE hInst, HWND parent) - { + virtual void init(HINSTANCE hInst, HWND parent) { _hInst = hInst; _hParent = parent; } virtual void destroy() = 0; - virtual void display(bool toShow = true) const - { + virtual void display(bool toShow = true) const { ::ShowWindow(_hSelf, toShow ? SW_SHOW : SW_HIDE); } - virtual void reSizeTo(RECT & rc) // should NEVER be const !!! - { + virtual void reSizeTo(RECT & rc) { // should NEVER be const !!! ::MoveWindow(_hSelf, rc.left, rc.top, rc.right, rc.bottom, TRUE); redraw(); } - virtual void reSizeToWH(RECT& rc) // should NEVER be const !!! - { + virtual void reSizeToWH(RECT& rc) { // should NEVER be const !!! ::MoveWindow(_hSelf, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE); redraw(); } - virtual void redraw(bool forceUpdate = false) const - { + virtual void redraw(bool forceUpdate = false) const { ::InvalidateRect(_hSelf, nullptr, TRUE); if (forceUpdate) ::UpdateWindow(_hSelf); } - virtual void getClientRect(RECT & rc) const - { + virtual void getClientRect(RECT & rc) const { ::GetClientRect(_hSelf, &rc); } - virtual void getWindowRect(RECT & rc) const - { + virtual void getWindowRect(RECT & rc) const { ::GetWindowRect(_hSelf, &rc); } - virtual int getWidth() const - { + virtual int getWidth() const { RECT rc; ::GetClientRect(_hSelf, &rc); return (rc.right - rc.left); } - virtual int getHeight() const - { + virtual int getHeight() const { RECT rc; ::GetClientRect(_hSelf, &rc); if (::IsWindowVisible(_hSelf) == TRUE) @@ -96,8 +87,7 @@ public: return (::IsWindowVisible(_hSelf)?true:false); } - HWND getHSelf() const - { + HWND getHSelf() const { return _hSelf; } @@ -105,13 +95,11 @@ public: return _hParent; } - void getFocus() const { + void grabFocus() const { ::SetFocus(_hSelf); } - HINSTANCE getHinst() const - { - //assert(_hInst != 0); + HINSTANCE getHinst() const { return _hInst; } diff --git a/PowerEditor/src/icons/dark/tabbar/empty.ico b/PowerEditor/src/icons/dark/tabbar/empty.ico index 619284ced..14a1bc4cf 100644 Binary files a/PowerEditor/src/icons/dark/tabbar/empty.ico and b/PowerEditor/src/icons/dark/tabbar/empty.ico differ diff --git a/PowerEditor/src/icons/standard/tabbar/empty.ico b/PowerEditor/src/icons/standard/tabbar/empty.ico index 619284ced..14a1bc4cf 100644 Binary files a/PowerEditor/src/icons/standard/tabbar/empty.ico and b/PowerEditor/src/icons/standard/tabbar/empty.ico differ