зеркало из https://github.com/github/putty.git
Introduce a context menu which appears on Ctrl+rightclick. This menu
contains all the stuff in the System menu except for the standard System menu bits (move, resize, close etc), and also contains `Paste'. [originally from svn r3555]
This commit is contained in:
Родитель
9f98f81271
Коммит
890582d297
61
window.c
61
window.c
|
@ -33,6 +33,7 @@
|
||||||
#define IDM_SAVEDSESS 0x0160
|
#define IDM_SAVEDSESS 0x0160
|
||||||
#define IDM_COPYALL 0x0170
|
#define IDM_COPYALL 0x0170
|
||||||
#define IDM_FULLSCREEN 0x0180
|
#define IDM_FULLSCREEN 0x0180
|
||||||
|
#define IDM_PASTE 0x0190
|
||||||
|
|
||||||
#define IDM_SESSLGP 0x0250 /* log type printable */
|
#define IDM_SESSLGP 0x0250 /* log type printable */
|
||||||
#define IDM_SESSLGA 0x0260 /* log type all chars */
|
#define IDM_SESSLGA 0x0260 /* log type all chars */
|
||||||
|
@ -111,6 +112,12 @@ static int session_closed;
|
||||||
static const struct telnet_special *specials;
|
static const struct telnet_special *specials;
|
||||||
static int specials_menu_position;
|
static int specials_menu_position;
|
||||||
|
|
||||||
|
static struct {
|
||||||
|
HMENU menu;
|
||||||
|
int specials_submenu_pos;
|
||||||
|
} popup_menus[2];
|
||||||
|
enum { SYSMENU, CTXMENU };
|
||||||
|
|
||||||
Config cfg; /* exported to windlg.c */
|
Config cfg; /* exported to windlg.c */
|
||||||
|
|
||||||
extern struct sesslist sesslist; /* imported from windlg.c */
|
extern struct sesslist sesslist; /* imported from windlg.c */
|
||||||
|
@ -650,17 +657,14 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||||
* Set up the session-control options on the system menu.
|
* Set up the session-control options on the system menu.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
HMENU m = GetSystemMenu(hwnd, FALSE);
|
HMENU s, m;
|
||||||
HMENU s;
|
int i, j;
|
||||||
int i;
|
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
popup_menus[SYSMENU].menu = GetSystemMenu(hwnd, FALSE);
|
||||||
specials_menu_position = GetMenuItemCount(m);
|
popup_menus[CTXMENU].menu = CreatePopupMenu();
|
||||||
AppendMenu(m, MF_ENABLED, IDM_SHOWLOG, "&Event Log");
|
AppendMenu(popup_menus[CTXMENU].menu, MF_ENABLED, IDM_PASTE, "&Paste");
|
||||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
|
||||||
AppendMenu(m, MF_ENABLED, IDM_NEWSESS, "Ne&w Session...");
|
|
||||||
AppendMenu(m, MF_ENABLED, IDM_DUPSESS, "&Duplicate Session");
|
|
||||||
s = CreateMenu();
|
s = CreateMenu();
|
||||||
get_sesslist(&sesslist, TRUE);
|
get_sesslist(&sesslist, TRUE);
|
||||||
for (i = 1;
|
for (i = 1;
|
||||||
|
@ -668,6 +672,16 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||||
i++)
|
i++)
|
||||||
AppendMenu(s, MF_ENABLED, IDM_SAVED_MIN + (16 * i),
|
AppendMenu(s, MF_ENABLED, IDM_SAVED_MIN + (16 * i),
|
||||||
sesslist.sessions[i]);
|
sesslist.sessions[i]);
|
||||||
|
|
||||||
|
for (j = 0; j < lenof(popup_menus); j++) {
|
||||||
|
m = popup_menus[j].menu;
|
||||||
|
|
||||||
|
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
||||||
|
popup_menus[j].specials_submenu_pos = GetMenuItemCount(m);
|
||||||
|
AppendMenu(m, MF_ENABLED, IDM_SHOWLOG, "&Event Log");
|
||||||
|
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
||||||
|
AppendMenu(m, MF_ENABLED, IDM_NEWSESS, "Ne&w Session...");
|
||||||
|
AppendMenu(m, MF_ENABLED, IDM_DUPSESS, "&Duplicate Session");
|
||||||
AppendMenu(m, MF_POPUP | MF_ENABLED, (UINT) s, "Sa&ved Sessions");
|
AppendMenu(m, MF_POPUP | MF_ENABLED, (UINT) s, "Sa&ved Sessions");
|
||||||
AppendMenu(m, MF_ENABLED, IDM_RECONF, "Chan&ge Settings...");
|
AppendMenu(m, MF_ENABLED, IDM_RECONF, "Chan&ge Settings...");
|
||||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
||||||
|
@ -684,6 +698,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||||
AppendMenu(m, MF_ENABLED, IDM_ABOUT, str);
|
AppendMenu(m, MF_ENABLED, IDM_ABOUT, str);
|
||||||
sfree(str);
|
sfree(str);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
update_specials_menu(NULL);
|
update_specials_menu(NULL);
|
||||||
|
|
||||||
|
@ -852,7 +867,7 @@ void update_specials_menu(void *frontend)
|
||||||
{
|
{
|
||||||
HMENU m = GetSystemMenu(hwnd, FALSE);
|
HMENU m = GetSystemMenu(hwnd, FALSE);
|
||||||
int menu_already_exists = (specials != NULL);
|
int menu_already_exists = (specials != NULL);
|
||||||
int i;
|
int i, j;
|
||||||
|
|
||||||
specials = back->get_specials(backhandle);
|
specials = back->get_specials(backhandle);
|
||||||
if (specials) {
|
if (specials) {
|
||||||
|
@ -865,16 +880,22 @@ void update_specials_menu(void *frontend)
|
||||||
else
|
else
|
||||||
AppendMenu(p, MF_SEPARATOR, 0, 0);
|
AppendMenu(p, MF_SEPARATOR, 0, 0);
|
||||||
}
|
}
|
||||||
|
for (j = 0; j < lenof(popup_menus); j++) {
|
||||||
if (menu_already_exists)
|
if (menu_already_exists)
|
||||||
DeleteMenu(m, specials_menu_position, MF_BYPOSITION);
|
DeleteMenu(popup_menus[j].menu,
|
||||||
|
popup_menus[j].specials_submenu_pos,
|
||||||
|
MF_BYPOSITION);
|
||||||
else
|
else
|
||||||
InsertMenu(m, specials_menu_position,
|
InsertMenu(popup_menus[j].menu,
|
||||||
|
popup_menus[j].specials_submenu_pos,
|
||||||
MF_BYPOSITION | MF_SEPARATOR, 0, 0);
|
MF_BYPOSITION | MF_SEPARATOR, 0, 0);
|
||||||
InsertMenu(m, specials_menu_position,
|
InsertMenu(popup_menus[j].menu,
|
||||||
|
popup_menus[j].specials_submenu_pos,
|
||||||
MF_BYPOSITION | MF_POPUP | MF_ENABLED,
|
MF_BYPOSITION | MF_POPUP | MF_ENABLED,
|
||||||
(UINT) p, "Special Command");
|
(UINT) p, "Special Command");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* set or clear the "raw mouse message" mode
|
* set or clear the "raw mouse message" mode
|
||||||
|
@ -1711,6 +1732,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||||
show_mouseptr(1);
|
show_mouseptr(1);
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
return 0;
|
return 0;
|
||||||
|
case WM_COMMAND:
|
||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
switch (wParam & ~0xF) { /* low 4 bits reserved to Windows */
|
switch (wParam & ~0xF) { /* low 4 bits reserved to Windows */
|
||||||
case IDM_SHOWLOG:
|
case IDM_SHOWLOG:
|
||||||
|
@ -1932,6 +1954,9 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||||
case IDM_COPYALL:
|
case IDM_COPYALL:
|
||||||
term_copyall(term);
|
term_copyall(term);
|
||||||
break;
|
break;
|
||||||
|
case IDM_PASTE:
|
||||||
|
term_do_paste(term);
|
||||||
|
break;
|
||||||
case IDM_CLRSB:
|
case IDM_CLRSB:
|
||||||
term_clrsb(term);
|
term_clrsb(term);
|
||||||
break;
|
break;
|
||||||
|
@ -2003,6 +2028,16 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
case WM_MBUTTONUP:
|
case WM_MBUTTONUP:
|
||||||
case WM_RBUTTONUP:
|
case WM_RBUTTONUP:
|
||||||
|
if (message == WM_RBUTTONDOWN && (wParam & MK_CONTROL)) {
|
||||||
|
POINT cursorpos;
|
||||||
|
|
||||||
|
GetCursorPos(&cursorpos);
|
||||||
|
TrackPopupMenu(popup_menus[CTXMENU].menu,
|
||||||
|
TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RIGHTBUTTON,
|
||||||
|
cursorpos.x, cursorpos.y,
|
||||||
|
0, hwnd, NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
{
|
{
|
||||||
int button, press;
|
int button, press;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче