Browse Source

Add tooltips for Folderas Workspace 3 commands

Fix #8325
pull/9133/head
Don HO 4 years ago
parent
commit
070630a243
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
  1. 3
      PowerEditor/installer/nativeLang/english.xml
  2. 3
      PowerEditor/installer/nativeLang/french.xml
  3. 3
      PowerEditor/installer/nativeLang/taiwaneseMandarin.xml
  4. 2
      PowerEditor/src/Notepad_plus.cpp
  5. 31
      PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp
  6. 8
      PowerEditor/src/WinControls/FileBrowser/fileBrowser.h
  7. 4
      PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp
  8. 22
      PowerEditor/src/WinControls/FunctionList/functionListPanel.h
  9. 3
      PowerEditor/src/localization.cpp

3
PowerEditor/installer/nativeLang/english.xml

@ -1230,6 +1230,9 @@ Continue?"/>
<FolderAsWorkspace>
<PanelTitle name="Folder as Workspace"/>
<SelectFolderFromBrowserString name="Select a folder to add in Folder as Workspace panel"/>
<ExpandAllFoldersTip name="Expand all folders"/>
<CollapseAllFoldersTip name="Collapse all folders"/>
<LocateCurrentFileTip name="Locate current file"/>
<Menus>
<Item id="3511" name="Remove"/>
<Item id="3512" name="Remove All"/>

3
PowerEditor/installer/nativeLang/french.xml

@ -1183,6 +1183,9 @@ Voulez-vous les poursuivez ?"/>
<FolderAsWorkspace>
<PanelTitle name="Dossier en tant qu'Espace de travail"/>
<SelectFolderFromBrowserString name="Sélectionner un dossier pour ajouter dans Dossier en tant qu'Espace de travail"/>
<ExpandAllFoldersTip name="Déplier tous les dossiers"/>
<CollapseAllFoldersTip name="Replier tous les dossiers"/>
<LocateCurrentFileTip name="Localiser le fichier courant"/>
<Menus>
<Item id="3511" name="Effacer"/>
<Item id="3512" name="Effacer Tout"/>

3
PowerEditor/installer/nativeLang/taiwaneseMandarin.xml

@ -1174,6 +1174,9 @@
<FolderAsWorkspace>
<PanelTitle name="資料夾工作區"/>
<SelectFolderFromBrowserString name="選擇一個資料夾以加入資料夾工作區"/>
<ExpandAllFoldersTip name="展開所有文件夾"/>
<CollapseAllFoldersTip name="收折所有文件夾"/>
<LocateCurrentFileTip name="現行文件位置"/>
<Menus>
<Item id="3511" name="移除"/>
<Item id="3512" name="全部移除"/>

2
PowerEditor/src/Notepad_plus.cpp

@ -6469,7 +6469,7 @@ void Notepad_plus::launchFileBrowser(const vector<generic_string> & folders, con
data.dlgID = IDM_VIEW_FILEBROWSER;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string title_temp = pNativeSpeaker->getAttrNameStr(FB_PANELTITLE, "FolderAsWorkspace", "PanelTitle");
generic_string title_temp = pNativeSpeaker->getAttrNameStr(FB_PANELTITLE, FOLDERASWORKSPACE_NODE, "PanelTitle");
static TCHAR title[32];
if (title_temp.length() < 32)

31
PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp

@ -57,6 +57,11 @@
#define FB_CMD_FOLDALL 2
#define FB_CMD_EXPANDALL 3
#define FB_TIPEXPANDALLFOLDERS
#define FB_TIPEXPANDALLFOLDERS
#define FB_TIPCOLLAPSEALLFOLDERS
#define FB_TIPLOCATECURRENTFILE
FileBrowser::~FileBrowser()
{
for (const auto folder : _folderUpdaters)
@ -141,6 +146,12 @@ INT_PTR CALLBACK FileBrowser::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
tbButtons[2].fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE;
tbButtons[2].iString = reinterpret_cast<INT_PTR>(TEXT(""));
// tips text for toolbar buttons
NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker();
_expandAllFolders = pNativeSpeaker->getAttrNameStr(_expandAllFolders.c_str(), FOLDERASWORKSPACE_NODE, "ExpandAllFoldersTip");
_collapseAllFolders = pNativeSpeaker->getAttrNameStr(_collapseAllFolders.c_str(), FOLDERASWORKSPACE_NODE, "CollapseAllFoldersTip");
_locateCurrentFile = pNativeSpeaker->getAttrNameStr(_locateCurrentFile.c_str(), FOLDERASWORKSPACE_NODE, "LocateCurrentFileTip");
::SendMessage(_hToolbarMenu, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
::SendMessage(_hToolbarMenu, TB_SETBUTTONSIZE, 0, MAKELONG(nppParam._dpiManager.scaleX(20), nppParam._dpiManager.scaleY(20)));
::SendMessage(_hToolbarMenu, TB_SETPADDING, 0, MAKELONG(20, 0));
@ -553,6 +564,24 @@ void FileBrowser::notified(LPNMHDR notification)
{
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_FILEBROWSER, 0);
}
else if (notification->code == TTN_GETDISPINFO)
{
LPTOOLTIPTEXT lpttt = (LPTOOLTIPTEXT)notification;
lpttt->hinst = NULL;
if (notification->idFrom == FB_CMD_AIMFILE)
{
wcscpy_s(lpttt->szText, _locateCurrentFile.c_str());
}
else if (notification->idFrom == FB_CMD_FOLDALL)
{
wcscpy_s(lpttt->szText, _collapseAllFolders.c_str());
}
else if (notification->idFrom == FB_CMD_EXPANDALL)
{
wcscpy_s(lpttt->szText, _expandAllFolders.c_str());
}
}
else if ((notification->hwndFrom == _treeView.getHSelf()))
{
TCHAR textBuffer[MAX_PATH];
@ -892,7 +921,7 @@ void FileBrowser::popupMenuCmd(int cmdID)
case IDM_FILEBROWSER_ADDROOT:
{
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
generic_string openWorkspaceStr = pNativeSpeaker->getAttrNameStr(TEXT("Select a folder to add in Folder as Workspace panel"), "FolderAsWorkspace", "SelectFolderFromBrowserString");
generic_string openWorkspaceStr = pNativeSpeaker->getAttrNameStr(TEXT("Select a folder to add in Folder as Workspace panel"), FOLDERASWORKSPACE_NODE, "SelectFolderFromBrowserString");
generic_string folderPath = folderBrowser(_hParent, openWorkspaceStr.c_str());
if (!folderPath.empty())
{

8
PowerEditor/src/WinControls/FileBrowser/fileBrowser.h

@ -44,6 +44,9 @@
#define FB_OPENINNPP TEXT("Open")
#define FB_SHELLEXECUTE TEXT("Run by system")
#define FOLDERASWORKSPACE_NODE "FolderAsWorkspace"
class TiXmlNode;
class FileBrowser;
class FolderInfo;
@ -120,6 +123,7 @@ struct SortingData4lParam {
SortingData4lParam(generic_string rootPath, generic_string label, bool isFolder) : _rootPath(rootPath), _label(label), _isFolder(isFolder) {}
};
;
class FileBrowser : public DockingDlgInterface {
public:
@ -182,6 +186,10 @@ protected:
std::vector<SortingData4lParam*> sortingDataArray;
generic_string _expandAllFolders = TEXT("Expand all folders");
generic_string _collapseAllFolders = TEXT("Collapse all folders");
generic_string _locateCurrentFile = TEXT("Locate current file");
void initPopupMenus();
void destroyMenus();
BOOL setImageList(int root_open_id, int root_close_id, int open_node_id, int closed_node_id, int leaf_id);

4
PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp

@ -41,6 +41,10 @@ using namespace std;
#define INDEX_NODE 1
#define INDEX_LEAF 2
#define FL_FUCTIONLISTROOTNODE "FunctionList"
#define FL_SORTLOCALNODENAME "SortTip"
#define FL_RELOADLOCALNODENAME "ReloadTip"
FunctionListPanel::~FunctionListPanel()
{
for (const auto s : posStrs)

22
PowerEditor/src/WinControls/FunctionList/functionListPanel.h

@ -33,12 +33,6 @@
#include "TreeView.h"
#define FL_PANELTITLE TEXT("Function List")
#define FL_SORTTIP TEXT("sort")
#define FL_RELOADTIP TEXT("Reload")
#define FL_FUCTIONLISTROOTNODE "FunctionList"
#define FL_SORTLOCALNODENAME "SortTip"
#define FL_RELOADLOCALNODENAME "ReloadTip"
class ScintillaEditView;
@ -83,8 +77,7 @@ struct TreeParams {
class FunctionListPanel : public DockingDlgInterface {
public:
FunctionListPanel(): DockingDlgInterface(IDD_FUNCLIST_PANEL), _ppEditView(NULL), _pTreeView(&_treeView),
_reloadTipStr(TEXT("Reload")), _sortTipStr(TEXT("Sort")) {};
FunctionListPanel(): DockingDlgInterface(IDD_FUNCLIST_PANEL), _pTreeView(&_treeView) {};
~FunctionListPanel();
void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView);
@ -119,10 +112,10 @@ protected:
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
private:
HWND _hToolbarMenu;
HWND _hSearchEdit;
HWND _hToolbarMenu = nullptr;
HWND _hSearchEdit = nullptr;
TreeView *_pTreeView;
TreeView *_pTreeView = nullptr;
TreeView _treeView;
TreeView _treeViewSearchResult;
@ -130,18 +123,19 @@ private:
long _findEndLine = -1;
HTREEITEM _findItem;
generic_string _sortTipStr;
generic_string _reloadTipStr;
generic_string _sortTipStr = TEXT("Reload");
generic_string _reloadTipStr = TEXT("Sort");
std::vector<foundInfo> _foundFuncInfos;
std::vector<generic_string*> posStrs;
ScintillaEditView **_ppEditView;
ScintillaEditView **_ppEditView = nullptr;
FunctionParsersManager _funcParserMgr;
std::vector< std::pair<int, int> > _skipZones;
std::vector<TreeParams> _treeParams;
HIMAGELIST _hTreeViewImaLst;
generic_string parseSubLevel(size_t begin, size_t end, std::vector< generic_string > dataToSearch, int & foundPos);
size_t getBodyClosePos(size_t begin, const TCHAR *bodyOpenSymbol, const TCHAR *bodyCloseSymbol);
void notified(LPNMHDR notification);

3
PowerEditor/src/localization.cpp

@ -30,6 +30,7 @@
#include "ShortcutMapper.h"
#include "EncodingMapper.h"
#include "localization.h"
#include "fileBrowser.h"
using namespace std;
@ -1254,7 +1255,7 @@ generic_string NativeLangSpeaker::getFileBrowserLangMenuStr(int cmdID, const TCH
{
if (!_nativeLangA) return defaultStr;
TiXmlNodeA *targetNode = _nativeLangA->FirstChild("FolderAsWorkspace");
TiXmlNodeA *targetNode = _nativeLangA->FirstChild(FOLDERASWORKSPACE_NODE);
if (!targetNode) return defaultStr;
targetNode = targetNode->FirstChild("Menus");

Loading…
Cancel
Save