From 8e2b2e053edf45a4ce148c9ac76a3475debeb9c3 Mon Sep 17 00:00:00 2001 From: chenall Date: Sun, 28 Dec 2014 18:06:12 +0800 Subject: [PATCH] =?UTF-8?q?issue=20#13=20=E5=8F=B3=E9=94=AE=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E5=A2=9E=E5=8A=A0=E4=BB=A5=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E8=BF=90=E8=A1=8C("=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E4=B8=BA").?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 ++++++---- doc/update.log | 2 ++ src/ALMRunConfig.h | 8 ++++++++ src/MerryControllerWindows.cpp | 6 ++++-- src/MerryListBoxPanel.cpp | 6 +++++- src/MerryTextCtrl.cpp | 2 ++ 6 files changed, 27 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 03fdba2..e5da097 100644 --- a/README.md +++ b/README.md @@ -23,15 +23,17 @@ ALMRun Base 基本功能 * 程序相关快捷键 * `ALT+R`(全局)    隐藏激活程序(可在参数配置中修改) * `ALT+L`(全局)    运行上一个命令(可改) - * `CTRL+D`       自动定位所选条目的文件位置,方便查找 * `Alt+C`       打开参数配置界面 * `Alt+S`       打开命令管理器 * `Alt+X`       退出程序 * `Tab`        选定条目,并且进入输入参数模式。 * `Ctrl+N/Alt+N`   N=0-9,启动列表中对应的条目 - * `Enter`       启动程序 - * `F1`        显示关于窗口 - * `F2`        编辑当前项目 + * `Insert`      添加新的命令 (菜单: **添加**) + * `F2`        编辑当前项目 (菜单: **编辑**) + * `CTRL+D`      自动定位所选条目的文件位置,方便查找(菜单: **定位**) + * `Shift+Enter`   以其它户用运行当前项目(菜单: **运行为**) + * `Enter`      启动程序 + * `F1`        显示关于窗口 * 基本操作 输入要启动的程序名(支持任意位置匹配和中文首字母识别),筛选过虑列表清单。然后根据列表框选择要启动的程序,如果需要输入参数可按`Tab`键,否则直接启动程序。如果在配置中勾选了“允许数字快捷键“,还支持直接按数字键0-9来启动,或按空格键来启动当前选择条目。 diff --git a/doc/update.log b/doc/update.log index 3e07019..877773b 100644 --- a/doc/update.log +++ b/doc/update.log @@ -1,4 +1,6 @@ ### [v1.2.0.72](https://github.com/chenall/ALMRun/releases/tag/v1.2.0.72) + 2014-12-28 + 1. issue #13 右键菜单增加以管理员方式运行("运行为").(快捷键Shift+Enter) 2014-12-21 1. 修正包含空格的文件名没有正确处理的问题(issue #14). 2014-12-22 diff --git a/src/ALMRunConfig.h b/src/ALMRunConfig.h index 5918ed9..a824764 100644 --- a/src/ALMRunConfig.h +++ b/src/ALMRunConfig.h @@ -129,6 +129,12 @@ class ALMRunConfig extern ALMRunConfig* g_config; extern SkinConfig *skin; extern bool LocationExec; +extern int cmdrun_flags; + +#define CMDRUN_FLAG_RUNAS 1 +#define CMDRUN_FLAG_HIDE 2 +#define CMDRUN_FLAG_FORCEARG 4 + enum { MENU_ITEM_FIRST = 10000, @@ -148,6 +154,8 @@ enum MENU_CMD_EDIT, MENU_CMD_OPENDIR, MENU_CMD_INFO, + MENU_CMD_RUNAS, + MENU_CMD_RUNHIDE, MENU_CMD_LAST, }; #endif \ No newline at end of file diff --git a/src/MerryControllerWindows.cpp b/src/MerryControllerWindows.cpp index f5c6424..1495ea4 100644 --- a/src/MerryControllerWindows.cpp +++ b/src/MerryControllerWindows.cpp @@ -468,10 +468,12 @@ DWORD MerryController::ShellExecute(const wxString& commandName, } wxString cmdName = commandName.substr(n); + if (cmdrun_flags & CMDRUN_FLAG_RUNAS) runas = true; + if (cmdrun_flags & CMDRUN_FLAG_HIDE) showCommand = SW_HIDE; + cmdrun_flags = 0; if (!LocationExec) { - __DEBUG_BEGIN(cmdName.c_str()); SHELLEXECUTEINFO ShExecInfo = {0}; ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); @@ -483,7 +485,6 @@ DWORD MerryController::ShellExecute(const wxString& commandName, ShExecInfo.lpDirectory = workingDir.c_str(); ShExecInfo.nShow = showCommand; ShExecInfo.hInstApp = NULL; - if (::ShellExecuteEx(&ShExecInfo)) return SavePid?GetProcessId(ShExecInfo.hProcess):1; return 0; @@ -495,6 +496,7 @@ DWORD MerryController::ShellExecute(const wxString& commandName, return 0; FullcmdName.Replace('/','\\'); + #ifdef _ALMRUN_CONFIG_H_ if (!g_config->Explorer.empty()) ::WinExec(wxString::Format("%s \"%s\"",g_config->Explorer,FullcmdName),SW_SHOW); diff --git a/src/MerryListBoxPanel.cpp b/src/MerryListBoxPanel.cpp index 4a4a949..24d6083 100644 --- a/src/MerryListBoxPanel.cpp +++ b/src/MerryListBoxPanel.cpp @@ -204,6 +204,7 @@ void MerryListBoxPanel::onContextMenu(wxContextMenuEvent& e) } menu.Append(MENU_CMD_OPENDIR, wxT("��λ(&L)")); menu.Append(MENU_CMD_INFO, wxT("����(&M)")); + menu.Append(MENU_CMD_RUNAS, wxT("����Ϊ(&A)")); PopupMenu(&menu); } @@ -265,7 +266,10 @@ void MerryListBoxPanel::onPopMenu(wxCommandEvent& e) LocationExec = true; GetSelectionCommand()->Execute(wxEmptyString); break; - + case MENU_CMD_RUNAS: + cmdrun_flags |= CMDRUN_FLAG_RUNAS; + GetSelectionCommand()->Execute(wxEmptyString); + break; } } diff --git a/src/MerryTextCtrl.cpp b/src/MerryTextCtrl.cpp index eb5d022..8d29aeb 100644 --- a/src/MerryTextCtrl.cpp +++ b/src/MerryTextCtrl.cpp @@ -17,6 +17,7 @@ #pragma comment(lib, "imm32.lib") #endif +int cmdrun_flags; bool LocationExec; #ifdef __WXMSW__ HWND HWND_TEXTCTRL = NULL; @@ -211,6 +212,7 @@ void MerryTextCtrl::OnKeyDownEvent(wxKeyEvent& e) { case WXK_RETURN: case WXK_NUMPAD_ENTER: + if (e.ShiftDown()) cmdrun_flags |= CMDRUN_FLAG_RUNAS; this->ExecuteCmd(); break; case WXK_ESCAPE: