Add "-quickPrint" command line argument
"-quickPrint" allows user to launch Notepad++ via command to print a given document then quit Notepad++ immediately. Usage: notepad++.exe -quickPrint c:\funcListTests\EncodingMapper.cpp
This commit is contained in:
parent
1d58c1d3d3
commit
1f89110b04
@ -300,6 +300,9 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
|
||||
|
||||
if (pNppParams->doFunctionListExport())
|
||||
::SendMessage(_hSelf, NPPM_INTERNAL_EXPORTFUNCLISTANDQUIT, 0, 0);
|
||||
|
||||
if (pNppParams->doPrintAndExit())
|
||||
::SendMessage(_hSelf, NPPM_INTERNAL_PRNTANDQUIT, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,7 +31,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] [-qnEsterEggName | -qtText | -qfCntentFileName] [filePath]\r\
|
||||
notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNumber] [-cColumnNumber] [-pPosition] [-xLeftPos] [-yTopPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [-alwaysOnTop] [-openSession] [-r] [-qnEsterEggName | -qtText | -qfCntentFileName] [-quickPrint] [filePath]\r\
|
||||
\r\
|
||||
--help : This help message\r\
|
||||
-multiInst : Launch another Notepad++ instance\r\
|
||||
@ -55,6 +55,7 @@ notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNum
|
||||
-qn : Launch ghost typing to display easter egg via its name\r\
|
||||
-qt : Launch ghost typing to display a text via the given text\r\
|
||||
-qf : Launch ghost typing to display a file content via the file path\r\
|
||||
-qickPrint : Print the file given as argument then quit Notepad++\r\
|
||||
filePath : file or folder name to open (absolute or relative path name)\r\
|
||||
");
|
||||
|
||||
|
@ -481,6 +481,13 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||
}
|
||||
break;
|
||||
|
||||
case NPPM_INTERNAL_PRNTANDQUIT:
|
||||
{
|
||||
::PostMessage(_pPublicInterface->getHSelf(), WM_COMMAND, IDM_FILE_PRINTNOW, 0);
|
||||
::PostMessage(_pPublicInterface->getHSelf(), WM_COMMAND, IDM_FILE_EXIT, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case NPPM_DISABLEAUTOUPDATE:
|
||||
{
|
||||
NppGUI & nppGUI = const_cast<NppGUI &>(pNppParam->getNppGUI());
|
||||
|
@ -1481,6 +1481,13 @@ public:
|
||||
return _doFunctionListExport;
|
||||
};
|
||||
|
||||
void setPrintAndExitBoolean(bool doIt) {
|
||||
_doPrintAndExit = doIt;
|
||||
};
|
||||
bool doPrintAndExit() const {
|
||||
return _doPrintAndExit;
|
||||
};
|
||||
|
||||
bool loadSession(Session & session, const TCHAR *sessionFileName);
|
||||
int langTypeToCommandID(LangType lt) const;
|
||||
WNDPROC getEnableThemeDlgTexture() const {return _enableThemeDialogTextureFuncAddr;};
|
||||
@ -1666,6 +1673,7 @@ private:
|
||||
LocalizationSwitcher _localizationSwitcher;
|
||||
generic_string _startWithLocFileName;
|
||||
bool _doFunctionListExport = false;
|
||||
bool _doPrintAndExit = false;
|
||||
|
||||
ThemeSwitcher _themeSwitcher;
|
||||
|
||||
|
@ -418,6 +418,7 @@
|
||||
#define NPPM_INTERNAL_SCROLLBEYONDLASTLINE (NOTEPADPLUS_USER_INTERNAL + 44)
|
||||
#define NPPM_INTERNAL_SETWORDCHARS (NOTEPADPLUS_USER_INTERNAL + 45)
|
||||
#define NPPM_INTERNAL_EXPORTFUNCLISTANDQUIT (NOTEPADPLUS_USER_INTERNAL + 46)
|
||||
#define NPPM_INTERNAL_PRNTANDQUIT (NOTEPADPLUS_USER_INTERNAL + 47)
|
||||
|
||||
//wParam: 0
|
||||
//lParam: document new index
|
||||
|
@ -307,7 +307,7 @@ const TCHAR FLAG_ALWAYS_ON_TOP[] = TEXT("-alwaysOnTop");
|
||||
const TCHAR FLAG_OPENSESSIONFILE[] = TEXT("-openSession");
|
||||
const TCHAR FLAG_RECURSIVE[] = TEXT("-r");
|
||||
const TCHAR FLAG_FUNCLSTEXPORT[] = TEXT("-export=functionList");
|
||||
|
||||
const TCHAR FLAG_PRINTANDQUIT[] = TEXT("-quickPrint");
|
||||
|
||||
|
||||
void doException(Notepad_plus_Window & notepad_plus_plus)
|
||||
@ -355,6 +355,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
||||
bool showHelp = isInList(FLAG_HELP, params);
|
||||
bool isMultiInst = isInList(FLAG_MULTI_INSTANCE, params);
|
||||
bool doFunctionListExport = isInList(FLAG_FUNCLSTEXPORT, params);
|
||||
bool doPrintAndQuit = isInList(FLAG_PRINTANDQUIT, params);
|
||||
|
||||
CmdLineParams cmdLineParams;
|
||||
cmdLineParams._isNoTab = isInList(FLAG_NOTABBAR, params);
|
||||
@ -368,12 +369,14 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
||||
cmdLineParams._isRecursive = isInList(FLAG_RECURSIVE, params);
|
||||
cmdLineParams._langType = getLangTypeFromParam(params);
|
||||
cmdLineParams._localizationPath = getLocalizationPathFromParam(params);
|
||||
cmdLineParams._easterEggName = getEasterEggNameFromParam(params, cmdLineParams._quoteType);
|
||||
|
||||
// getNumberFromParam should be run at the end, to not consuming the other params
|
||||
cmdLineParams._line2go = getNumberFromParam('n', params, isParamePresent);
|
||||
cmdLineParams._column2go = getNumberFromParam('c', params, isParamePresent);
|
||||
cmdLineParams._pos2go = getNumberFromParam('p', params, isParamePresent);
|
||||
cmdLineParams._point.x = getNumberFromParam('x', params, cmdLineParams._isPointXValid);
|
||||
cmdLineParams._point.y = getNumberFromParam('y', params, cmdLineParams._isPointYValid);
|
||||
cmdLineParams._easterEggName = getEasterEggNameFromParam(params, cmdLineParams._quoteType);
|
||||
|
||||
|
||||
if (showHelp)
|
||||
@ -383,7 +386,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
||||
NppGUI & nppGui = const_cast<NppGUI &>(pNppParameters->getNppGUI());
|
||||
bool doUpdate = nppGui._autoUpdateOpt._doAutoUpdate;
|
||||
|
||||
if (doFunctionListExport) // export functionlist feature will serialize fuctionlist on the disk, then exit Notepad++. So it's important to not launch into existing instance, and keep it silent.
|
||||
if (doFunctionListExport || doPrintAndQuit) // export functionlist feature will serialize fuctionlist on the disk, then exit Notepad++. So it's important to not launch into existing instance, and keep it silent.
|
||||
{
|
||||
isMultiInst = true;
|
||||
doUpdate = false;
|
||||
@ -397,6 +400,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
||||
pNppParameters->load();
|
||||
|
||||
pNppParameters->setFunctionListExportBoolean(doFunctionListExport);
|
||||
pNppParameters->setPrintAndExitBoolean(doPrintAndQuit);
|
||||
|
||||
// override the settings if notepad style is present
|
||||
if (pNppParameters->asNotepadStyle())
|
||||
|
Loading…
Reference in New Issue
Block a user