More translatable entries for Folder as Workspace

This commit is contained in:
Don HO 2018-02-08 02:57:07 +01:00
parent 37b30dd396
commit 70f7287e58
10 changed files with 124 additions and 60 deletions

View File

@ -91,6 +91,7 @@
<Item id="41017" name="檔案重新命名..."/>
<Item id="41021" name="重新開啟最近關閉檔案"/>
<Item id="41022" name="在工作區開啟文件夾(&amp;W)"/>
<Item id="41023" name="開啟在內定查看器中"/>
<Item id="42001" name="剪下(&amp;T)"/>
<Item id="42002" name="複製(&amp;C)"/>
<Item id="42003" name="還原(&amp;U)"/>
@ -335,6 +336,7 @@
<Item CMID="18" name="關閉右側所有檔案"/>
<Item CMID="19" name="開啟此資料夾於檔案總管"/>
<Item CMID="20" name="開啟此資料夾於主控台 (Console)"/>
<Item CMID="21" name="開啟在內定查看器中"/>
</TabBar>
</Menu>

View File

@ -984,6 +984,10 @@ Are you sure you want to remove this folder from the project?"/>
<ProjectPanelReloadError title="Reload Workspace" message="Cannot find the file to reload."/>
<ProjectPanelReloadDirty title="Reload Workspace" message="The current workspace was modified. Reloading will discard all modifications.
Do you want to continue?"/>
<UDLNewNameError title="UDL Error" message="This name is used by another language,
please give another one."/>
<UDLRemoveCurrentLang title="Remove the current language" message="Are you sure?"/>
<FindCharRangeValueError title="Range Value problem" message="You should type between from 0 to 255."/>
</MessageBox>
<ClipboardHistory>
<PanelTitle name="Clipboard History"/>
@ -1007,6 +1011,21 @@ Do you want to continue?"/>
<SortTip name="Sort" />
<ReloadTip name="Reload" />
</FunctionList>
<FolderAsWorkspace>
<PanelTitle name="Folder as Workspace"/>
<SelectFolderFromBrowserString name="Select a folder to add in Folder as Workspace panel"/>
<Menus>
<Item id="3511" name="Remove"/>
<Item id="3512" name="Remove All"/>
<Item id="3513" name="Add"/>
<Item id="3514" name="Run by system"/>
<Item id="3515" name="Open"/>
<Item id="3516" name="Copy path"/>
<Item id="3517" name="Find in Files..."/>
<Item id="3518" name="Explorer here"/>
<Item id="3519" name="CMD here"/>
</Menus>
</FolderAsWorkspace>
<ProjectManager>
<PanelTitle name="Project"/>
<WorkspaceRootName name="Workspace"/>

View File

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

View File

@ -1121,15 +1121,6 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
msg += TEXT("\rfor file type : ");
msg += _options._filters[0]?_options._filters:TEXT("*.*");
int res = ::MessageBox(_hParent, msg.c_str(), TEXT("Are you sure?"), MB_OKCANCEL | MB_DEFBUTTON2);
/*
NppParameters::getInstance()->getNativeLangSpeaker()->messageBox("FolderAsWorspaceSubfolderExists",
_hParent,
TEXT("A sub-folder of the folder you want to add exists.\rPlease remove it from the panel before you add folder \"$STR_REPLACE$\"."),
TEXT("Folder as Worspace adding folder problem"),
MB_OK,
0, // not used
_options._directory.c_str());
*/
if (res == IDOK)
{
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);

View File

@ -1049,7 +1049,7 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
_pUserLang = _pCurrentUserLang;
_ctrlTab.init(_hInst, _hSelf, false);
int tabDpiDynamicalHeight = NppParameters::getInstance()->_dpiManager.scaleY(13);
int tabDpiDynamicalHeight = pNppParam->_dpiManager.scaleY(13);
_ctrlTab.setFont(TEXT("Tahoma"), tabDpiDynamicalHeight);
_folderStyleDlg.init(_hInst, _hSelf);
@ -1223,7 +1223,12 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
case IDC_REMOVELANG_BUTTON :
{
int result = ::MessageBox(_hSelf, TEXT("Are you sure?"), TEXT("Remove the current language"), MB_YESNO);
int result = pNppParam->getNativeLangSpeaker()->messageBox("UDLRemoveCurrentLang",
_hSelf,
TEXT("Are you sure?"),
TEXT("Remove the current language"),
MB_YESNO);
if (result == IDYES)
{
auto i = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETCURSEL, 0, 0);
@ -1263,7 +1268,11 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
{
if (pNppParam->isExistingUserLangName(newName))
{
::MessageBox(_hSelf, TEXT("This name is used by another language,\rplease give another one."), TEXT("Err"), MB_OK);
pNppParam->getNativeLangSpeaker()->messageBox("UDLNewNameError",
_hSelf,
TEXT("This name is used by another language,\rplease give another one."),
TEXT("UDL Error"),
MB_OK);
::PostMessage(_hSelf, WM_COMMAND, IDC_RENAME_BUTTON, 0);
return TRUE;
}
@ -1310,7 +1319,11 @@ INT_PTR CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPAR
if (pNppParam->isExistingUserLangName(newName))
{
::MessageBox(_hSelf, TEXT("This name is used by another language,\rplease give another one."), TEXT("Err"), MB_OK);
pNppParam->getNativeLangSpeaker()->messageBox("UDLNewNameError",
_hSelf,
TEXT("This name is used by another language,\rplease give another one."),
TEXT("UDL Error"),
MB_OK);
::PostMessage(_hSelf, WM_COMMAND, IDC_RENAME_BUTTON, 0);
return TRUE;
}

View File

@ -246,34 +246,46 @@ INT_PTR CALLBACK FileBrowser::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
void FileBrowser::initPopupMenus()
{
NativeLangSpeaker* pNativeSpeaker = NppParameters::getInstance()->getNativeLangSpeaker();
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 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);
generic_string openInNpp = pNativeSpeaker->getFileBrowserLangMenuStr(IDM_FILEBROWSER_OPENINNPP, FB_OPENINNPP);
generic_string shellExecute = pNativeSpeaker->getFileBrowserLangMenuStr(IDM_FILEBROWSER_SHELLEXECUTE, FB_SHELLEXECUTE);
_hGlobalMenu = ::CreatePopupMenu();
::InsertMenu(_hGlobalMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_ADDROOT, TEXT("Add"));
::InsertMenu(_hGlobalMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_REMOVEALLROOTS, TEXT("Remove All"));
::InsertMenu(_hGlobalMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_ADDROOT, addRoot.c_str());
::InsertMenu(_hGlobalMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_REMOVEALLROOTS, removeAllRoot.c_str());
_hRootMenu = ::CreatePopupMenu();
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_REMOVEROOTFOLDER, TEXT("Remove"));
::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, TEXT("Copy path"));
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_FINDINFILES, TEXT("Find in Files..."));
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYEPATH, 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, TEXT("Explorer here"));
::InsertMenu(_hRootMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_CMDHERE, TEXT("CMD here"));
::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, TEXT("Copy path"));
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_FINDINFILES, TEXT("Find in Files..."));
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYEPATH, 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, TEXT("Explorer here"));
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_CMDHERE, TEXT("CMD here"));
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_EXPLORERHERE, explorerHere.c_str());
::InsertMenu(_hFolderMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_CMDHERE, cmdHere.c_str());
_hFileMenu = ::CreatePopupMenu();
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_OPENINNPP, TEXT("Open"));
::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, TEXT("Copy path"));
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_SHELLEXECUTE, TEXT("Run by system"));
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_COPYEPATH, copyPath.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, TEXT("Explorer here"));
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_CMDHERE, TEXT("CMD here"));
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_EXPLORERHERE, explorerHere.c_str());
::InsertMenu(_hFileMenu, 0, MF_BYCOMMAND, IDM_FILEBROWSER_CMDHERE, cmdHere.c_str());
}
@ -550,7 +562,6 @@ void FileBrowser::notified(LPNMHDR notification)
case TVN_BEGINDRAG:
{
//printStr(TEXT("hello"));
_treeView.beginDrag((LPNMTREEVIEW)notification);
}
@ -723,8 +734,10 @@ void FileBrowser::popupMenuCmd(int cmdID)
case IDM_FILEBROWSER_ADDROOT:
{
generic_string folderPath = folderBrowser(_hParent, TEXT("Select a folder to add in Folder as Workspace panel"));
if (not folderPath.empty())
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 folderPath = folderBrowser(_hParent, openWorkspaceStr.c_str());
if (!folderPath.empty())
{
addRootFolder(folderPath);
}
@ -733,7 +746,7 @@ void FileBrowser::popupMenuCmd(int cmdID)
case IDM_FILEBROWSER_SHELLEXECUTE:
{
if (not selectedNode) return;
if (!selectedNode) return;
generic_string path = getNodePath(selectedNode);
if (::PathFileExists(path.c_str()))

View File

@ -37,30 +37,16 @@
#include "TreeView.h"
#include "fileBrowser_rc.h"
#define FB_PANELTITLE TEXT("Folder as Workspace")
/*
#define PM_NEWFOLDERNAME TEXT("Folder Name")
#define PM_NEWPROJECTNAME TEXT("Project Name")
#define PM_SAVEWORKSPACE TEXT("Save")
#define PM_SAVEASWORKSPACE TEXT("Save As...")
#define PM_SAVEACOPYASWORKSPACE TEXT("Save a Copy As...")
#define PM_NEWPROJECTWORKSPACE TEXT("Add New Project")
#define PM_EDITRENAME TEXT("Rename")
#define PM_EDITNEWFOLDER TEXT("Add Folder")
#define PM_EDITADDFILES TEXT("Add Files...")
#define PM_EDITADDFILESRECUSIVELY TEXT("Add Files from Directory...")
*/
#define FB_REMOVEROOT TEXT("Remove")
//#define PM_EDITMODIFYFILE TEXT("Copy path")
//#define PM_WORKSPACEMENUENTRY TEXT("Workspace")
//#define PM_EDITMENUENTRY TEXT("Edit")
//#define PM_MOVEUPENTRY TEXT("Move Up\tCtrl+Up")
//#define PM_MOVEDOWNENTRY TEXT("Move Down\tCtrl+Down")
#define FB_PANELTITLE TEXT("Folder as Workspace")
#define FB_ADDROOT TEXT("Add")
#define FB_REMOVEALLROOTS TEXT("Remove All")
#define FB_REMOVEROOTFOLDER TEXT("Remove")
#define FB_COPYEPATH TEXT("Copy path")
#define FB_FINDINFILES TEXT("Find in Files...")
#define FB_EXPLORERHERE TEXT("Explorer here")
#define FB_CMDHERE TEXT("CMD here")
#define FB_OPENINNPP TEXT("Open")
#define FB_SHELLEXECUTE TEXT("Run by system")
class TiXmlNode;
class FileBrowser;

View File

@ -28,6 +28,8 @@
#include "FindCharsInRange.h"
#include "findCharsInRange_rc.h"
#include "Parameters.h"
#include "localization.h"
INT_PTR CALLBACK FindCharsInRangeDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{
@ -60,7 +62,11 @@ INT_PTR CALLBACK FindCharsInRangeDlg::run_dlgProc(UINT message, WPARAM wParam, L
if (!getRangeFromUI(startRange, endRange))
{
//STOP!
::MessageBox(_hSelf, TEXT("You should type between from 0 to 255."), TEXT("Range Value problem"), MB_OK);
NppParameters::getInstance()->getNativeLangSpeaker()->messageBox("FindCharRangeValueError",
_hSelf,
TEXT("You should type between from 0 to 255."),
TEXT("Range Value problem"),
MB_OK);
return TRUE;
}
getDirectionFromUI(direction, isWrap);

View File

@ -1064,6 +1064,40 @@ bool NativeLangSpeaker::getMsgBoxLang(const char *msgBoxTagName, generic_string
return false;
}
generic_string NativeLangSpeaker::getFileBrowserLangMenuStr(int cmdID, const TCHAR *defaultStr) const
{
if (!_nativeLangA) return defaultStr;
TiXmlNodeA *targetNode = _nativeLangA->FirstChild("FolderAsWorkspace");
if (!targetNode) return defaultStr;
targetNode = targetNode->FirstChild("Menus");
if (!targetNode) return defaultStr;
const char *name = NULL;
for (TiXmlNodeA *childNode = targetNode->FirstChildElement("Item");
childNode;
childNode = childNode->NextSibling("Item"))
{
TiXmlElementA *element = childNode->ToElement();
int id;
const char *idStr = element->Attribute("id", &id);
if (idStr && id == cmdID)
{
name = element->Attribute("name");
break;
}
}
if (name && name[0])
{
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
return wmc->char2wchar(name, _nativeLangEncoding);
}
return defaultStr;
}
generic_string NativeLangSpeaker::getProjectPanelLangMenuStr(const char * nodeName, int cmdID, const TCHAR *defaultStr) const
{
if (!_nativeLangA) return defaultStr;

View File

@ -83,7 +83,7 @@ public:
};
bool getMsgBoxLang(const char *msgBoxTagName, generic_string & title, generic_string & message);
generic_string getProjectPanelLangMenuStr(const char * nodeName, int cmdID, const TCHAR *defaultStr) const;
//generic_string getFileBrowserLangMenuStr(const char * nodeName, int cmdID, const TCHAR *defaultStr) const;
generic_string getFileBrowserLangMenuStr(int cmdID, const TCHAR *defaultStr) const;
generic_string getAttrNameStr(const TCHAR *defaultStr, const char *nodeL1Name, const char *nodeL2Name = NULL) const;
generic_string getLocalizedStrFromID(const char *strID) const;