From 8c9d0cbd0e8eedbf2434c3591096066df25ce542 Mon Sep 17 00:00:00 2001 From: Jason Millard Date: Mon, 20 Nov 2006 12:00:00 +0600 Subject: [PATCH] 1.6 commit - Added support for PuTTYtel, TuTTY, and PieTTY. Added support for user defined cascade size. Changed scripting to send CR on last line if Carriage Return is enabled. --- Defines.h | 29 +++++++-- PreferencesDialog.cpp | 145 ++++++++++++++++++++++++++++++++++++++++-- PreferencesDialog.h | 14 ++++ PuTTYCS.clw | 32 ++++++---- PuTTYCS.rc | 38 ++++++----- PuTTYCSDialog.cpp | 82 ++++++++++++++++++++++-- PuTTYCSDialog.h | 11 +++- readme.txt | 77 ++++++++++++++-------- resource.h | 5 +- setup.iss | 19 +++--- 10 files changed, 370 insertions(+), 82 deletions(-) diff --git a/Defines.h b/Defines.h index a0b932b..82acc12 100755 --- a/Defines.h +++ b/Defines.h @@ -38,6 +38,9 @@ * 12/19/2005: Added window opacity J. Millard * 12/21/2005: Fixed password not sending CR J. Millard * 05/27/2006: Added custom window class J. Millard + * 11/20/2006: Added support for PuTTYtel, TuTTY, J. Millard + * and PieTTY. Added support for user + * defined cascade size. */ #if !defined(DEFINES_H__INCLUDED_) @@ -46,14 +49,18 @@ #define PUTTYCS_APP_NAME _T( "PuTTYCS" ) #define PUTTYCS_WINDOW_CLASS_PUTTY _T( "PuTTY" ) +#define PUTTYCS_WINDOW_CLASS_PUTTYTEL _T( "PuTTYtel" ) +#define PUTTYCS_WINDOW_CLASS_TUTTY _T( "TuTTY" ) +#define PUTTYCS_WINDOW_CLASS_PIETTY _T( "PieTTY" ) + #define PUTTYCS_MSG_TASKBAR_CREATED _T( "TaskbarCreated" ) -#define PUTTYCS_WINDOW_TITLE_TOOL _T( "PuTTYCS 1.5 - PuTTY Command Sender") -#define PUTTYCS_WINDOW_TITLE_APP _T( "PuTTYCS 1.5") +#define PUTTYCS_WINDOW_TITLE_TOOL _T( "PuTTYCS 1.6 - PuTTY Command Sender") +#define PUTTYCS_WINDOW_TITLE_APP _T( "PuTTYCS 1.6") #define PUTTYCS_WINDOW_TITLE_ABOUT _T( "About PuTTYCS...") -#define PUTTYCS_ABOUT_TEXT_LINE1 _T( "PuTTY Command Sender 1.5" ) +#define PUTTYCS_ABOUT_TEXT_LINE1 _T( "PuTTY Command Sender 1.6" ) #define PUTTYCS_ABOUT_TEXT_LINE2 _T( "© 2005, 2006 Jason Millard. All rights reserved." ) #define PUTTYCS_WINDOW_TITLE_FILTER_ADD _T( "Add Filter" ) @@ -63,9 +70,10 @@ #define PUTTYCS_WINDOW_TITLE_LOCATE_PUTTY _T( "Please locate PuTTY" ) #define PUTTYCS_MESSAGEBOX_CMDHISTORY _T( "Are you sure you want to\nclear the command history?" ) +#define PUTTYCS_MESSAGEBOX_CASCADE _T( "Could not determine cascade dimensions.\n\nPlease verify that:\n\n1) At least one PuTTY window is open and visible.\n2) The PuTTY window is no smaller than %d x %d pixels.\n3) The PuTTY window is no larger than %d x %d pixels.\n\nCascade dimensions will be set to defaults." ) #define PUTTYCS_MESSAGEBOX_CLOSE _T( "Are you sure you want to\nclose filtered PuTTYs?" ) -#define PUTTYCS_URL_HOMEPAGE _T( "http://www.millardsoftware.com/puttycs/index.php?app=1&v=15" ) +#define PUTTYCS_URL_HOMEPAGE _T( "http://www.millardsoftware.com/puttycs/index.php?app=1&v=16" ) #define PUTTYCS_FILTER_ALL _T( "All PuTTYs||+*") @@ -99,6 +107,9 @@ #define PUTTYCS_PREF_AUTO_ARRANGE_CASCADE 2 #define PUTTYCS_PREF_AUTO_ARRANGE_TILE 3 +#define PUTTYCS_PREF_CASCADE_WIDTH _T( "cascadeWidth" ) +#define PUTTYCS_PREF_CASCADE_HEIGHT _T( "cascadeHeight" ) + #define PUTTYCS_PREF_AUTO_MINIMIZE _T( "autoMinimize" ) #define PUTTYCS_PREF_ARRANGE_ON_STARTUP _T( "arrangeOnStartup" ) #define PUTTYCS_PREF_UNHIDE_ON_EXIT _T( "unhideOnExit" ) @@ -160,8 +171,14 @@ #define PUTTYCS_EMPTY_STRING _T( "" ) -#define PUTTYCS_CASCADE_DIMENSION_WIDTH 600 -#define PUTTYCS_CASCADE_DIMENSION_HEIGHT 400 +#define PUTTYCS_CASCADE_DEFAULT_WIDTH 642 +#define PUTTYCS_CASCADE_DEFAULT_HEIGHT 386 + +#define PUTTYCS_CASCADE_MINIMUM_WIDTH 98 +#define PUTTYCS_CASCADE_MINIMUM_HEIGHT 18 + +#define PUTTYCS_CASCADE_MAXIMUM_WIDTH 1042 +#define PUTTYCS_CASCADE_MAXIMUM_HEIGHT 802 #define PUTTYCS_OPACITY_MIN 50 #define PUTTYCS_OPACITY_MAX 255 diff --git a/PreferencesDialog.cpp b/PreferencesDialog.cpp index fe2cbe3..ecfac2c 100755 --- a/PreferencesDialog.cpp +++ b/PreferencesDialog.cpp @@ -34,10 +34,13 @@ * Updated Help/F1 to go visit website * Added tab completion * 12/19/2005: Added window opacity J. Millard + * 11/20/2006: Added support for user defined J. Millard + * cascade size. */ #include "stdafx.h" #include "PuTTYCS.h" +#include "PuTTYCSDialog.h" #include "PreferencesDialog.h" #ifdef _DEBUG @@ -79,15 +82,18 @@ BEGIN_MESSAGE_MAP(CPreferencesDialog, CDialog) ON_BN_CLICKED(IDC_UNHIDEONEXIT_CHECKBOX, OnUnhideOnExitCheckbox) ON_BN_CLICKED(IDC_TOOLWINDOW_CHECKBOX, OnToolWindowCheckbox) ON_BN_CLICKED(IDC_ALWAYSONTOP_CHECKBOX, OnAlwaysOnTopCheckbox) + ON_EN_CHANGE(IDC_TRANSITION_EDIT, OnChangeTransition) ON_BN_CLICKED(IDC_EMULATECOPYPASTE_CHECKBOX, OnEmulateCopyPasteCheckbox) ON_BN_CLICKED(IDC_OK_BUTTON, OnOKButton) ON_BN_CLICKED(IDC_MINIMIZETOSYSTRAY_CHECKBOX, OnMinimizeToSysTrayCheckbox) + ON_WM_HELPINFO() ON_BN_CLICKED(IDC_TABCOMPLETION_CHECKBOX, OnTabCompletionCheckbox) + ON_WM_HSCROLL() + ON_EN_CHANGE(IDC_CASCADE_HEIGHT_EDIT, OnChangeCascadeHeightEdit) + ON_EN_CHANGE(IDC_CASCADE_WIDTH_EDIT, OnChangeCascadeWidthEdit) ON_BN_CLICKED(IDC_AUTOARRANGE_CASCADE_RADIO, OnAutoArrangeRadio) ON_BN_CLICKED(IDC_AUTOARRANGE_TILE_RADIO, OnAutoArrangeRadio) - ON_EN_CHANGE(IDC_TRANSITION_EDIT, OnChangeTransition) - ON_WM_HELPINFO() - ON_WM_HSCROLL() + ON_BN_CLICKED(IDC_FIND_BUTTON, OnFindButton) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -163,6 +169,42 @@ void CPreferencesDialog::setArrangeOnStartup( int iArrangeOnStartup ) m_iArrangeOnStartup = iArrangeOnStartup; } +/** + * CPreferencesDialog::getCascadeWidth() + */ + +int CPreferencesDialog::getCascadeWidth() +{ + return m_iCascadeWidth; +} + +/** + * CPreferencesDialog::setCascadeWidth() + */ + +void CPreferencesDialog::setCascadeWidth( int iCascadeWidth ) +{ + m_iCascadeWidth = iCascadeWidth; +} + +/** + * CPreferencesDialog::getCascadeHeight() + */ + +int CPreferencesDialog::getCascadeHeight() +{ + return m_iCascadeHeight; +} + +/** + * CPreferencesDialog::setCascadeHeight() + */ + +void CPreferencesDialog::setCascadeHeight( int iCascadeHeight ) +{ + m_iCascadeHeight = iCascadeHeight; +} + /** * CPreferencesDialog::getUnhideOnExit() */ @@ -364,6 +406,12 @@ BOOL CPreferencesDialog::OnInitDialog() SetDlgItemInt( IDC_TRANSITION_EDIT, m_iTransition ); + SetDlgItemInt( IDC_CASCADE_WIDTH_EDIT, + m_iCascadeWidth ); + + SetDlgItemInt( IDC_CASCADE_HEIGHT_EDIT, + m_iCascadeHeight ); + if ( CPuTTYCSApp::g_pSetLayeredWindowAttributes ) { ((CSliderCtrl*)GetDlgItem(IDC_OPACITY_SLIDER))-> @@ -410,7 +458,11 @@ void CPreferencesDialog::UpdateDialog() ((CButton*) GetDlgItem(IDC_OK_BUTTON))-> EnableWindow( (m_iTransition >= 1) && (m_iTransition <= 1500) && - (m_iOpacity >= PUTTYCS_OPACITY_MIN) ); + (m_iOpacity >= PUTTYCS_OPACITY_MIN) && + (m_iCascadeWidth >= PUTTYCS_CASCADE_MINIMUM_WIDTH) && + (m_iCascadeWidth <= PUTTYCS_CASCADE_MAXIMUM_WIDTH) && + (m_iCascadeHeight >= PUTTYCS_CASCADE_MINIMUM_HEIGHT) && + (m_iCascadeHeight <= PUTTYCS_CASCADE_MAXIMUM_HEIGHT) ); float fPercent = ((float) (m_iOpacity - PUTTYCS_OPACITY_MIN) / @@ -493,6 +545,88 @@ void CPreferencesDialog::OnArrangeOnStartupCheckbox() UpdateDialog(); } +/** + * CPreferencesDialog::OnChangeCascadeWidthEdit() + */ + +void CPreferencesDialog::OnChangeCascadeWidthEdit() +{ + m_iCascadeWidth = + GetDlgItemInt( IDC_CASCADE_WIDTH_EDIT ); + + UpdateDialog(); +} + +/** + * CPreferencesDialog::OnChangeCascadeHeightEdit() + */ + +void CPreferencesDialog::OnChangeCascadeHeightEdit() +{ + m_iCascadeHeight = + GetDlgItemInt( IDC_CASCADE_HEIGHT_EDIT ); + + UpdateDialog(); +} + +/** + * CPreferencesDialog::OnFindButton() + */ + +void CPreferencesDialog::OnFindButton() +{ + CPuTTYCSDialog* pDialog = (CPuTTYCSDialog*) GetParent(); + CObArray* pWindows = pDialog->GetAllWindows(); + + int iWidth = 0; + int iHeight = 0; + + for ( int loop = 0; loop < pWindows->GetSize(); loop++ ) + { + CWnd* pWnd = (CWnd*) pWindows->GetAt(loop); + + if (pWnd->IsWindowVisible()) + { + CRect rect; + pWnd->GetClientRect(rect); + + int iWndWidth = rect.Width(); + int iWndHeight = rect.Height(); + + if ( (iWidth * iHeight) < (iWndWidth * iWndHeight) ) + { + iWidth = iWndWidth; + iHeight = iWndHeight; + } + } + } + + if ( ((iWidth >= PUTTYCS_CASCADE_MINIMUM_WIDTH) && (iWidth <= PUTTYCS_CASCADE_MAXIMUM_WIDTH)) && + ((iHeight >= PUTTYCS_CASCADE_MINIMUM_HEIGHT) && (iHeight <= PUTTYCS_CASCADE_MAXIMUM_HEIGHT)) ) + { + m_iCascadeWidth = iWidth; + m_iCascadeHeight = iHeight; + } + else + { + CString csMessage; + + csMessage.Format( PUTTYCS_MESSAGEBOX_CASCADE, + PUTTYCS_CASCADE_MINIMUM_WIDTH, PUTTYCS_CASCADE_MINIMUM_HEIGHT, + PUTTYCS_CASCADE_MAXIMUM_WIDTH, PUTTYCS_CASCADE_MAXIMUM_HEIGHT ); + + MessageBox( csMessage, PUTTYCS_APP_NAME, MB_ICONEXCLAMATION | MB_OK ); + + m_iCascadeWidth = PUTTYCS_CASCADE_DEFAULT_WIDTH; + m_iCascadeHeight = PUTTYCS_CASCADE_DEFAULT_HEIGHT; + } + + SetDlgItemInt( IDC_CASCADE_WIDTH_EDIT, m_iCascadeWidth ); + SetDlgItemInt( IDC_CASCADE_HEIGHT_EDIT, m_iCascadeHeight ); + + UpdateDialog(); +} + /** * CPreferencesDialog::OnUnhideOnExitCheckbox() */ @@ -572,4 +706,5 @@ void CPreferencesDialog::OnEmulateCopyPasteCheckbox() void CPreferencesDialog::OnOKButton() { CDialog::OnOK(); -} \ No newline at end of file +} + diff --git a/PreferencesDialog.h b/PreferencesDialog.h index 0fd7c85..3814f2d 100755 --- a/PreferencesDialog.h +++ b/PreferencesDialog.h @@ -35,6 +35,8 @@ * 12/15/2005: Added minimize to system tray J. Millard * Added tab completion * 12/19/2005: Added window opacity J. Millard + * 11/20/2006: Added support for user defined J. Millard + * cascade size. */ #if !defined(AFX_PREFERENCESDLG_H__4CD996C9_091F_4F4D_BFE3_EDD9236AB74B__INCLUDED_) @@ -68,6 +70,12 @@ class CPreferencesDialog : public CDialog int getArrangeOnStartup(); void setArrangeOnStartup( int iArrangeOnStartup ); + int getCascadeWidth(); + void setCascadeWidth( int iCascadeWidth ); + + int getCascadeHeight(); + void setCascadeHeight( int iCascadeHeight ); + int getUnhideOnExit(); void setUnhideOnExit( int iUnhideOnExit); @@ -106,6 +114,9 @@ class CPreferencesDialog : public CDialog int m_iAutoArrange; int m_iAutoMinimize; int m_iArrangeOnStartup; + int m_iCascadeWidth; + int m_iCascadeHeight; + int m_iUnhideOnExit; int m_iToolWindow; int m_iAlwaysOnTop; @@ -132,6 +143,9 @@ class CPreferencesDialog : public CDialog afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnTabCompletionCheckbox(); afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); + afx_msg void OnChangeCascadeHeightEdit(); + afx_msg void OnChangeCascadeWidthEdit(); + afx_msg void OnFindButton(); //}}AFX_MSG DECLARE_MESSAGE_MAP() diff --git a/PuTTYCS.clw b/PuTTYCS.clw index dafb149..5b20cbf 100755 --- a/PuTTYCS.clw +++ b/PuTTYCS.clw @@ -2,7 +2,7 @@ [General Info] Version=1 -LastClass=CPuTTYCSDialog +LastClass=CPreferencesDialog LastTemplate=CDialog NewFileInclude1=#include "stdafx.h" NewFileInclude2=#include "puttycs.h" @@ -19,12 +19,12 @@ Class7=CPuTTYCSApp Class8=CPuTTYCSDialog ResourceCount=7 -Resource1=IDD_FILTER_DIALOG -Resource2=IDD_FILTERS_DIALOG -Resource3=IDD_PUTTYCS_DIALOG +Resource1=IDD_PUTTYCS_DIALOG +Resource2=IDD_ABOUT_DIALOG +Resource3=IDD_FILTER_DIALOG Resource4=IDD_PREFERENCES_DIALOG Resource5=IDD_PASSWORD_DIALOG -Resource6=IDD_ABOUT_DIALOG +Resource6=IDD_FILTERS_DIALOG Resource7=IDM_SYSTRAY_MENU [CLS:CAboutDialog] @@ -65,7 +65,7 @@ HeaderFile=PreferencesDialog.h ImplementationFile=PreferencesDialog.cpp Filter=D VirtualFilter=dWC -LastObject=CPreferencesDialog +LastObject=IDC_FIND_BUTTON [CLS:CPuTTYCSApp] Type=0 @@ -140,7 +140,7 @@ Control4=IDCANCEL,button,1342242816 [DLG:IDD_PREFERENCES_DIALOG] Type=1 Class=CPreferencesDialog -ControlCount=24 +ControlCount=30 Control1=IDC_STATIC,button,1342177287 Control2=IDC_TOOLWINDOW_CHECKBOX,button,1342242819 Control3=IDC_ALWAYSONTOP_CHECKBOX,button,1342242819 @@ -158,13 +158,19 @@ Control14=IDC_AUTOARRANGE_TILE_RADIO,button,1342177289 Control15=IDC_AUTOMINIMIZE_CHECKBOX,button,1342242819 Control16=IDC_ARRANGEONSTARTUP_CHECKBOX,button,1342242819 Control17=IDC_UNHIDEONEXIT_CHECKBOX,button,1342242819 -Control18=IDC_STATIC,button,1342177287 -Control19=IDC_TABCOMPLETION_CHECKBOX,button,1342242819 -Control20=IDC_EMULATECOPYPASTE_CHECKBOX,button,1342242819 -Control21=IDC_SAVEPASSWORD_CHECKBOX,button,1342242819 -Control22=IDC_OK_BUTTON,button,1342242817 -Control23=IDCANCEL,button,1342242816 +Control18=IDC_STATIC,static,1342177296 +Control19=IDC_STATIC,static,1342308352 +Control20=IDC_CASCADE_WIDTH_EDIT,edit,1350639744 +Control21=IDC_STATIC,static,1342308352 +Control22=IDC_CASCADE_HEIGHT_EDIT,edit,1350639744 +Control23=IDC_FIND_BUTTON,button,1342242816 Control24=IDC_STATIC,button,1342177287 +Control25=IDC_TABCOMPLETION_CHECKBOX,button,1342242819 +Control26=IDC_EMULATECOPYPASTE_CHECKBOX,button,1342242819 +Control27=IDC_SAVEPASSWORD_CHECKBOX,button,1342242819 +Control28=IDC_OK_BUTTON,button,1342242817 +Control29=IDCANCEL,button,1342242816 +Control30=IDC_STATIC,button,1342177287 [DLG:IDD_PUTTYCS_DIALOG] Type=1 diff --git a/PuTTYCS.rc b/PuTTYCS.rc index 4cac0b1..0718485 100755 --- a/PuTTYCS.rc +++ b/PuTTYCS.rc @@ -128,7 +128,7 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,129,38,50,14 END -IDD_PREFERENCES_DIALOG DIALOG DISCARDABLE 0, 0, 211, 225 +IDD_PREFERENCES_DIALOG DIALOGEX 0, 0, 211, 249 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Preferences" FONT 8, "MS Sans Serif" @@ -149,7 +149,7 @@ BEGIN CONTROL "Slider1",IDC_OPACITY_SLIDER,"msctls_trackbar32", WS_TABSTOP,145,45,35,11 LTEXT "100%",IDC_OPACITY2_STATIC,181,46,18,10,SS_CENTERIMAGE - GROUPBOX "Auto arrange:",IDC_STATIC,7,66,197,57 + GROUPBOX "Auto arrange:",IDC_STATIC,7,66,197,81 CONTROL "Off",IDC_AUTOARRANGE_OFF_RADIO,"Button", BS_AUTORADIOBUTTON | WS_GROUP,13,81,44,10 CONTROL "Cascade",IDC_AUTOARRANGE_CASCADE_RADIO,"Button", @@ -162,17 +162,25 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,112,93,74,10 CONTROL "Unhide PuTTYs on exit",IDC_UNHIDEONEXIT_CHECKBOX,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,112,105,89,10 - GROUPBOX "Keyboard/Mouse:",IDC_STATIC,7,127,197,40 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,12,121,190,1 + LTEXT "Cascade dimensions:",IDC_STATIC,21,130,68,8 + EDITTEXT IDC_CASCADE_WIDTH_EDIT,97,128,22,12,ES_AUTOHSCROLL | + ES_NUMBER + LTEXT "x",IDC_STATIC,123,130,8,8,0,WS_EX_TRANSPARENT + EDITTEXT IDC_CASCADE_HEIGHT_EDIT,132,128,22,12,ES_AUTOHSCROLL | + ES_NUMBER + PUSHBUTTON "&Find",IDC_FIND_BUTTON,159,127,32,14 + GROUPBOX "Keyboard/Mouse:",IDC_STATIC,7,151,197,40 CONTROL "Enable Tab completion",IDC_TABCOMPLETION_CHECKBOX, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,140,85,10 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,165,85,10 CONTROL "Selection copies, right button pastes", IDC_EMULATECOPYPASTE_CHECKBOX,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,13,153,155,10 + WS_TABSTOP,13,177,155,10 CONTROL "Save password",IDC_SAVEPASSWORD_CHECKBOX,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,183,63,10 - DEFPUSHBUTTON "OK",IDC_OK_BUTTON,103,204,50,14 - PUSHBUTTON "Cancel",IDCANCEL,154,204,50,14 - GROUPBOX "Password:",IDC_STATIC,7,171,197,28 + BS_AUTOCHECKBOX | WS_TABSTOP,13,207,63,10 + DEFPUSHBUTTON "OK",IDC_OK_BUTTON,103,227,50,14 + PUSHBUTTON "Cancel",IDCANCEL,154,227,50,14 + GROUPBOX "Password:",IDC_STATIC,7,195,197,28 END IDD_FILTERS_DIALOG DIALOG DISCARDABLE 0, 0, 200, 178 @@ -239,8 +247,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,5,0,0 - PRODUCTVERSION 1,5,0,0 + FILEVERSION 1,6,0,0 + PRODUCTVERSION 1,6,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -258,14 +266,14 @@ BEGIN VALUE "Comments", "Created by Jason Millard\0" VALUE "CompanyName", "\0" VALUE "FileDescription", "PuTTYCS\0" - VALUE "FileVersion", "1, 5, 0, 0\0" + VALUE "FileVersion", "1, 6, 0, 0\0" VALUE "InternalName", "PuTTYCS\0" VALUE "LegalCopyright", "Copyright (C) 2005, 2006\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "PuTTYCS.EXE\0" VALUE "PrivateBuild", "\0" - VALUE "ProductName", "PuTTYCS - PuTTY Command Sender 1.5\0" - VALUE "ProductVersion", "1, 5, 0, 0\0" + VALUE "ProductName", "PuTTYCS - PuTTY Command Sender 1.6\0" + VALUE "ProductVersion", "1, 6, 0, 0\0" VALUE "SpecialBuild", "\0" END END @@ -307,7 +315,7 @@ BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 204 TOPMARGIN, 7 - BOTTOMMARGIN, 218 + BOTTOMMARGIN, 242 END IDD_FILTERS_DIALOG, DIALOG diff --git a/PuTTYCSDialog.cpp b/PuTTYCSDialog.cpp index 1531b38..b451a93 100755 --- a/PuTTYCSDialog.cpp +++ b/PuTTYCSDialog.cpp @@ -45,6 +45,11 @@ * delete buttons * 05/30/2006: Implemented MSDN KB135788 for J. Millard * system tray context menu + * 11/20/2006: Added support for PuTTYtel and J. Millard + * TuTTY. Added support for user + * defined cascade size. Changed + * scripting to send CR on last line + * if CR button is on. */ #include "stdafx.h" @@ -281,7 +286,7 @@ void CPuTTYCSDialog::LoadPreferences() AfxGetApp()->GetProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_WINDOW_OPACITY, PUTTYCS_OPACITY_MAX ); - + /** * Auto arrange */ @@ -302,6 +307,14 @@ void CPuTTYCSDialog::LoadPreferences() AfxGetApp()->GetProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_UNHIDE_ON_EXIT, 1 ); + m_iCascadeWidth = + AfxGetApp()->GetProfileInt( + PUTTYCS_APP_NAME, PUTTYCS_PREF_CASCADE_WIDTH, PUTTYCS_CASCADE_DEFAULT_WIDTH ); + + m_iCascadeHeight = + AfxGetApp()->GetProfileInt( + PUTTYCS_APP_NAME, PUTTYCS_PREF_CASCADE_HEIGHT, PUTTYCS_CASCADE_DEFAULT_HEIGHT ); + /** * Send CR */ @@ -427,6 +440,12 @@ void CPuTTYCSDialog::SavePreferences() AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_UNHIDE_ON_EXIT, m_iUnhideOnExit ); + AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, + PUTTYCS_PREF_CASCADE_WIDTH, m_iCascadeWidth ); + + AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, + PUTTYCS_PREF_CASCADE_HEIGHT, m_iCascadeHeight ); + /** * Send CR */ @@ -650,6 +669,7 @@ BOOL CPuTTYCSDialog::OnInitDialog() SetIcon(m_hIcon, FALSE); m_bIsClosing = false; + m_bFindAll = false; /** * Preferences @@ -1024,6 +1044,25 @@ void CPuTTYCSDialog::OnSelChangeFiltersCombobox() RefreshDialog(); } +/** + * CPuTTYCSDialog::GetAllWindows() + */ + +CObArray* CPuTTYCSDialog::GetAllWindows() +{ + m_obaWindows.RemoveAll(); + + m_bFindAll = true; + + ::EnumWindows( enumwindowsProc, (LPARAM) this ); + + SortWindows(); + + m_bFindAll = false; + + return &m_obaWindows; +} + /** * CPuTTYCSDialog::OnCascadeButton */ @@ -1073,8 +1112,8 @@ void CPuTTYCSDialog::OnCascadeButton() SendMessage( WM_SIZE, SIZE_RESTORED, MAKELPARAM( - PUTTYCS_CASCADE_DIMENSION_WIDTH, - PUTTYCS_CASCADE_DIMENSION_HEIGHT) ); + m_iCascadeWidth, + m_iCascadeHeight) ); pWnd->SendMessage( WM_EXITSIZEMOVE, 0, 0 ); @@ -1542,7 +1581,7 @@ void CPuTTYCSDialog::OnPreferencesButton() m_bDisablePopup = TRUE; CPreferencesDialog* pDialog = - new CPreferencesDialog(); + new CPreferencesDialog( this ); /** * Password @@ -1567,6 +1606,12 @@ void CPuTTYCSDialog::OnPreferencesButton() pDialog-> setUnhideOnExit( m_iUnhideOnExit ); + pDialog-> + setCascadeWidth( m_iCascadeWidth ); + + pDialog-> + setCascadeHeight( m_iCascadeHeight ); + /** * Window */ @@ -1620,6 +1665,12 @@ void CPuTTYCSDialog::OnPreferencesButton() m_iUnhideOnExit = pDialog->getUnhideOnExit(); + + m_iCascadeWidth = + pDialog->getCascadeWidth(); + + m_iCascadeHeight = + pDialog->getCascadeHeight(); /** * Window @@ -1748,11 +1799,24 @@ void CPuTTYCSDialog::OnScriptButton() PUTTYCS_SENDKEY_BUTTON_CAPSLOCK; } + bool firstLine = true; + TCHAR szLine[65536]; while ( _fgetts(szLine, sizeof( szLine ), pFile) != NULL ) { - csBuffer += szLine; + if ( !firstLine ) + { + csBuffer += PUTTYCS_SENDKEY_BUTTON_ENTER; + } + + csBuffer += szLine; + + firstLine = false; + } + + if ( m_iSendCR ) + { csBuffer += PUTTYCS_SENDKEY_BUTTON_ENTER; } @@ -2044,13 +2108,17 @@ BOOL CALLBACK CPuTTYCSDialog::enumwindowsProc( HWND hwnd, LPARAM lParam ) ::GetClassName( hwnd, szClass, sizeof(szClass) ); - if ( !_tcscmp(szClass, PUTTYCS_WINDOW_CLASS_PUTTY) ) + if ( (!_tcscmp(szClass, PUTTYCS_WINDOW_CLASS_PUTTY)) + || (!_tcscmp(szClass, PUTTYCS_WINDOW_CLASS_PUTTYTEL)) + || (!_tcscmp(szClass, PUTTYCS_WINDOW_CLASS_TUTTY)) + || (!_tcscmp(szClass, PUTTYCS_WINDOW_CLASS_PIETTY)) ) + { TCHAR szTitle[300]; ::GetWindowText(hwnd, szTitle, sizeof(szTitle)); CString csEntry = - (pDialog->m_bIsClosing) ? PUTTYCS_FILTER_ALL : + ((pDialog->m_bIsClosing) || (pDialog->m_bFindAll)) ? PUTTYCS_FILTER_ALL : pDialog->m_csaFilters.GetAt(pDialog->m_iFilter); csEntry = csEntry.Mid( diff --git a/PuTTYCSDialog.h b/PuTTYCSDialog.h index d723b61..164d305 100755 --- a/PuTTYCSDialog.h +++ b/PuTTYCSDialog.h @@ -42,6 +42,8 @@ * Added Windows XP style * Added close, backspace, and * delete buttons + * 11/20/2006: Added support for user defined J. Millard + * cascade size. */ #if !defined(AFX_PuTTYCSDLG_H__7BCAE5A7_75C4_4831_82FD_5A13F846FE61__INCLUDED_) @@ -61,6 +63,8 @@ class CPuTTYCSDialog : public CDialog CPuTTYCSDialog(CWnd* pParent = NULL); // standard constructor ~CPuTTYCSDialog(); + CObArray* GetAllWindows(); + // Dialog Data //{{AFX_DATA(CPuTTYCSDialog) enum { IDD = IDD_PUTTYCS_DIALOG }; @@ -82,7 +86,9 @@ class CPuTTYCSDialog : public CDialog HICON m_hIcon; - bool m_bIsClosing; + bool m_bIsClosing; + bool m_bFindAll; + int m_iDialogHeight; /** @@ -125,6 +131,9 @@ class CPuTTYCSDialog : public CDialog int m_iAutoMinimize; int m_iArrangeOnStartup; int m_iUnhideOnExit; + + int m_iCascadeWidth; + int m_iCascadeHeight; /** * Keyboard/Mouse diff --git a/readme.txt b/readme.txt index 467086f..39d30ac 100755 --- a/readme.txt +++ b/readme.txt @@ -1,10 +1,17 @@ -PuTTYCS - PuTTY Command Sender v1.5 +PuTTYCS - PuTTY Command Sender v1.6 (C) 2005, 2006 - Jason Millard - jsm174@gmail.com -Release Date: 05/30/06 +Release Date: 11/20/06 VERSION HISTORY +11/20/06 - v1.6 - Added support for PuTTYtel, TuTTY, + and PieTTY + Added support for user defined + cascade size + Changed scripting to send CR on + last line if Carriage Return is + enabled 05/30/06 - v1.5 - Improved system tray logic Added Windows XP style Added close, backspace, and @@ -27,10 +34,11 @@ ABOUT ----- PuTTYCS is a small windows application that is intended -to be used along with multiple instances of PuTTY. It's -purpose is to send the same command to each PuTTY window. -It is can be useful for copying files, starting and -stopping processes, and examine logs on multiple servers. +to be used along with multiple instances of PuTTY +(including PuTTYtel, TuTTY, and PieTTY). It's purpose is +to send the same command to each PuTTY window. It is can +be useful for copying files, starting and stopping +processes, and examining logs on multiple servers. If you're not familiar with PuTTY, then this tool is probably not for you. If you want to find out more @@ -140,7 +148,8 @@ CARRIAGE RETURN The carriage return push button next to the command history arrow button determines if a carriage return -should be send when the Send button is pressed. This +should be sent 1) when the Send button is pressed, and +2) after the last line of a script [see SCRIPT]. This maybe useful if you want to send most of a command and than manually complete it. @@ -207,7 +216,7 @@ Preferences are loaded each time PuTTYCS is started. window. This maybe useful if PuTTYCS sometimes blocks your existing PuTTY windows. - Auto Arrange (Off, Cascade, Tile) + Auto arrange (Off, Cascade, Tile) When switching filters, automatically cascade or tile PuTTY windows. @@ -221,7 +230,20 @@ Preferences are loaded each time PuTTYCS is started. Unhide PuTTYs on exit Unhides any PuTTYs hidden using the Hide button. - + + Cascade dimensions: + Sets the dimensions of filtered PuTTY windows when + the Cascade button is pressed. Press the Find button + to determine the dimensions of the largest visible + PuTTY window. + + NOTE: PuTTYCS only supports cascading dimensions + between 98x18 (12x1) and 1042x802 (130x50). + Default dimensions are 642x386 (80x24). + + These dimensions are hardcoded and will not + change with system settings. + Enable Tab Completion Pressing Tab in the command field, sends the command @@ -248,6 +270,11 @@ This button can be used to a load a PuTTYCS script. A script can be any text file and should end with a .pcs extension. +If you do not want to send a carriage return at the end +of the script 1) make sure the last line of the script +is not blank, and 2) the Carriage Return button is not +enabled. + Because the core of PuTTYCS is based on SendKeys in C++, the script should follow the syntax defined by SendKeys. Some features such as application activation have been @@ -300,6 +327,10 @@ PuTTYCS gets around this by performing a variety of hide, move, resize, and show commands. However, at times, PuTTYs may not arrange as expected. +PuTTYCS officially supports PuTTY. I have support to find +PuTTYtel, TuTTY, and PieTTY windows based upon user requests. +I can't guarantee they will work 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 @@ -311,16 +342,13 @@ FUTURE When I first released PuTTYCS, I had no plans on releasing any major updates. However, from all the positive feedback -I've received, I have been contemplating a version 2. +I've received, I have started coding version 2. It is a +complete rewrite. -I would like to break the filters down into an Environment -> -Tier -> Server setup. This way you could easily launch PuTTYs -directly from PuTTYCS. +The next version supports tabbing and launching PuTTYs. -Also, I have figured out how to control PuTTY without using -SendKeys. This makes for much more reliable communication. -However, if I removed SendKeys, the scripting ability would -be removed. If you use scripting, please let me know! +Unfortunately, I am seriously debating releasing version 2 as +shareware. [see I LIKE IT] PuTTYCS needs a LOGO!! If you can draw and would be interested in designing a logo please contact me!! @@ -340,16 +368,15 @@ I LIKE IT If you like this application, drop me a line at jsm174@gmail.com. It's just cool to hear from people around the world! +If you really like and use this application, please consider +donating. You can use the Paypal link found on the homepage. -I REALLY LIKE IT ----------------- - -If you really like this application, feel free to send a -donation! I really would appreciate it! Plus I need some -motivation for version 2. :) +As of writing this, I've received a grand total of $1. It's +disappointing considering the amount of downloads and the effort +that went into making PuTTYCS. -Donations can be made through Paypal using the link on the -homepage. +If this changes, I promise future version of PuTTYCS will remain +free. CREDITS diff --git a/resource.h b/resource.h index 4377c5a..9d04d73 100755 --- a/resource.h +++ b/resource.h @@ -50,6 +50,8 @@ #define IDC_EMULATECOPYPASTE_CHECKBOX 1110 #define IDC_MINIMIZETOSYSTRAY_CHECKBOX 1111 #define IDC_TABCOMPLETION_CHECKBOX 1112 +#define IDC_CASCADE_WIDTH_EDIT 1113 +#define IDC_CASCADE_HEIGHT_EDIT 1114 #define IDC_FILTERS_LISTBOX 1200 #define IDC_ADD_BUTTON 1201 #define IDC_COPY_BUTTON 1202 @@ -61,7 +63,8 @@ #define IDC_CLOSE_BUTTON 1208 #define IDC_OK_BUTTON 1209 #define IDC_CANCEL_BUTTON 1210 -#define IDC_APPLY_BUTTON 1211 +#define IDC_FIND_BUTTON 1211 +#define IDC_APPLY_BUTTON 1212 #define IDC_FILTERNAME_EDIT 1300 #define IDC_FILTERLIST_EDIT 1301 #define IDC_PASSWORD_CEDIT 1400 diff --git a/setup.iss b/setup.iss index 27d7d82..bb27bb4 100755 --- a/setup.iss +++ b/setup.iss @@ -30,16 +30,17 @@ ; 12/06/2005: Initial version J. Millard ; 12/15/2005: Updated for version 1.3 J. Millard ; 12/19/2005: Updated for version 1.4 J. Millard -; 12/21/2005: Updated for version 1.5 J. Millard +; 12/21/2005: Updated for version 1.4a J. Millard ; 05/30/2006: Updated for version 1.5 J. Millard +; 11/20/2006: Updated for version 1.6 J. Millard ; [Setup] -AppName=PuTTYCS 1.5 -AppVerName=PuTTY Command Sender 1.5 -VersionInfoVersion=1.5.0.0 +AppName=PuTTYCS 1.6 +AppVerName=PuTTY Command Sender 1.6 +VersionInfoVersion=1.6.0.0 VersionInfoCopyright=Copyright (C) 2005, 2006 Jason Millard -VersionInfoDescription=PuTTYCS - PuTTY Command Sender 1.5 +VersionInfoDescription=PuTTYCS - PuTTY Command Sender 1.6 AppPublisher=Jason Millard AppPublisherURL=http://www.millardsoftware.com/puttycs AppSupportURL=http://www.millardsoftware.com/puttycs @@ -68,11 +69,11 @@ Source: "README.txt"; DestDir: "{app}"; Flags: ignoreversion ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] -Name: "{group}\PuTTYCS 1.5"; Filename: "{app}\PuTTYCS.exe" +Name: "{group}\PuTTYCS 1.6"; Filename: "{app}\PuTTYCS.exe" Name: "{group}\README.txt"; Filename: "{app}\README.txt" -Name: "{userdesktop}\PuTTYCS 1.5"; Filename: "{app}\PuTTYCS.exe"; Tasks: desktopicon -Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\PuTTYCS 1.5"; Filename: "{app}\PuTTYCS.exe"; Tasks: quicklaunchicon +Name: "{userdesktop}\PuTTYCS 1.6"; Filename: "{app}\PuTTYCS.exe"; Tasks: desktopicon +Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\PuTTYCS 1.6"; 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.5}"; Flags: nowait postinstall skipifsilent +Filename: "{app}\PuTTYCS.exe"; Description: "{cm:LaunchProgram,PuTTY Command Sender 1.6}"; Flags: nowait postinstall skipifsilent