mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-23 05:45:00 +02:00
Reorder tab focus in Run dlg
Plus: - add key accelerators. - remove unneeded library. - add initializers. Fix #13540, close #13541
This commit is contained in:
parent
15decdb3d9
commit
3cf45ec3a8
@ -187,15 +187,15 @@ HINSTANCE Command::run(HWND hWnd)
|
|||||||
|
|
||||||
HINSTANCE Command::run(HWND hWnd, const TCHAR* cwd)
|
HINSTANCE Command::run(HWND hWnd, const TCHAR* cwd)
|
||||||
{
|
{
|
||||||
const int argsIntermediateLen = MAX_PATH*2;
|
constexpr int argsIntermediateLen = MAX_PATH * 2;
|
||||||
const int args2ExecLen = CURRENTWORD_MAXLENGTH+MAX_PATH*2;
|
constexpr int args2ExecLen = CURRENTWORD_MAXLENGTH + MAX_PATH * 2;
|
||||||
|
|
||||||
TCHAR cmdPure[MAX_PATH];
|
TCHAR cmdPure[MAX_PATH]{};
|
||||||
TCHAR cmdIntermediate[MAX_PATH];
|
TCHAR cmdIntermediate[MAX_PATH]{};
|
||||||
TCHAR cmd2Exec[MAX_PATH];
|
TCHAR cmd2Exec[MAX_PATH]{};
|
||||||
TCHAR args[MAX_PATH];
|
TCHAR args[MAX_PATH]{};
|
||||||
TCHAR argsIntermediate[argsIntermediateLen];
|
TCHAR argsIntermediate[argsIntermediateLen]{};
|
||||||
TCHAR args2Exec[args2ExecLen];
|
TCHAR args2Exec[args2ExecLen]{};
|
||||||
|
|
||||||
extractArgs(cmdPure, MAX_PATH, args, MAX_PATH, _cmdLine.c_str());
|
extractArgs(cmdPure, MAX_PATH, args, MAX_PATH, _cmdLine.c_str());
|
||||||
int nbTchar = ::ExpandEnvironmentStrings(cmdPure, cmdIntermediate, MAX_PATH);
|
int nbTchar = ::ExpandEnvironmentStrings(cmdPure, cmdIntermediate, MAX_PATH);
|
||||||
@ -213,7 +213,7 @@ HINSTANCE Command::run(HWND hWnd, const TCHAR* cwd)
|
|||||||
expandNppEnvironmentStrs(cmdIntermediate, cmd2Exec, MAX_PATH, hWnd);
|
expandNppEnvironmentStrs(cmdIntermediate, cmd2Exec, MAX_PATH, hWnd);
|
||||||
expandNppEnvironmentStrs(argsIntermediate, args2Exec, args2ExecLen, hWnd);
|
expandNppEnvironmentStrs(argsIntermediate, args2Exec, args2ExecLen, hWnd);
|
||||||
|
|
||||||
TCHAR cwd2Exec[MAX_PATH];
|
TCHAR cwd2Exec[MAX_PATH]{};
|
||||||
expandNppEnvironmentStrs(cwd, cwd2Exec, MAX_PATH, hWnd);
|
expandNppEnvironmentStrs(cwd, cwd2Exec, MAX_PATH, hWnd);
|
||||||
|
|
||||||
HINSTANCE res = ::ShellExecute(hWnd, TEXT("open"), cmd2Exec, args2Exec, cwd2Exec, SW_SHOW);
|
HINSTANCE res = ::ShellExecute(hWnd, TEXT("open"), cmd2Exec, args2Exec, cwd2Exec, SW_SHOW);
|
||||||
@ -253,22 +253,18 @@ intptr_t CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam
|
|||||||
|
|
||||||
case WM_CTLCOLOREDIT:
|
case WM_CTLCOLOREDIT:
|
||||||
{
|
{
|
||||||
if (NppDarkMode::isEnabled())
|
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
|
||||||
{
|
|
||||||
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_CTLCOLORLISTBOX:
|
case WM_CTLCOLORLISTBOX:
|
||||||
|
{
|
||||||
|
return NppDarkMode::onCtlColorListbox(wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
case WM_CTLCOLORDLG:
|
case WM_CTLCOLORDLG:
|
||||||
case WM_CTLCOLORSTATIC:
|
case WM_CTLCOLORSTATIC:
|
||||||
{
|
{
|
||||||
if (NppDarkMode::isEnabled())
|
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
|
||||||
{
|
|
||||||
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_PRINTCLIENT:
|
case WM_PRINTCLIENT:
|
||||||
@ -284,7 +280,7 @@ intptr_t CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam
|
|||||||
{
|
{
|
||||||
if (NppDarkMode::isEnabled())
|
if (NppDarkMode::isEnabled())
|
||||||
{
|
{
|
||||||
RECT rc = {};
|
RECT rc{};
|
||||||
getClientRect(rc);
|
getClientRect(rc);
|
||||||
::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush());
|
::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDarkerBackgroundBrush());
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -298,7 +294,7 @@ intptr_t CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_COMMAND :
|
case WM_COMMAND:
|
||||||
{
|
{
|
||||||
switch (wParam)
|
switch (wParam)
|
||||||
{
|
{
|
||||||
@ -308,7 +304,7 @@ intptr_t CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam
|
|||||||
|
|
||||||
case IDOK :
|
case IDOK :
|
||||||
{
|
{
|
||||||
TCHAR cmd[MAX_PATH];
|
TCHAR cmd[MAX_PATH]{};
|
||||||
::GetDlgItemText(_hSelf, IDC_COMBO_RUN_PATH, cmd, MAX_PATH);
|
::GetDlgItemText(_hSelf, IDC_COMBO_RUN_PATH, cmd, MAX_PATH);
|
||||||
_cmdLine = cmd;
|
_cmdLine = cmd;
|
||||||
|
|
||||||
@ -336,7 +332,7 @@ intptr_t CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam
|
|||||||
DynamicMenu& runMenu = nppParams.getRunMenuItems();
|
DynamicMenu& runMenu = nppParams.getRunMenuItems();
|
||||||
int nbTopLevelItem = runMenu.getTopLevelItemNumber();
|
int nbTopLevelItem = runMenu.getTopLevelItemNumber();
|
||||||
|
|
||||||
TCHAR cmd[MAX_PATH];
|
TCHAR cmd[MAX_PATH]{};
|
||||||
::GetDlgItemText(_hSelf, IDC_COMBO_RUN_PATH, cmd, MAX_PATH);
|
::GetDlgItemText(_hSelf, IDC_COMBO_RUN_PATH, cmd, MAX_PATH);
|
||||||
UserCommand uc(Shortcut(), wstring2string(cmd, CP_UTF8).c_str(), cmdID);
|
UserCommand uc(Shortcut(), wstring2string(cmd, CP_UTF8).c_str(), cmdID);
|
||||||
uc.init(_hInst, _hSelf);
|
uc.init(_hInst, _hSelf);
|
||||||
@ -427,7 +423,7 @@ void RunDlg::doDialog(bool isRTL)
|
|||||||
|
|
||||||
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
|
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
|
||||||
|
|
||||||
// Adjust the position in the center
|
// Adjust the position in the center
|
||||||
goToCenter();
|
goToCenter(SWP_SHOWWINDOW | SWP_NOSIZE);
|
||||||
::SetFocus(::GetDlgItem(_hSelf, IDC_COMBO_RUN_PATH));
|
::SetFocus(::GetDlgItem(_hSelf, IDC_COMBO_RUN_PATH));
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <oleacc.h>
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "RunDlg_rc.h"
|
#include "RunDlg_rc.h"
|
||||||
|
|
||||||
@ -57,10 +56,10 @@ public :
|
|||||||
RunDlg() = default;
|
RunDlg() = default;
|
||||||
|
|
||||||
void doDialog(bool isRTL = false);
|
void doDialog(bool isRTL = false);
|
||||||
virtual void destroy() {};
|
void destroy() override {};
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
virtual intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
void addTextToCombo(const TCHAR *txt2Add) const;
|
void addTextToCombo(const TCHAR *txt2Add) const;
|
||||||
|
@ -21,21 +21,19 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
#include "RunDlg_rc.h"
|
#include "RunDlg_rc.h"
|
||||||
|
|
||||||
#ifndef IDC_STATIC
|
#ifndef IDC_STATIC
|
||||||
#define IDC_STATIC -1
|
#define IDC_STATIC -1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IDD_RUN_DLG DIALOGEX 0, 0, 196, 100
|
IDD_RUN_DLG DIALOGEX 0, 0, 186, 80
|
||||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE
|
EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE
|
||||||
CAPTION "Run..."
|
CAPTION "Run..."
|
||||||
FONT 8, TEXT("MS Shell Dlg"), 400, 0, 0x1
|
FONT 8, TEXT("MS Shell Dlg"), 400, 0, 0x1
|
||||||
BEGIN
|
BEGIN
|
||||||
DEFPUSHBUTTON "Run",IDOK,16,74,47,14
|
GROUPBOX "The &Program to Run",IDC_MAINTEXT_STATIC,7,6,172,48,BS_CENTER
|
||||||
PUSHBUTTON "Cancel",IDCANCEL, 121,74,48,14
|
COMBOBOX IDC_COMBO_RUN_PATH,14,26,138,71,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||||
PUSHBUTTON "...",IDC_BUTTON_FILE_BROWSER,154,30,16,14
|
PUSHBUTTON "...",IDC_BUTTON_FILE_BROWSER,156,25,16,14
|
||||||
COMBOBOX IDC_COMBO_RUN_PATH,14,31,136,71,CBS_DROPDOWN |
|
DEFPUSHBUTTON "&Run",IDOK,16,60,50,14
|
||||||
CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
PUSHBUTTON "&Save...",IDC_BUTTON_SAVE,69,60,50,14
|
||||||
GROUPBOX "The Program to Run",IDC_MAINTEXT_STATIC,7,10,
|
PUSHBUTTON "&Cancel",IDCANCEL,122,60,50,14
|
||||||
172,49,BS_CENTER
|
|
||||||
PUSHBUTTON "Save...",IDC_BUTTON_SAVE,68,74,50,14
|
|
||||||
END
|
END
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
<AnalyzeExternalRuleset>NativeRecommendedRules.ruleset</AnalyzeExternalRuleset>
|
<AnalyzeExternalRuleset>NativeRecommendedRules.ruleset</AnalyzeExternalRuleset>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>comctl32.lib;shlwapi.lib;shell32.lib;Oleacc.lib;Dbghelp.lib;Version.lib;Crypt32.lib;wintrust.lib;Sensapi.lib;wininet.lib;imm32.lib;msimg32.lib;uxtheme.lib;libscintilla.lib;liblexilla.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>comctl32.lib;shlwapi.lib;shell32.lib;Dbghelp.lib;Version.lib;Crypt32.lib;wintrust.lib;Sensapi.lib;wininet.lib;imm32.lib;msimg32.lib;uxtheme.lib;libscintilla.lib;liblexilla.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<ShowProgress>LinkVerboseLib</ShowProgress>
|
<ShowProgress>LinkVerboseLib</ShowProgress>
|
||||||
<OutputFile>$(OutDir)notepad++.exe</OutputFile>
|
<OutputFile>$(OutDir)notepad++.exe</OutputFile>
|
||||||
<Version>1.0</Version>
|
<Version>1.0</Version>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user