From b2cffb36da692e10d4aee94c88a7d46e44bb37c2 Mon Sep 17 00:00:00 2001 From: cyd01 Date: Thu, 9 Apr 2020 19:57:58 +0200 Subject: [PATCH] Change shortcuts toggle: from shortcut to menu item --- 0.73_My_PuTTY/windows/window.c | 14 +++++++++++--- docs/index.md | 8 +++++--- kitty.c | 17 ++++++++++++++--- kitty.h | 6 +++++- kitty_ini.txt | 2 +- 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/0.73_My_PuTTY/windows/window.c b/0.73_My_PuTTY/windows/window.c index 7741d27..9e24ac7 100644 --- a/0.73_My_PuTTY/windows/window.c +++ b/0.73_My_PuTTY/windows/window.c @@ -1500,6 +1500,12 @@ TrayIcone.hWnd = hwnd ; AppendMenu(FontMenu, MF_ENABLED, IDM_FONTNEGATIVE, "Negative"); AppendMenu(FontMenu, MF_ENABLED, IDM_FONTBLACKANDWHITE, "Black and White"); AppendMenu(m, MF_POPUP | MF_ENABLED, (UINT) FontMenu, "Font settings"); + + if( GetShortcutsFlag() ) + AppendMenu(m, MF_ENABLED|MF_CHECKED, IDM_SHORTCUTSTOGGLE, "Shortcuts toggle"); + else + AppendMenu(m, MF_ENABLED, IDM_SHORTCUTSTOGGLE, "Shortcuts toggle"); + AppendMenu(m, MF_SEPARATOR, 0, 0); AppendMenu(m, MF_ENABLED, IDM_SCRIPTFILE, "Send scr&ipt file" ) ; @@ -4023,6 +4029,9 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation case IDM_VISIBLE: ManageVisible( hwnd, wintw, conf_get_str(conf, CONF_wintitle) ) ; break ; + case IDM_SHORTCUTSTOGGLE: + ManageShortcutsFlag( hwnd ) ; + break ; case IDM_TOTRAY: if( GetVisibleFlag()==VISIBLE_YES ) { SetVisibleFlag( VISIBLE_TRAY ) ; @@ -5209,7 +5218,6 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation } #endif #ifdef MOD_PERSO - if( (wParam == VK_TAB) && (GetKeyState(VK_CONTROL) & 0x8000) ) { // CTRL + TAB to switch between windows if (conf_get_int(conf, CONF_ctrl_tab_switch) && GetCtrlTabFlag()) { if( message==WM_KEYUP ) { @@ -5242,10 +5250,10 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation } #endif - +/* if((wParam==VK_F1)&&(message==WM_KEYDOWN)&&(GetKeyState(VK_CONTROL)&0x8000)&&(GetKeyState(VK_SHIFT)&0x8000)) // CTRL+SHIFT+F1 => Manage shortcut flag { SetShortcutsFlag( abs(GetShortcutsFlag()-1) ) ; return 0 ; } - +*/ if( GetShortcutsFlag() ) { if ( (message==WM_KEYDOWN)||(message==WM_SYSKEYDOWN) ) { diff --git a/docs/index.md b/docs/index.md index 3c8d610..d2519a5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,3 +1,5 @@ +[//]: # (title:KiTTY, a free telnet/ssh client for Windows) + # Welcome to the KiTTY introduction web site ## What is KiTTY ? @@ -19,7 +21,7 @@ KiTTY has all the features from the original software, and adds many others as d * Automatic password * Automatic command * Running a locally saved script on a remote session -* ~~ZModem integration~~ +* ZModem integration ### Graphical features * An icon for each session @@ -37,8 +39,8 @@ KiTTY has all the features from the original software, and adds many others as d * pscp.exe and WinSCP integration * Binary compression * Clipboard printing -* Cygwin and cmd.exe intégration -* ~~Background image~~ +* The PuTTYCyg patch +* Background image * File association * Other settings * New command-line options diff --git a/kitty.c b/kitty.c index fd8bc2e..af7095d 100644 --- a/kitty.c +++ b/kitty.c @@ -1868,16 +1868,27 @@ void ManageVisible( HWND hwnd, TermWin *tw, char * title ) { SetWindowPos(hwnd,(HWND)-1,0,0,0,0, SWP_NOMOVE |SWP_NOSIZE ) ; conf_set_bool( conf, CONF_alwaysontop, true ) ; set_title(tw, title) ; - } - else { + } else { CheckMenuItem( m, (UINT)IDM_VISIBLE, MF_BYCOMMAND|MF_UNCHECKED ) ; SetWindowPos(hwnd,(HWND)-2,0,0,0,0, SWP_NOMOVE |SWP_NOSIZE ) ; conf_set_bool( conf, CONF_alwaysontop, false ) ; set_title(tw, title) ; - } } } +} +void ManageShortcutsFlag( HWND hwnd ) { + HMENU m ; + SetShortcutsFlag( abs(GetShortcutsFlag()-1) ) ; + if( ( m = GetSystemMenu (hwnd, FALSE) ) != NULL ) { + if( GetShortcutsFlag() ) { + CheckMenuItem( m, (UINT)IDM_SHORTCUTSTOGGLE, MF_BYCOMMAND|MF_CHECKED ) ; + } else { + CheckMenuItem( m, (UINT)IDM_SHORTCUTSTOGGLE, MF_BYCOMMAND|MF_UNCHECKED ) ; + } + } +} + // Gere la demande de relance de l'application void ManageRestart( HWND hwnd ) { SendMessage( hwnd, WM_COMMAND, IDM_RESTART, 0 ) ; diff --git a/kitty.h b/kitty.h index f6e32a0..fc85cfb 100644 --- a/kitty.h +++ b/kitty.h @@ -589,9 +589,13 @@ void xyz_updateMenuItems(Terminal *term) ; #endif #endif +#ifndef IDM_SHORTCUTSTOGGLE +#define IDM_SHORTCUTSTOGGLE 0xB120 +#endif + // Doit etre le dernier #ifndef IDM_LAUNCHER -#define IDM_LAUNCHER 0xB120 +#define IDM_LAUNCHER 0xB130 #endif // USERCMD doit etre la plus grande valeur pour permettre d'avoir autant de raccourcis qu'on le souhaite diff --git a/kitty_ini.txt b/kitty_ini.txt index c207fbf..bfa0d6c 100644 --- a/kitty_ini.txt +++ b/kitty_ini.txt @@ -87,7 +87,7 @@ cygterm=no ;downloaddir= ; fileextension: the extension for session settings files in portable mode -;fileextension= +;fileextension=.ktx ; hyperlink: enable/disable the hyperlink feature hyperlink=yes