From e9d1518c213ebf252ba0d3e621127dd48445be60 Mon Sep 17 00:00:00 2001 From: Jason Millard Date: Thu, 15 Dec 2005 12:00:00 +0600 Subject: [PATCH] 1.3 commit - Added minimize to system tray. Added tab completion. --- AboutDialog.cpp | 15 +- AboutDialog.h | 3 +- CommandEdit.cpp | 16 +- CommandEdit.h | 2 + Defines.h | 13 +- FilterDialog.cpp | 22 ++- FilterDialog.h | 3 +- FiltersDialog.cpp | 30 +++- FiltersDialog.h | 4 +- PasswordDialog.cpp | 20 ++- PasswordDialog.h | 3 +- PreferencesDialog.cpp | 95 +++++++++++- PreferencesDialog.h | 15 +- PuTTYCS.clw | 111 ++++++++------ PuTTYCS.rc | 93 ++++++++---- PuTTYCSDialog.cpp | 332 +++++++++++++++++++++++++++++++++--------- PuTTYCSDialog.h | 37 +++-- readme.txt | 20 ++- resource.h | 12 +- setup.iss | 19 +-- 20 files changed, 672 insertions(+), 193 deletions(-) diff --git a/AboutDialog.cpp b/AboutDialog.cpp index 5e72793..fcb5286 100755 --- a/AboutDialog.cpp +++ b/AboutDialog.cpp @@ -29,6 +29,7 @@ * * 11/07/2005: Initial version J. Millard * 11/17/2005: Added UNICODE support J. Millard + * 12/15/2005: Updated Help/F1 to go visit website J. Millard */ #include "stdafx.h" @@ -69,9 +70,21 @@ BEGIN_MESSAGE_MAP(CAboutDialog, CDialog) //{{AFX_MSG_MAP(CAboutDialog) ON_BN_CLICKED(IDC_VISITWEBSITE_BUTTON, OnVisitWebSiteButton) ON_BN_CLICKED(IDC_CLOSE_BUTTON, OnOK) - //}}AFX_MSG_MAP + ON_WM_HELPINFO() + //}}AFX_MSG_MAP END_MESSAGE_MAP() +/** + * CAboutDialog::OnHelpInfo() + */ + +BOOL CAboutDialog::OnHelpInfo(HELPINFO* pHelpInfo) +{ + OnVisitWebSiteButton(); + + return TRUE; +} + /** * CAboutDialog::OnInitDialog() */ diff --git a/AboutDialog.h b/AboutDialog.h index a7edae3..2716197 100755 --- a/AboutDialog.h +++ b/AboutDialog.h @@ -65,7 +65,8 @@ class CAboutDialog : public CDialog //{{AFX_MSG(CAboutDialog) virtual BOOL OnInitDialog(); afx_msg void OnVisitWebSiteButton(); - //}}AFX_MSG + afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); + //}}AFX_MSG DECLARE_MESSAGE_MAP() }; diff --git a/CommandEdit.cpp b/CommandEdit.cpp index f8971da..600ea99 100755 --- a/CommandEdit.cpp +++ b/CommandEdit.cpp @@ -28,6 +28,7 @@ * REVISION HISTORY: * * 12/06/2005: Initial version J. Millard + * 12/15/2005: Added GetText() method J. Millard */ #include "stdafx.h" @@ -64,6 +65,18 @@ BEGIN_MESSAGE_MAP(CCommandEdit, CEdit) //}}AFX_MSG_MAP END_MESSAGE_MAP() +/** + * CCommandEdit::GetText() + */ + +CString CCommandEdit::GetText() +{ + CString csText; + GetWindowText(csText); + + return csText; +} + /** * CCommandEdit::SetText() */ @@ -103,8 +116,7 @@ void CCommandEdit::OnLButtonUp(UINT nFlags, CPoint point) { if ( OpenClipboard() ) { - CString csText; - GetWindowText(csText); + CString csText = GetText(); CString csCommand = csText.Mid( iStart, (iEnd - iStart) ); diff --git a/CommandEdit.h b/CommandEdit.h index 7d38aa2..8d61c79 100755 --- a/CommandEdit.h +++ b/CommandEdit.h @@ -28,6 +28,7 @@ * REVISION HISTORY: * * 12/06/2005: Initial version J. Millard + * 12/15/2005: Added GetText() method J. Millard */ #if !defined(AFX_COMMANDEDIT_H__309531A0_E385_4512_83CF_2A230314E589__INCLUDED_) @@ -43,6 +44,7 @@ class CCommandEdit : public CEdit public: CCommandEdit(); + CString GetText(); void SetText( CString csText ); void SetEmulateCopyPaste( int iEmulateCopyPaste ); diff --git a/Defines.h b/Defines.h index 50e2cfd..0e2c502 100755 --- a/Defines.h +++ b/Defines.h @@ -33,6 +33,8 @@ * Added AltGr support * 11/18/2005: Fixed AltGr support J. Millard * 12/06/2005: Added mouse Copy/Paste emulation J. Millard + * 12/15/2005: Added minimize to systray. J. Millard + * Added tab completion */ #if !defined(DEFINES_H__INCLUDED_) @@ -42,12 +44,12 @@ #define PUTTYCS_WINDOW_CLASS_PUTTY _T( "PuTTY" ) -#define PUTTYCS_WINDOW_TITLE_TOOL _T( "PuTTYCS 1.2 - PuTTY Command Sender") -#define PUTTYCS_WINDOW_TITLE_APP _T( "PuTTYCS 1.2") +#define PUTTYCS_WINDOW_TITLE_TOOL _T( "PuTTYCS 1.3 - PuTTY Command Sender") +#define PUTTYCS_WINDOW_TITLE_APP _T( "PuTTYCS 1.3") -#define PUTTYCS_WINDOW_TITLE_ABOUT _T( "About PuTTYCS 1.2") +#define PUTTYCS_WINDOW_TITLE_ABOUT _T( "About PuTTYCS...") -#define PUTTYCS_ABOUT_TEXT_LINE1 _T( "PuTTY Command Sender 1.2" ) +#define PUTTYCS_ABOUT_TEXT_LINE1 _T( "PuTTY Command Sender 1.3" ) #define PUTTYCS_ABOUT_TEXT_LINE2 _T( "© 2005 Jason Millard. All rights reserved." ) #define PUTTYCS_WINDOW_TITLE_FILTER_ADD _T( "Add Filter" ) @@ -82,6 +84,7 @@ #define PUTTYCS_PREF_WINDOW_TOOL _T( "toolWindow" ) #define PUTTYCS_PREF_WINDOW_ALWAYS_ON_TOP _T( "alwaysOnTop" ) +#define PUTTYCS_PREF_MINIMIZE_TO_SYSTRAY _T( "minimizeToSysTray" ) #define PUTTYCS_PREF_WINDOW_TRANSITION _T( "transition" ) #define PUTTYCS_PREF_AUTO_ARRANGE _T( "autoArrange" ) @@ -93,6 +96,7 @@ #define PUTTYCS_PREF_ARRANGE_ON_STARTUP _T( "arrangeOnStartup" ) #define PUTTYCS_PREF_UNHIDE_ON_EXIT _T( "unhideOnExit" ) +#define PUTTYCS_PREF_TAB_COMPLETION _T( "tabCompletion" ) #define PUTTYCS_PREF_EMULATE_COPY_PASTE _T( "emulateCopyPaste" ) #define PUTTYCS_PREF_SEND_CR _T( "sendCR" ) @@ -109,6 +113,7 @@ #define PUTTYCS_SENDKEY_BUTTON_ENDTELNET _T( "^]" ) #define PUTTYCS_SENDKEY_BUTTON_ESCAPE _T( "{ESC}" ) +#define PUTTYCS_SENDKEY_BUTTON_TAB _T( "{TAB}" ) #define PUTTYCS_SENDKEY_BUTTON_ENTER _T( "^m" ) #define PUTTYCS_SENDKEY_BUTTON_PLUS _T( "{PLUS}" ) diff --git a/FilterDialog.cpp b/FilterDialog.cpp index 62a3546..ddefdc5 100755 --- a/FilterDialog.cpp +++ b/FilterDialog.cpp @@ -29,6 +29,7 @@ * * 11/07/2005: Initial version J. Millard * 11/17/2005: Added UNICODE support J. Millard + * 12/15/2005: Updated Help/F1 to go visit website J. Millard */ #include "stdafx.h" @@ -70,9 +71,26 @@ BEGIN_MESSAGE_MAP(CFilterDialog, CDialog) ON_EN_CHANGE(IDC_FILTERNAME_EDIT, OnChangeFilterName) ON_EN_CHANGE(IDC_FILTERLIST_EDIT, OnChangeFilterList) ON_BN_CLICKED(IDC_OK_BUTTON, OnOK) - //}}AFX_MSG_MAP + ON_WM_HELPINFO() + //}}AFX_MSG_MAP END_MESSAGE_MAP() +/** + * CFiltersDialog::OnHelpInfo() + */ + +BOOL CFilterDialog::OnHelpInfo(HELPINFO* pHelpInfo) +{ + ShellExecute( NULL, + PUTTYCS_SHELL_EXECUTE_OPEN, + PUTTYCS_URL_HOMEPAGE, + NULL, + NULL, + SW_SHOWNORMAL ); + + return TRUE; +} + /** * CFilterDialog::OnInitDialog() */ @@ -175,4 +193,4 @@ void CFilterDialog::OnChangeFilterList() m_csFilterList.TrimRight(); RefreshDialog(); -} +} \ No newline at end of file diff --git a/FilterDialog.h b/FilterDialog.h index c4cd0d8..e5c9850 100755 --- a/FilterDialog.h +++ b/FilterDialog.h @@ -73,7 +73,8 @@ class CFilterDialog : public CDialog virtual BOOL OnInitDialog(); afx_msg void OnChangeFilterName(); afx_msg void OnChangeFilterList(); - //}}AFX_MSG + afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); + //}}AFX_MSG DECLARE_MESSAGE_MAP() CString m_csFilterName; diff --git a/FiltersDialog.cpp b/FiltersDialog.cpp index b1c1a8f..663e199 100755 --- a/FiltersDialog.cpp +++ b/FiltersDialog.cpp @@ -29,6 +29,7 @@ * * 11/07/2005: Initial version J. Millard * 11/17/2005: Added UNICODE support J. Millard + * 12/15/2005: Updated Help/F1 to go visit website J. Millard */ #include "stdafx.h" @@ -68,19 +69,20 @@ void CFiltersDialog::DoDataExchange(CDataExchange* pDX) BEGIN_MESSAGE_MAP(CFiltersDialog, CDialog) //{{AFX_MSG_MAP(CFiltersDialog) - ON_LBN_SELCHANGE(IDC_FILTERS_LISTBOX, RefreshDialog) - ON_LBN_DBLCLK(IDC_FILTERS_LISTBOX, OnEditButton) ON_BN_CLICKED(IDC_ADD_BUTTON, OnAddButton) - ON_BN_CLICKED(IDC_EDIT_BUTTON, OnEditButton) + ON_LBN_DBLCLK(IDC_FILTERS_LISTBOX, OnEditButton) ON_BN_CLICKED(IDC_COPY_BUTTON, OnCopyButton) ON_BN_CLICKED(IDC_REMOVE_BUTTON, OnRemoveButton) ON_BN_CLICKED(IDC_REMOVE_ALL_BUTTON, OnRemoveAllButton) ON_BN_CLICKED(IDC_MOVEUP_BUTTON, OnMoveUpButton) ON_BN_CLICKED(IDC_MOVEDOWN_BUTTON, OnMoveDownButton) ON_BN_CLICKED(IDC_OK_BUTTON, OnOKButton) - ON_BN_CLICKED(IDC_CANCEL_BUTTON, OnCancel) ON_BN_CLICKED(IDC_APPLY_BUTTON, OnApplyButton) - //}}AFX_MSG_MAP + ON_LBN_SELCHANGE(IDC_FILTERS_LISTBOX, RefreshDialog) + ON_BN_CLICKED(IDC_EDIT_BUTTON, OnEditButton) + ON_BN_CLICKED(IDC_CANCEL_BUTTON, OnCancel) + ON_WM_HELPINFO() + //}}AFX_MSG_MAP END_MESSAGE_MAP() /** @@ -116,6 +118,22 @@ void CFiltersDialog::setFilter( int filter ) m_iFilter = filter; } +/** + * CFiltersDialog::OnHelpInfo() + */ + +BOOL CFiltersDialog::OnHelpInfo(HELPINFO* pHelpInfo) +{ + ShellExecute( NULL, + PUTTYCS_SHELL_EXECUTE_OPEN, + PUTTYCS_URL_HOMEPAGE, + NULL, + NULL, + SW_SHOWNORMAL ); + + return TRUE; +} + /** * CFiltersDialog::OnInitDialog() */ @@ -437,4 +455,4 @@ void CFiltersDialog::OnApplyButton() m_bChanges = false; RefreshDialog(); -} +} \ No newline at end of file diff --git a/FiltersDialog.h b/FiltersDialog.h index 7fa36b6..e82a374 100755 --- a/FiltersDialog.h +++ b/FiltersDialog.h @@ -85,9 +85,9 @@ class CFiltersDialog : public CDialog afx_msg void OnMoveUpButton(); afx_msg void OnMoveDownButton(); afx_msg void OnOKButton(); - afx_msg void OnCancelButton(); afx_msg void OnApplyButton(); - //}}AFX_MSG + afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); + //}}AFX_MSG DECLARE_MESSAGE_MAP() }; diff --git a/PasswordDialog.cpp b/PasswordDialog.cpp index 9d1c718..95581a7 100755 --- a/PasswordDialog.cpp +++ b/PasswordDialog.cpp @@ -29,6 +29,7 @@ * * 11/07/2005: Initial version J. Millard * 11/17/2005: Added UNICODE support J. Millard + * 12/15/2005: Updated Help/F1 to go visit website J. Millard */ #include "stdafx.h" @@ -69,7 +70,8 @@ void CPasswordDialog::DoDataExchange(CDataExchange* pDX) BEGIN_MESSAGE_MAP(CPasswordDialog, CDialog) //{{AFX_MSG_MAP(CPasswordDialog) ON_BN_CLICKED(IDC_OK_BUTTON, OnOKButton) - //}}AFX_MSG_MAP + ON_WM_HELPINFO() + //}}AFX_MSG_MAP END_MESSAGE_MAP() /** @@ -90,6 +92,22 @@ CString CPasswordDialog::getPassword() return m_csPassword; } +/** + * CPasswordDialog::OnHelpInfo() + */ + +BOOL CPasswordDialog::OnHelpInfo(HELPINFO* pHelpInfo) +{ + ShellExecute( NULL, + PUTTYCS_SHELL_EXECUTE_OPEN, + PUTTYCS_URL_HOMEPAGE, + NULL, + NULL, + SW_SHOWNORMAL ); + + return TRUE; +} + /** * CPasswordDialog::OnInitDialog() */ diff --git a/PasswordDialog.h b/PasswordDialog.h index 300e579..2010f57 100755 --- a/PasswordDialog.h +++ b/PasswordDialog.h @@ -67,7 +67,8 @@ class CPasswordDialog : public CDialog //{{AFX_MSG(CPasswordDialog) virtual BOOL OnInitDialog(); afx_msg void OnOKButton(); - //}}AFX_MSG + afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); + //}}AFX_MSG DECLARE_MESSAGE_MAP() CString m_csPassword; diff --git a/PreferencesDialog.cpp b/PreferencesDialog.cpp index 1c074f8..a4456e6 100755 --- a/PreferencesDialog.cpp +++ b/PreferencesDialog.cpp @@ -30,6 +30,9 @@ * 11/07/2005: Initial version J. Millard * 11/17/2005: Added UNICODE support J. Millard * 12/06/2005: Added mouse Copy/Paste emulation J. Millard + * 12/15/2005: Added minimize to system tray J. Millard + * Updated Help/F1 to go visit website + * Added tab completion */ #include "stdafx.h" @@ -70,17 +73,20 @@ BEGIN_MESSAGE_MAP(CPreferencesDialog, CDialog) //{{AFX_MSG_MAP(CPreferencesDialog) ON_BN_CLICKED(IDC_SAVEPASSWORD_CHECKBOX, OnSavePasswordCheckbox) ON_BN_CLICKED(IDC_AUTOARRANGE_OFF_RADIO, OnAutoArrangeRadio) - ON_BN_CLICKED(IDC_AUTOARRANGE_CASCADE_RADIO, OnAutoArrangeRadio) - ON_BN_CLICKED(IDC_AUTOARRANGE_TILE_RADIO, OnAutoArrangeRadio) ON_BN_CLICKED(IDC_AUTOMINIMIZE_CHECKBOX, OnAutoMinimizeCheckbox) ON_BN_CLICKED(IDC_ARRANGEONSTARTUP_CHECKBOX, OnArrangeOnStartupCheckbox) ON_BN_CLICKED(IDC_UNHIDEONEXIT_CHECKBOX, OnUnhideOnExitCheckbox) ON_BN_CLICKED(IDC_TOOLWINDOW_CHECKBOX, OnToolWindowCheckbox) ON_BN_CLICKED(IDC_ALWAYSONTOP_CHECKBOX, OnAlwaysOnTopCheckbox) - ON_BN_CLICKED(IDC_EMULATECOPYPASTE_CHECKBOX, OnEmulateCopyPasteCheckbox) ON_EN_CHANGE(IDC_TRANSITION_EDIT, OnChangeTransition) + ON_BN_CLICKED(IDC_EMULATECOPYPASTE_CHECKBOX, OnEmulateCopyPasteCheckbox) ON_BN_CLICKED(IDC_OK_BUTTON, OnOKButton) - //}}AFX_MSG_MAP + ON_BN_CLICKED(IDC_MINIMIZETOSYSTRAY_CHECKBOX, OnMinimizeToSysTrayCheckbox) + ON_WM_HELPINFO() + ON_BN_CLICKED(IDC_AUTOARRANGE_CASCADE_RADIO, OnAutoArrangeRadio) + ON_BN_CLICKED(IDC_AUTOARRANGE_TILE_RADIO, OnAutoArrangeRadio) + ON_BN_CLICKED(IDC_TABCOMPLETION_CHECKBOX, OnTabCompletionCheckbox) + //}}AFX_MSG_MAP END_MESSAGE_MAP() /** @@ -209,6 +215,24 @@ void CPreferencesDialog::setAlwaysOnTop( int iAlwaysOnTop ) m_iAlwaysOnTop = iAlwaysOnTop; } +/** + * CPreferencesDialog::getMinimizeToSysTray() + */ + +int CPreferencesDialog::getMinimizeToSysTray() +{ + return m_iMinimizeToSysTray; +} + +/** + * CPreferencesDialog::setMinimizeToSysTray() + */ + +void CPreferencesDialog::setMinimizeToSysTray( int iMinimizeToSysTray ) +{ + m_iMinimizeToSysTray = iMinimizeToSysTray; +} + /** * CPreferencesDialog::getTransition() */ @@ -227,6 +251,24 @@ void CPreferencesDialog::setTransition( int iTransition ) m_iTransition = iTransition; } +/** + * CPreferencesDialog::getTabCompletion() + */ + +int CPreferencesDialog::getTabCompletion() +{ + return m_iTabCompletion; +} + +/** + * CPreferencesDialog::setTabCompletion() + */ + +void CPreferencesDialog::setTabCompletion( int iTabCompletion ) +{ + m_iTabCompletion = iTabCompletion; +} + /** * CPreferencesDialog::getEmulateCopyPaste() */ @@ -245,6 +287,22 @@ void CPreferencesDialog::setEmulateCopyPaste( int iEmulateCopyPaste ) m_iEmulateCopyPaste = iEmulateCopyPaste; } +/** + * CPreferencesDialog::OnHelpInfo() + */ + +BOOL CPreferencesDialog::OnHelpInfo(HELPINFO* pHelpInfo) +{ + ShellExecute( NULL, + PUTTYCS_SHELL_EXECUTE_OPEN, + PUTTYCS_URL_HOMEPAGE, + NULL, + NULL, + SW_SHOWNORMAL ); + + return TRUE; +} + /** * CPreferencesDialog::OnInitDialog() */ @@ -280,9 +338,15 @@ BOOL CPreferencesDialog::OnInitDialog() CheckDlgButton( IDC_ALWAYSONTOP_CHECKBOX, m_iAlwaysOnTop ); + CheckDlgButton( IDC_MINIMIZETOSYSTRAY_CHECKBOX, + m_iMinimizeToSysTray ); + SetDlgItemInt( IDC_TRANSITION_EDIT, m_iTransition ); + CheckDlgButton( IDC_TABCOMPLETION_CHECKBOX, + m_iTabCompletion ); + CheckDlgButton( IDC_EMULATECOPYPASTE_CHECKBOX, m_iEmulateCopyPaste ); @@ -390,6 +454,16 @@ void CPreferencesDialog::OnAlwaysOnTopCheckbox() IsDlgButtonChecked( IDC_ALWAYSONTOP_CHECKBOX ); } +/** + * CPreferencesDialog::OnMinimizeToSysTrayCheckbox() + */ + +void CPreferencesDialog::OnMinimizeToSysTrayCheckbox() +{ + m_iMinimizeToSysTray = + IsDlgButtonChecked( IDC_MINIMIZETOSYSTRAY_CHECKBOX ); +} + /** * CPreferencesDialog::OnChangeTransition() */ @@ -402,6 +476,16 @@ void CPreferencesDialog::OnChangeTransition() UpdateDialog(); } +/** + * CPreferencesDialog::OnTabCompletionCheckbox() + */ + +void CPreferencesDialog::OnTabCompletionCheckbox() +{ + m_iTabCompletion = + IsDlgButtonChecked( IDC_TABCOMPLETION_CHECKBOX ); +} + /** * CPreferencesDialog::OnEmulateCopyPasteCheckbox() */ @@ -410,8 +494,6 @@ void CPreferencesDialog::OnEmulateCopyPasteCheckbox() { m_iEmulateCopyPaste = IsDlgButtonChecked( IDC_EMULATECOPYPASTE_CHECKBOX ); - - UpdateDialog(); } /** @@ -422,3 +504,4 @@ void CPreferencesDialog::OnOKButton() { CDialog::OnOK(); } + diff --git a/PreferencesDialog.h b/PreferencesDialog.h index 06f901f..f16f615 100755 --- a/PreferencesDialog.h +++ b/PreferencesDialog.h @@ -32,6 +32,8 @@ * Added AltGr support * 11/18/2005: Fixed AltGr support J. Millard * 12/06/2005: Added mouse Copy/Paste emulation J. Millard + * 12/15/2005: Added minimize to system tray J. Millard + * Added tab completion */ #if !defined(AFX_PREFERENCESDLG_H__4CD996C9_091F_4F4D_BFE3_EDD9236AB74B__INCLUDED_) @@ -74,9 +76,15 @@ class CPreferencesDialog : public CDialog int getAlwaysOnTop(); void setAlwaysOnTop( int iAlwaysOnTop ); + int getMinimizeToSysTray(); + void setMinimizeToSysTray( int iMinimizeToSysTray ); + int getTransition(); void setTransition( int iTransition ); + int getTabCompletion(); + void setTabCompletion( int iTabCompletion ); + int getEmulateCopyPaste(); void setEmulateCopyPaste( int iEmulateCopyPaste ); @@ -97,8 +105,10 @@ class CPreferencesDialog : public CDialog int m_iUnhideOnExit; int m_iToolWindow; int m_iAlwaysOnTop; + int m_iMinimizeToSysTray; int m_iTransition; int m_iEmulateCopyPaste; + int m_iTabCompletion; // Generated message map functions //{{AFX_MSG(CPreferencesDialog) @@ -113,7 +123,10 @@ class CPreferencesDialog : public CDialog afx_msg void OnChangeTransition(); afx_msg void OnEmulateCopyPasteCheckbox(); afx_msg void OnOKButton(); - //}}AFX_MSG + afx_msg void OnMinimizeToSysTrayCheckbox(); + afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); + afx_msg void OnTabCompletionCheckbox(); + //}}AFX_MSG DECLARE_MESSAGE_MAP() void UpdateDialog(); diff --git a/PuTTYCS.clw b/PuTTYCS.clw index dfa929c..a0b9da7 100755 --- a/PuTTYCS.clw +++ b/PuTTYCS.clw @@ -2,30 +2,30 @@ [General Info] Version=1 -LastClass=CCommandRichEditCtrl +LastClass=CPuTTYCSDialog LastTemplate=CDialog NewFileInclude1=#include "stdafx.h" NewFileInclude2=#include "puttycs.h" LastPage=0 -ClassCount=9 +ClassCount=8 Class1=CAboutDialog Class2=CCommandEdit -Class3=CCommandRichEditCtrl +Class3=CPuTTYCSDialog Class4=CFilterDialog Class5=CFiltersDialog Class6=CPasswordDialog Class7=CPreferencesDialog Class8=CPuTTYCSApp -Class9=CPuTTYCSDialog -ResourceCount=6 -Resource1=IDD_PREFERENCES_DIALOG +ResourceCount=7 +Resource1=IDD_PASSWORD_DIALOG Resource2=IDD_FILTERS_DIALOG Resource3=IDD_FILTER_DIALOG -Resource4=IDD_PUTTYCS_DIALOG -Resource5=IDD_PASSWORD_DIALOG +Resource4=IDD_PREFERENCES_DIALOG +Resource5=IDD_PUTTYCS_DIALOG Resource6=IDD_ABOUT_DIALOG +Resource7=IDM_SYSTRAY_MENU [CLS:CAboutDialog] Type=0 @@ -33,45 +33,51 @@ BaseClass=CDialog HeaderFile=AboutDialog.h ImplementationFile=AboutDialog.cpp Filter=D +VirtualFilter=dWC +LastObject=CAboutDialog [CLS:CCommandEdit] Type=0 BaseClass=CEdit HeaderFile=CommandEdit.h ImplementationFile=CommandEdit.cpp - -[CLS:CCommandRichEditCtrl] -Type=0 -BaseClass=CRichEditCtrl -HeaderFile=CommandRichEditCtrl.h -ImplementationFile=CommandRichEditCtrl.cpp -Filter=W -VirtualFilter=WC -LastObject=CCommandRichEditCtrl +LastObject=CCommandEdit [CLS:CFilterDialog] Type=0 BaseClass=CDialog HeaderFile=FilterDialog.h ImplementationFile=FilterDialog.cpp +Filter=D +VirtualFilter=dWC +LastObject=CFilterDialog [CLS:CFiltersDialog] Type=0 BaseClass=CDialog HeaderFile=FiltersDialog.h ImplementationFile=FiltersDialog.cpp +Filter=D +VirtualFilter=dWC +LastObject=CFiltersDialog [CLS:CPasswordDialog] Type=0 BaseClass=CDialog HeaderFile=PasswordDialog.h ImplementationFile=PasswordDialog.cpp +Filter=D +VirtualFilter=dWC +LastObject=CPasswordDialog [CLS:CPreferencesDialog] Type=0 BaseClass=CDialog HeaderFile=PreferencesDialog.h ImplementationFile=PreferencesDialog.cpp +Filter=D +VirtualFilter=dWC +LastObject=CPreferencesDialog [CLS:CPuTTYCSApp] Type=0 @@ -84,6 +90,9 @@ Type=0 BaseClass=CDialog HeaderFile=PuTTYCSDialog.h ImplementationFile=PuTTYCSDialog.cpp +Filter=D +VirtualFilter=dWC +LastObject=CPuTTYCSDialog [DLG:IDD_ABOUT_DIALOG] Type=1 @@ -142,26 +151,28 @@ Control4=IDCANCEL,button,1342242816 [DLG:IDD_PREFERENCES_DIALOG] Type=1 Class=CPreferencesDialog -ControlCount=19 +ControlCount=21 Control1=IDC_STATIC,button,1342177287 Control2=IDC_TOOLWINDOW_CHECKBOX,button,1342242819 Control3=IDC_ALWAYSONTOP_CHECKBOX,button,1342242819 -Control4=IDC_STATIC,static,1342308352 -Control5=IDC_TRANSITION_EDIT,edit,1350639744 -Control6=IDC_STATIC,static,1342308352 -Control7=IDC_STATIC,button,1342177287 -Control8=IDC_AUTOARRANGE_OFF_RADIO,button,1342308361 -Control9=IDC_AUTOARRANGE_CASCADE_RADIO,button,1342177289 -Control10=IDC_AUTOARRANGE_TILE_RADIO,button,1342177289 -Control11=IDC_AUTOMINIMIZE_CHECKBOX,button,1342242819 -Control12=IDC_ARRANGEONSTARTUP_CHECKBOX,button,1342242819 -Control13=IDC_UNHIDEONEXIT_CHECKBOX,button,1342242819 -Control14=IDC_STATIC,button,1342177287 -Control15=IDC_EMULATECOPYPASTE_CHECKBOX,button,1342242819 -Control16=IDC_STATIC,button,1342177287 -Control17=IDC_SAVEPASSWORD_CHECKBOX,button,1342242819 -Control18=IDC_OK_BUTTON,button,1342242817 -Control19=IDCANCEL,button,1342242816 +Control4=IDC_MINIMIZETOSYSTRAY_CHECKBOX,button,1342242819 +Control5=IDC_STATIC,static,1342308352 +Control6=IDC_TRANSITION_EDIT,edit,1350639744 +Control7=IDC_STATIC,static,1342308352 +Control8=IDC_STATIC,button,1342177287 +Control9=IDC_AUTOARRANGE_OFF_RADIO,button,1342308361 +Control10=IDC_AUTOARRANGE_CASCADE_RADIO,button,1342177289 +Control11=IDC_AUTOARRANGE_TILE_RADIO,button,1342177289 +Control12=IDC_AUTOMINIMIZE_CHECKBOX,button,1342242819 +Control13=IDC_ARRANGEONSTARTUP_CHECKBOX,button,1342242819 +Control14=IDC_UNHIDEONEXIT_CHECKBOX,button,1342242819 +Control15=IDC_STATIC,button,1342177287 +Control16=IDC_EMULATECOPYPASTE_CHECKBOX,button,1342242819 +Control17=IDC_TABCOMPLETION_CHECKBOX,button,1342242819 +Control18=IDC_STATIC,button,1342177287 +Control19=IDC_SAVEPASSWORD_CHECKBOX,button,1342242819 +Control20=IDC_OK_BUTTON,button,1342242817 +Control21=IDCANCEL,button,1342242816 [DLG:IDD_PUTTYCS_DIALOG] Type=1 @@ -175,16 +186,16 @@ Control5=IDC_MINIMIZE_BUTTON,button,1342242816 Control6=IDC_HIDE_BUTTON,button,1342242816 Control7=IDC_FILTERS_BUTTON,button,1342242816 Control8=IDC_STATIC,static,1342308352 -Control9=IDC_COMMAND_EDIT,edit,1350631492 -Control10=IDC_SENDCR_PUSHBUTTON,button,1342246916 -Control11=IDC_CMDHISTORYUP_BUTTON,button,1476460544 -Control12=IDC_CMDHISTORYDOWN_BUTTON,button,1476464384 -Control13=IDC_CMDHISTORYCLEAR_BUTTON,button,1476460544 -Control14=IDC_CLEAR_BUTTON,button,1342242816 -Control15=IDC_UP_BUTTON,button,1342242816 -Control16=IDC_LEFT_BUTTON,button,1342242816 -Control17=IDC_DOWN_BUTTON,button,1342242816 -Control18=IDC_RIGHT_BUTTON,button,1342246656 +Control9=IDC_SENDCR_PUSHBUTTON,button,1342246916 +Control10=IDC_CMDHISTORYUP_BUTTON,button,1476460544 +Control11=IDC_CMDHISTORYDOWN_BUTTON,button,1476464384 +Control12=IDC_CMDHISTORYCLEAR_BUTTON,button,1476460544 +Control13=IDC_COMMAND_EDIT,edit,1350631492 +Control14=IDC_UP_BUTTON,button,1342242816 +Control15=IDC_LEFT_BUTTON,button,1342242816 +Control16=IDC_CLEAR_BUTTON,button,1342242816 +Control17=IDC_RIGHT_BUTTON,button,1342246656 +Control18=IDC_DOWN_BUTTON,button,1342242816 Control19=IDC_BREAK_BUTTON,button,1342242816 Control20=IDC_ENDTELNET_BUTTON,button,1342242816 Control21=IDC_ESCAPE_BUTTON,button,1342242816 @@ -194,3 +205,15 @@ Control24=IDC_PASSWORD_BUTTON,button,1342242816 Control25=IDC_PREFERENCES_BUTTON,button,1342242816 Control26=IDC_SEND_BUTTON,button,1342242817 +[MNU:IDM_SYSTRAY_MENU] +Type=1 +Class=? +Command1=IDMI_SYSTRAYOPEN_MENUITEM +Command2=IDMI_SYSTRAYCASCADE_MENUITEM +Command3=IDMI_SYSTRAYTILE_MENUITEM +Command4=IDMI_SYSTRAYMINIMIZE_MENUITEM +Command5=IDMI_SYSTRAYHIDE_MENUITEM +Command6=IDMI_SYSTRAYABOUT_MENUITEM +Command7=IDMI_SYSTRAYEXIT_MENUITEM +CommandCount=7 + diff --git a/PuTTYCS.rc b/PuTTYCS.rc index 73661b4..6ba6c39 100755 --- a/PuTTYCS.rc +++ b/PuTTYCS.rc @@ -80,7 +80,7 @@ EXSTYLE WS_EX_APPWINDOW FONT 8, "MS Sans Serif" BEGIN LTEXT "PuTTY Filter:",IDC_STATIC,7,6,88,8 - COMBOBOX IDC_FILTERS_COMBOBOX,7,17,198,86,CBS_DROPDOWNLIST | + COMBOBOX IDC_FILTERS_COMBOBOX,7,17,198,114,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "C&ascade",IDC_CASCADE_BUTTON,7,34,38,14 PUSHBUTTON "&Tile",IDC_TILE_BUTTON,47,34,38,14 @@ -88,8 +88,6 @@ BEGIN PUSHBUTTON "&Hide",IDC_HIDE_BUTTON,127,34,38,14 PUSHBUTTON "&Filters",IDC_FILTERS_BUTTON,167,34,38,14 LTEXT "Command:",IDC_STATIC,7,54,40,8 - EDITTEXT IDC_COMMAND_EDIT,7,67,198,60,ES_MULTILINE | - ES_AUTOVSCROLL RADIOBUTTON "¿",IDC_SENDCR_PUSHBUTTON,159,54,10,9,BS_PUSHLIKE | WS_TABSTOP PUSHBUTTON "3",IDC_CMDHISTORYUP_BUTTON,173,54,10,9,WS_DISABLED, @@ -98,12 +96,14 @@ BEGIN BS_VCENTER | WS_DISABLED,WS_EX_TRANSPARENT PUSHBUTTON "r",IDC_CMDHISTORYCLEAR_BUTTON,195,54,10,9,WS_DISABLED, WS_EX_TRANSPARENT - PUSHBUTTON "i",IDC_CLEAR_BUTTON,20,145,10,9,0,WS_EX_TRANSPARENT + EDITTEXT IDC_COMMAND_EDIT,7,67,198,60,ES_MULTILINE | + ES_AUTOVSCROLL PUSHBUTTON "5",IDC_UP_BUTTON,20,135,10,9,0,WS_EX_TRANSPARENT PUSHBUTTON "3",IDC_LEFT_BUTTON,8,145,10,9,0,WS_EX_TRANSPARENT - PUSHBUTTON "6",IDC_DOWN_BUTTON,20,156,10,9,0,WS_EX_TRANSPARENT + PUSHBUTTON "i",IDC_CLEAR_BUTTON,20,145,10,9,0,WS_EX_TRANSPARENT PUSHBUTTON "4",IDC_RIGHT_BUTTON,32,145,10,9,BS_CENTER | BS_VCENTER, WS_EX_TRANSPARENT + PUSHBUTTON "6",IDC_DOWN_BUTTON,20,156,10,9,0,WS_EX_TRANSPARENT PUSHBUTTON "Ctr&l-C",IDC_BREAK_BUTTON,57,134,22,14 PUSHBUTTON "Ctrl&-]",IDC_ENDTELNET_BUTTON,82,134,22,14 PUSHBUTTON "Es&c",IDC_ESCAPE_BUTTON,107,134,22,14 @@ -126,42 +126,46 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,129,38,50,14 END -IDD_PREFERENCES_DIALOG DIALOG DISCARDABLE 0, 0, 196, 217 +IDD_PREFERENCES_DIALOG DIALOG DISCARDABLE 0, 0, 211, 233 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Preferences" FONT 8, "MS Sans Serif" BEGIN - GROUPBOX "Window:",IDC_STATIC,7,6,182,44 + GROUPBOX "Window:",IDC_STATIC,7,6,197,56 CONTROL "Tool window",IDC_TOOLWINDOW_CHECKBOX,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,13,20,72,10 CONTROL "Always on top",IDC_ALWAYSONTOP_CHECKBOX,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,13,33,72,10 - LTEXT "Transition:",IDC_STATIC,94,20,34,10 - EDITTEXT IDC_TRANSITION_EDIT,131,17,22,14,ES_AUTOHSCROLL | + CONTROL "Minimize to system tray",IDC_MINIMIZETOSYSTRAY_CHECKBOX, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,46,84,10 + LTEXT "Transition:",IDC_STATIC,108,20,34,10 + EDITTEXT IDC_TRANSITION_EDIT,145,17,22,14,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "ms",IDC_STATIC,157,20,10,10 - GROUPBOX "Auto arrange:",IDC_STATIC,7,55,182,57 + LTEXT "ms",IDC_STATIC,171,20,10,10 + GROUPBOX "Auto arrange:",IDC_STATIC,7,66,197,57 CONTROL "Off",IDC_AUTOARRANGE_OFF_RADIO,"Button", - BS_AUTORADIOBUTTON | WS_GROUP,13,70,44,10 + BS_AUTORADIOBUTTON | WS_GROUP,13,81,44,10 CONTROL "Cascade",IDC_AUTOARRANGE_CASCADE_RADIO,"Button", - BS_AUTORADIOBUTTON,13,82,44,10 + BS_AUTORADIOBUTTON,13,93,44,10 CONTROL "Tile",IDC_AUTOARRANGE_TILE_RADIO,"Button", - BS_AUTORADIOBUTTON,13,94,44,10 + BS_AUTORADIOBUTTON,13,105,44,10 CONTROL "Minimize other PuTTYs",IDC_AUTOMINIMIZE_CHECKBOX,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,94,70,89,10 + BS_AUTOCHECKBOX | WS_TABSTOP,108,81,89,10 CONTROL "Arrange on startup",IDC_ARRANGEONSTARTUP_CHECKBOX, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,94,82,74,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,93,74,10 CONTROL "Unhide PuTTYs on exit",IDC_UNHIDEONEXIT_CHECKBOX,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,94,94,89,10 - GROUPBOX "Mouse:",IDC_STATIC,7,117,182,31 + BS_AUTOCHECKBOX | WS_TABSTOP,108,105,89,10 + GROUPBOX "Keyboard/Mouse:",IDC_STATIC,7,127,197,43 CONTROL "Selection copies, right button pastes", IDC_EMULATECOPYPASTE_CHECKBOX,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,13,130,170,10 - GROUPBOX "Password:",IDC_STATIC,7,152,182,31 + WS_TABSTOP,13,154,170,10 + CONTROL "Enable Tab completion",IDC_TABCOMPLETION_CHECKBOX, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,140,87,10 + GROUPBOX "Password:",IDC_STATIC,7,175,197,31 CONTROL "Save password",IDC_SAVEPASSWORD_CHECKBOX,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,165,63,10 - DEFPUSHBUTTON "OK",IDC_OK_BUTTON,86,196,50,14 - PUSHBUTTON "Cancel",IDCANCEL,139,196,50,14 + BS_AUTOCHECKBOX | WS_TABSTOP,13,188,63,10 + DEFPUSHBUTTON "OK",IDC_OK_BUTTON,101,212,50,14 + PUSHBUTTON "Cancel",IDCANCEL,154,212,50,14 END IDD_FILTERS_DIALOG DIALOG DISCARDABLE 0, 0, 200, 178 @@ -228,8 +232,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,2,0,0 - PRODUCTVERSION 1,2,0,0 + FILEVERSION 1,3,0,0 + PRODUCTVERSION 1,3,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -247,14 +251,14 @@ BEGIN VALUE "Comments", "Created by Jason Millard\0" VALUE "CompanyName", "\0" VALUE "FileDescription", "PuTTYCS\0" - VALUE "FileVersion", "1, 2, 0, 0\0" + VALUE "FileVersion", "1, 3, 0, 0\0" VALUE "InternalName", "PuTTYCS\0" VALUE "LegalCopyright", "Copyright (C) 2005\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "PuTTYCS.EXE\0" VALUE "PrivateBuild", "\0" - VALUE "ProductName", "PuTTYCS - PuTTY Command Sender 1.2\0" - VALUE "ProductVersion", "1, 2, 0, 0\0" + VALUE "ProductName", "PuTTYCS - PuTTY Command Sender 1.3\0" + VALUE "ProductVersion", "1, 3, 0, 0\0" VALUE "SpecialBuild", "\0" END END @@ -294,9 +298,9 @@ BEGIN IDD_PREFERENCES_DIALOG, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 189 + RIGHTMARGIN, 204 TOPMARGIN, 7 - BOTTOMMARGIN, 210 + BOTTOMMARGIN, 226 END IDD_FILTERS_DIALOG, DIALOG @@ -326,6 +330,35 @@ BEGIN END #endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDM_SYSTRAY_MENU MENU DISCARDABLE +BEGIN + POPUP "TrayMenu" + BEGIN + MENUITEM "Open PuTTYCS...", IDMI_SYSTRAYOPEN_MENUITEM + MENUITEM SEPARATOR + POPUP "Arrange filtered PuTTYs" + BEGIN + MENUITEM "Cascade", IDMI_SYSTRAYCASCADE_MENUITEM + + MENUITEM "Tile", IDMI_SYSTRAYTILE_MENUITEM + + MENUITEM "Minimize", IDMI_SYSTRAYMINIMIZE_MENUITEM + + MENUITEM "Hide", IDMI_SYSTRAYHIDE_MENUITEM + + END + MENUITEM SEPARATOR + MENUITEM "About PuTTYCS...", IDMI_SYSTRAYABOUT_MENUITEM + MENUITEM "Exit", IDMI_SYSTRAYEXIT_MENUITEM + END +END + #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/PuTTYCSDialog.cpp b/PuTTYCSDialog.cpp index 36d15a3..a72efab 100755 --- a/PuTTYCSDialog.cpp +++ b/PuTTYCSDialog.cpp @@ -35,6 +35,8 @@ * 12/06/2005: Added mouse Copy/Paste emulation J. Millard * Navigation through command history * moves cursor to end of command + * 12/15/2005: Added minimize to system tray J. Millard + * Added tab completion */ #include "stdafx.h" @@ -82,6 +84,12 @@ CPuTTYCSDialog::CPuTTYCSDialog(CWnd* pParent /*=NULL*/) m_pSymbolSmall->CreatePointFont( 80, PUTTYCS_FONT_SYMBOL ); + + /** + * Taskbar Notification Icon + */ + + m_pTNI = NULL; } /** @@ -92,6 +100,10 @@ CPuTTYCSDialog::~CPuTTYCSDialog() { SavePreferences(); + /** + * Fonts + */ + if ( m_pMarlettNormal ) { delete m_pMarlettNormal; @@ -106,6 +118,18 @@ CPuTTYCSDialog::~CPuTTYCSDialog() { delete m_pSymbolSmall; } + + /** + * Taskbar Notification Icon + */ + + if ( m_pTNI ) + { + Shell_NotifyIcon( NIM_DELETE, + (NOTIFYICONDATA*) m_pTNI ); + + delete m_pTNI; + } } /** @@ -216,10 +240,14 @@ void CPuTTYCSDialog::LoadPreferences() AfxGetApp()->GetProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_WINDOW_ALWAYS_ON_TOP, 1 ); + m_iMinimizeToSysTray = + AfxGetApp()->GetProfileInt( + PUTTYCS_APP_NAME, PUTTYCS_PREF_MINIMIZE_TO_SYSTRAY, 1 ); + m_iTransition = AfxGetApp()->GetProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_WINDOW_TRANSITION, 25 ); - + /** * Auto arrange */ @@ -249,12 +277,17 @@ void CPuTTYCSDialog::LoadPreferences() PUTTYCS_APP_NAME, PUTTYCS_PREF_SEND_CR, 1 ); /** - * Emulate Copy/Paste + * Keyboard/Mouse */ m_iEmulateCopyPaste = AfxGetApp()->GetProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_EMULATE_COPY_PASTE, 1 ); + + m_iTabCompletion = + AfxGetApp()->GetProfileInt( + PUTTYCS_APP_NAME, PUTTYCS_PREF_TAB_COMPLETION, 0 ); + } /** @@ -335,6 +368,10 @@ void CPuTTYCSDialog::SavePreferences() AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_WINDOW_ALWAYS_ON_TOP, m_iAlwaysOnTop ); + + AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, + PUTTYCS_PREF_MINIMIZE_TO_SYSTRAY, m_iMinimizeToSysTray ); + AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_WINDOW_TRANSITION, m_iTransition ); @@ -362,11 +399,11 @@ void CPuTTYCSDialog::SavePreferences() PUTTYCS_PREF_SEND_CR, m_iSendCR ); /** - * Emulate Copy/Paste + * Keyboard/Mouse */ AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, - PUTTYCS_PREF_EMULATE_COPY_PASTE, m_iEmulateCopyPaste ); + PUTTYCS_PREF_TAB_COMPLETION, m_iTabCompletion ); } /** @@ -408,34 +445,121 @@ BEGIN_MESSAGE_MAP(CPuTTYCSDialog, CDialog) ON_BN_CLICKED(IDC_PASSWORD_BUTTON, OnPasswordButton) ON_BN_CLICKED(IDC_PREFERENCES_BUTTON, OnPreferencesButton) ON_BN_CLICKED(IDC_SCRIPT_BUTTON, OnScriptButton) - ON_BN_CLICKED(IDC_SEND_BUTTON, OnSendButton) - ON_WM_CLOSE() + ON_BN_CLICKED(IDC_SEND_BUTTON, OnSendButton) + ON_MESSAGE(WM_TNI_MESSAGE, OnTrayNotify) + ON_COMMAND(IDMI_SYSTRAYOPEN_MENUITEM, OnOpenMenuItem) + ON_COMMAND(IDMI_SYSTRAYABOUT_MENUITEM, OnAboutButton) + ON_COMMAND(IDMI_SYSTRAYCASCADE_MENUITEM, OnCascadeButton) + ON_COMMAND(IDMI_SYSTRAYTILE_MENUITEM, OnTileButton) + ON_COMMAND(IDMI_SYSTRAYMINIMIZE_MENUITEM, OnMinimizeButton) + ON_COMMAND(IDMI_SYSTRAYHIDE_MENUITEM, OnHideButton) + ON_COMMAND(IDMI_SYSTRAYEXIT_MENUITEM, OnOK) ON_WM_HELPINFO() //}}AFX_MSG_MAP END_MESSAGE_MAP() -///////////////////////////////////////////////////////////////////////////// -// CPuTTYCSDialog message handlers +/** + * CPuTTYCSDialog::SetSysTrayTip() + */ + +void CPuTTYCSDialog::SetSysTrayTip( CString csTip ) +{ + DWORD dwMessage = NIM_MODIFY; + + if ( !m_pTNI ) + { + m_pTNI = new NOTIFYICONDATA; + + ZeroMemory( + m_pTNI, sizeof(NOTIFYICONDATA) ); + + m_pTNI->hWnd = + ((CWnd*) this)->GetSafeHwnd(); + + m_pTNI->cbSize = sizeof( NOTIFYICONDATA ); + m_pTNI->uCallbackMessage = WM_TNI_MESSAGE; + m_pTNI->uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE; + m_pTNI->hIcon = m_hIcon; + m_pTNI->uTimeout = 1000; + m_pTNI->uID = 1; + + dwMessage = NIM_ADD; + } + + _tcscpy( m_pTNI->szTip, csTip ); + + Shell_NotifyIcon( dwMessage, + (NOTIFYICONDATA*) m_pTNI ); +} /** - * PreTranslateMessage() + * CPuTTYCSDialog::PreTranslateMessage() */ BOOL CPuTTYCSDialog::PreTranslateMessage(MSG* pMsg) { if ( pMsg->message == WM_KEYDOWN ) { - if ( pMsg->wParam==VK_ESCAPE ) + if ( pMsg->wParam == VK_ESCAPE ) { pMsg->wParam = NULL; } + else if ( pMsg->wParam == VK_TAB ) + { + if ( m_iTabCompletion ) + { + UINT uiCtrlId = + ((CWnd*) GetFocus())->GetDlgCtrlID(); + + if ( uiCtrlId == IDC_COMMAND_EDIT ) + { + CString csCommand = + m_cceCommandEdit.GetText(); + + sendCommand( csCommand, true ); + pMsg->wParam = NULL; + } + } + } } return CDialog::PreTranslateMessage(pMsg); } /** - * OnInitDialog() + * CPuTTYCSDialog::DestroyWindow() + */ + +BOOL CPuTTYCSDialog::DestroyWindow() +{ + m_bIsClosing = true; + + if ( m_iUnhideOnExit ) + { + m_obaWindows.RemoveAll(); + + ::EnumWindows( enumwindowsProc, (LPARAM) this ); + + SortWindows(); + + for ( int loop = 0; + loop < m_obaWindows.GetSize(); loop++ ) + { + CWnd* pWnd = + (CWnd*) m_obaWindows.GetAt( loop ); + + if ( !pWnd->IsWindowVisible() ) + { + pWnd->ShowWindow( SW_SHOW ); + } + } + } + + return CDialog::DestroyWindow(); +} + +/** + * CPuTTYCSDialog::OnInitDialog() */ BOOL CPuTTYCSDialog::OnInitDialog() @@ -519,7 +643,7 @@ BOOL CPuTTYCSDialog::OnInitDialog() SetCheck( m_iSendCR ); /** - * System Menu + * Menus */ CMenu* pMenu = GetSystemMenu( FALSE ); @@ -534,6 +658,8 @@ BOOL CPuTTYCSDialog::OnInitDialog() IDM_ABOUT_PUTTYCS, PUTTYCS_WINDOW_TITLE_ABOUT ); } + m_cmMenu.LoadMenu( IDM_SYSTRAY_MENU ); + /** * Dialog size */ @@ -563,15 +689,26 @@ BOOL CPuTTYCSDialog::OnInitDialog() void CPuTTYCSDialog::OnSysCommand(UINT nID, LPARAM lParam) { - if ((nID & 0xFFF0) == IDM_ABOUT_PUTTYCS) + if ( (nID & 0xFFF0) == IDM_ABOUT_PUTTYCS ) { - CAboutDialog dialog; - dialog.DoModal(); + OnAboutButton(); } + else if ( (nID & 0xFFF0) == SC_MINIMIZE ) + { + if ( m_iMinimizeToSysTray ) + { + ShowWindow( SW_HIDE ); + SetSysTrayTip( PUTTYCS_WINDOW_TITLE_APP ); + } + else + { + CDialog::OnSysCommand(nID, lParam); + } + } else { CDialog::OnSysCommand(nID, lParam); - } + } } /** @@ -628,6 +765,16 @@ BOOL CPuTTYCSDialog::OnHelpInfo(HELPINFO* pHelpInfo) return TRUE; } +/** + * CPuTTYCSDialog::OnAboutButton() + */ + +void CPuTTYCSDialog::OnAboutButton() +{ + CAboutDialog dialog; + dialog.DoModal(); +} + /** * RefreshDialog(); */ @@ -701,35 +848,22 @@ void CPuTTYCSDialog::UpdateDialog() } /** - * CPuTTYCSDialog::OnClose() - */ - -void CPuTTYCSDialog::OnClose() -{ - m_bIsClosing = true; + * CPuTTYCSDialog::OnOpenMenuItem() + */ - if ( m_iUnhideOnExit ) +void CPuTTYCSDialog::OnOpenMenuItem() +{ + if ( m_pTNI ) { - m_obaWindows.RemoveAll(); + Shell_NotifyIcon( NIM_DELETE, + (NOTIFYICONDATA*) m_pTNI ); - ::EnumWindows( enumwindowsProc, (LPARAM) this ); - - SortWindows(); + delete m_pTNI; - for ( int loop = 0; - loop < m_obaWindows.GetSize(); loop++ ) - { - CWnd* pWnd = - (CWnd*) m_obaWindows.GetAt( loop ); - - if ( !pWnd->IsWindowVisible() ) - { - pWnd->ShowWindow( SW_SHOW ); - } - } + m_pTNI = NULL; } - CDialog::OnClose(); + ShowWindow( SW_SHOW ); } /** @@ -752,7 +886,7 @@ void CPuTTYCSDialog::OnSelChangeFiltersCombobox() OnMinimizeButton(); - ::Sleep(250); + ::Sleep( 250 ); m_iFilter = iFilter; } @@ -771,7 +905,7 @@ void CPuTTYCSDialog::OnSelChangeFiltersCombobox() } /** - * OnCascadeButton + * CPuTTYCSDialog::OnCascadeButton */ void CPuTTYCSDialog::OnCascadeButton() @@ -1195,7 +1329,7 @@ void CPuTTYCSDialog::OnPasswordButton() m_csPassword = pDialog->getPassword(); sendBuffer( - CBase64::decode(m_csPassword), true ); + CBase64::decode(m_csPassword), true, false ); SavePreferences(); } @@ -1247,13 +1381,19 @@ void CPuTTYCSDialog::OnPreferencesButton() pDialog-> setAlwaysOnTop( m_iAlwaysOnTop ); + pDialog-> + setMinimizeToSysTray( m_iMinimizeToSysTray ); + pDialog-> setTransition( m_iTransition ); /** - * Emulate Copy/Paste + * Keyboard/Mouse */ + pDialog-> + setTabCompletion( m_iTabCompletion ); + pDialog-> setEmulateCopyPaste( m_iEmulateCopyPaste ); @@ -1296,25 +1436,31 @@ void CPuTTYCSDialog::OnPreferencesButton() m_iAlwaysOnTop = pDialog->getAlwaysOnTop(); + m_iMinimizeToSysTray = + pDialog->getMinimizeToSysTray(); + m_iTransition = pDialog->getTransition(); /** - * Emulate Copy/Paste + * Keyboard/Mouse */ + m_iTabCompletion = + pDialog->getTabCompletion(); + m_iEmulateCopyPaste = pDialog->getEmulateCopyPaste(); m_cceCommandEdit.SetEmulateCopyPaste( m_iEmulateCopyPaste ); - + /** * Window refresh */ - + if ( (iToolWindow != m_iToolWindow) || (iAlwaysOnTop != m_iAlwaysOnTop) ) - { + { ShowWindow(SW_HIDE); UpdateDialog(); @@ -1406,6 +1552,56 @@ void CPuTTYCSDialog::OnScriptButton() */ void CPuTTYCSDialog::OnSendButton() +{ + CString csCommand; + GetDlgItemText(IDC_COMMAND_EDIT, csCommand); + + sendCommand( csCommand, false ); +} + +/** + * CPuTTYCSDialog::OnTrayNotify() + */ + +void CPuTTYCSDialog::OnTrayNotify( WPARAM wParam, LPARAM lParam ) +{ + UINT uID = (UINT) wParam; + UINT uMsg = (UINT) lParam; + + switch ( uMsg ) + { + case WM_LBUTTONDBLCLK: + + OnOpenMenuItem(); + + break; + + case WM_RBUTTONDOWN: + case WM_CONTEXTMENU: + + CPoint pt; + GetCursorPos(&pt); + + m_cmMenu.GetSubMenu(0)-> + SetDefaultItem( IDMI_SYSTRAYOPEN_MENUITEM, FALSE ); + + m_cmMenu.GetSubMenu(0)-> + TrackPopupMenu( TPM_BOTTOMALIGN | + TPM_LEFTBUTTON | + TPM_RIGHTBUTTON, + pt.x, pt.y, this ); + + break; + } + + return; +} + +/** + * CPuTTYCSDialog::sendCommand( ) + */ + +void CPuTTYCSDialog::sendCommand( CString csCommand, bool bTab ) { if ( m_csaCmdHistory.GetSize() == PUTTYCS_PREF_CMDHISTORY_MAX_SIZE ) @@ -1413,9 +1609,6 @@ void CPuTTYCSDialog::OnSendButton() m_csaCmdHistory.RemoveAt( 0 ) ; } - CString csCommand; - GetDlgItemText(IDC_COMMAND_EDIT, csCommand); - CString csTempCommand = csCommand; csTempCommand.TrimLeft(); csTempCommand.TrimRight(); @@ -1429,7 +1622,7 @@ void CPuTTYCSDialog::OnSendButton() m_cceCommandEdit.SetText( PUTTYCS_EMPTY_STRING ); - sendBuffer( csCommand, true ); + sendBuffer( csCommand, bTab, true ); RefreshDialog(); } @@ -1438,12 +1631,12 @@ void CPuTTYCSDialog::OnSendButton() * CPuTTYCSDialog::sendBuffer() */ -void CPuTTYCSDialog::sendBuffer( CString csBuffer, bool parse ) +void CPuTTYCSDialog::sendBuffer( CString csBuffer, bool bTab, bool bParse ) { CString csOutput = PUTTYCS_SENDKEY_DELAY_0; - if ( !parse ) + if ( !bParse ) { csOutput += csBuffer; } @@ -1461,56 +1654,56 @@ void CPuTTYCSDialog::sendBuffer( CString csBuffer, bool parse ) for ( int loop = 0; loop < csBuffer.GetLength(); loop++ ) { - TCHAR ch = csBuffer.GetAt(loop); + TCHAR chChar = csBuffer.GetAt(loop); - if ( ch == PUTTYCS_SENDKEY_CHAR_PLUS ) + if ( chChar == PUTTYCS_SENDKEY_CHAR_PLUS ) { csOutput += PUTTYCS_SENDKEY_BUTTON_PLUS; } - else if ( ch == PUTTYCS_SENDKEY_CHAR_AT ) + else if ( chChar == PUTTYCS_SENDKEY_CHAR_AT ) { csOutput += PUTTYCS_SENDKEY_BUTTON_AT; } - else if ( ch == PUTTYCS_SENDKEY_CHAR_CARET ) + else if ( chChar == PUTTYCS_SENDKEY_CHAR_CARET ) { csOutput += PUTTYCS_SENDKEY_BUTTON_CARET; } - else if ( ch == PUTTYCS_SENDKEY_CHAR_TILDE ) + else if ( chChar == PUTTYCS_SENDKEY_CHAR_TILDE ) { csOutput += PUTTYCS_SENDKEY_BUTTON_TILDE; } - else if ( ch == PUTTYCS_SENDKEY_CHAR_LEFTBRACE ) + else if ( chChar == PUTTYCS_SENDKEY_CHAR_LEFTBRACE ) { csOutput += PUTTYCS_SENDKEY_BUTTON_LEFTBRACE; } - else if ( ch == PUTTYCS_SENDKEY_CHAR_RIGHTBRACE ) + else if ( chChar == PUTTYCS_SENDKEY_CHAR_RIGHTBRACE ) { csOutput += PUTTYCS_SENDKEY_BUTTON_RIGHTBRACE; } - else if ( ch == PUTTYCS_SENDKEY_CHAR_LEFTPAREN ) + else if ( chChar == PUTTYCS_SENDKEY_CHAR_LEFTPAREN ) { csOutput += PUTTYCS_SENDKEY_BUTTON_LEFTPAREN; } - else if ( ch == PUTTYCS_SENDKEY_CHAR_RIGHTPAREN ) + else if ( chChar == PUTTYCS_SENDKEY_CHAR_RIGHTPAREN ) { csOutput += PUTTYCS_SENDKEY_BUTTON_RIGHTPAREN; } - else if ( ch == PUTTYCS_SENDKEY_CHAR_PERCENT ) + else if ( chChar == PUTTYCS_SENDKEY_CHAR_PERCENT ) { csOutput += PUTTYCS_SENDKEY_BUTTON_PERCENT; } else { - csOutput += ch; + csOutput += chChar; } } @@ -1520,7 +1713,12 @@ void CPuTTYCSDialog::sendBuffer( CString csBuffer, bool parse ) PUTTYCS_SENDKEY_BUTTON_CAPSLOCK; } - if ( m_iSendCR ) + if ( bTab ) + { + csOutput += + PUTTYCS_SENDKEY_BUTTON_TAB; + } + else if ( m_iSendCR ) { csOutput += PUTTYCS_SENDKEY_BUTTON_ENTER; @@ -1742,6 +1940,4 @@ int CPuTTYCSDialog::Compare( const void *pWndS1, const void *pWndS2 ) ((CWnd*) pWnd2)->GetWindowText( csS2 ); return ( csS1 < csS2 ); -} - - +} \ No newline at end of file diff --git a/PuTTYCSDialog.h b/PuTTYCSDialog.h index 4949d9c..b292664 100755 --- a/PuTTYCSDialog.h +++ b/PuTTYCSDialog.h @@ -34,7 +34,9 @@ * 11/18/2005: Fixed AltGr support J. Millard * 12/06/2005: Added mouse Copy/Paste emulation J. Millard * Navigation through command history - * moves cursor to end of command + * moves cursor to end of command + * 12/15/2005: Added minimize to system tray J. Millard + * Added tab completion */ #if !defined(AFX_PuTTYCSDLG_H__7BCAE5A7_75C4_4831_82FD_5A13F846FE61__INCLUDED_) @@ -46,6 +48,8 @@ #include "CommandEdit.h" +#define WM_TNI_MESSAGE (WM_USER + 1) + class CPuTTYCSDialog : public CDialog { // Construction @@ -62,11 +66,12 @@ class CPuTTYCSDialog : public CDialog // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CPuTTYCSDialog) - public: + public: virtual BOOL PreTranslateMessage(MSG* pMsg); - protected: + virtual BOOL DestroyWindow(); + protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL + //}}AFX_VIRTUAL // Implementation protected: @@ -90,7 +95,7 @@ class CPuTTYCSDialog : public CDialog CStringArray m_csaCmdHistory; int m_iCmdHistory; - /** + /** * Password */ @@ -103,6 +108,7 @@ class CPuTTYCSDialog : public CDialog int m_iToolWindow; int m_iAlwaysOnTop; + int m_iMinimizeToSysTray; int m_iTransition; /** @@ -113,11 +119,12 @@ class CPuTTYCSDialog : public CDialog int m_iAutoMinimize; int m_iArrangeOnStartup; int m_iUnhideOnExit; - + /** - * Emulate Copy/Paste + * Keyboard/Mouse */ + int m_iTabCompletion; int m_iEmulateCopyPaste; /** @@ -133,8 +140,9 @@ class CPuTTYCSDialog : public CDialog CFont* m_pMarlettNormal; CFont* m_pMarlettSmall; CFont* m_pSymbolSmall; - - void sendBuffer(CString csBuffer, bool parse = false); + + void sendCommand( CString csCommand, bool bTab ); + void sendBuffer( CString csBuffer, bool bParse = false, bool bTab = false ); void LoadPreferences(); void SavePreferences(); @@ -148,6 +156,7 @@ class CPuTTYCSDialog : public CDialog afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); + afx_msg void OnAboutButton(); afx_msg void OnSelChangeFiltersCombobox(); afx_msg void OnCascadeButton(); afx_msg void OnTileButton(); @@ -169,10 +178,11 @@ class CPuTTYCSDialog : public CDialog afx_msg void OnPasswordButton(); afx_msg void OnPreferencesButton(); afx_msg void OnScriptButton(); - afx_msg void OnSendButton(); - afx_msg void OnClose(); + afx_msg void OnSendButton(); + afx_msg void OnTrayNotify(WPARAM wParam, LPARAM lParam); afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnCmdHistoryClearButton(); + afx_msg void OnOpenMenuItem(); //}}AFX_MSG DECLARE_MESSAGE_MAP() @@ -181,6 +191,11 @@ class CPuTTYCSDialog : public CDialog CSendKeys m_skSendKeys; CObArray m_obaWindows; + CMenu m_cmMenu; + + NOTIFYICONDATA* m_pTNI; + void SetSysTrayTip( CString csTip = PUTTYCS_EMPTY_STRING ); + static BOOL CALLBACK enumwindowsProc(HWND hwnd, LPARAM lParam); static int wildcmp(const TCHAR* wild, const TCHAR* string); diff --git a/readme.txt b/readme.txt index f02ffa6..d60fba8 100755 --- a/readme.txt +++ b/readme.txt @@ -1,11 +1,13 @@ -PuTTYCS - PuTTY Command Sender v1.2 +PuTTYCS - PuTTY Command Sender v1.3 (C) 2005 - Jason Millard - jsm174@gmail.com -Release Date: 12/06/05 +Release Date: 12/15/05 VERSION HISTORY --------------- +12/15/05 - v1.3 - Added minimize to system tray + Added tab completion 12/06/05 - v1.2 - Added mouse Copy/Paste emulation Navigation through command history moves cursor to end of command @@ -180,6 +182,9 @@ Preferences are loaded each time PuTTYCS is started. Always on top: Display the PuTTYCS on top of all other windows. + + Minimize to system tray: + Minimizes PuTTYCS to the system tray. Transition: Sets the amount time (in milliseconds) to pause @@ -204,6 +209,11 @@ Preferences are loaded each time PuTTYCS is started. Unhides any PuTTYs hidden using the Hide button. + Enable Tab Completion + Pressing Tab in the command field, sends the command + including the Tab key. Useful for file completion in + shells like tcsh. + Selection copies, right button pastes Enable this to emulate PuTTY's selection to clipboard, and right mouse button paste feature. @@ -275,6 +285,12 @@ properly. PuTTYCS gets around this by performing a variety of hide, move, resize, and show commands. However, at times PuTTYs may not arrange as expected. +To use Tab completion on several windows, press the Tab +key and wait until all windows receive the command. Pressing +the Tab key too early may send an additional Tab to one of +filtered PuTTY windows. + + FUTURE ------ diff --git a/resource.h b/resource.h index d24692a..d7f7f6a 100755 --- a/resource.h +++ b/resource.h @@ -10,6 +10,7 @@ #define IDD_PASSWORD_DIALOG 113 #define IDD_FILTERS_DIALOG 114 #define IDD_FILTER_DIALOG 115 +#define IDM_SYSTRAY_MENU 139 #define IDC_FILTERS_COMBOBOX 1001 #define IDC_CASCADE_BUTTON 1002 #define IDC_TILE_BUTTON 1003 @@ -45,6 +46,8 @@ #define IDC_TOOLWINDOW_CHECKBOX 1108 #define IDC_TRANSITION_EDIT 1109 #define IDC_EMULATECOPYPASTE_CHECKBOX 1110 +#define IDC_MINIMIZETOSYSTRAY_CHECKBOX 1111 +#define IDC_TABCOMPLETION_CHECKBOX 1112 #define IDC_FILTERS_LISTBOX 1200 #define IDC_ADD_BUTTON 1201 #define IDC_COPY_BUTTON 1202 @@ -65,13 +68,20 @@ #define IDC_VISITWEBSITE_BUTTON 1503 #define IDC_ABOUT_TEXT_LINE3 1504 #define IDC_COMMAND_RICHEDIT 1600 +#define IDMI_SYSTRAYOPEN_MENUITEM 32771 +#define IDMI_SYSTRAYCASCADE_MENUITEM 32772 +#define IDMI_SYSTRAYABOUT_MENUITEM 32773 +#define IDMI_SYSTRAYEXIT_MENUITEM 32774 +#define IDMI_SYSTRAYMINIMIZE_MENUITEM 32777 +#define IDMI_SYSTRAYHIDE_MENUITEM 32778 +#define IDMI_SYSTRAYTILE_MENUITEM 32779 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 134 -#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_COMMAND_VALUE 32780 #define _APS_NEXT_CONTROL_VALUE 1601 #define _APS_NEXT_SYMED_VALUE 101 #endif diff --git a/setup.iss b/setup.iss index b9111dd..f0e0775 100755 --- a/setup.iss +++ b/setup.iss @@ -28,14 +28,15 @@ ; REVISION HISTORY: ; ; 12/06/2005: Initial version J. Millard -; +; 12/15/2005: Updated for version 1.3 J. Millard +; [Setup] -AppName=PuTTYCS 1.2 -AppVerName=PuTTY Command Sender 1.2 -VersionInfoVersion=1.2.0.0 +AppName=PuTTYCS 1.3 +AppVerName=PuTTY Command Sender 1.3 +VersionInfoVersion=1.3.0.0 VersionInfoCopyright=Copyright (C) 2005 Jason Millard -VersionInfoDescription=PuTTYCS - PuTTY Command Sender 1.2 +VersionInfoDescription=PuTTYCS - PuTTY Command Sender 1.3 AppPublisher=Jason Millard AppPublisherURL=http://www.millardsoftware.com/puttycs AppSupportURL=http://www.millardsoftware.com/puttycs @@ -64,11 +65,11 @@ Source: "README.txt"; DestDir: "{app}"; Flags: ignoreversion ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] -Name: "{group}\PuTTYCS 1.2"; Filename: "{app}\PuTTYCS.exe" +Name: "{group}\PuTTYCS 1.3"; Filename: "{app}\PuTTYCS.exe" Name: "{group}\README.txt"; Filename: "{app}\README.txt" -Name: "{userdesktop}\PuTTYCS 1.2"; Filename: "{app}\PuTTYCS.exe"; Tasks: desktopicon -Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\PuTTYCS 1.2"; Filename: "{app}\PuTTYCS.exe"; Tasks: quicklaunchicon +Name: "{userdesktop}\PuTTYCS 1.3"; Filename: "{app}\PuTTYCS.exe"; Tasks: desktopicon +Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\PuTTYCS 1.3"; Filename: "{app}\PuTTYCS.exe"; Tasks: quicklaunchicon [Run] Filename: "{app}\README.txt"; Description: "{cm:ViewREADME}"; Flags: postinstall shellexec skipifsilent -Filename: "{app}\PuTTYCS.exe"; Description: "{cm:LaunchProgram,PuTTY Command Sender 1.2}"; Flags: nowait postinstall skipifsilent +Filename: "{app}\PuTTYCS.exe"; Description: "{cm:LaunchProgram,PuTTY Command Sender 1.3}"; Flags: nowait postinstall skipifsilent