Add command line parameter for adding specified string to app title bar
Fix #9539, #9704
This commit is contained in:
parent
bdae2aef92
commit
cae2f77daf
|
@ -3466,6 +3466,13 @@ void Notepad_plus::setTitle()
|
|||
if (_isAdministrator)
|
||||
result += TEXT(" [Administrator]");
|
||||
|
||||
generic_string tbAdd = (NppParameters::getInstance()).getTitleBarAdd();
|
||||
if (!tbAdd.empty())
|
||||
{
|
||||
result += TEXT(" - ");
|
||||
result += tbAdd;
|
||||
}
|
||||
|
||||
::SendMessage(_pPublicInterface->getHSelf(), WM_SETTEXT, 0, reinterpret_cast<LPARAM>(result.c_str()));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
const TCHAR COMMAND_ARG_HELP[] = TEXT("Usage :\r\
|
||||
\r\
|
||||
notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNumber] [-cColumnNumber] [-pPosition] [-xLeftPos] [-yTopPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [-alwaysOnTop] [-openSession] [-r] [-qn=\"Easter egg name\" | -qt=\"a text to display.\" | -qf=\"D:\\my quote.txt\"] [-qSpeed1|2|3] [-quickPrint] [-settingsDir=\"d:\\your settings dir\\\"] [-openFoldersAsWorkspace] [filePath]\r\
|
||||
notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNumber] [-cColumnNumber] [-pPosition] [-xLeftPos] [-yTopPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [-alwaysOnTop] [-openSession] [-r] [-qn=\"Easter egg name\" | -qt=\"a text to display.\" | -qf=\"D:\\my quote.txt\"] [-qSpeed1|2|3] [-quickPrint] [-settingsDir=\"d:\\your settings dir\\\"] [-openFoldersAsWorkspace] [-titleAdd=\"additional title bar text\"][filePath]\r\
|
||||
\r\
|
||||
--help : This help message\r\
|
||||
-multiInst : Launch another Notepad++ instance\r\
|
||||
|
@ -48,6 +48,7 @@ notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNum
|
|||
-quickPrint : Print the file given as argument then quit Notepad++\r\
|
||||
-settingsDir=\"d:\\your settings dir\\\": Override the default settings dir\r\
|
||||
-openFoldersAsWorkspace: open filePath of folder(s) as workspace\r\
|
||||
-titleAdd=\"string\": add string to Notepad++ title bar\r\
|
||||
filePath : file or folder name to open (absolute or relative path name)\r\
|
||||
");
|
||||
|
||||
|
|
|
@ -1676,6 +1676,16 @@ public:
|
|||
_cmdSettingsDir = settingsDir;
|
||||
};
|
||||
|
||||
void setTitleBarAdd(const generic_string& titleAdd)
|
||||
{
|
||||
_titleBarAdditional = titleAdd;
|
||||
}
|
||||
|
||||
const generic_string& getTitleBarAdd() const
|
||||
{
|
||||
return _titleBarAdditional;
|
||||
}
|
||||
|
||||
DPIManager _dpiManager;
|
||||
|
||||
generic_string static getSpecialFolderLocation(int folderKind);
|
||||
|
@ -1756,6 +1766,8 @@ private:
|
|||
|
||||
generic_string _cmdSettingsDir;
|
||||
|
||||
generic_string _titleBarAdditional;
|
||||
|
||||
public:
|
||||
void setShortcutDirty() { _isAnyShortcutModified = true; };
|
||||
void setAdminMode(bool isAdmin) { _isAdminMode = isAdmin; }
|
||||
|
|
|
@ -308,6 +308,7 @@ const TCHAR FLAG_PRINTANDQUIT[] = TEXT("-quickPrint");
|
|||
const TCHAR FLAG_NOTEPAD_COMPATIBILITY[] = TEXT("-notepadStyleCmdline");
|
||||
const TCHAR FLAG_OPEN_FOLDERS_AS_WORKSPACE[] = TEXT("-openFoldersAsWorkspace");
|
||||
const TCHAR FLAG_SETTINGS_DIR[] = TEXT("-settingsDir=");
|
||||
const TCHAR FLAG_TITLEBAR_ADD[] = TEXT("-titleAdd=");
|
||||
|
||||
void doException(Notepad_plus_Window & notepad_plus_plus)
|
||||
{
|
||||
|
@ -467,11 +468,22 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int)
|
|||
nppParameters.setCmdSettingsDir(path);
|
||||
}
|
||||
|
||||
generic_string titleBarAdditional;
|
||||
if (getParamValFromString(FLAG_TITLEBAR_ADD, params, titleBarAdditional))
|
||||
{
|
||||
if (titleBarAdditional.length() >= 2)
|
||||
{
|
||||
if (titleBarAdditional.front() == '"' && titleBarAdditional.back() == '"')
|
||||
{
|
||||
titleBarAdditional = titleBarAdditional.substr(1, titleBarAdditional.length() - 2);
|
||||
}
|
||||
}
|
||||
nppParameters.setTitleBarAdd(titleBarAdditional);
|
||||
}
|
||||
|
||||
if (showHelp)
|
||||
::MessageBox(NULL, COMMAND_ARG_HELP, TEXT("Notepad++ Command Argument Help"), MB_OK);
|
||||
|
||||
|
||||
|
||||
if (cmdLineParams._localizationPath != TEXT(""))
|
||||
{
|
||||
// setStartWithLocFileName() should be called before parameters are loaded
|
||||
|
|
Loading…
Reference in New Issue