diff --git a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp index fdccdcb2c..4117d835a 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp +++ b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp @@ -317,7 +317,7 @@ int PluginsManager::loadPluginFromPath(const TCHAR *pluginFilePath) } } -bool PluginsManager::loadPlugins(const TCHAR* dir, const PluginViewList* pluginUpdateInfoList, PluginViewList* pluginImcompatibleList) +bool PluginsManager::loadPlugins(const TCHAR* dir, const PluginViewList* pluginUpdateInfoList, PluginViewList* pluginIncompatibleList) { if (_isDisabled) return false; @@ -389,14 +389,14 @@ bool PluginsManager::loadPlugins(const TCHAR* dir, const PluginViewList* pluginU // Find compatible Notepad++ versions isCompatible = nppVer.isCompatibleTo(pui->_nppCompatibleVersions.first, pui->_nppCompatibleVersions.second); - if (!isCompatible && pluginImcompatibleList) + if (!isCompatible && pluginIncompatibleList) { PluginUpdateInfo* incompatiblePlg = new PluginUpdateInfo(*pui); incompatiblePlg->_version = v; TCHAR msg[1024]; wsprintf(msg, incompatibleWarning, incompatiblePlg->_displayName.c_str(), v.toString().c_str(), nppVer.toString().c_str()); incompatiblePlg->_description = msg; - pluginImcompatibleList->pushBack(incompatiblePlg); + pluginIncompatibleList->pushBack(incompatiblePlg); } } else if (v < pui->_version && // If dll version is older, and _oldVersionCompatibility is valid (not empty), we search in "_oldVersionCompatibility" @@ -407,14 +407,14 @@ bool PluginsManager::loadPlugins(const TCHAR* dir, const PluginViewList* pluginU { isCompatible = nppVer.isCompatibleTo(pui->_oldVersionCompatibility.second.first, pui->_oldVersionCompatibility.second.second); - if (!isCompatible && pluginImcompatibleList) + if (!isCompatible && pluginIncompatibleList) { PluginUpdateInfo* incompatiblePlg = new PluginUpdateInfo(*pui); incompatiblePlg->_version = v; TCHAR msg[1024]; wsprintf(msg, incompatibleWarningWithSolution, incompatiblePlg->_displayName.c_str(), v.toString().c_str(), nppVer.toString().c_str(), pui->_version.toString().c_str()); incompatiblePlg->_description = msg; - pluginImcompatibleList->pushBack(incompatiblePlg); + pluginIncompatibleList->pushBack(incompatiblePlg); } } } @@ -467,14 +467,14 @@ bool PluginsManager::loadPlugins(const TCHAR* dir, const PluginViewList* pluginU // Find compatible Notepad++ versions isCompatible2 = nppVer.isCompatibleTo(pui2->_nppCompatibleVersions.first, pui2->_nppCompatibleVersions.second); - if (!isCompatible2 && pluginImcompatibleList) + if (!isCompatible2 && pluginIncompatibleList) { PluginUpdateInfo* incompatiblePlg = new PluginUpdateInfo(*pui2); incompatiblePlg->_version = v2; TCHAR msg[1024]; wsprintf(msg, incompatibleWarning, incompatiblePlg->_displayName.c_str(), v2.toString().c_str(), nppVer.toString().c_str()); incompatiblePlg->_description = msg; - pluginImcompatibleList->pushBack(incompatiblePlg); + pluginIncompatibleList->pushBack(incompatiblePlg); } } else if (v2 < pui2->_version && // If dll version is older, and _oldVersionCompatibility is valid (not empty), we search in "_oldVersionCompatibility" @@ -485,14 +485,14 @@ bool PluginsManager::loadPlugins(const TCHAR* dir, const PluginViewList* pluginU { isCompatible2 = nppVer.isCompatibleTo(pui2->_oldVersionCompatibility.second.first, pui2->_oldVersionCompatibility.second.second); - if (!isCompatible2 && pluginImcompatibleList) + if (!isCompatible2 && pluginIncompatibleList) { PluginUpdateInfo* incompatiblePlg = new PluginUpdateInfo(*pui2); incompatiblePlg->_version = v2; TCHAR msg[1024]; wsprintf(msg, incompatibleWarningWithSolution, incompatiblePlg->_displayName.c_str(), v2.toString().c_str(), nppVer.toString().c_str(), pui2->_version.toString().c_str()); incompatiblePlg->_description = msg; - pluginImcompatibleList->pushBack(incompatiblePlg); + pluginIncompatibleList->pushBack(incompatiblePlg); } } } diff --git a/PowerEditor/src/ScintillaComponent/Buffer.cpp b/PowerEditor/src/ScintillaComponent/Buffer.cpp index c5baa039f..520d503ad 100644 --- a/PowerEditor/src/ScintillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScintillaComponent/Buffer.cpp @@ -742,7 +742,7 @@ BufferID FileManager::loadFile(const TCHAR* filename, Document doc, int encoding buf->setEncoding(-1); // if no file extension, and the language has been detected, we use the detected value - if (!newBuf->_isLargeFile && loadedFileFormat._language != L_TEXT) + if (!newBuf->_isLargeFile && loadedFileFormat._language != L_TEXT) buf->setLangType(loadedFileFormat._language); setLoadedBufferEncodingAndEol(buf, UnicodeConvertor, loadedFileFormat._encoding, loadedFileFormat._eolFormat); diff --git a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp index d7e9afca2..204d8292e 100644 --- a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp +++ b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp @@ -157,6 +157,7 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent) RECT researchLabelRect; ::GetClientRect(hResearchLabel, &researchLabelRect); researchLabelRect.left = rect.left + marge; + long leftCusor = researchLabelRect.left + researchLabelRect.right; researchLabelRect.top = topMarge + dpiManager.scaleY(4); ::MoveWindow(hResearchLabel, researchLabelRect.left, researchLabelRect.top, researchLabelRect.right, researchLabelRect.bottom, TRUE); ::InvalidateRect(hResearchLabel, nullptr, TRUE); @@ -164,15 +165,17 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent) HWND hResearchEdit = ::GetDlgItem(_hSelf, IDC_PLUGINADM_SEARCH_EDIT); RECT researchEditRect; ::GetClientRect(hResearchEdit, &researchEditRect); - researchEditRect.left = researchLabelRect.right + marge; - researchEditRect.top = topMarge + dpiManager.scaleX(2); + researchEditRect.left = leftCusor; + leftCusor += researchEditRect.right; + researchEditRect.top = topMarge + dpiManager.scaleX(1); ::MoveWindow(hResearchEdit, researchEditRect.left, researchEditRect.top, researchEditRect.right, researchEditRect.bottom, TRUE); ::InvalidateRect(hResearchEdit, nullptr, TRUE); HWND hNextButton = ::GetDlgItem(_hSelf, IDC_PLUGINADM_RESEARCH_NEXT); RECT researchNextRect; ::GetClientRect(hNextButton, &researchNextRect); - researchNextRect.left = researchEditRect.left + researchEditRect.right + marge; + researchNextRect.left = leftCusor + marge; + leftCusor = researchNextRect.left + researchNextRect.right; researchNextRect.top = topMarge; ::MoveWindow(hNextButton, researchNextRect.left, researchNextRect.top, researchNextRect.right, researchNextRect.bottom, TRUE); ::InvalidateRect(hNextButton, nullptr, TRUE); @@ -267,6 +270,12 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent) NppDarkMode::autoSubclassAndThemeChildControls(_hSelf); NppDarkMode::autoSubclassAndThemeWindowNotify(_hSelf); + HWND hPluginListVersionNumber = ::GetDlgItem(_hSelf, IDC_PLUGINLIST_VERSIONNUMBER_STATIC); + ::SetWindowText(hPluginListVersionNumber, _pluginListVersion.c_str()); + + _repoLink.init(_hInst, _hSelf); + _repoLink.create(::GetDlgItem(_hSelf, IDC_PLUGINLIST_ADDR), TEXT("https://github.com/notepad-plus-plus/nppPluginList")); + goToCenter(); } @@ -581,13 +590,20 @@ std::pair, std::pair> getTwoInterv return r; } -bool loadFromJson(std::vector& pl, const json& j) +bool loadFromJson(std::vector& pl, wstring& verStr, const json& j) { if (j.empty()) return false; WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + json jVerStr = j["version"]; + if (jVerStr.empty() || jVerStr.type() != json::value_t::string) + return false; + + string s = jVerStr.get(); + verStr = wmc.char2wchar(s.c_str(), CP_ACP); + json jArray = j["npp-plugins"]; if (jArray.empty() || jArray.type() != json::value_t::array) return false; @@ -776,7 +792,7 @@ bool PluginsAdminDlg::initFromJson() #endif - return loadFromJson(_availableList._list, j); + return loadFromJson(_availableList._list, _pluginListVersion, j); } bool PluginsAdminDlg::updateList() diff --git a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h index 3c2fbf8a1..2307a44f4 100644 --- a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h +++ b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h @@ -23,6 +23,7 @@ #include "TabBar.h" #include "ListView.h" #include "tinyxml.h" +#include "URLCtrl.h" class PluginsManager; @@ -135,7 +136,7 @@ private: SORT_TYPE _sortType = DISPLAY_NAME_ALPHABET_ENCREASE; }; -enum LIST_TYPE { AVAILABLE_LIST, UPDATES_LIST, INSTALLED_LIST }; +enum LIST_TYPE { AVAILABLE_LIST, UPDATES_LIST, INSTALLED_LIST, INCOMPATIBLE_LIST }; class PluginsAdminDlg final : public StaticDialog @@ -196,6 +197,9 @@ private : TabBar _tab; + std::wstring _pluginListVersion; + URLCtrl _repoLink; + PluginViewList _availableList; // A permanent list, once it's loaded (no removal - only hide or show) PluginViewList _updateList; // A dynamical list, items are removable PluginViewList _installedList; // A dynamical list, items are removable diff --git a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.rc b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.rc index f28693a8b..c91a78f26 100644 --- a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.rc +++ b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.rc @@ -34,11 +34,9 @@ BEGIN PUSHBUTTON "Install", IDC_PLUGINADM_INSTALL,432,35,57,14 PUSHBUTTON "Update", IDC_PLUGINADM_UPDATE,432,35,57,14 PUSHBUTTON "Remove", IDC_PLUGINADM_REMOVE,432,35,57,14 - //LISTBOX IDC_PLUGINADM_LISTVIEW,30,20,78,120,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP EDITTEXT IDC_PLUGINADM_EDIT,30,160,220,80,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_BORDER | WS_VSCROLL - + RTEXT "Plugin list version: ", IDC_PLUGINLIST_VERSION_STATIC,350,230,120,14 + LTEXT "", IDC_PLUGINLIST_VERSIONNUMBER_STATIC,470,230,30,14 + RTEXT "Plugin list repository",IDC_PLUGINLIST_ADDR,368,245,120,14 PUSHBUTTON "Close", IDCANCEL, 225, 270, 57, 14 - - //PUSHBUTTON "Close", IDCANCEL,332,270,57,14 - //PUSHBUTTON "Settings",IDC_PLUGINADM_SETTINGS_BUTTON,255,270,69,14 END diff --git a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdminRes.h b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdminRes.h index 9b7f71bea..dd2884526 100644 --- a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdminRes.h +++ b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdminRes.h @@ -25,5 +25,7 @@ #define IDC_PLUGINADM_LISTVIEW (IDD_PLUGINSADMIN_DLG + 6) #define IDC_PLUGINADM_EDIT (IDD_PLUGINSADMIN_DLG + 7) #define IDC_PLUGINADM_RESEARCH_NEXT (IDD_PLUGINSADMIN_DLG + 8) -#define IDC_PLUGINADM_SETTINGS_BUTTON (IDD_PLUGINSADMIN_DLG + 9) +#define IDC_PLUGINLIST_VERSION_STATIC (IDD_PLUGINSADMIN_DLG + 9) +#define IDC_PLUGINLIST_VERSIONNUMBER_STATIC (IDD_PLUGINSADMIN_DLG + 10) +#define IDC_PLUGINLIST_ADDR (IDD_PLUGINSADMIN_DLG + 11) diff --git a/PowerEditor/src/localization.cpp b/PowerEditor/src/localization.cpp index aa15b2faf..7e5cf07a0 100644 --- a/PowerEditor/src/localization.cpp +++ b/PowerEditor/src/localization.cpp @@ -815,6 +815,7 @@ void NativeLangSpeaker::changePluginsAdminDlgLang(PluginsAdminDlg & pluginsAdmin const char *titre1 = (dlgNode->ToElement())->Attribute("titleAvailable"); const char *titre2 = (dlgNode->ToElement())->Attribute("titleUpdates"); const char *titre3 = (dlgNode->ToElement())->Attribute("titleInstalled"); + const char *titre4 = (dlgNode->ToElement())->Attribute("titleIncompatible"); if (titre1 && titre1[0]) { @@ -831,6 +832,11 @@ void NativeLangSpeaker::changePluginsAdminDlgLang(PluginsAdminDlg & pluginsAdmin basic_string nameW = wmc.char2wchar(titre3, _nativeLangEncoding); pluginsAdminDlg.changeTabName(INSTALLED_LIST, nameW.c_str()); } + if (titre4 && titre4[0]) + { + basic_string nameW = wmc.char2wchar(titre4, _nativeLangEncoding); + pluginsAdminDlg.changeTabName(INCOMPATIBLE_LIST, nameW.c_str()); + } } changeDlgLang(pluginsAdminDlg.getHSelf(), "PluginsAdminDlg");