mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-10-25 09:33:51 +02:00
Enhance Command Line Arguments dialog: smaller & more readable
This commit is contained in:
parent
7a21c638eb
commit
85fa8bf953
@ -723,6 +723,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
||||
_colEditorDlg.init(_pPublicInterface->getHinst(), hwnd, &_pEditView);
|
||||
_aboutDlg.init(_pPublicInterface->getHinst(), hwnd);
|
||||
_debugInfoDlg.init(_pPublicInterface->getHinst(), hwnd, _isAdministrator, _pluginsManager.getLoadedPluginNames());
|
||||
_cmdLineArgsDlg.init(_pPublicInterface->getHinst(), hwnd);
|
||||
_runDlg.init(_pPublicInterface->getHinst(), hwnd);
|
||||
_runMacroDlg.init(_pPublicInterface->getHinst(), hwnd);
|
||||
_documentPeeker.init(_pPublicInterface->getHinst(), hwnd);
|
||||
|
||||
@ -321,6 +321,7 @@ private:
|
||||
FindIncrementDlg _incrementFindDlg;
|
||||
AboutDlg _aboutDlg;
|
||||
DebugInfoDlg _debugInfoDlg;
|
||||
CmdLineArgsDlg _cmdLineArgsDlg;
|
||||
RunDlg _runDlg;
|
||||
HashFromFilesDlg _md5FromFilesDlg;
|
||||
HashFromTextDlg _md5FromTextDlg;
|
||||
|
||||
@ -1418,6 +1418,16 @@ BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,125,175,50,14
|
||||
END
|
||||
|
||||
IDD_COMMANDLINEARGSBOX DIALOGEX 0, 0, 420, 385
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE
|
||||
CAPTION "Command Line Arguments"
|
||||
FONT 8, L"MS Shell Dlg", 0, 0, 0x1
|
||||
BEGIN
|
||||
EDITTEXT IDC_COMMANDLINEARGS_EDIT,10,10,400,345,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | NOT WS_BORDER | WS_VSCROLL
|
||||
DEFPUSHBUTTON "OK",IDOK,185,360,50,14
|
||||
END
|
||||
|
||||
IDD_DOSAVEORNOTBOX DIALOGEX 0, 0, 312, 80
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE
|
||||
|
||||
@ -411,6 +411,11 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const wchar_t *cmdL
|
||||
::MessageBoxW(NULL, wss.str().c_str(), L"Notepad++ loading time (hh:mm:ss.ms)", MB_OK);
|
||||
}
|
||||
|
||||
if (cmdLineParams->_displayCmdLineArgs)
|
||||
{
|
||||
_notepad_plus_plus_core.command(IDM_CMDLINEARGUMENTS);
|
||||
}
|
||||
|
||||
bool isSnapshotMode = nppGUI.isSnapshotMode();
|
||||
if (isSnapshotMode)
|
||||
{
|
||||
|
||||
@ -18,46 +18,6 @@
|
||||
|
||||
constexpr int splitterSize = 8;
|
||||
|
||||
const wchar_t COMMAND_ARG_HELP[] = L"Usage :\r\
|
||||
\r\
|
||||
notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-udl=\"My UDL Name\"] [-LlangCode] [-nLineNumber] [-cColumnNumber] [-pPosition] [-xLeftPos] [-yTopPos] [-monitor] [-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\
|
||||
-noPlugin : Launch Notepad++ without loading any plugin\r\
|
||||
-l : Open file or Ghost type with syntax highlighting of choice\r\
|
||||
-udl=\"My UDL Name\": Open file by applying User Defined Language\r\
|
||||
-L : Apply indicated localization, langCode is browser language code\r\
|
||||
-n : Scroll to indicated line on filePath\r\
|
||||
-c : Scroll to indicated column on filePath\r\
|
||||
-p : Scroll to indicated position on filePath\r\
|
||||
-x : Move Notepad++ to indicated left side position on the screen\r\
|
||||
-y : Move Notepad++ to indicated top position on the screen\r\
|
||||
-monitor: Open file with file monitoring enabled\r\
|
||||
-nosession : Launch Notepad++ without previous session\r\
|
||||
-notabbar : Launch Notepad++ without tab bar\r\
|
||||
-ro : Make the filePath read-only\r\
|
||||
-fullReadOnly : Open all files read-only by default,\r\
|
||||
toggling the R/O off and saving is allowed\r\
|
||||
-fullReadOnlySavingForbidden : Open all files read-only by default,\r\
|
||||
toggling the R/O off and saving is disabled\r\
|
||||
-systemtray : Launch Notepad++ directly in system tray\r\
|
||||
-loadingTime : Display Notepad++ loading time\r\
|
||||
-alwaysOnTop : Make Notepad++ always on top\r\
|
||||
-openSession : Open a session. filePath must be a session file\r\
|
||||
-r : Open files recursively. This argument will be ignored\r\
|
||||
if filePath contains no wildcard character\r\
|
||||
-qn=\"Easter egg name\": Ghost type easter egg via its name\r\
|
||||
-qt=\"text to display.\": Ghost type the given text\r\
|
||||
-qf=\"D:\\my quote.txt\": Ghost type a file content via the file path\r\
|
||||
-qSpeed : Ghost typing speed. Value from 1 to 3 for slow, fast and fastest\r\
|
||||
-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\
|
||||
";
|
||||
|
||||
|
||||
class Notepad_plus_Window : public Window
|
||||
{
|
||||
|
||||
@ -3551,8 +3551,7 @@ void Notepad_plus::command(int id)
|
||||
|
||||
case IDM_CMDLINEARGUMENTS:
|
||||
{
|
||||
// Not translatable
|
||||
::MessageBox(_pPublicInterface->getHSelf(), COMMAND_ARG_HELP, L"Notepad++ Command Argument Help", MB_OK | MB_APPLMODAL);
|
||||
_cmdLineArgsDlg.doDialog();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -276,6 +276,7 @@ struct CmdLineParams
|
||||
bool _isPreLaunch = false;
|
||||
bool _showLoadingTime = false;
|
||||
bool _alwaysOnTop = false;
|
||||
bool _displayCmdLineArgs = false;
|
||||
intptr_t _line2go = -1;
|
||||
intptr_t _column2go = -1;
|
||||
intptr_t _pos2go = -1;
|
||||
|
||||
@ -646,6 +646,122 @@ void DebugInfoDlg::refreshDebugInfo()
|
||||
}
|
||||
|
||||
|
||||
const wchar_t COMMAND_ARG_HELP[] = L"Usage:\r\n\
|
||||
\r\n\
|
||||
notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-udl=\"My UDL Name\"] [-LlangCode] [-nLineNumber]\r\n\
|
||||
[-cColumnNumber] [-pPosition] [-xLeftPos] [-yTopPos] [-monitor] [-nosession] [-notabbar] [-systemtray]\r\n\
|
||||
[-loadingTime] [-ro] [-fullReadOnly] [-fullReadOnlySavingForbidden] [-alwaysOnTop] [-openSession] [-r]\r\n\
|
||||
[-qn=\"Easter egg name\" | -qt=\"a text to display.\" | -qf=\"D:\\my quote.txt\"] [-qSpeed1|2|3] [-quickPrint]\r\n\
|
||||
[-settingsDir=\"d:\\your settings dir\\\"] [-openFoldersAsWorkspace] [-titleAdd=\"additional title bar text\"]\r\n\
|
||||
[filePath]\r\n\
|
||||
\r\n\
|
||||
--help: This help message\r\n\
|
||||
-multiInst: Launch another Notepad++ instance\r\n\
|
||||
-noPlugin: Launch Notepad++ without loading any plugin\r\n\
|
||||
-l: Open file or Ghost type with syntax highlighting of choice\r\n\
|
||||
-udl=\"My UDL Name\": Open file by applying User Defined Language\r\n\
|
||||
-L: Apply indicated localization, langCode is browser language code\r\n\
|
||||
-n: Scroll to indicated line on filePath\r\n\
|
||||
-c: Scroll to indicated column on filePath\r\n\
|
||||
-p: Scroll to indicated position on filePath\r\n\
|
||||
-x: Move Notepad++ to indicated left side position on the screen\r\n\
|
||||
-y: Move Notepad++ to indicated top position on the screen\r\n\
|
||||
-monitor: Open file with file monitoring enabled\r\n\
|
||||
-nosession: Launch Notepad++ without previous session\r\n\
|
||||
-notabbar: Launch Notepad++ without tab bar\r\n\
|
||||
-ro: Make the filePath read-only\r\n\
|
||||
-fullReadOnly: Open all files read-only by default, toggling the R/O off and saving is allowed\r\n\
|
||||
-fullReadOnlySavingForbidden: Open all files read-only by default, toggling the R/O off and saving is disabled\r\n\
|
||||
-systemtray: Launch Notepad++ directly in system tray\r\n\
|
||||
-loadingTime: Display Notepad++ loading time\r\n\
|
||||
-alwaysOnTop: Make Notepad++ always on top\r\n\
|
||||
-openSession: Open a session. filePath must be a session file\r\n\
|
||||
-r: Open files recursively. This argument will be ignored if filePath contains no wildcard character\r\n\
|
||||
-qn=\"Easter egg name\": Ghost type easter egg via its name\r\n\
|
||||
-qt=\"text to display.\": Ghost type the given text\r\n\
|
||||
-qf=\"D:\\my quote.txt\": Ghost type a file content via the file path\r\n\
|
||||
-qSpeed: Ghost typing speed. Value from 1 to 3 for slow, fast and fastest\r\n\
|
||||
-quickPrint: Print the file given as argument then quit Notepad++\r\n\
|
||||
-settingsDir=\"d:\\your settings dir\\\": Override the default settings dir\r\n\
|
||||
-openFoldersAsWorkspace: open filePath of folder(s) as workspace\r\n\
|
||||
-titleAdd=\"string\": add string to Notepad++ title bar\r\n\
|
||||
filePath: file or folder name to open (absolute or relative path name)\r\n\
|
||||
";
|
||||
|
||||
void CmdLineArgsDlg::doDialog()
|
||||
{
|
||||
if (!isCreated())
|
||||
create(IDD_COMMANDLINEARGSBOX);
|
||||
|
||||
::SetDlgItemText(_hSelf, IDC_COMMANDLINEARGS_EDIT, COMMAND_ARG_HELP);
|
||||
|
||||
moveForDpiChange();
|
||||
goToCenter(SWP_SHOWWINDOW | SWP_NOSIZE);
|
||||
}
|
||||
|
||||
intptr_t CALLBACK CmdLineArgsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_CTLCOLORDLG:
|
||||
case WM_CTLCOLORSTATIC:
|
||||
{
|
||||
return NppDarkMode::onCtlColorDlg(reinterpret_cast<HDC>(wParam));
|
||||
}
|
||||
|
||||
case WM_PRINTCLIENT:
|
||||
{
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case NPPM_INTERNAL_REFRESHDARKMODE:
|
||||
{
|
||||
NppDarkMode::autoThemeChildControls(_hSelf);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_DPICHANGED:
|
||||
{
|
||||
_dpiManager.setDpiWP(wParam);
|
||||
setPositionDpi(lParam);
|
||||
getWindowRect(_rc);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (wParam)
|
||||
{
|
||||
case IDCANCEL:
|
||||
case IDOK:
|
||||
display(false);
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DESTROY:
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void DoSaveOrNotBox::doDialog(bool isRTL)
|
||||
{
|
||||
|
||||
|
||||
@ -92,6 +92,23 @@ private:
|
||||
std::wstring _loadedPlugins;
|
||||
};
|
||||
|
||||
|
||||
class CmdLineArgsDlg : public StaticDialog
|
||||
{
|
||||
public:
|
||||
CmdLineArgsDlg() = default;
|
||||
|
||||
void init(HINSTANCE hInst, HWND parent) {
|
||||
Window::init(hInst, parent);
|
||||
};
|
||||
|
||||
void doDialog();
|
||||
void destroy() override {};
|
||||
|
||||
protected:
|
||||
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
|
||||
};
|
||||
|
||||
class DoSaveOrNotBox : public StaticDialog
|
||||
{
|
||||
public:
|
||||
|
||||
@ -574,12 +574,12 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE /*hPrevInstance
|
||||
}
|
||||
|
||||
bool isParamePresent;
|
||||
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._displayCmdLineArgs = isInList(FLAG_HELP, params);
|
||||
cmdLineParams._isNoTab = isInList(FLAG_NOTABBAR, params);
|
||||
cmdLineParams._isNoPlugin = isInList(FLAG_NO_PLUGIN, params);
|
||||
cmdLineParams._isReadOnly = isInList(FLAG_READONLY, params);
|
||||
@ -657,9 +657,6 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE /*hPrevInstance
|
||||
cmdLineParams._udlName = udlName;
|
||||
}
|
||||
|
||||
if (showHelp)
|
||||
::MessageBox(NULL, COMMAND_ARG_HELP, L"Notepad++ Command Argument Help", MB_OK);
|
||||
|
||||
if (cmdLineParams._localizationPath != L"")
|
||||
{
|
||||
// setStartWithLocFileName() should be called before parameters are loaded
|
||||
@ -793,7 +790,7 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE /*hPrevInstance
|
||||
|
||||
bool isUpExist = nppGui._doesExistUpdater = doesFileExist(updaterFullPath.c_str());
|
||||
|
||||
// wingup doesn't work with the obsolete security layer (API) under xp since downloads are secured with SSL on notepad_plus_plus.org
|
||||
// wingup doesn't work with the obsolete security layer (API) under xp since downloads are secured with SSL on notepad-plus-plus.org
|
||||
winVer ver = nppParameters.getWinVersion();
|
||||
bool isGtXP = ver > WV_XP;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user