diff --git a/0.74_My_PuTTY/config.c b/0.74_My_PuTTY/config.c index 9df2ceb..743076d 100644 --- a/0.74_My_PuTTY/config.c +++ b/0.74_My_PuTTY/config.c @@ -2355,6 +2355,7 @@ void setup_config_box(struct controlbox *b, bool midsession, ssd->editbox = ctrl_editbox(s, "Saved Sessions/New Folder", 'e', 100, HELPCTX(session_saved), sessionsaver_handler, P(ssd), P(NULL)); + ssd->editbox->generic.column = 0; if( !midsession && ( (get_param("INIFILE")!=2)||(!GetDirectoryBrowseFlag()) ) ) { ssd->clearbutton = ctrl_pushbutton(s, "Clear", NO_SHORTCUT, @@ -2381,6 +2382,7 @@ void setup_config_box(struct controlbox *b, bool midsession, ssd->listbox->generic.column = 0; #ifdef MOD_PERSO ssd->listbox->listbox.height = GetConfigBoxHeight() ; + ssd->listbox->listbox.hscroll = true ; /* Does nothing */ #else ssd->listbox->listbox.height = 7; #endif diff --git a/0.74_My_PuTTY/dialog.c b/0.74_My_PuTTY/dialog.c index 2c83f10..09e1399 100644 --- a/0.74_My_PuTTY/dialog.c +++ b/0.74_My_PuTTY/dialog.c @@ -352,7 +352,6 @@ union control *ctrl_listbox(struct controlset *s, const char *label, c->listbox.percentwidth = 100; c->listbox.ncols = 0; c->listbox.percentages = NULL; - c->listbox.hscroll = true; return c; } diff --git a/0.74_My_PuTTY/version.h b/0.74_My_PuTTY/version.h index c9f4b5b..55d3a36 100644 --- a/0.74_My_PuTTY/version.h +++ b/0.74_My_PuTTY/version.h @@ -1,5 +1,5 @@ #define RELEASE 0.74 #define TEXTVER "Release 0.74" #define SSHVER "-Release-0.74" -#define BINARY_VERSION 0,74,3,1 +#define BINARY_VERSION 0,74,3,2 #define SOURCE_COMMIT "unavailable" diff --git a/0.74_My_PuTTY/windows/MAKEFILE.MINGW b/0.74_My_PuTTY/windows/MAKEFILE.MINGW index 5e66485..267bd8f 100644 --- a/0.74_My_PuTTY/windows/MAKEFILE.MINGW +++ b/0.74_My_PuTTY/windows/MAKEFILE.MINGW @@ -1854,7 +1854,7 @@ winpgnt_integrated.o: ../windows/winpgnt.c ../putty.h ../ssh.h ../misc.h ../tree adb.o: ../putty.h ../../adb/adb.c $(CC) $(COMPAT) $(CFLAGS) $(XFLAGS) -c ../../adb/adb.c -I../../adb -I../../ -kitty.o: ../../kitty.c ../../kitty.h ../../kitty_savedump.c ../../kitty_launcher.c ../../kitty_launcher.h ../windows/window.c ../../kitty_ini.h +kitty.o: ../../kitty.c ../../kitty.h ../../kitty_savedump.c ../../kitty_launcher.c ../../kitty_launcher.h ../windows/window.c ../../kitty_ini.h ../../kitty_help.h $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) -c ../../kitty.c \ -DBUILD_TIME=`date +'"%d/%m/%Y-%H:%M:%S(%Z)"'` \ -DBUILD_VERSION=`cat version_major.txt` \ @@ -1982,6 +1982,9 @@ kitty.dll: ../../kitty_dll.c kitty_dll.res.o ../../kitty_ini.h: ../../kitty_ini.txt ( printf 'static char *default_init_file_content = "' ; sed 's/\\/\\\\/g' ../../kitty_ini.txt | sed 's/$$/\\n\\/' ; printf '" ;\n' ) > ../../kitty_ini.h +../../kitty_help.h: ../../docs/pages/CommandLine.md + ( printf 'static char *default_help_file_content = "' ; sed -n '/CmdLineOptions_begin/,/CmdLineOptions_end/p' ../../docs/pages/CommandLine.md|sed 's///'|sed 's/\*\*//g'|sed 's/$$/\\r\\n\\/' ; printf '" ;\n' ) > ../../kitty_help.h + nohyperlink: putty_nohyperlink.exe notrans: putty_notrans.exe diff --git a/0.74_My_PuTTY/windows/version_minor.txt b/0.74_My_PuTTY/windows/version_minor.txt index d00491f..0cfbf08 100644 --- a/0.74_My_PuTTY/windows/version_minor.txt +++ b/0.74_My_PuTTY/windows/version_minor.txt @@ -1 +1 @@ -1 +2 diff --git a/0.74_My_PuTTY/windows/window.c b/0.74_My_PuTTY/windows/window.c index 5a46bd4..bab97f1 100644 --- a/0.74_My_PuTTY/windows/window.c +++ b/0.74_My_PuTTY/windows/window.c @@ -965,7 +965,12 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) if( existfile(argv[i]) ) { LoadFile = (char*) malloc( strlen(argv[i])+1 ) ; strcpy( LoadFile, argv[i] ) ; + RunPuttyEd( hwnd, LoadFile, true ) ; + free( LoadFile ) ; + } else { + MessageBox(hwnd,"Unable to find requested file","Error",MB_OK|MB_ICONERROR) ; } + exit( 0 ) ; } else if( !strcmp(p, "-folder") ) { char *pfolder ; pfolder=p+7; @@ -1110,9 +1115,19 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) sprintf(buffer, "%s|%s|0", (char*)get_param_str("INI"), (char*)get_param_str("SAV") ) ; return Notepad_WinMain(inst, prev, buffer, show) ; } else if( !strcmp(p, "-edb") ) { - char buffer[1024]; i++; - sprintf(buffer, "%s|%s|%s", (char*)get_param_str("INI"), (char*)get_param_str("SAV"), argv[i] ) ; + if( existfile(argv[i]) ) { + char buffer[1024]; + sprintf(buffer, "%s|%s|%s", (char*)get_param_str("INI"), (char*)get_param_str("SAV"), argv[i] ) ; + return Notepad_WinMain(inst, prev, buffer, show) ; + } else { + MessageBox(hwnd,"Unable to find requested file","Error",MB_OK|MB_ICONERROR) ; + } + exit(0); + } else if( !strcmp(p, "-help") ) { + SetTextToClipboard(GetHelpMessage()) ; + char buffer[1024]; + sprintf(buffer, "%s|%s|2", (char*)get_param_str("INI"), (char*)get_param_str("SAV") ) ; return Notepad_WinMain(inst, prev, buffer, show) ; #ifdef MOD_LAUNCHER } else if( !strcmp(p, "-launcher") ) { @@ -3318,7 +3333,11 @@ else if((UINT_PTR)wParam == TIMER_INIT) { // Initialisation char buffer[4096] = "" ; // On charge automatiquement au démarrage (-edit) un fichier dans l'editeur connecté - if( !PuttyFlag ) if( LoadFile!=NULL ) { RunPuttyEd( hwnd, LoadFile ) ; free( LoadFile ) ; LoadFile = NULL ; } + if( !PuttyFlag ) if( LoadFile!=NULL ) { + RunPuttyEd( hwnd, LoadFile, true ) ; + free( LoadFile ) ; + LoadFile = NULL ; + } if( (conf_get_int(conf,CONF_protocol) == PROT_SSH) && (!is_backend_connected) ) break ; // On sort si en SSH on n'est pas connecte // Lancement d'une (ou plusieurs separees par \\n) commande(s) automatique(s) a l'initialisation diff --git a/blocnote/notepad.a b/blocnote/notepad.a index 6b59cda..fcf485d 100644 Binary files a/blocnote/notepad.a and b/blocnote/notepad.a differ diff --git a/blocnote/notepad.c b/blocnote/notepad.c index 0c69394..e0571c5 100644 --- a/blocnote/notepad.c +++ b/blocnote/notepad.c @@ -154,7 +154,7 @@ int WINAPI Notepad_WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR l AppendMenu(hMenu,MF_POPUP,(UINT)hSMApropos,Notepad_LoadString(NOTEPAD_STR_HELP)); //hwnd = CreateWindow(Notepad_szprogname, Notepad_szprogname, WS_OVERLAPPEDWINDOW,CW_USEDEFAULT, CW_USEDEFAULT, cxScreen, cyScreen, NULL, hMenu, hinstance, NULL); - hwnd = CreateWindowEx(WS_EX_ACCEPTFILES,Notepad_szprogname, Notepad_szprogname, WS_OVERLAPPEDWINDOW,CW_USEDEFAULT, CW_USEDEFAULT, cxScreen, cyScreen, NULL, hMenu, hinstance, NULL); + hwnd = CreateWindowEx(WS_EX_ACCEPTFILES,Notepad_szprogname, Notepad_szprogname, WS_OVERLAPPEDWINDOW,CW_USEDEFAULT, CW_USEDEFAULT, (int)cxScreen/2, (int)cyScreen/2, NULL, hMenu, hinstance, NULL); if (!hwnd) return FALSE; @@ -193,9 +193,17 @@ LRESULT CALLBACK Notepad_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa switch (uMsg) { case WM_CREATE: { - hEdit = CreateWindow("edit", "", WS_CHILD | WS_VISIBLE | - ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL, - 0, 0, 0, 0, hwnd, NULL, notepad_hinst, NULL); + + if( (LoadFile!=NULL)&&(strlen(LoadFile)>0)&&(!strcmp(LoadFile,"2")) ) { + hEdit = CreateWindow("edit", "", WS_CHILD | WS_VISIBLE | ES_READONLY | + ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL, + 0, 0, 0, 0, hwnd, NULL, notepad_hinst, NULL); + strcpy(LoadFile,"1"); + } else { + hEdit = CreateWindow("edit", "", WS_CHILD | WS_VISIBLE | + ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL, + 0, 0, 0, 0, hwnd, NULL, notepad_hinst, NULL); + } ZeroMemory(&lf, sizeof(LOGFONT)); lstrcpy(lf.lfFaceName,"Courier"); diff --git a/docs/pages/CommandLine.md b/docs/pages/CommandLine.md index 33cae1c..49d7f4d 100644 --- a/docs/pages/CommandLine.md +++ b/docs/pages/CommandLine.md @@ -1,6 +1,8 @@
## New command-line options + + In **KiTTY** some new command-line options are available: * **-auto-store-sshkey**: automatically store server SSH key without prompting @@ -14,6 +16,7 @@ In **KiTTY** some new command-line options are available: * **-fileassoc**: associate **.ktx** files with **KiTTY**. See [Portability feature](Portability.md) to define file extention * **-folder**: directly open a specific folder (for [savemode=dir mode](Portability.md) only). It must precede **-load** option * **-fullscreen**: start directly in full screen mode +* **-help**: print this help message * **-icon**: choose a specific [build-in icon](kitty_icon.md) * **-iconfile**: choose an external icon file * **-initdelay**: delay (in seconds) before initial configured actions (send to tray, autocommand ...). Default is 2.0 @@ -48,3 +51,7 @@ In **Klink** there is one of the **KiTTY** option: In **Kageant** there is only one: * **-pass**: to set the passphrase of the ssh key to add + + + +> All original **PuTTY** command-line options are available on [PuTTY website](https://the.earth.li/~sgtatham/putty/latest/htmldoc/Chapter3.html#using-cmdline) diff --git a/docs/pages/cygtermd.md b/docs/pages/cygtermd.md index 355707d..801c685 100644 --- a/docs/pages/cygtermd.md +++ b/docs/pages/cygtermd.md @@ -1,4 +1,3 @@ - ## About cygtermd, the PuTTYCyg workaround @@ -13,44 +12,35 @@ Download it and put it into your **/bin** Cygwin directory. This feature is also available directly from the command-line. Once the **cygtermd.exe** is put into the **Cygwin** directory just call this command: ``` -kitty.exe -localproxy "C:\cygwin64\bin\cygtermd.exe /home/%USERNAME% /bin/bash -login" localhost +kitty.exe -localproxy 'C:\cygwin64\bin\cygtermd.exe /home/cyd /bin/bash -login' localhost ``` -Adapt **C:\cygwin64\bin\cygtermd.exe** if it has been installed to a different directory. You must provide a target hostname (ex: localhost) even if it is not used in this situation. - -If you are running this command from PowerShell rather than a Windows shortcut, Start➡Run, or a regular command prompt, you should use single quotes instead of double quotes. -``` -kitty.exe -localproxy 'C:\cygwin64\bin\cygtermd.exe /home/%USERNAME% /bin/bash -login' localhost -``` +Adapt **C:\cygwin64\bin\cygtermd.exe** and **/home/cyd** with your own settings. You must provide a target hostname (ex: localhost) even if it is not used in this situation. + ### Start a **CMD.EXE** into a **KiTTY** terminal It is possible to start directly the Windows command line utility **cmd.exe**: ``` -kitty.exe -localproxy "C:\cygwin64\bin\cygtermd.exe /cygdrive/c/Windows /cygdrive/c/Windows/System32/cmd.exe" localhost +kitty.exe -localproxy 'C:\cygwin64\bin\cygtermd.exe /cygdrive/c/Windows /cygdrive/c/Windows/System32/cmd.exe' localhost ``` -Don't forget to choose the right codepage in translation tab or use the **-codepage** command line option. +Don't forget to choose the rigth codepage in translation tab or use the **-codepage** command line option. -It is not necessary to have the full **Cygwin** environment to do this. Just add the **cygtermd.exe** file and the corresponding **cygwin1.dll** library next the **kitty.exe** binary. +It si not necessary to have the full **Cygwin** environment to do this. Just add the **cygtermd.exe** file and the corresponding **cygwin1.dll** library next the **kitty.exe** binary. ### Use **winpty** to start **cmd.exe** or ** PowerShell** Windows utilities -It is also possible to start the Windows command line utility **cmd.exe** from the [winpty tool](https://github.com/rprichard/winpty): +It is also possible to start the Windows command line utility **cmd.exe** from de [winpty tool](https://github.com/rprichard/winpty): Get it and unzip it into your **/usr** Cygwin directory. Then run ``` -kitty.exe -localproxy "C:\cygwin64\bin\cygtermd.exe /usr/bin/winpty.exe C:\Windows\System32\cmd.exe" localhost +kitty.exe -localproxy 'C:\cygwin64\bin\cygtermd.exe /cygdrive/c/Windows /usr/bin/winpty.exe /cygdrive/c/Windows/System32/cmd.exe' localhost ``` And now use it to run **PowerShell**: ``` -kitty.exe -localproxy "C:\cygwin64\bin\cygtermd.exe /usr/bin/winpty.exe C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" localhost -``` - -or **PowerShell 7**: -``` -kitty.exe -localproxy "C:\cygwin64\bin\cygtermd.exe /usr/bin/winpty.exe C:\Program Files\PowerShell\7\pwsh.exe" localhost +kitty.exe -localproxy 'C:\cygwin64\bin\cygtermd.exe /cygdrive/c /usr/bin/winpty.exe /cygdrive/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe' localhost ``` --- diff --git a/docs/version.txt b/docs/version.txt index 7584334..9243766 100644 --- a/docs/version.txt +++ b/docs/version.txt @@ -1 +1 @@ -0.74.3.1 \ No newline at end of file +0.74.3.2 \ No newline at end of file diff --git a/kitty.c b/kitty.c index d661f33..dea83ac 100644 --- a/kitty.c +++ b/kitty.c @@ -1246,7 +1246,12 @@ void CountUp( void ) { WriteParameter( INIT_SECTION, "KiLic", buffer) ; } } - + +#include "../../kitty_help.h" +char * GetHelpMessage(void) { + return default_help_file_content ; +} + // Si le fichier kitty.ini n'existe pas => creation du fichier par defaut #include "kitty_ini.h" void CreateIniFile( const char * filename ) { @@ -5005,22 +5010,20 @@ int ManageShortcuts( HWND hwnd, const int* clips_system, int key_num, int shift_ if( key == shortcuts_tab.editor ) { // Lancement d'un putty-ed if( debug_flag ) { debug_logevent( "Start empty internal editor" ) ; } - RunPuttyEd( hwnd, NULL ) ; + RunPuttyEd( hwnd, NULL, false ) ; return 1 ; } if( key == (shortcuts_tab.editorclipboard ) ) { // Lancement d'un putty-ed qui charge le contenu du presse-papier if( debug_flag ) { debug_logevent( "Start internal editor fullfiled with clipboard" ) ; } - term_copyall(term,clips_system,lenof(clips_system)) ; RunPuttyEd( hwnd, "1" ) ; + term_copyall(term,clips_system,lenof(clips_system)) ; RunPuttyEd( hwnd, "1", false ) ; return 1 ; - } - else if( key == shortcuts_tab.winscp ) // Lancement de WinSCP - { SendMessage( hwnd, WM_COMMAND, IDM_WINSCP, 0 ) ; return 1 ; } - else if( key == shortcuts_tab.autocommand ) // Rejouer la commande de demarrage - { + } else if( key == shortcuts_tab.winscp ) { // Lancement de WinSCP + SendMessage( hwnd, WM_COMMAND, IDM_WINSCP, 0 ) ; return 1 ; + } else if( key == shortcuts_tab.autocommand ) { // Rejouer la commande de demarrage RenewPassword( conf ) ; SetTimer(hwnd, TIMER_AUTOCOMMAND,autocommand_delay, NULL) ; - return 1 ; } - if( key == shortcuts_tab.print ) { // Impression presse papier + return 1 ; + } if( key == shortcuts_tab.print ) { // Impression presse papier SendMessage( hwnd, WM_COMMAND, IDM_PRINT, 0 ) ; return 1 ; } diff --git a/kitty.h b/kitty.h index 7b49de5..a207950 100644 --- a/kitty.h +++ b/kitty.h @@ -402,6 +402,7 @@ void ChangeFontSize(HWND hwnd, int dec) ; void create_settings( const char * name ) ; void SetHostKeyExtension( const char* ext ) ; +char * GetHelpMessage(void) ; void CreateIniFile( const char * filename ) ; void SendKeyboard( HWND hwnd, const char * buffer ) ; char * GetRemotePath() ; diff --git a/kitty_win.c b/kitty_win.c index eca7066..002cd89 100644 --- a/kitty_win.c +++ b/kitty_win.c @@ -396,16 +396,18 @@ void RunCommand( HWND hwnd, const char * cmd ) { } } -void RunPuttyEd( HWND hwnd, char * filename ) { +void RunPuttyEd( HWND hwnd, char * filename, bool readonly ) { char buffer[1024]="", shortname[1024]="" ; - if( GetModuleFileName( NULL, (LPTSTR)buffer, 1023 ) ) - if( GetShortPathName( buffer, shortname, 1023 ) ) { + if( GetModuleFileName( NULL, (LPTSTR)buffer, 1023 ) ) if( GetShortPathName( buffer, shortname, 1023 ) ) { strcat( shortname, " -ed" ); - if( filename!=NULL ) if( strlen(filename)>0 ) { strcat( shortname, "b " ) ; strcat( shortname, filename ) ; } + if( filename!=NULL ) if( strlen(filename)>0 ) { + strcat( shortname, "b " ) ; + strcat( shortname, filename ) ; + } debug_logevent( shortname ) ; RunCommand( hwnd, shortname ) ; - } - } + } +} // Verifie si une mise a jour est disponible sur le site web extern char BuildVersionTime[256] ; @@ -454,3 +456,69 @@ void PopUpSystemMenu( HWND hwnd, int npos ) { } } + +// Description: +// Creates a tooltip for an item in a dialog box. +// Parameters: +// idTool - identifier of an dialog box item. +// nDlg - window handle of the dialog box. +// pszText - string to use as the tooltip text. +// Returns: +// The handle to the tooltip. +// +HWND CreateToolTip(int toolID, HWND hDlg, PTSTR pszText) +{ + if (!toolID || !hDlg || !pszText) + { + return FALSE; + } + // Get the window of the tool. + HWND hwndTool = GetDlgItem(hDlg, toolID); + + // Create the tooltip. g_hInst is the global instance handle. + HWND hwndTip = CreateWindowEx((DWORD)NULL, TOOLTIPS_CLASS, NULL, + WS_POPUP |TTS_ALWAYSTIP | TTS_BALLOON, + CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, + hDlg, NULL, + hinst /*g_hInst*/, NULL); + + if (!hwndTool || !hwndTip) + { + return (HWND)NULL; + } + + // Associate the tooltip with the tool. + TOOLINFO toolInfo = { 0 }; + toolInfo.cbSize = sizeof(toolInfo); + toolInfo.hwnd = hDlg; + toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS; + toolInfo.uId = (UINT_PTR)hwndTool; + toolInfo.lpszText = pszText; + SendMessage(hwndTip, TTM_ADDTOOL, 0, (LPARAM)&toolInfo); + + return hwndTip; +} + +HWND CreateToolTip2(int toolID, HWND hDlg, PTSTR pszText) { + HWND hwndToolTips = CreateWindow(TOOLTIPS_CLASS, NULL, + WS_POPUP | TTS_NOPREFIX | TTS_BALLOON, + 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL); + if (hwndToolTips) +{ + TOOLINFO ti; + + ti.cbSize = sizeof(ti); + ti.uFlags = TTF_TRANSPARENT | TTF_CENTERTIP; + ti.hwnd = hDlg; + ti.uId = toolID; + ti.hinst = NULL; + ti.lpszText = pszText; + + GetClientRect(hwnd, &ti.rect); + + SendMessage(hwndToolTips, TTM_ADDTOOL, 0, (LPARAM) &ti ); + +} +return hwndToolTips ; +} diff --git a/kitty_win.h b/kitty_win.h index 1008be5..9d8b29e 100644 --- a/kitty_win.h +++ b/kitty_win.h @@ -29,7 +29,7 @@ int SetTextToClipboard( const char * buf ) ; void RunCommand( HWND hwnd, const char * cmd ) ; // Démarre l'éditeur embarqué -void RunPuttyEd( HWND hwnd, char * filename ) ; +void RunPuttyEd( HWND hwnd, char * filename, bool readonly ) ; // Verifie si une mise a jour est disponible sur le site web void CheckVersionFromWebSite( HWND hwnd ) ; @@ -40,4 +40,6 @@ void debug_logevent( const char *fmt, ... ) ; // Affiche le menu system de l'application void PopUpSystemMenu( HWND hwnd, int npos ) ; +// Affiche une bulle tooltip +HWND CreateToolTip(int toolID, HWND hDlg, PTSTR pszText) ; #endif