Add "Copy File Name" command in context menu of "Folder as Workspace"

Close #5574, close #5597
This commit is contained in:
Rajendra Singh 2019-04-28 15:55:55 +05:30 committed by Don HO
parent ff20c264df
commit 074a4bca93
5 changed files with 30 additions and 8 deletions

View File

@ -1113,6 +1113,7 @@ Do you want to launch Notepad++ in Administrator mode?"/>
<Item id="3517" name="Find in Files..."/>
<Item id="3518" name="Explorer here"/>
<Item id="3519" name="CMD here"/>
<Item id="3520" name="Copy file name"/>
</Menus>
</FolderAsWorkspace>
<ProjectManager>

View File

@ -87,6 +87,7 @@
<Item id="41005" name="वर्तमान दस्तावेज़ के अलावा सभी बंद करें"/>
<Item id="41009" name="बाएं और सभी बंद करें"/>
<Item id="41018" name="दाएं और सभी बंद करें"/>
<Item id="41024" name="सभी अनचेंज्ड बंद करें"/>
<Item id="41006" name="&amp;सेव करें"/>
<Item id="41007" name="&amp;सभी सेव करें"/>
<Item id="41008" name="&amp;की तरह सेव करें"/>
@ -349,7 +350,8 @@
<Item CMID="18" name="दाएं और सभी बंद करें"/>
<Item CMID="19" name="धारक फोल्डर को एक्स्प्लोरर में खोलें"/>
<Item CMID="20" name="धारक फोल्डर को cmd में खोलें"/>
<Item CMID="21" name="डिफ़ॉल्ट व्यूअर में खोलें"/>
<Item CMID="21" name="डिफ़ॉल्ट व्यूअर में खोलें"/>
<Item CMID="22" name="सभी अनचेंज्ड बंद करें"/>
</TabBar>
</Menu>
@ -1104,6 +1106,7 @@
<Item id="3517" name="फाइल्स में खोजें..."/>
<Item id="3518" name="यहाँ Explorer खोलें"/>
<Item id="3519" name="यहाँ CMD खोलें"/>
<Item id="3520" name="फाइल का नाम कॉपी करें"/>
</Menus>
</FolderAsWorkspace>
<ProjectManager>

View File

@ -251,7 +251,8 @@ void FileBrowser::initPopupMenus()
generic_string addRoot = pNativeSpeaker->getFileBrowserLangMenuStr(IDM_FILEBROWSER_ADDROOT, FB_ADDROOT);
generic_string removeAllRoot = pNativeSpeaker->getFileBrowserLangMenuStr(IDM_FILEBROWSER_REMOVEALLROOTS, FB_REMOVEALLROOTS);
generic_string removeRootFolder = pNativeSpeaker->getFileBrowserLangMenuStr(IDM_FILEBROWSER_REMOVEROOTFOLDER, FB_REMOVEROOTFOLDER);
generic_string copyPath = pNativeSpeaker->getFileBrowserLangMenuStr(IDM_FILEBROWSER_COPYEPATH, FB_COPYEPATH);
generic_string copyPath = pNativeSpeaker->getFileBrowserLangMenuStr(IDM_FILEBROWSER_COPYPATH, FB_COPYPATH);
generic_string copyFileName = pNativeSpeaker->getFileBrowserLangMenuStr(IDM_FILEBROWSER_COPYFILENAME, FB_COPYFILENAME);
generic_string findInFile = pNativeSpeaker->getFileBrowserLangMenuStr(IDM_FILEBROWSER_FINDINFILES, FB_FINDINFILES);
generic_string explorerHere = pNativeSpeaker->getFileBrowserLangMenuStr(IDM_FILEBROWSER_EXPLORERHERE, FB_EXPLORERHERE);
generic_string cmdHere = pNativeSpeaker->getFileBrowserLangMenuStr(IDM_FILEBROWSER_CMDHERE, FB_CMDHERE);
@ -265,14 +266,14 @@ void FileBrowser::initPopupMenus()
_hRootMenu = ::CreatePopupMenu();
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_REMOVEROOTFOLDER, removeRootFolder.c_str());
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, static_cast<UINT>(-1), 0);
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYEPATH, copyPath.c_str());
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYPATH, copyPath.c_str());
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_FINDINFILES, findInFile.c_str());
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, static_cast<UINT>(-1), 0);
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_EXPLORERHERE, explorerHere.c_str());
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_CMDHERE, cmdHere.c_str());
_hFolderMenu = ::CreatePopupMenu();
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYEPATH, copyPath.c_str());
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYPATH, copyPath.c_str());
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_FINDINFILES, findInFile.c_str());
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, static_cast<UINT>(-1), 0);
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_EXPLORERHERE, explorerHere.c_str());
@ -281,7 +282,8 @@ void FileBrowser::initPopupMenus()
_hFileMenu = ::CreatePopupMenu();
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_OPENINNPP, openInNpp.c_str());
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, static_cast<UINT>(-1), 0);
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYEPATH, copyPath.c_str());
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYPATH, copyPath.c_str());
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYFILENAME, copyFileName.c_str());
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_SHELLEXECUTE, shellExecute.c_str());
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, static_cast<UINT>(-1), 0);
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_EXPLORERHERE, explorerHere.c_str());
@ -382,6 +384,11 @@ generic_string FileBrowser::getNodePath(HTREEITEM node) const
return fullPath;
}
generic_string FileBrowser::getNodeName(HTREEITEM node) const
{
return node ? _treeView.getItemDisplayName(node) : TEXT("");
}
void FileBrowser::openSelectFile()
{
// Get the selected item
@ -695,7 +702,7 @@ void FileBrowser::popupMenuCmd(int cmdID)
}
break;
case IDM_FILEBROWSER_COPYEPATH:
case IDM_FILEBROWSER_COPYPATH:
{
if (not selectedNode) return;
generic_string path = getNodePath(selectedNode);
@ -703,6 +710,14 @@ void FileBrowser::popupMenuCmd(int cmdID)
}
break;
case IDM_FILEBROWSER_COPYFILENAME:
{
if (not selectedNode) return;
generic_string fileName = getNodeName(selectedNode);
str2Clipboard(fileName, _hParent);
}
break;
case IDM_FILEBROWSER_FINDINFILES:
{
if (not selectedNode) return;

View File

@ -40,7 +40,8 @@
#define FB_ADDROOT TEXT("Add")
#define FB_REMOVEALLROOTS TEXT("Remove All")
#define FB_REMOVEROOTFOLDER TEXT("Remove")
#define FB_COPYEPATH TEXT("Copy path")
#define FB_COPYPATH TEXT("Copy path")
#define FB_COPYFILENAME TEXT("Copy file name")
#define FB_FINDINFILES TEXT("Find in Files...")
#define FB_EXPLORERHERE TEXT("Explorer here")
#define FB_CMDHERE TEXT("CMD here")
@ -142,6 +143,7 @@ public:
};
generic_string getNodePath(HTREEITEM node) const;
generic_string getNodeName(HTREEITEM node) const;
void addRootFolder(generic_string);
HTREEITEM getRootFromFullPath(const generic_string & rootPath) const;

View File

@ -38,7 +38,8 @@
#define IDM_FILEBROWSER_ADDROOT (IDD_FILEBROWSER_MENU + 3)
#define IDM_FILEBROWSER_SHELLEXECUTE (IDD_FILEBROWSER_MENU + 4)
#define IDM_FILEBROWSER_OPENINNPP (IDD_FILEBROWSER_MENU + 5)
#define IDM_FILEBROWSER_COPYEPATH (IDD_FILEBROWSER_MENU + 6)
#define IDM_FILEBROWSER_COPYPATH (IDD_FILEBROWSER_MENU + 6)
#define IDM_FILEBROWSER_COPYFILENAME (IDD_FILEBROWSER_MENU + 10)
#define IDM_FILEBROWSER_FINDINFILES (IDD_FILEBROWSER_MENU + 7)
#define IDM_FILEBROWSER_EXPLORERHERE (IDD_FILEBROWSER_MENU + 8)