diff --git a/AboutDialog.cpp b/AboutDialog.cpp index bab6256..2359570 100755 --- a/AboutDialog.cpp +++ b/AboutDialog.cpp @@ -1,7 +1,7 @@ /** * AboutDialog.cpp - PuTTYCS About Dialog * - * Copyright (c) 2005 - 2007 Jason Millard (jsm174@gmail.com) + * Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/AboutDialog.h b/AboutDialog.h index 11446b0..2ed8214 100755 --- a/AboutDialog.h +++ b/AboutDialog.h @@ -1,7 +1,7 @@ /** * AboutDialog.h - PuTTYCS About Dialog header * - * Copyright (c) 2005 - 2007 Jason Millard (jsm174@gmail.com) + * Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Base64.cpp b/Base64.cpp index 6a13b3c..c6deda4 100755 --- a/Base64.cpp +++ b/Base64.cpp @@ -4,7 +4,7 @@ * This code is based HEAVILY on the code found at: * http://www.adp-gmbh.ch/cpp/common/base64.html * - * Copyright (c) 2005 - 2007 Jason Millard (jsm174@gmail.com) + * Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/CommandEdit.cpp b/CommandEdit.cpp index 91e75ef..ea92880 100755 --- a/CommandEdit.cpp +++ b/CommandEdit.cpp @@ -1,7 +1,7 @@ /** * CommandEdit.cpp - Command CEdit Control * - * Copyright (c) 2005 - 2007 Jason Millard (jsm174@gmail.com) + * Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/CommandEdit.h b/CommandEdit.h index 4cb79d0..1ab914c 100755 --- a/CommandEdit.h +++ b/CommandEdit.h @@ -1,7 +1,7 @@ /** * CommandEdit.h - Command CEdit Control header * - * Copyright (c) 2005 - 2007 Jason Millard (jsm174@gmail.com) + * Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/Defines.h b/Defines.h index dad2810..f7584e2 100755 --- a/Defines.h +++ b/Defines.h @@ -1,7 +1,7 @@ /** * Defines.h - PuTTYCS Defines header * - * Copyright (c) 2005 - 2007 Jason Millard (jsm174@gmail.com) + * Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,6 +48,11 @@ * up/down arrow keys * Added check for PuTTYCS update * Added run on system startup + * 02/29/2008: Added horizontal/vertical tiling J. Millard + * support. + * Updated cascade logic. + * Added post send transition delay. + * Added --script command line option. */ #if !defined(DEFINES_H__INCLUDED_) @@ -55,8 +60,8 @@ #define PUTTYCS_APP_NAME _T( "PuTTYCS" ) -#define PUTTYCS_VERSION _T( "1.7" ) -#define PUTTYCS_VERSION_INT _T( "010700" ) +#define PUTTYCS_VERSION _T( "1.8.1" ) +#define PUTTYCS_VERSION_INT _T( "010801" ) #define PUTTYCS_REGKEY_RUN _T( "Software\\Microsoft\\Windows\\CurrentVersion\\Run" ) @@ -73,7 +78,7 @@ #define PUTTYCS_WINDOW_TITLE_ABOUT _T( "About PuTTYCS...") #define PUTTYCS_ABOUT_TEXT_LINE1 _T( "PuTTY Command Sender ") PUTTYCS_VERSION -#define PUTTYCS_ABOUT_TEXT_LINE2 _T( "© 2005 - 2007 Millard Software. All rights reserved." ) +#define PUTTYCS_ABOUT_TEXT_LINE2 _T( "© 2005 - 2008 Millard Software. All rights reserved." ) #define PUTTYCS_WINDOW_TITLE_FILTER_ADD _T( "Add Filter" ) #define PUTTYCS_WINDOW_TITLE_FILTER_EDIT _T( "Edit Filter" ) @@ -84,6 +89,17 @@ #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_MESSAGEBOX_MISSING_ARGUMENT _T( "Missing argument for %s or %s option" ) +#define PUTTYCS_MESSAGEBOX_UNKNOWN_OPTION _T( "Unknown option: %s" ) +#define PUTTYCS_MESSAGEBOX_HELP _T( "Usage: puttycs [OPTION]...\n\n-s, --script \n Send a PuTTYCS script\n\n-h, --help\n Display this help" ) +#define PUTTYCS_MESSAGEBOX_LOAD_SCRIPT_ERROR _T( "Unable to load script.") + +#define PUTTYCS_CMD_SCRIPT _T( "-s" ) +#define PUTTYCS_CMD_SCRIPT_LONG _T( "--script" ) + +#define PUTTYCS_CMD_HELP _T( "-h" ) +#define PUTTYCS_CMD_HELP_LONG _T( "--help" ) #define PUTTYCS_MESSAGEBOX_UPDATE _T( "A new version of PuTTYCS is available for download.\n\nCurrent version: %s\nLatest version: %s\n\nWould you like to go to the PuTTYCS homepage?" ) #define PUTTYCS_MESSAGEBOX_NO_UPDATES _T( "No updates found. PuTTYCS %s is the latest version." ) @@ -103,9 +119,6 @@ #define PUTTYCS_FONT_MARLETT _T( "Marlett" ) #define PUTTYCS_FONT_SYMBOL _T( "Symbol" ) -#define PUTTYCS_PREF_SAVE_PASSWORD _T( "savePassword" ) -#define PUTTYCS_PREF_PASSWORD _T( "password" ) - #define PUTTYCS_PREF_CMDHISTORY_MAX_SIZE 100 #define PUTTYCS_PREF_CMDHISTORY_ENTRY _T( "cmdhistory%02d" ) @@ -116,7 +129,6 @@ #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_WINDOW_OPACITY _T( "windowOpacity" ) #define PUTTYCS_PREF_AUTO_ARRANGE _T( "autoArrange" ) @@ -124,6 +136,11 @@ #define PUTTYCS_PREF_AUTO_ARRANGE_CASCADE 2 #define PUTTYCS_PREF_AUTO_ARRANGE_TILE 3 +#define PUTTYCS_PREF_TILE_METHOD _T( "tileMethod" ) +#define PUTTYCS_PREF_TILE_METHOD_VERTICAL 1 +#define PUTTYCS_PREF_TILE_METHOD_HORIZONTAL 2 +#define PUTTYCS_PREF_TILE_METHOD_CLASSIC 3 + #define PUTTYCS_PREF_CASCADE_WIDTH _T( "cascadeWidth" ) #define PUTTYCS_PREF_CASCADE_HEIGHT _T( "cascadeHeight" ) @@ -137,6 +154,12 @@ #define PUTTYCS_PREF_SEND_CR _T( "sendCR" ) +#define PUTTYCS_PREF_WINDOW_TRANSITION _T( "transition" ) +#define PUTTYCS_PREF_POST_SEND_DELAY _T( "postSendDelay" ) + +#define PUTTYCS_PREF_SAVE_PASSWORD _T( "savePassword" ) +#define PUTTYCS_PREF_PASSWORD _T( "password" ) + #define PUTTYCS_PREF_RUN_ON_SYSTEM_STARTUP _T( "runOnSystemStartup" ) #define PUTTYCS_PREF_CHECK_FOR_UPDATES _T( "checkForUpdates" ) @@ -217,12 +240,15 @@ #define PUTTYCS_CASCADE_MAXIMUM_WIDTH 1042 #define PUTTYCS_CASCADE_MAXIMUM_HEIGHT 802 +#define PUTTYCS_TILE_METHOD_DEFAULT PUTTYCS_PREF_TILE_METHOD_CLASSIC + #define PUTTYCS_OPACITY_MIN 50 #define PUTTYCS_OPACITY_MAX 255 #define PUTTYCS_WND_CLASS _T( "PUTTYCS_WND_CLASS" ) -#define WM_USER_MULTIPLE_INSTANCE WM_USER + 1 -#define WM_USER_TNI_MESSAGE WM_USER + 2 +#define PUTTYCS_WM_COPYDATA_CMD_LINE 1 + +#define WM_USER_TNI_MESSAGE WM_USER + 1 #endif // !defined(DEFINES_H__INCLUDED_) diff --git a/FilterDialog.cpp b/FilterDialog.cpp index 1dc479f..c4ea172 100755 --- a/FilterDialog.cpp +++ b/FilterDialog.cpp @@ -1,7 +1,7 @@ /** * FilterDialog.cpp - PuTTYCS Filter Dialog * - * Copyright (c) 2005 - 2007 Jason Millard (jsm174@gmail.com) + * Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/FilterDialog.h b/FilterDialog.h index 8bfcefa..bf0c867 100755 --- a/FilterDialog.h +++ b/FilterDialog.h @@ -1,7 +1,7 @@ /** * FilterDialog.h - PuTTYCS Filter Dialog header * - * Copyright (c) 2005 - 2007 Jason Millard (jsm174@gmail.com) + * Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/FiltersDialog.cpp b/FiltersDialog.cpp index 3241165..456da0d 100755 --- a/FiltersDialog.cpp +++ b/FiltersDialog.cpp @@ -1,7 +1,7 @@ /** * FiltersDialog.cpp - PuTTYCS Filters Dialog * - * Copyright (c) 2005 - 2007 Jason Millard (jsm174@gmail.com) + * Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/FiltersDialog.h b/FiltersDialog.h index 4818ffc..dce73d1 100755 --- a/FiltersDialog.h +++ b/FiltersDialog.h @@ -1,7 +1,7 @@ /** * FiltersDialog.cpp - PuTTYCS Filters Dialog header * - * Copyright (c) 2005 - 2007 Jason Millard (jsm174@gmail.com) + * Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/PasswordDialog.cpp b/PasswordDialog.cpp index 510e71b..64aa165 100755 --- a/PasswordDialog.cpp +++ b/PasswordDialog.cpp @@ -1,7 +1,7 @@ /** * PasswordDialog.cpp - PuTTYCS Password Dialog * - * Copyright (c) 2005 - 2007 Jason Millard (jsm174@gmail.com) + * Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/PasswordDialog.h b/PasswordDialog.h index 634ef13..78fd319 100755 --- a/PasswordDialog.h +++ b/PasswordDialog.h @@ -1,7 +1,7 @@ /** * PasswordDialog.h - PuTTYCS Password Dialog header * - * Copyright (c) 2005 - 2007 Jason Millard (jsm174@gmail.com) + * Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/PreferencesDialog.cpp b/PreferencesDialog.cpp index 170a0a0..f48d0b5 100755 --- a/PreferencesDialog.cpp +++ b/PreferencesDialog.cpp @@ -1,7 +1,7 @@ /** * PreferencesDialog.cpp - PuTTYCS Preferences Dialog * - * Copyright (c) 2005 - 2007 Jason Millard (jsm174@gmail.com) + * Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,6 +40,9 @@ * up/down arrow keys * Added check for PuTTYCS update * Added run on system startup + * 02/29/2008: Added tiling methods J. Millard + * Added post send transition delay + * Rearranged dialog */ #include "stdafx.h" @@ -79,14 +82,14 @@ void CPreferencesDialog::DoDataExchange(CDataExchange* pDX) 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_SAVEPASSWORD_CHECKBOX, OnSavePasswordCheckbox) 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_EN_CHANGE(IDC_TRANSITION_EDIT, OnChangeTransition) + ON_EN_CHANGE(IDC_POST_SEND_DELAY_EDIT, OnChangePostSendDelay) ON_BN_CLICKED(IDC_EMULATECOPYPASTE_CHECKBOX, OnEmulateCopyPasteCheckbox) ON_BN_CLICKED(IDC_CMDHISTORYSCROLLTHROUGH_CHECKBOX, OnCmdHistoryScrollThroughCheckbox) ON_BN_CLICKED(IDC_TABCOMPLETION_CHECKBOX, OnTabCompletionCheckbox) @@ -95,8 +98,12 @@ BEGIN_MESSAGE_MAP(CPreferencesDialog, CDialog) ON_BN_CLICKED(IDC_CHECKFORUPDATES_CHECKBOX, OnCheckForUpdatesCheckbox) ON_EN_CHANGE(IDC_CASCADE_HEIGHT_EDIT, OnChangeCascadeHeightEdit) ON_EN_CHANGE(IDC_CASCADE_WIDTH_EDIT, OnChangeCascadeWidthEdit) + 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_TILEMETHOD_VERTICAL_RADIO, OnTileMethodRadio) + ON_BN_CLICKED(IDC_TILEMETHOD_HORIZONTAL_RADIO, OnTileMethodRadio) + ON_BN_CLICKED(IDC_TILEMETHOD_CLASSIC_RADIO, OnTileMethodRadio) ON_BN_CLICKED(IDC_FIND_BUTTON, OnFindButton) ON_BN_CLICKED(IDC_OK_BUTTON, OnOKButton) ON_WM_HSCROLL() @@ -104,24 +111,6 @@ BEGIN_MESSAGE_MAP(CPreferencesDialog, CDialog) //}}AFX_MSG_MAP END_MESSAGE_MAP() -/** - * CPreferencesDialog::getSavePassword() - */ - -int CPreferencesDialog::getSavePassword() -{ - return m_iSavePassword; -} - -/** - * CPreferencesDialog::setSavePassword() - */ - -void CPreferencesDialog::setSavePassword( int iSavePassword ) -{ - m_iSavePassword = iSavePassword; -} - /** * CPreferencesDialog::getAutoArrange() */ @@ -176,6 +165,24 @@ void CPreferencesDialog::setArrangeOnStartup( int iArrangeOnStartup ) m_iArrangeOnStartup = iArrangeOnStartup; } +/** + * CPreferencesDialog::getTileMethod() + */ + +int CPreferencesDialog::getTileMethod() +{ + return m_iTileMethod; +} + +/** + * CPreferencesDialog::setTileMethod() + */ + +void CPreferencesDialog::setTileMethod( int iTileMethod) +{ + m_iTileMethod = iTileMethod; +} + /** * CPreferencesDialog::getCascadeWidth() */ @@ -284,24 +291,6 @@ void CPreferencesDialog::setMinimizeToSysTray( int iMinimizeToSysTray ) m_iMinimizeToSysTray = iMinimizeToSysTray; } -/** - * CPreferencesDialog::getTransition() - */ - -int CPreferencesDialog::getTransition() -{ - return m_iTransition; -} - -/** - * CPreferencesDialog::setTransition() - */ - -void CPreferencesDialog::setTransition( int iTransition ) -{ - m_iTransition = iTransition; -} - /** * CPreferencesDialog::getOpacity() */ @@ -374,6 +363,60 @@ void CPreferencesDialog::setEmulateCopyPaste( int iEmulateCopyPaste ) m_iEmulateCopyPaste = iEmulateCopyPaste; } +/** + * CPreferencesDialog::getTransition() + */ + +int CPreferencesDialog::getTransition() +{ + return m_iTransition; +} + +/** + * CPreferencesDialog::setTransition() + */ + +void CPreferencesDialog::setTransition( int iTransition ) +{ + m_iTransition = iTransition; +} + +/** + * CPreferencesDialog::getPostSendDelay() + */ + +int CPreferencesDialog::getPostSendDelay() +{ + return m_iPostSendDelay; +} + +/** + * CPreferencesDialog::setPostSendDelay() + */ + +void CPreferencesDialog::setPostSendDelay( int iPostSendDelay ) +{ + m_iPostSendDelay = iPostSendDelay; +} + +/** + * CPreferencesDialog::getSavePassword() + */ + +int CPreferencesDialog::getSavePassword() +{ + return m_iSavePassword; +} + +/** + * CPreferencesDialog::setSavePassword() + */ + +void CPreferencesDialog::setSavePassword( int iSavePassword ) +{ + m_iSavePassword = iSavePassword; +} + /** * CPreferencesDialog::getRunOnSystemStartup() */ @@ -464,8 +507,14 @@ BOOL CPreferencesDialog::OnInitDialog() CheckDlgButton( IDC_MINIMIZETOSYSTRAY_CHECKBOX, m_iMinimizeToSysTray ); - SetDlgItemInt( IDC_TRANSITION_EDIT, - m_iTransition ); + CheckDlgButton( IDC_TILEMETHOD_VERTICAL_RADIO, + (m_iTileMethod == PUTTYCS_PREF_TILE_METHOD_VERTICAL) ); + + CheckDlgButton( IDC_TILEMETHOD_HORIZONTAL_RADIO, + (m_iTileMethod == PUTTYCS_PREF_TILE_METHOD_HORIZONTAL) ); + + CheckDlgButton( IDC_TILEMETHOD_CLASSIC_RADIO, + (m_iTileMethod == PUTTYCS_PREF_TILE_METHOD_CLASSIC) ); SetDlgItemInt( IDC_CASCADE_WIDTH_EDIT, m_iCascadeWidth ); @@ -502,6 +551,12 @@ BOOL CPreferencesDialog::OnInitDialog() CheckDlgButton( IDC_EMULATECOPYPASTE_CHECKBOX, m_iEmulateCopyPaste ); + SetDlgItemInt( IDC_TRANSITION_EDIT, + m_iTransition ); + + SetDlgItemInt( IDC_POST_SEND_DELAY_EDIT, + m_iPostSendDelay ); + CheckDlgButton( IDC_RUNONSYSTEMSTARTUP_CHECKBOX, m_iRunOnSystemStartup ); @@ -528,12 +583,14 @@ void CPreferencesDialog::UpdateDialog() ((CButton*) GetDlgItem(IDC_OK_BUTTON))-> EnableWindow( (m_iTransition >= 1) && (m_iTransition <= 1500) && + (m_iPostSendDelay >= 1) && + (m_iPostSendDelay <= 1500) && (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) ); - + (m_iCascadeHeight <= PUTTYCS_CASCADE_MAXIMUM_HEIGHT) ); + float fPercent = ((float) (m_iOpacity - PUTTYCS_OPACITY_MIN) / (float) ((PUTTYCS_OPACITY_MAX + 1) - @@ -562,18 +619,6 @@ void CPreferencesDialog::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollB CDialog::OnHScroll(nSBCode, nPos, pScrollBar); } -/** - * CPreferencesDialog::OnSavePasswordCheckbox() - */ - -void CPreferencesDialog::OnSavePasswordCheckbox() -{ - m_iSavePassword = - IsDlgButtonChecked( IDC_SAVEPASSWORD_CHECKBOX ); - - UpdateDialog(); -} - /** * CPreferencesDialog::OnAutoArrangeRadio() */ @@ -591,6 +636,23 @@ void CPreferencesDialog::OnAutoArrangeRadio() UpdateDialog(); } +/** + * CPreferencesDialog::OnTileMethodRadio() + */ + +void CPreferencesDialog::OnTileMethodRadio() +{ + m_iTileMethod = + ( (((CButton*) GetDlgItem(IDC_TILEMETHOD_VERTICAL_RADIO))-> + GetCheck() * PUTTYCS_PREF_TILE_METHOD_VERTICAL) + + (((CButton*) GetDlgItem(IDC_TILEMETHOD_HORIZONTAL_RADIO))-> + GetCheck() * PUTTYCS_PREF_TILE_METHOD_HORIZONTAL) + + (((CButton*) GetDlgItem(IDC_TILEMETHOD_CLASSIC_RADIO))-> + GetCheck() * PUTTYCS_PREF_TILE_METHOD_CLASSIC) ); + + UpdateDialog(); +} + /** * CPreferencesDialog::OnAutoMinimizeCheckbox() */ @@ -737,18 +799,6 @@ void CPreferencesDialog::OnMinimizeToSysTrayCheckbox() IsDlgButtonChecked( IDC_MINIMIZETOSYSTRAY_CHECKBOX ); } -/** - * CPreferencesDialog::OnChangeTransition() - */ - -void CPreferencesDialog::OnChangeTransition() -{ - m_iTransition = - GetDlgItemInt( IDC_TRANSITION_EDIT ); - - UpdateDialog(); -} - /** * CPreferencesDialog::OnTabCompletionCheckbox() */ @@ -779,6 +829,42 @@ void CPreferencesDialog::OnEmulateCopyPasteCheckbox() IsDlgButtonChecked( IDC_EMULATECOPYPASTE_CHECKBOX ); } +/** + * CPreferencesDialog::OnChangeTransition() + */ + +void CPreferencesDialog::OnChangeTransition() +{ + m_iTransition = + GetDlgItemInt( IDC_TRANSITION_EDIT ); + + UpdateDialog(); +} + +/** + * CPreferencesDialog::OnChangePostSendDelay() + */ + +void CPreferencesDialog::OnChangePostSendDelay() +{ + m_iPostSendDelay = + GetDlgItemInt( IDC_POST_SEND_DELAY_EDIT ); + + UpdateDialog(); +} + +/** + * CPreferencesDialog::OnSavePasswordCheckbox() + */ + +void CPreferencesDialog::OnSavePasswordCheckbox() +{ + m_iSavePassword = + IsDlgButtonChecked( IDC_SAVEPASSWORD_CHECKBOX ); + + UpdateDialog(); +} + /** * CPreferencesDialog::OnRunOnSystemStartupCheckbox() */ diff --git a/PreferencesDialog.h b/PreferencesDialog.h index 2c5388f..2c20f46 100755 --- a/PreferencesDialog.h +++ b/PreferencesDialog.h @@ -1,7 +1,7 @@ /** * PreferencesDialog.h - PuTTYCS Preferences Dialog header * - * Copyright (c) 2005 - 2007 Jason Millard (jsm174@gmail.com) + * Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,6 +41,9 @@ * up/down arrow keys * Added check for PuTTYCS update * Added run on system startup + * 02/29/2008: Added tiling methods J. Millard + * Added post send transition delay + * Rearranged dialog */ #if !defined(AFX_PREFERENCESDLG_H__4CD996C9_091F_4F4D_BFE3_EDD9236AB74B__INCLUDED_) @@ -61,10 +64,7 @@ class CPreferencesDialog : public CDialog enum { IDD = IDD_PREFERENCES_DIALOG }; // NOTE: the ClassWizard will add data members here //}}AFX_DATA - - int getSavePassword(); - void setSavePassword( int iSavePassword ); - + int getAutoArrange(); void setAutoArrange( int iAutoArrange ); @@ -74,6 +74,9 @@ class CPreferencesDialog : public CDialog int getArrangeOnStartup(); void setArrangeOnStartup( int iArrangeOnStartup ); + int getTileMethod(); + void setTileMethod( int iTileMethod ); + int getCascadeWidth(); void setCascadeWidth( int iCascadeWidth ); @@ -95,9 +98,6 @@ class CPreferencesDialog : public CDialog int getOpacity(); void setOpacity( int iOpacity ); - int getTransition(); - void setTransition( int iTransition ); - int getTabCompletion(); void setTabCompletion( int iTabCompletion ); @@ -107,6 +107,15 @@ class CPreferencesDialog : public CDialog int getEmulateCopyPaste(); void setEmulateCopyPaste( int iEmulateCopyPaste ); + int getTransition(); + void setTransition( int iTransition ); + + int getPostSendDelay(); + void setPostSendDelay( int iPostSendDelay ); + + int getSavePassword(); + void setSavePassword( int iSavePassword ); + int getRunOnSystemStartup(); void setRunOnSystemStartup( int iRunOnSystemStartup ); @@ -123,10 +132,12 @@ class CPreferencesDialog : public CDialog // Implementation protected: - int m_iSavePassword; int m_iAutoArrange; int m_iAutoMinimize; int m_iArrangeOnStartup; + + int m_iTileMethod; + int m_iCascadeWidth; int m_iCascadeHeight; @@ -135,27 +146,34 @@ class CPreferencesDialog : public CDialog int m_iAlwaysOnTop; int m_iMinimizeToSysTray; int m_iOpacity; - int m_iTransition; + int m_iEmulateCopyPaste; int m_iCmdHistoryScrollThrough; int m_iTabCompletion; + + int m_iTransition; + int m_iPostSendDelay; + + int m_iSavePassword; int m_iRunOnSystemStartup; int m_iCheckForUpdates; // Generated message map functions //{{AFX_MSG(CPreferencesDialog) virtual BOOL OnInitDialog(); - afx_msg void OnSavePasswordCheckbox(); afx_msg void OnAutoArrangeRadio(); + afx_msg void OnTileMethodRadio(); afx_msg void OnAutoMinimizeCheckbox(); afx_msg void OnArrangeOnStartupCheckbox(); afx_msg void OnUnhideOnExitCheckbox(); afx_msg void OnToolWindowCheckbox(); afx_msg void OnAlwaysOnTopCheckbox(); - afx_msg void OnChangeTransition(); afx_msg void OnEmulateCopyPasteCheckbox(); afx_msg void OnCmdHistoryScrollThroughCheckbox(); afx_msg void OnTabCompletionCheckbox(); + afx_msg void OnChangeTransition(); + afx_msg void OnChangePostSendDelay(); + afx_msg void OnSavePasswordCheckbox(); afx_msg void OnCheckForUpdatesCheckbox(); afx_msg void OnRunOnSystemStartupCheckbox(); afx_msg void OnOKButton(); diff --git a/PuTTYCS.clw b/PuTTYCS.clw index f54ba27..c71f209 100755 --- a/PuTTYCS.clw +++ b/PuTTYCS.clw @@ -19,13 +19,13 @@ Class7=CPuTTYCSApp Class8=CPuTTYCSDialog ResourceCount=7 -Resource1=IDD_FILTERS_DIALOG -Resource2=IDD_PASSWORD_DIALOG -Resource3=IDM_SYSTRAY_MENU -Resource4=IDD_ABOUT_DIALOG -Resource5=IDD_PUTTYCS_DIALOG -Resource6=IDD_FILTER_DIALOG -Resource7=IDD_PREFERENCES_DIALOG +Resource1=IDD_PREFERENCES_DIALOG +Resource2=IDD_FILTER_DIALOG +Resource3=IDD_PUTTYCS_DIALOG +Resource4=IDD_PASSWORD_DIALOG +Resource5=IDD_ABOUT_DIALOG +Resource6=IDD_FILTERS_DIALOG +Resource7=IDM_SYSTRAY_MENU [CLS:CAboutDialog] Type=0 @@ -84,7 +84,7 @@ Type=0 BaseClass=CDialog HeaderFile=PuTTYCSDialog.h ImplementationFile=PuTTYCSDialog.cpp -LastObject=IDC_CTRLR_BUTTON +LastObject=CPuTTYCSDialog Filter=D VirtualFilter=dWC @@ -144,45 +144,6 @@ Control2=IDC_PASSWORD_CEDIT,edit,1350631584 Control3=IDC_OK_BUTTON,button,1342242817 Control4=IDCANCEL,button,1342242816 -[DLG:IDD_PREFERENCES_DIALOG] -Type=1 -Class=CPreferencesDialog -ControlCount=34 -Control1=IDC_STATIC,button,1342177287 -Control2=IDC_TOOLWINDOW_CHECKBOX,button,1342242819 -Control3=IDC_ALWAYSONTOP_CHECKBOX,button,1342242819 -Control4=IDC_MINIMIZETOSYSTRAY_CHECKBOX,button,1342242819 -Control5=IDC_STATIC,static,1342308352 -Control6=IDC_TRANSITION_EDIT,edit,1350639744 -Control7=IDC_STATIC,static,1342308352 -Control8=IDC_OPACITY1_STATIC,static,1342308864 -Control9=IDC_OPACITY_SLIDER,msctls_trackbar32,1342242816 -Control10=IDC_OPACITY2_STATIC,static,1342308864 -Control11=IDC_STATIC,button,1342177287 -Control12=IDC_AUTOARRANGE_OFF_RADIO,button,1342308361 -Control13=IDC_AUTOARRANGE_CASCADE_RADIO,button,1342177289 -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,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_CMDHISTORYSCROLLTHROUGH_CHECKBOX,button,1342242819 -Control27=IDC_EMULATECOPYPASTE_CHECKBOX,button,1342242819 -Control28=IDC_STATIC,button,1342177287 -Control29=IDC_SAVEPASSWORD_CHECKBOX,button,1342242819 -Control30=IDC_STATIC,button,1342177287 -Control31=IDC_RUNONSYSTEMSTARTUP_CHECKBOX,button,1342242819 -Control32=IDC_CHECKFORUPDATES_CHECKBOX,button,1342242819 -Control33=IDC_OK_BUTTON,button,1342242817 -Control34=IDCANCEL,button,1342242816 - [DLG:IDD_PUTTYCS_DIALOG] Type=1 Class=CPuTTYCSDialog @@ -235,3 +196,48 @@ Command8=IDMI_SYSTRAYABOUT_MENUITEM Command9=IDMI_SYSTRAYEXIT_MENUITEM CommandCount=9 +[DLG:IDD_PREFERENCES_DIALOG] +Type=1 +Class=? +ControlCount=40 +Control1=IDC_STATIC,button,1342177287 +Control2=IDC_TOOLWINDOW_CHECKBOX,button,1342242819 +Control3=IDC_ALWAYSONTOP_CHECKBOX,button,1342242819 +Control4=IDC_MINIMIZETOSYSTRAY_CHECKBOX,button,1342242819 +Control5=IDC_OPACITY1_STATIC,static,1342308864 +Control6=IDC_OPACITY_SLIDER,msctls_trackbar32,1342242816 +Control7=IDC_OPACITY2_STATIC,static,1342308864 +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_TILEMETHOD_VERTICAL_RADIO,button,1342308361 +Control17=IDC_TILEMETHOD_HORIZONTAL_RADIO,button,1342177289 +Control18=IDC_TILEMETHOD_CLASSIC_RADIO,button,1342177289 +Control19=IDC_STATIC,button,1342177287 +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_CMDHISTORYSCROLLTHROUGH_CHECKBOX,button,1342242819 +Control27=IDC_EMULATECOPYPASTE_CHECKBOX,button,1342242819 +Control28=IDC_STATIC,button,1342177287 +Control29=IDC_STATIC,static,1342308352 +Control30=IDC_TRANSITION_EDIT,edit,1350639744 +Control31=IDC_STATIC,static,1342308352 +Control32=IDC_STATIC,static,1342308352 +Control33=IDC_POST_SEND_DELAY_EDIT,edit,1350639744 +Control34=IDC_STATIC,static,1342308352 +Control35=IDC_STATIC,button,1342177287 +Control36=IDC_SAVEPASSWORD_CHECKBOX,button,1342242819 +Control37=IDC_RUNONSYSTEMSTARTUP_CHECKBOX,button,1342242819 +Control38=IDC_CHECKFORUPDATES_CHECKBOX,button,1342242819 +Control39=IDC_OK_BUTTON,button,1342242817 +Control40=IDCANCEL,button,1342242816 + diff --git a/PuTTYCS.cpp b/PuTTYCS.cpp index c4cf1d1..5f2ac08 100755 --- a/PuTTYCS.cpp +++ b/PuTTYCS.cpp @@ -1,7 +1,7 @@ /** * PuTTYCS.cpp - PuTTYCS Main Application * - * Copyright (c) 2005 - 2007 Jason Millard (jsm174@gmail.com) + * Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,6 +32,8 @@ * 12/19/2005: Added window opacity J. Millard * 05/27/2006: Added custom window class for J. Millard * better multiple instance detection + * 02/29/2008: Added code to send command line to J. Millard + * running instance of PuTTYCS */ #include "stdafx.h" @@ -106,15 +108,17 @@ BOOL CPuTTYCSApp::InitInstance() * Search for existing application */ - CWnd* pAppWnd = - CWnd::FindWindow( PUTTYCS_WND_CLASS, NULL ); + CWnd* pAppWnd = CWnd::FindWindow( PUTTYCS_WND_CLASS, NULL ); if ( pAppWnd ) - { - pAppWnd->SendMessage( WM_USER_MULTIPLE_INSTANCE, - NULL, - NULL ); - } + { + COPYDATASTRUCT cds; + cds.dwData = PUTTYCS_WM_COPYDATA_CMD_LINE; + cds.cbData = (lstrlen(GetCommandLine()) + 1) * sizeof(TCHAR); + cds.lpData = (void*) GetCommandLine(); + + pAppWnd->SendMessage(WM_COPYDATA, NULL, (LPARAM) &cds); + } else { CPuTTYCSDialog dialog; diff --git a/PuTTYCS.h b/PuTTYCS.h index efbf7c3..9935b4f 100755 --- a/PuTTYCS.h +++ b/PuTTYCS.h @@ -1,7 +1,7 @@ /** * PuTTYCS.h - PuTTYCS Main Application header * - * Copyright (c) 2005 - 2007 Jason Millard (jsm174@gmail.com) + * Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/PuTTYCS.rc b/PuTTYCS.rc index c5b2ab8..f0b9bfd 100755 --- a/PuTTYCS.rc +++ b/PuTTYCS.rc @@ -74,8 +74,8 @@ IDR_MAINFRAME ICON DISCARDABLE "res\\PuTTYCS.ico" // IDD_PUTTYCS_DIALOG DIALOGEX 0, 0, 254, 166 -STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | - WS_SYSMENU +STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | + WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_APPWINDOW CLASS "PUTTYCS_WND_CLASS" FONT 8, "MS Sans Serif" @@ -132,70 +132,6 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,129,38,50,14 END -IDD_PREFERENCES_DIALOG DIALOGEX 0, 0, 412, 174 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Preferences" -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - GROUPBOX "Window:",IDC_STATIC,7,6,195,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 - CONTROL "Minimize to system tray",IDC_MINIMIZETOSYSTRAY_CHECKBOX, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,46,84,10 - LTEXT "Transition:",IDC_STATIC,108,21,34,10 - EDITTEXT IDC_TRANSITION_EDIT,145,18,22,12,ES_AUTOHSCROLL | - ES_NUMBER - LTEXT "ms",IDC_STATIC,171,21,10,10 - LTEXT "Opacity:",IDC_OPACITY1_STATIC,108,46,34,10, - SS_CENTERIMAGE - CONTROL "Slider1",IDC_OPACITY_SLIDER,"msctls_trackbar32", - WS_TABSTOP,141,45,35,11 - LTEXT "100%",IDC_OPACITY2_STATIC,177,46,18,10,SS_CENTERIMAGE - GROUPBOX "Auto arrange:",IDC_STATIC,7,66,195,81 - CONTROL "Off",IDC_AUTOARRANGE_OFF_RADIO,"Button", - BS_AUTORADIOBUTTON | WS_GROUP,13,81,44,10 - CONTROL "Cascade",IDC_AUTOARRANGE_CASCADE_RADIO,"Button", - BS_AUTORADIOBUTTON,13,93,44,10 - CONTROL "Tile",IDC_AUTOARRANGE_TILE_RADIO,"Button", - BS_AUTORADIOBUTTON,13,105,44,10 - CONTROL "Minimize other PuTTYs",IDC_AUTOMINIMIZE_CHECKBOX,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,108,81,89,10 - CONTROL "Arrange on startup",IDC_ARRANGEONSTARTUP_CHECKBOX, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,93,74,10 - CONTROL "Unhide PuTTYs on exit",IDC_UNHIDEONEXIT_CHECKBOX,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,108,105,89,10 - CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,12,121,186,1 - LTEXT "Cascade dimensions:",IDC_STATIC,19,130,68,8 - EDITTEXT IDC_CASCADE_WIDTH_EDIT,95,128,22,12,ES_AUTOHSCROLL | - ES_NUMBER - LTEXT "x",IDC_STATIC,121,130,8,8,0,WS_EX_TRANSPARENT - EDITTEXT IDC_CASCADE_HEIGHT_EDIT,130,128,22,12,ES_AUTOHSCROLL | - ES_NUMBER - PUSHBUTTON "&Find",IDC_FIND_BUTTON,157,127,32,14 - GROUPBOX "Keyboard/Mouse:",IDC_STATIC,210,6,195,56 - CONTROL "Enable Tab completion",IDC_TABCOMPLETION_CHECKBOX, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,216,20,155,10 - CONTROL "Scroll command history with up/down arrows keys", - IDC_CMDHISTORYSCROLLTHROUGH_CHECKBOX,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,216,33,183,10 - CONTROL "Selection copies, right button pastes", - IDC_EMULATECOPYPASTE_CHECKBOX,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,216,46,155,10 - GROUPBOX "Password:",IDC_STATIC,209,66,196,33 - CONTROL "Save password",IDC_SAVEPASSWORD_CHECKBOX,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,215,81,63,10 - GROUPBOX "Miscellaneous:",IDC_STATIC,209,104,196,43 - CONTROL "Run on system startup",IDC_RUNONSYSTEMSTARTUP_CHECKBOX, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,216,118,136,10 - CONTROL "Check for updates on startup", - IDC_CHECKFORUPDATES_CHECKBOX,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,216,131,136,10 - DEFPUSHBUTTON "OK",IDC_OK_BUTTON,303,154,50,14 - PUSHBUTTON "Cancel",IDCANCEL,355,154,50,14 -END - IDD_FILTERS_DIALOG DIALOG DISCARDABLE 0, 0, 200, 178 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "PuTTY Filters" @@ -255,6 +191,80 @@ BEGIN WS_TABSTOP,75,75,41,19 END +IDD_PREFERENCES_DIALOG DIALOGEX 0, 0, 409, 207 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Preferences" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Window:",IDC_STATIC,7,6,195,58 + CONTROL "Tool window",IDC_TOOLWINDOW_CHECKBOX,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,14,20,72,10 + CONTROL "Always on top",IDC_ALWAYSONTOP_CHECKBOX,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,14,34,72,10 + CONTROL "Minimize to system tray",IDC_MINIMIZETOSYSTRAY_CHECKBOX, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,47,84,10 + LTEXT "Opacity:",IDC_OPACITY1_STATIC,108,20,34,10, + SS_CENTERIMAGE + CONTROL "Slider1",IDC_OPACITY_SLIDER,"msctls_trackbar32", + WS_TABSTOP,141,19,35,11 + LTEXT "100%",IDC_OPACITY2_STATIC,177,20,18,10,SS_CENTERIMAGE + GROUPBOX "Auto arrange:",IDC_STATIC,7,67,195,58 + CONTROL "Off",IDC_AUTOARRANGE_OFF_RADIO,"Button", + BS_AUTORADIOBUTTON | WS_GROUP,13,83,44,10 + CONTROL "Cascade",IDC_AUTOARRANGE_CASCADE_RADIO,"Button", + BS_AUTORADIOBUTTON,13,95,44,10 + CONTROL "Tile",IDC_AUTOARRANGE_TILE_RADIO,"Button", + BS_AUTORADIOBUTTON,13,107,44,10 + CONTROL "Minimize other PuTTYs",IDC_AUTOMINIMIZE_CHECKBOX,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,109,83,89,10 + CONTROL "Arrange on startup",IDC_ARRANGEONSTARTUP_CHECKBOX, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,109,95,74,10 + CONTROL "Unhide PuTTYs on exit",IDC_UNHIDEONEXIT_CHECKBOX,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,109,107,89,10 + GROUPBOX "Tile method:",IDC_STATIC,7,129,95,54 + CONTROL "Vertical",IDC_TILEMETHOD_VERTICAL_RADIO,"Button", + BS_AUTORADIOBUTTON | WS_GROUP,13,144,39,10 + CONTROL "Horizontal",IDC_TILEMETHOD_HORIZONTAL_RADIO,"Button", + BS_AUTORADIOBUTTON,13,155,47,10 + CONTROL "Classic",IDC_TILEMETHOD_CLASSIC_RADIO,"Button", + BS_AUTORADIOBUTTON,13,166,38,10 + GROUPBOX "Cascade dimensions:",IDC_STATIC,107,129,95,54 + EDITTEXT IDC_CASCADE_WIDTH_EDIT,116,150,22,12,ES_AUTOHSCROLL | + ES_NUMBER + LTEXT "x",IDC_STATIC,142,152,8,8,0,WS_EX_TRANSPARENT + EDITTEXT IDC_CASCADE_HEIGHT_EDIT,151,150,22,12,ES_AUTOHSCROLL | + ES_NUMBER + PUSHBUTTON "...",IDC_FIND_BUTTON,177,149,15,14 + GROUPBOX "Keyboard/Mouse:",IDC_STATIC,207,6,195,58 + CONTROL "Enable Tab completion",IDC_TABCOMPLETION_CHECKBOX, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,214,20,155,10 + CONTROL "Scroll command history with up/down arrows keys", + IDC_CMDHISTORYSCROLLTHROUGH_CHECKBOX,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,214,34,182,10 + CONTROL "Selection copies, right button pastes", + IDC_EMULATECOPYPASTE_CHECKBOX,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,214,47,155,10 + GROUPBOX "Transition delays: (Advanced)",IDC_STATIC,207,67,195,58 + LTEXT "Window",IDC_STATIC,216,84,32,10 + EDITTEXT IDC_TRANSITION_EDIT,254,81,22,12,ES_AUTOHSCROLL | + ES_NUMBER + LTEXT "ms",IDC_STATIC,279,84,11,10 + LTEXT "Post send ",IDC_STATIC,216,98,33,10 + EDITTEXT IDC_POST_SEND_DELAY_EDIT,254,97,22,12,ES_AUTOHSCROLL | + ES_NUMBER + LTEXT "ms",IDC_STATIC,279,98,11,10 + GROUPBOX "Miscellaneous:",IDC_STATIC,207,129,195,54 + CONTROL "Save password",IDC_SAVEPASSWORD_CHECKBOX,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,214,144,63,10 + CONTROL "Run on system startup",IDC_RUNONSYSTEMSTARTUP_CHECKBOX, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,214,155,136,10 + CONTROL "Check for updates on startup", + IDC_CHECKFORUPDATES_CHECKBOX,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,214,166,136,10 + DEFPUSHBUTTON "OK",IDC_OK_BUTTON,300,187,50,14 + PUSHBUTTON "Cancel",IDCANCEL,352,187,50,14 +END + #ifndef _MAC ///////////////////////////////////////////////////////////////////////////// @@ -263,8 +273,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,7,0,0 - PRODUCTVERSION 1,7,0,0 + FILEVERSION 1,8,1,0 + PRODUCTVERSION 1,8,1,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -282,14 +292,14 @@ BEGIN VALUE "Comments", "\0" VALUE "CompanyName", "Millard Software\0" VALUE "FileDescription", "PuTTYCS\0" - VALUE "FileVersion", "1, 7, 0, 0\0" + VALUE "FileVersion", "1, 8, 1, 0\0" VALUE "InternalName", "PuTTYCS\0" - VALUE "LegalCopyright", "Copyright (C) 2005 - 2007\0" + VALUE "LegalCopyright", "Copyright (C) 2005 - 2008\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "PuTTYCS.EXE\0" VALUE "PrivateBuild", "\0" - VALUE "ProductName", "PuTTYCS - PuTTY Command Sender 1.7\0" - VALUE "ProductVersion", "1, 7, 0, 0\0" + VALUE "ProductName", "PuTTYCS - PuTTY Command Sender 1.8.1\0" + VALUE "ProductVersion", "1, 8, 1, 0\0" VALUE "SpecialBuild", "\0" END END @@ -326,14 +336,6 @@ BEGIN BOTTOMMARGIN, 52 END - IDD_PREFERENCES_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 405 - TOPMARGIN, 7 - BOTTOMMARGIN, 167 - END - IDD_FILTERS_DIALOG, DIALOG BEGIN LEFTMARGIN, 7 @@ -358,6 +360,14 @@ BEGIN TOPMARGIN, 7 BOTTOMMARGIN, 122 END + + IDD_PREFERENCES_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 402 + TOPMARGIN, 7 + BOTTOMMARGIN, 200 + END END #endif // APSTUDIO_INVOKED diff --git a/PuTTYCSDialog.cpp b/PuTTYCSDialog.cpp index 82776f9..8be6458 100755 --- a/PuTTYCSDialog.cpp +++ b/PuTTYCSDialog.cpp @@ -1,7 +1,7 @@ /** * PuTTYCSDialog.cpp - PuTTYCS Main Dialog * - * Copyright (c) 2005 - 2007 Jason Millard (jsm174@gmail.com) + * Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -57,6 +57,10 @@ * up/down arrow keys * Added check for PuTTYCS update * Added run on system startup + * 02/29/2008: Added horizontal/vertical tiling J. Millard + * Updated cascade logic + * Added post send transition delay + * Added --script command line option */ #include "stdafx.h" @@ -185,11 +189,11 @@ void CPuTTYCSDialog::LoadPreferences() m_csaFilters.RemoveAll(); - for ( int loop = 0; - loop < PUTTYCS_PREF_FILTER_MAX_SIZE; loop++ ) + for ( int iLoop = 0; + iLoop < PUTTYCS_PREF_FILTER_MAX_SIZE; iLoop++ ) { CString csAttribute; - csAttribute.Format( PUTTYCS_PREF_FILTER_ENTRY, loop ); + csAttribute.Format( PUTTYCS_PREF_FILTER_ENTRY, iLoop ); CString csValue = AfxGetApp()->GetProfileString( @@ -228,11 +232,11 @@ void CPuTTYCSDialog::LoadPreferences() m_csaCmdHistory.RemoveAll(); - for ( loop = 0; - loop < PUTTYCS_PREF_CMDHISTORY_MAX_SIZE; loop++ ) + for ( iLoop = 0; + iLoop < PUTTYCS_PREF_CMDHISTORY_MAX_SIZE; iLoop++ ) { CString csAttribute; - csAttribute.Format( PUTTYCS_PREF_CMDHISTORY_ENTRY, loop ); + csAttribute.Format( PUTTYCS_PREF_CMDHISTORY_ENTRY, iLoop ); CString csValue = AfxGetApp()->GetProfileString( @@ -246,28 +250,7 @@ void CPuTTYCSDialog::LoadPreferences() } } - m_iCmdHistory = m_csaCmdHistory.GetSize(); - - /** - * Password - */ - - m_iSavePassword = - AfxGetApp()->GetProfileInt( - PUTTYCS_APP_NAME, PUTTYCS_PREF_SAVE_PASSWORD, 0 ); - - if ( m_iSavePassword ) - { - m_csPassword = - AfxGetApp()->GetProfileString( - PUTTYCS_APP_NAME, - PUTTYCS_PREF_PASSWORD, - PUTTYCS_EMPTY_STRING ); - } - else - { - m_csPassword = PUTTYCS_EMPTY_STRING; - } + m_iCmdHistory = m_csaCmdHistory.GetSize(); /** * Window settings @@ -285,10 +268,6 @@ void CPuTTYCSDialog::LoadPreferences() AfxGetApp()->GetProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_MINIMIZE_TO_SYSTRAY, 1 ); - m_iTransition = - AfxGetApp()->GetProfileInt( - PUTTYCS_APP_NAME, PUTTYCS_PREF_WINDOW_TRANSITION, 25 ); - m_iOpacity = AfxGetApp()->GetProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_WINDOW_OPACITY, @@ -314,6 +293,18 @@ void CPuTTYCSDialog::LoadPreferences() AfxGetApp()->GetProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_UNHIDE_ON_EXIT, 1 ); + /** + * Tile method + */ + + m_iTileMethod = + AfxGetApp()->GetProfileInt( + PUTTYCS_APP_NAME, PUTTYCS_PREF_TILE_METHOD, PUTTYCS_TILE_METHOD_DEFAULT ); + + /** + * Cascade dimensions + */ + m_iCascadeWidth = AfxGetApp()->GetProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_CASCADE_WIDTH, PUTTYCS_CASCADE_DEFAULT_WIDTH ); @@ -350,6 +341,23 @@ void CPuTTYCSDialog::LoadPreferences() * Miscellenous */ + m_iSavePassword = + AfxGetApp()->GetProfileInt( + PUTTYCS_APP_NAME, PUTTYCS_PREF_SAVE_PASSWORD, 0 ); + + if ( m_iSavePassword ) + { + m_csPassword = + AfxGetApp()->GetProfileString( + PUTTYCS_APP_NAME, + PUTTYCS_PREF_PASSWORD, + PUTTYCS_EMPTY_STRING ); + } + else + { + m_csPassword = PUTTYCS_EMPTY_STRING; + } + m_iRunOnSystemStartup = AfxGetApp()->GetProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_RUN_ON_SYSTEM_STARTUP, 0 ); @@ -359,6 +367,19 @@ void CPuTTYCSDialog::LoadPreferences() m_iCheckForUpdates = AfxGetApp()->GetProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_CHECK_FOR_UPDATES, 1 ); + + /** + * Transition Delays + */ + + m_iTransition = + AfxGetApp()->GetProfileInt( + PUTTYCS_APP_NAME, PUTTYCS_PREF_WINDOW_TRANSITION, 25 ); + + m_iPostSendDelay = + AfxGetApp()->GetProfileInt( + PUTTYCS_APP_NAME, PUTTYCS_PREF_POST_SEND_DELAY, 100 ); + } /** @@ -371,16 +392,16 @@ void CPuTTYCSDialog::SavePreferences() * PuTTY filters */ - for ( int loop = 0; loop < PUTTYCS_PREF_FILTER_MAX_SIZE; loop++ ) + for ( int iLoop = 0; iLoop < PUTTYCS_PREF_FILTER_MAX_SIZE; iLoop++ ) { CString csAttribute; - csAttribute.Format( PUTTYCS_PREF_FILTER_ENTRY, loop ); + csAttribute.Format( PUTTYCS_PREF_FILTER_ENTRY, iLoop ); CString csValue = PUTTYCS_EMPTY_STRING; - if ( loop < m_csaFilters.GetSize() ) + if ( iLoop < m_csaFilters.GetSize() ) { - csValue = m_csaFilters.GetAt( loop ); + csValue = m_csaFilters.GetAt( iLoop ); } AfxGetApp()->WriteProfileString( @@ -394,41 +415,23 @@ void CPuTTYCSDialog::SavePreferences() * Command history */ - for ( loop = 0; - loop < PUTTYCS_PREF_CMDHISTORY_MAX_SIZE; loop++ ) + for ( iLoop = 0; + iLoop < PUTTYCS_PREF_CMDHISTORY_MAX_SIZE; iLoop++ ) { CString csAttribute; - csAttribute.Format( PUTTYCS_PREF_CMDHISTORY_ENTRY, loop ); + csAttribute.Format( PUTTYCS_PREF_CMDHISTORY_ENTRY, iLoop ); CString csValue = PUTTYCS_EMPTY_STRING; - if ( loop < m_csaCmdHistory.GetSize() ) + if ( iLoop < m_csaCmdHistory.GetSize() ) { - csValue = m_csaCmdHistory.GetAt(loop); + csValue = m_csaCmdHistory.GetAt(iLoop); } AfxGetApp()->WriteProfileString( PUTTYCS_APP_NAME, csAttribute, csValue ); } - /** - * Password - */ - - AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, - PUTTYCS_PREF_SAVE_PASSWORD, m_iSavePassword ); - - if ( m_iSavePassword ) - { - AfxGetApp()->WriteProfileString( PUTTYCS_APP_NAME, - PUTTYCS_PREF_PASSWORD, m_csPassword ); - } - else - { - AfxGetApp()->WriteProfileString( PUTTYCS_APP_NAME, - PUTTYCS_PREF_PASSWORD, PUTTYCS_EMPTY_STRING ); - } - /** * Window settings */ @@ -443,9 +446,6 @@ void CPuTTYCSDialog::SavePreferences() AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_MINIMIZE_TO_SYSTRAY, m_iMinimizeToSysTray ); - AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, - PUTTYCS_PREF_WINDOW_TRANSITION, m_iTransition ); - AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_WINDOW_OPACITY, m_iOpacity ); @@ -465,6 +465,17 @@ void CPuTTYCSDialog::SavePreferences() AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_UNHIDE_ON_EXIT, m_iUnhideOnExit ); + /** + * Tile method + */ + + AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, + PUTTYCS_PREF_TILE_METHOD, m_iTileMethod ); + + /** + * Cascade dimensions + */ + AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_CASCADE_WIDTH, m_iCascadeWidth ); @@ -495,6 +506,20 @@ void CPuTTYCSDialog::SavePreferences() * Miscellaneous */ + AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, + PUTTYCS_PREF_SAVE_PASSWORD, m_iSavePassword ); + + if ( m_iSavePassword ) + { + AfxGetApp()->WriteProfileString( PUTTYCS_APP_NAME, + PUTTYCS_PREF_PASSWORD, m_csPassword ); + } + else + { + AfxGetApp()->WriteProfileString( PUTTYCS_APP_NAME, + PUTTYCS_PREF_PASSWORD, PUTTYCS_EMPTY_STRING ); + } + AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_RUN_ON_SYSTEM_STARTUP, m_iRunOnSystemStartup ); @@ -502,6 +527,16 @@ void CPuTTYCSDialog::SavePreferences() AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, PUTTYCS_PREF_CHECK_FOR_UPDATES, m_iCheckForUpdates ); + + /** + * Transition Delays + */ + + AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, + PUTTYCS_PREF_WINDOW_TRANSITION, m_iTransition ); + + AfxGetApp()->WriteProfileInt( PUTTYCS_APP_NAME, + PUTTYCS_PREF_POST_SEND_DELAY, m_iPostSendDelay ); } /** @@ -521,7 +556,6 @@ BEGIN_MESSAGE_MAP(CPuTTYCSDialog, CDialog) ON_WM_CREATE() ON_WM_SYSCOMMAND() ON_WM_PAINT() - ON_MESSAGE(WM_USER_MULTIPLE_INSTANCE, OnMultipleInstance) ON_WM_QUERYDRAGICON() ON_COMMAND(IDMI_SYSTRAYABOUT_MENUITEM, OnAboutButton) ON_CBN_SELCHANGE(IDC_FILTERS_COMBOBOX, OnSelChangeFiltersCombobox) @@ -556,14 +590,15 @@ BEGIN_MESSAGE_MAP(CPuTTYCSDialog, CDialog) ON_BN_CLICKED(IDC_CTRL_BUTTON, OnCtrlButton) ON_BN_CLICKED(IDC_INC_BUTTON, OnIncButton) ON_COMMAND(IDMI_SYSTRAYCHECKFORUPDATES_MENUITEM, OnCheckForUpdates) + ON_BN_CLICKED(IDC_CTRLD_BUTTON, OnCtrlDButton) + ON_BN_CLICKED(IDC_CTRLR_BUTTON, OnCtrlRButton) 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_SYSTRAYPREFERENCES_MENUITEM, OnPreferencesButton) ON_COMMAND(IDMI_SYSTRAYEXIT_MENUITEM, OnOK) - ON_BN_CLICKED(IDC_CTRLD_BUTTON, OnCtrlDButton) - ON_BN_CLICKED(IDC_CTRLR_BUTTON, OnCtrlRButton) + ON_WM_COPYDATA() //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -691,11 +726,11 @@ BOOL CPuTTYCSDialog::DestroyWindow() SortWindows(); - for ( int loop = 0; - loop < m_obaWindows.GetSize(); loop++ ) + for ( int iLoop = 0; + iLoop < m_obaWindows.GetSize(); iLoop++ ) { CWnd* pWnd = - (CWnd*) m_obaWindows.GetAt( loop ); + (CWnd*) m_obaWindows.GetAt( iLoop ); if ( !pWnd->IsWindowVisible() ) { @@ -755,9 +790,9 @@ BOOL CPuTTYCSDialog::OnInitDialog() * PuTTY filters */ - for ( int loop = 0; loop < m_csaFilters.GetSize(); loop++ ) + for ( int iLoop = 0; iLoop < m_csaFilters.GetSize(); iLoop++ ) { - CString csFilter = m_csaFilters.GetAt(loop); + CString csFilter = m_csaFilters.GetAt(iLoop); ((CComboBox*) GetDlgItem(IDC_FILTERS_COMBOBOX))-> AddString(csFilter.Mid(0, @@ -866,7 +901,13 @@ BOOL CPuTTYCSDialog::OnInitDialog() UpdateDialog(); - return FALSE; + /** + * Parse command line options + */ + + ParseCmdLineOptions(); + + return TRUE; } /** @@ -952,12 +993,52 @@ BOOL CPuTTYCSDialog::OnHelpInfo(HELPINFO* pHelpInfo) } /** - * CPuTTYCSDialog::OnMultipleInstance() + * CPuTTYCSDialog::ParseCmdLineOptions() */ -void CPuTTYCSDialog::OnMultipleInstance(WPARAM wParam, LPARAM lParam) +void CPuTTYCSDialog::ParseCmdLineOptions(LPTSTR pCmdLine) { - OnOpenMenuItem(); + if (!m_bDisablePopup) + { + m_bDisablePopup = true; + + CString sMessage; + + int iArgc; + LPTSTR* pArgv = CommandLineToArgv(pCmdLine ? pCmdLine : GetCommandLine(), &iArgc); + + for (int iArg = 1; iArg < iArgc; iArg++) + { + if (pArgv[iArg][0] == '-') + { + if (_tcscmp(pArgv[iArg],PUTTYCS_CMD_SCRIPT)==0 || _tcscmp(pArgv[iArg],PUTTYCS_CMD_SCRIPT_LONG)==0) + { + if (++iArg >= iArgc) + { + sMessage.Format(PUTTYCS_MESSAGEBOX_MISSING_ARGUMENT, PUTTYCS_CMD_SCRIPT, PUTTYCS_CMD_SCRIPT_LONG); + MessageBox(sMessage, PUTTYCS_WINDOW_TITLE_APP, MB_OK); + } + else + { + SendScript( pArgv[iArg] ); + } + } + else if (_tcscmp(pArgv[iArg],PUTTYCS_CMD_HELP)==0 || _tcscmp(pArgv[iArg],PUTTYCS_CMD_HELP_LONG)==0) + { + MessageBox(PUTTYCS_MESSAGEBOX_HELP, PUTTYCS_WINDOW_TITLE_APP, MB_OK); + } + else + { + sMessage.Format( PUTTYCS_MESSAGEBOX_UNKNOWN_OPTION, pArgv[iArg]); + MessageBox(sMessage, PUTTYCS_WINDOW_TITLE_APP, MB_OK); + } + } + } + + LocalFree(pArgv); + + m_bDisablePopup = false; + } } /** @@ -1143,57 +1224,37 @@ CObArray* CPuTTYCSDialog::GetAllWindows() */ void CPuTTYCSDialog::OnCascadeButton() -{ - int x = 0; - int y = 0; - int size = GetSystemMetrics( SM_CYSIZE ); - - int offset = size; - +{ 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 ( (loop % 10) == 0 ) - { - x = offset; - y = size; - - offset += ( size * 8 ); - } - else - { - x += size; - y += size; - } - - pWnd->SendMessage( WM_SYSCOMMAND, SC_RESTORE, 0 ); + int iTotal = m_obaWindows.GetSize(); - pWnd->ShowWindow( SW_HIDE ); + if (iTotal > 0) + { + RECT rectWorkArea; + ::SystemParametersInfo(SPI_GETWORKAREA, NULL, &rectWorkArea, 0); + + int iX = rectWorkArea.left; + int iY = rectWorkArea.top; - pWnd->SetWindowPos( NULL, x, y, 0, 0, SWP_NOSIZE ); - - pWnd->SendMessage( WM_ENTERSIZEMOVE, 0, 0 ); - - pWnd-> - SendMessage( WM_SIZE, - SIZE_RESTORED, - MAKELPARAM( - m_iCascadeWidth, - m_iCascadeHeight) ); + for ( int iLoop = 0; iLoop < iTotal; iLoop++ ) + { + MovePuttyWnd((CWnd*) m_obaWindows.GetAt(iLoop), iX, iY, m_iCascadeWidth, m_iCascadeHeight); - pWnd->SendMessage( WM_EXITSIZEMOVE, 0, 0 ); + iX += GetSystemMetrics(SM_CYCAPTION) - GetSystemMetrics(SM_CYFRAME); + iY += GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYFRAME) - 1; - pWnd->SendMessage( WM_SYSCOMMAND, SC_MINIMIZE, 0 ); - pWnd->SendMessage( WM_SYSCOMMAND, SC_RESTORE, 0 ); + if ( ((iX + m_iCascadeWidth) >= rectWorkArea.right) || + ((iY + m_iCascadeHeight + GetSystemMetrics(SM_CYCAPTION)) >= rectWorkArea.bottom) ) + { + iX = rectWorkArea.left; + iY = rectWorkArea.top; + } + } } RefreshDialog(); @@ -1205,72 +1266,93 @@ void CPuTTYCSDialog::OnCascadeButton() void CPuTTYCSDialog::OnTileButton() { - int x = 0; - int y = 0; - m_obaWindows.RemoveAll(); ::EnumWindows( enumwindowsProc, (LPARAM) this ); SortWindows(); - int size = - m_obaWindows.GetSize(); + int iTotal = m_obaWindows.GetSize(); - if ( size > 0 ) - { - int maxCols = - (size / 4) + ((size % 4) > 0); - - int maxScreenX = GetSystemMetrics(SM_CXFULLSCREEN); - int maxScreenY = GetSystemMetrics(SM_CYFULLSCREEN); + if ( iTotal > 0 ) + { + int iLoop; - int tileHeight = - (maxScreenY / ((size / maxCols) + ((size % maxCols) > 0))); + int iSizeX = 0; + int iSizeY = 0; - int tileWidth = (maxScreenX / maxCols); + int iX = 0; + int iY = 0; - for ( int loop = 0; - loop < m_obaWindows.GetSize(); loop++ ) - { - CWnd* pWnd = - (CWnd*) m_obaWindows.GetAt(loop); - - int offset = GetSystemMetrics( SM_CYSIZE ); + int iColumns; - pWnd-> - SendMessage( WM_SYSCOMMAND, SC_RESTORE, 0 ); - - pWnd->ShowWindow( SW_HIDE ); + RECT rectWorkArea; + ::SystemParametersInfo(SPI_GETWORKAREA, NULL, &rectWorkArea, 0); + + if (m_iTileMethod == PUTTYCS_PREF_TILE_METHOD_CLASSIC) + { + iColumns = (iTotal / 4) + ((iTotal % 4) > 0); - pWnd->SetWindowPos( NULL, x, y, 0, 0, SWP_NOSIZE ); + iSizeY = ((rectWorkArea.bottom - rectWorkArea.top) / ((iTotal / iColumns) + ((iTotal % iColumns) > 0))); + iSizeX = ((rectWorkArea.right - rectWorkArea.left) / iColumns); + + for ( iLoop = 0; iLoop < iTotal; iLoop++ ) + { + MovePuttyWnd((CWnd*) m_obaWindows.GetAt(iLoop), (iX + rectWorkArea.left), (iY + rectWorkArea.top), iSizeX, iSizeY - 20); - x += (tileWidth); + iX += (iSizeX); - if ( x > (tileWidth * (maxCols - 1)) ) + if ( iX > (iSizeX * (iColumns - 1)) ) + { + iX = 0; + iY += iSizeY; + } + } + } + else + { + int iRow; + int iRows = (int) sqrt((double) iTotal); + + int iColumn; + iColumns = iTotal / iRows; + + int iWndIndex = 0; + + if (m_iTileMethod == PUTTYCS_PREF_TILE_METHOD_HORIZONTAL) { - x = 0; - y += tileHeight; + int iTemp = iRows; + iRows = iColumns; + iColumns = iTemp; } - - pWnd-> - SendMessage( WM_ENTERSIZEMOVE, 0, 0 ); - pWnd-> - SendMessage( WM_SIZE, - SIZE_RESTORED, - MAKELPARAM(tileWidth, - tileHeight - 20) ); + iSizeY = (rectWorkArea.bottom - rectWorkArea.top) / iRows; + iSizeX = (rectWorkArea.right - rectWorkArea.left) / iColumns; + + for (iX = rectWorkArea.left, iLoop = 0, iColumn = 1; iColumn <= iColumns && iWndIndex < iTotal; iColumn++) + { + if (iColumn == iColumns) + { + iRows = iTotal - iLoop; + iSizeY = (rectWorkArea.bottom - rectWorkArea.top) / iRows; + } + + iY = rectWorkArea.top; - pWnd-> - SendMessage( WM_EXITSIZEMOVE, 0, 0 ); + for (iRow = 1; iRow <= iRows && iWndIndex < iTotal; iRow++, iLoop++) + { + MovePuttyWnd((CWnd*) m_obaWindows.GetAt(iWndIndex), iX, iY, + (iSizeX - ((GetSystemMetrics(SM_CXSIZEFRAME) * 2) + GetSystemMetrics(SM_CXVSCROLL))), + (iSizeY - (GetSystemMetrics(SM_CYSIZE) + (GetSystemMetrics(SM_CYSIZEFRAME) * 2)))); + + iY += iSizeY; - pWnd-> - SendMessage( WM_SYSCOMMAND, SC_MINIMIZE, 0 ); + iWndIndex++; + } - pWnd-> - SendMessage( WM_SYSCOMMAND, SC_RESTORE, 0 ); - } + iX += iSizeX; + } + } } RefreshDialog(); @@ -1288,11 +1370,11 @@ void CPuTTYCSDialog::OnMinimizeButton() SortWindows(); - for ( int loop = 0; - loop < m_obaWindows.GetSize(); loop++ ) + for ( int iLoop = 0; + iLoop < m_obaWindows.GetSize(); iLoop++ ) { CWnd* pWnd = - (CWnd*) m_obaWindows.GetAt( loop ); + (CWnd*) m_obaWindows.GetAt( iLoop ); if ( !pWnd->IsWindowVisible() ) { @@ -1318,11 +1400,11 @@ void CPuTTYCSDialog::OnHideButton() SortWindows(); - for ( int loop = 0; - loop < m_obaWindows.GetSize(); loop++ ) + for ( int iLoop = 0; + iLoop < m_obaWindows.GetSize(); iLoop++ ) { CWnd* pWnd = - (CWnd*) m_obaWindows.GetAt( loop ); + (CWnd*) m_obaWindows.GetAt( iLoop ); if ( pWnd->IsWindowVisible() ) { @@ -1353,10 +1435,10 @@ void CPuTTYCSDialog::OnCloseButton() PUTTYCS_APP_NAME, MB_ICONEXCLAMATION | MB_YESNO) == IDYES ) { - for ( int loop = 0; loop < iSize; loop++ ) + for ( int iLoop = 0; iLoop < iSize; iLoop++ ) { CWnd* pWnd = - (CWnd*) m_obaWindows.GetAt( loop ); + (CWnd*) m_obaWindows.GetAt( iLoop ); DWORD dwPid; @@ -1396,9 +1478,9 @@ void CPuTTYCSDialog::OnFiltersButton() ((CComboBox*) GetDlgItem(IDC_FILTERS_COMBOBOX))-> ResetContent(); - for ( int loop = 0; loop < m_csaFilters.GetSize(); loop++) + for ( int iLoop = 0; iLoop < m_csaFilters.GetSize(); iLoop++) { - CString csFilter = m_csaFilters.GetAt(loop); + CString csFilter = m_csaFilters.GetAt(iLoop); ((CComboBox*) GetDlgItem(IDC_FILTERS_COMBOBOX))-> AddString( csFilter.Mid(0, @@ -1686,13 +1768,6 @@ void CPuTTYCSDialog::OnPreferencesButton() CPreferencesDialog* pDialog = new CPreferencesDialog( this ); - /** - * Password - */ - - pDialog-> - setSavePassword( m_iSavePassword ); - /** * Auto arrange */ @@ -1709,6 +1784,16 @@ void CPuTTYCSDialog::OnPreferencesButton() pDialog-> setUnhideOnExit( m_iUnhideOnExit ); + /** + * Tile method + */ + + pDialog->setTileMethod( m_iTileMethod ); + + /** + * Cascade dimensions + */ + pDialog-> setCascadeWidth( m_iCascadeWidth ); @@ -1728,9 +1813,6 @@ void CPuTTYCSDialog::OnPreferencesButton() pDialog-> setMinimizeToSysTray( m_iMinimizeToSysTray ); - pDialog-> - setTransition( m_iTransition ); - pDialog-> setOpacity(m_iOpacity ); @@ -1747,10 +1829,24 @@ void CPuTTYCSDialog::OnPreferencesButton() pDialog-> setEmulateCopyPaste( m_iEmulateCopyPaste ); + /** + * Transition delays + */ + + pDialog-> + setTransition( m_iTransition ); + + pDialog-> + setPostSendDelay( m_iPostSendDelay ); + /** * Miscellaneous */ + + pDialog-> + setSavePassword( m_iSavePassword ); + pDialog-> setRunOnSystemStartup( m_iRunOnSystemStartup ); @@ -1759,13 +1855,6 @@ void CPuTTYCSDialog::OnPreferencesButton() if ( pDialog->DoModal() == IDOK ) { - /** - * Password - */ - - m_iSavePassword = - pDialog->getSavePassword(); - /** * Auto arrange */ @@ -1782,6 +1871,17 @@ void CPuTTYCSDialog::OnPreferencesButton() m_iUnhideOnExit = pDialog->getUnhideOnExit(); + /** + * Tile method + */ + + m_iTileMethod = + pDialog->getTileMethod(); + + /** + * Cascade dimensions + */ + m_iCascadeWidth = pDialog->getCascadeWidth(); @@ -1830,8 +1930,6 @@ void CPuTTYCSDialog::OnPreferencesButton() m_iOpacity = pDialog->getOpacity(); - m_iTransition = pDialog->getTransition(); - /** * Keyboard/Mouse */ @@ -1848,15 +1946,24 @@ void CPuTTYCSDialog::OnPreferencesButton() pDialog->getEmulateCopyPaste(); m_cceCommandEdit.SetEmulateCopyPaste( m_iEmulateCopyPaste ); - + + /** + * Transition Delays + */ + + m_iTransition = pDialog->getTransition(); + m_iPostSendDelay = pDialog->getPostSendDelay(); + /** * Miscellaneous */ + m_iSavePassword = pDialog->getSavePassword(); + m_iRunOnSystemStartup = pDialog->getRunOnSystemStartup(); m_iCheckForUpdates = pDialog->getCheckForUpdates(); - + /** * Window refresh */ @@ -2035,13 +2142,28 @@ void CPuTTYCSDialog::OnScriptButton() PUTTYCS_WINDOW_TITLE_OPEN_SCRIPT; if ( pDialog->DoModal() == IDOK ) - { - FILE* pFile; + { + SendScript(pDialog->GetPathName()); + } + + delete( pDialog ); - if ( (pFile = - _tfopen(pDialog->GetPathName(), PUTTYCS_FILE_MODE_READ)) ) - { - CString csBuffer; + m_bDisablePopup = FALSE; + + RefreshDialog(); +} + +/** + * CPuTTYCSDialog::SendScript() + */ + +void CPuTTYCSDialog::SendScript(CString sFilename) +{ + FILE* pFile; + + if ( (pFile = _tfopen(sFilename, PUTTYCS_FILE_MODE_READ)) ) + { + CString csBuffer; bool capsLock = false; @@ -2049,8 +2171,7 @@ void CPuTTYCSDialog::OnScriptButton() { capsLock = true; - csBuffer += - PUTTYCS_SENDKEY_BUTTON_CAPSLOCK; + csBuffer += PUTTYCS_SENDKEY_BUTTON_CAPSLOCK; } bool firstLine = true; @@ -2087,14 +2208,11 @@ void CPuTTYCSDialog::OnScriptButton() ShowWindow( SW_SHOW ); fclose( pFile ); - } - } - - RefreshDialog(); - - delete( pDialog ); - - m_bDisablePopup = FALSE; + } + else + { + MessageBox(PUTTYCS_MESSAGEBOX_LOAD_SCRIPT_ERROR, PUTTYCS_WINDOW_TITLE_APP, MB_ICONEXCLAMATION | MB_OK ); + } } /** @@ -2206,6 +2324,22 @@ void CPuTTYCSDialog::OnTrayNotify( WPARAM wParam, LPARAM lParam ) return; } +/** + * CPuTTYCSDialog::OnCopyData() + */ + +BOOL CPuTTYCSDialog::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct) +{ + if (pCopyDataStruct->dwData == PUTTYCS_WM_COPYDATA_CMD_LINE) + { + ParseCmdLineOptions((LPTSTR) pCopyDataStruct->lpData); + } + + OnOpenMenuItem(); + + return CDialog::OnCopyData(pWnd, pCopyDataStruct); +} + /** * CPuTTYCSDialog::sendCommand( ) */ @@ -2259,9 +2393,9 @@ void CPuTTYCSDialog::sendBuffer( CString csBuffer, bool bTab, bool bParse ) csBuffer.Replace( PUTTYCS_TOKEN_INC, csIncToken ); csBuffer.Replace( PUTTYCS_TOKEN_CTRL, csCtrlToken ); - for ( int loop = 0; loop < csBuffer.GetLength(); loop++ ) + for ( int iLoop = 0; iLoop < csBuffer.GetLength(); iLoop++ ) { - TCHAR chChar = csBuffer.GetAt(loop); + TCHAR chChar = csBuffer.GetAt(iLoop); if ( chChar == PUTTYCS_SENDKEY_CHAR_PLUS ) { @@ -2315,10 +2449,10 @@ void CPuTTYCSDialog::sendBuffer( CString csBuffer, bool bTab, bool bParse ) if ( m_obaWindows.GetSize() > 0 ) { - for (int loop = 0; loop < m_obaWindows.GetSize(); loop++) + for (int iLoop = 0; iLoop < m_obaWindows.GetSize(); iLoop++) { CString csInc; - csInc.Format( PUTTYCS_TOKEN_INT_TO_STRING, (loop + 1) ); + csInc.Format( PUTTYCS_TOKEN_INT_TO_STRING, (iLoop + 1) ); CString csTemp; @@ -2348,7 +2482,7 @@ void CPuTTYCSDialog::sendBuffer( CString csBuffer, bool bTab, bool bParse ) } CWnd* pWnd = - (CWnd*) m_obaWindows.GetAt(loop); + (CWnd*) m_obaWindows.GetAt(iLoop); pWnd->SendMessage( WM_SYSCOMMAND, SC_HOTKEY, (LPARAM) pWnd->m_hWnd ); @@ -2362,9 +2496,11 @@ void CPuTTYCSDialog::sendBuffer( CString csBuffer, bool bTab, bool bParse ) pWnd->SetFocus(); + ::Sleep( m_iTransition ); + m_skSendKeys.SendKeys( (LPCTSTR) csTemp ); - ::Sleep( m_iTransition ); + ::Sleep( m_iPostSendDelay ); } } @@ -2414,9 +2550,9 @@ BOOL CALLBACK CPuTTYCSDialog::enumwindowsProc( HWND hwnd, LPARAM lParam ) CString csFilter = PUTTYCS_EMPTY_STRING; - for ( int loop = 0; loop < csEntry.GetLength(); loop++ ) + for ( int iLoop = 0; iLoop < csEntry.GetLength(); iLoop++ ) { - TCHAR ch = csEntry.GetAt(loop); + TCHAR ch = csEntry.GetAt(iLoop); if ( ch == PUTTYCS_FILTER_SEPARATOR ) { @@ -2472,9 +2608,32 @@ BOOL CALLBACK CPuTTYCSDialog::enumwindowsProc( HWND hwnd, LPARAM lParam ) } /** - * CPuTTYCSDialog::wildcmp() + * CPuTTYCSDialog::MovePuttyWnd(CWnd* pWnd) */ +void CPuTTYCSDialog::MovePuttyWnd(CWnd* pWnd, int iX, int iY, int iSizeX, int iSizeY) +{ + if (pWnd) + { + HWND hWnd = pWnd->GetSafeHwnd(); + + if (hWnd) + { + ::SendMessage(hWnd, WM_SYSCOMMAND, SC_RESTORE, 0); + ::ShowWindow(hWnd, SW_HIDE); + ::SetWindowPos(hWnd, NULL, iX, iY, 0, 0, SWP_NOSIZE); + ::SendMessage(hWnd, WM_ENTERSIZEMOVE, 0, 0); + ::SendMessage(hWnd, WM_SIZE, SIZE_RESTORED, MAKELPARAM(iSizeX, iSizeY)); + ::SendMessage(hWnd, WM_EXITSIZEMOVE, 0, 0); + ::SendMessage(hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0); + ::SendMessage(hWnd, WM_SYSCOMMAND, SC_RESTORE, 0); + } + } +} + +/** + * CPuTTYCSDialog::wildcmp() + */ int CPuTTYCSDialog::wildcmp( const TCHAR* s1, const TCHAR* wild ) { @@ -2584,4 +2743,142 @@ CString CPuTTYCSDialog::GetAttributeValue( CString csLine, CString csAttribute ) } return csValue; -} \ No newline at end of file +} + +#ifndef UNICODE +/** + * CommandLineToArgvT() + * http://www.koders.com/c/fid63F8E1B505B46BF92349E967A24E3DD1D2BFF72D.aspx + */ + +LPTSTR *WINAPI CommandLineToArgvT(LPCTSTR lpCmdLine, int *lpArgc) +{ + HGLOBAL hargv; + LPTSTR *argv, lpSrc, lpDest, lpArg; + int argc, nBSlash; + BOOL bInQuotes; + + // If null was passed in for lpCmdLine, there are no arguments + if (!lpCmdLine) { + if (lpArgc) + *lpArgc = 0; + return 0; + } + + lpSrc = (LPTSTR)lpCmdLine; + // Skip spaces at beginning + while (*lpSrc == _T(' ') || *lpSrc == _T('\t')) + lpSrc++; + + // If command-line starts with null, there are no arguments + if (*lpSrc == 0) { + if (lpArgc) + *lpArgc = 0; + return 0; + } + + lpArg = lpSrc; + argc = 0; + nBSlash = 0; + bInQuotes = FALSE; + + // Count the number of arguments + while (1) { + if (*lpSrc == 0 || ((*lpSrc == _T(' ') || *lpSrc == _T('\t')) && !bInQuotes)) { + // Whitespace not enclosed in quotes signals the start of another argument + argc++; + + // Skip whitespace between arguments + while (*lpSrc == _T(' ') || *lpSrc == _T('\t')) + lpSrc++; + if (*lpSrc == 0) + break; + nBSlash = 0; + continue; + } + else if (*lpSrc == _T('\\')) { + // Count consecutive backslashes + nBSlash++; + } + else if (*lpSrc == _T('\"') && !(nBSlash & 1)) { + // Open or close quotes + bInQuotes = !bInQuotes; + nBSlash = 0; + } + else { + // Some other character + nBSlash = 0; + } + lpSrc++; + } + + // Allocate space the same way as CommandLineToArgvW for compatibility + hargv = GlobalAlloc(0, argc * sizeof(LPTSTR) + (_tcslen(lpArg) + 1) * sizeof(TCHAR)); + argv = (LPTSTR *)GlobalLock(hargv); + + if (!argv) { + // Memory allocation failed + if (lpArgc) + *lpArgc = 0; + return 0; + } + + lpSrc = lpArg; + lpDest = lpArg = (LPTSTR)(argv + argc); + argc = 0; + nBSlash = 0; + bInQuotes = FALSE; + + // Fill the argument array + while (1) { + if (*lpSrc == 0 || ((*lpSrc == _T(' ') || *lpSrc == _T('\t')) && !bInQuotes)) { + // Whitespace not enclosed in quotes signals the start of another argument + // Null-terminate argument + *lpDest++ = 0; + argv[argc++] = lpArg; + + // Skip whitespace between arguments + while (*lpSrc == _T(' ') || *lpSrc == _T('\t')) + lpSrc++; + if (*lpSrc == 0) + break; + lpArg = lpDest; + nBSlash = 0; + continue; + } + else if (*lpSrc == _T('\\')) { + *lpDest++ = _T('\\'); + lpSrc++; + + // Count consecutive backslashes + nBSlash++; + } + else if (*lpSrc == _T('\"')) { + if (!(nBSlash & 1)) { + // If an even number of backslashes are before the quotes, + // the quotes don't go in the output + lpDest -= nBSlash / 2; + bInQuotes = !bInQuotes; + } + else { + // If an odd number of backslashes are before the quotes, + // output a quote + lpDest -= (nBSlash + 1) / 2; + *lpDest++ = _T('\"'); + } + lpSrc++; + nBSlash = 0; + } + else { + // Copy other characters + *lpDest++ = *lpSrc++; + nBSlash = 0; + } + } + + if (lpArgc) + *lpArgc = argc; + return argv; +} + +#endif diff --git a/PuTTYCSDialog.h b/PuTTYCSDialog.h index 5bd9aff..32354d2 100755 --- a/PuTTYCSDialog.h +++ b/PuTTYCSDialog.h @@ -1,7 +1,7 @@ /** * PuTTYCSDialog.h - PuTTYCS Main Dialog header * - * Copyright (c) 2005 - 2007 Jason Millard (jsm174@gmail.com) + * Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -51,6 +51,10 @@ * up/down arrow keys * Added check for PuTTYCS update * Added run on system startup + * 02/29/2008: Added horizontal/vertical tiling J. Millard + * Updated cascade logic + * Added post send transition delay + * Added --script command line option */ #if !defined(AFX_PuTTYCSDLG_H__7BCAE5A7_75C4_4831_82FD_5A13F846FE61__INCLUDED_) @@ -60,6 +64,13 @@ #pragma once #endif // _MSC_VER > 1000 +#ifdef UNICODE +#define CommandLineToArgv CommandLineToArgvW +#else +#define CommandLineToArgv CommandLineToArgvT +LPTSTR *WINAPI CommandLineToArgvT(LPCTSTR lpCmdLine, int *lpArgc); +#endif + #include "CommandEdit.h" class CPuTTYCSDialog : public CDialog @@ -112,14 +123,6 @@ class CPuTTYCSDialog : public CDialog CStringArray m_csaCmdHistory; int m_iCmdHistory; - /** - * Password - */ - - int m_iSavePassword; - - CString m_csPassword; - /** * Window */ @@ -128,7 +131,6 @@ class CPuTTYCSDialog : public CDialog int m_iAlwaysOnTop; int m_iMinimizeToSysTray; int m_iOpacity; - int m_iTransition; /** * Auto arrange @@ -138,7 +140,17 @@ class CPuTTYCSDialog : public CDialog int m_iAutoMinimize; int m_iArrangeOnStartup; int m_iUnhideOnExit; + + /** + * Tile method + */ + int m_iTileMethod; + + /** + * Cascade dimensions + */ + int m_iCascadeWidth; int m_iCascadeHeight; @@ -159,10 +171,21 @@ class CPuTTYCSDialog : public CDialog /** * Miscellaneous */ - + + int m_iSavePassword; + + CString m_csPassword; + int m_iRunOnSystemStartup; int m_iCheckForUpdates; + /** + * Transition delays + */ + + int m_iTransition; + int m_iPostSendDelay; + /** * Fonts */ @@ -173,23 +196,28 @@ class CPuTTYCSDialog : public CDialog void sendCommand( CString csCommand, bool bTab ); void sendBuffer( CString csBuffer, bool bParse = false, bool bTab = false ); - + void LoadPreferences(); void SavePreferences(); void UpdateDialog(); void RefreshDialog(); + void SendScript( CString csFilename ); + + void MovePuttyWnd(CWnd* pWnd, int iX, int intY, int iSizeX, int iSizeY); + void SetRunOnSystemStartup( bool bEnable = true ); void CheckForUpdates(bool bInteractive = false); + void ParseCmdLineOptions(LPTSTR pCmdLine = NULL); + // Generated message map functions //{{AFX_MSG(CPuTTYCSDialog) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); - afx_msg void OnMultipleInstance(WPARAM wParam, LPARAM lParam); afx_msg HCURSOR OnQueryDragIcon(); afx_msg void OnAboutButton(); afx_msg void OnSelChangeFiltersCombobox(); @@ -226,6 +254,7 @@ class CPuTTYCSDialog : public CDialog afx_msg void OnCheckForUpdates(); afx_msg void OnCtrlDButton(); afx_msg void OnCtrlRButton(); + afx_msg BOOL OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct); //}}AFX_MSG DECLARE_MESSAGE_MAP() @@ -247,9 +276,7 @@ class CPuTTYCSDialog : public CDialog static int Compare(const void* pWndS1, const void* pWndS2); static CString GetAttributeValue(const CString, const CString); - CMenu* m_pMenu; - - + CMenu* m_pMenu; }; //{{AFX_INSERT_LOCATION}} diff --git a/StdAfx.h b/StdAfx.h index 1e0bea5..732f4e3 100755 --- a/StdAfx.h +++ b/StdAfx.h @@ -20,8 +20,11 @@ #include // MFC support for Windows Common Controls #include +#include + #include "SendKeys.h" #include "Defines.h" + #endif // _AFX_NO_AFXCMN_SUPPORT diff --git a/readme.txt b/readme.txt index 2080512..70429cc 100755 --- a/readme.txt +++ b/readme.txt @@ -1,48 +1,58 @@ -PuTTYCS - PuTTY Command Sender v1.7 -(C) 2005 - 2007 - Millard Software - jsm174@gmail.com -Release Date: 06/21/07 +PuTTYCS - PuTTY Command Sender v1.8.1 +(C) 2005 - 2008 - Millard Software - jsm174@gmail.com +Release Date: 02/29/08 VERSION HISTORY -06/21/07 - v1.7 - Added Ctrl-R and Ctrl-D buttons. - Added support for any control - sequence using {%CTRL%} token in - command input - Added support for an incremental - counter using {%INC%} token in - command input - Added scroll command history using - up/down arrow keys - Changed command history right/left - buttons to up/down buttons - Added support to check for PuTTYCS - updates - Added support for automatically - running on system startup -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 - delete buttons -12/21/05 - v1.4a - Fixed password not sending CR -12/19/05 - v1.4 - Added window opacity -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 -11/18/05 - v1.1a - Fixed AltGr support -11/17/05 - v1.1 - Added UNICODE support - Added clear command history button - Added AltGr support -11/07/05 - v1.0 - Initial release +02/29/08 - v1.8.1 - Added horizontal and vertical + tiling. + Updated tile and cascade to be + aware of taskbar. Cascade now + uses entire desktop. + Added additional Post Send delay. + [thanks sirandrew] + Added --script command line + option. + Rearranged preferences dialog. +06/21/07 - v1.7 - Added Ctrl-R and Ctrl-D buttons. + Added support for any control + sequence using {%CTRL%} token in + command input + Added support for an incremental + counter using {%INC%} token in + command input + Added scroll command history using + up/down arrow keys + Changed command history right/left + buttons to up/down buttons + Added support to check for PuTTYCS + updates + Added support for automatically + running on system startup +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 + delete buttons +12/21/05 - v1.4a - Fixed password not sending CR +12/19/05 - v1.4 - Added window opacity +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 +11/18/05 - v1.1a - Fixed AltGr support +11/17/05 - v1.1 - Added UNICODE support + Added clear command history button + Added AltGr support +11/07/05 - v1.0 - Initial release ABOUT @@ -252,33 +262,31 @@ PREFERENCES This button will bring up the Preferences dialog. Preferences are loaded each time PuTTYCS is started. - Tool Window: - Display PuTTYCS as a tool window with the thin - title bar. + Window: + + Tool Window + Display PuTTYCS as a tool window with the thin + title bar. - Always on top: - Display the PuTTYCS on top of all other windows. + Always on top + Display the PuTTYCS on top of all other windows. - Minimize to system tray: - Minimizes PuTTYCS to the system tray. If this is - enabled, PuTTYCS can only be exited through the - system tray popup menu. + Minimize to system tray + Minimizes PuTTYCS to the system tray. If this is + enabled, PuTTYCS can only be exited through the + system tray popup menu. - Transition: - Sets the amount time (in milliseconds) to pause - before sending a command to next PuTTY window. - - NOTE: The slower the machine the higher this value - should be. + Opacity + Use the slider to set the opacity for the PuTTYCS + window. This maybe useful if PuTTYCS sometimes blocks + your existing PuTTY windows. - Opacity: - Use the slider to set the opacity for the PuTTYCS - window. This maybe useful if PuTTYCS sometimes blocks - your existing PuTTY windows. - Auto arrange (Off, Cascade, Tile) - When switching filters, automatically cascade or - tile PuTTY windows. + Auto arrange: + + Off, Cascade, Tile + When switching filters, automatically cascade or + tile PuTTY windows. Minimize other PuTTYs When auto arranging filtered PuTTY windows, @@ -288,14 +296,23 @@ Preferences are loaded each time PuTTYCS is started. When starting PuTTYCS, auto arranging filtered PuTTY windows. - Unhide PuTTYs on exit - Unhides any PuTTYs hidden using the Hide button. + Unhide PuTTYs on exit + Unhides any PuTTYs hidden using the Hide button. + + + Tile method: + + Vertical, Horizontal, Classic + When tiling PuTTY windows use this method. Use + Classic to tile like PuTTYCS v1.7 and lower. + 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. + + 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). @@ -305,41 +322,62 @@ Preferences are loaded each time PuTTYCS is started. change with system settings. - Enable Tab ccmpletion - Pressing Tab in the command field, sends the command - including the Tab key. Useful for file completion in - shells like tcsh. + Keyboard/Mouse: + + Enable Tab ccmpletion + Pressing Tab in the command field, sends the command + including the Tab key. Useful for file completion in + shells like tcsh. - Scroll command history with up/down arrow keys - Enable this to allow the up and down arrow keys to - scroll through the command history. + Scroll command history with up/down arrow keys + Enable this to allow the up and down arrow keys to + scroll through the command history. + + Selection copies, right button pastes + Enable this to emulate PuTTY's selection to + clipboard, and right mouse button paste feature. + - Selection copies, right button pastes - Enable this to emulate PuTTY's selection to - clipboard, and right mouse button paste feature. + Transition delays: (Advanced) + Window + Sets the amount time (in milliseconds) to pause + after focusing a PuTTY window and before sending the + command. - Save Password - Saves the password used in the Send Password dialog. + NOTE: The slower the machine or remote connection, + the higher this value should be. - NOTE: Passwords are encoded in Base64 and stored in - the PuTTYCS.ini file. This may present a - potential security risk. [see CONFIG FILE - section] + Post send + Sets the amount time (in milliseconds) to pause + after sending a command to a PuTTY window. + NOTE: The slower the machine or remote connection, + the higher this value should be. - Run on system startup - If enabled, adds a registry entry that automatically - executes PuTTYCS when the system is started. + + Miscellaneous: + + Save Password + Saves the password used in the Send Password dialog. + + NOTE: Passwords are encoded in Base64 and stored in + the PuTTYCS.ini file. This may present a + potential security risk. [see CONFIG FILE + section] + + Run on system startup + If enabled, adds a registry entry that automatically + executes PuTTYCS when the system is started. - NOTE: The registry entry is: + NOTE: The registry entry is: - HKEY_CURRENT_USER\Software\ - Microsoft\Windows\CurrentVersion\Run\PuTTYCS + HKEY_CURRENT_USER\Software\ + Microsoft\Windows\CurrentVersion\Run\PuTTYCS - Check for updates on startup - If enable, PuTTYCS will check for software updates - when started. + Check for updates on startup + If enable, PuTTYCS will check for software updates + when started. SCRIPT @@ -377,6 +415,19 @@ directory: C:\Windows\PuTTYCS.ini +COMMAND LINE OPTIONS +-------------------- + + -s, --script + Send a PuTTYCS script. If PuTTYCS is already + running, the script will be sent to the current + filter, otherwise the script will be sent to the + last selected filter. + + -h, --help + Displays the help dialog. + + KNOWN ISSUES ------------ @@ -407,7 +458,8 @@ example, on the Start bar, choose Tile or Cascade. You will see that PuTTY windows do not re-arrange themselves 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. +may not arrange as expected. Also, because PuTTY snaps to the +text size, Vertical and Horizontal tiling will contain gaps. PuTTYCS officially supports PuTTY. I have support to find PuTTYtel, TuTTY, and PieTTY windows based upon user requests. @@ -424,6 +476,9 @@ www.millardsoftware.com, PuTTYCS should be able to as well. However, if it can not, PuTTYCS may appear to freeze for a short time. For the next release, I will try to improve this code, +PuTTYCS does not work well with multiple monitors. I have +looked into this and it would be extensive rewrite of the code. + FUTURE ------ @@ -452,7 +507,7 @@ 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! +It is great 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 or @@ -471,6 +526,12 @@ http://www.adp-gmbh.ch/cpp/common/base64.html The wildcard compare was based on source code found at: http://www.codeproject.com/string/wildcmp.asp +The ANSI version of CommandLineToArgv() can be found at: +http://www.koders.com/c/fid63F8E1B505B46BF92349E967A24E3DD1D2BFF72D.aspx + +Horizontal and vertical tiling routines are based on source code +found at: http://source.winehq.org/source/dlls/user32/mdi.c + DISCLAIMER ---------- diff --git a/res/x-click-but04.bmp b/res/x-click-but04.bmp index 3bc70ae..c1775fe 100755 Binary files a/res/x-click-but04.bmp and b/res/x-click-but04.bmp differ diff --git a/resource.h b/resource.h index 823ad28..5ee73d8 100755 --- a/resource.h +++ b/resource.h @@ -60,6 +60,10 @@ #define IDC_CMDHISTORYSCROLLTHROUGH_CHECKBOX 1115 #define IDC_RUNONSYSTEMSTARTUP_CHECKBOX 1116 #define IDC_CHECKFORUPDATES_CHECKBOX 1117 +#define IDC_TILEMETHOD_VERTICAL_RADIO 1122 +#define IDC_TILEMETHOD_HORIZONTAL_RADIO 1123 +#define IDC_TILEMETHOD_CLASSIC_RADIO 1124 +#define IDC_POST_SEND_DELAY_EDIT 1125 #define IDC_FILTERS_LISTBOX 1200 #define IDC_ADD_BUTTON 1201 #define IDC_COPY_BUTTON 1202 diff --git a/setup.iss b/setup.iss index 9dde961..1f72894 100755 --- a/setup.iss +++ b/setup.iss @@ -1,7 +1,7 @@ ; ; setup.iss - PuTTYCS Inno Setup Script ; -; Copyright (c) 2005 Jason Millard (jsm174@gmail.com) +; Copyright (c) 2005 - 2008 Jason Millard (jsm174@gmail.com) ; All rights reserved. ; ; Redistribution and use in source and binary forms, with or without @@ -34,14 +34,15 @@ ; 05/30/2006: Updated for version 1.5 J. Millard ; 11/20/2006: Updated for version 1.6 J. Millard ; 06/20/2007: Updated for version 1.7 J. Millard +; 02/29/2008: Updated for version 1.8.1 J. Millard ; [Setup] -AppName=PuTTYCS 1.7 -AppVerName=PuTTY Command Sender 1.7 -VersionInfoVersion=1.7.0.0 -VersionInfoCopyright=Copyright (C) 2005 - 2007 Millard Software -VersionInfoDescription=PuTTYCS - PuTTY Command Sender 1.7 +AppName=PuTTYCS 1.8.1 +AppVerName=PuTTY Command Sender 1.8.1 +VersionInfoVersion=1.8.1.0 +VersionInfoCopyright=Copyright (C) 2005 - 2008 Millard Software +VersionInfoDescription=PuTTYCS - PuTTY Command Sender 1.8.1 AppPublisher=Millard Software AppPublisherURL=http://www.millardsoftware.com/puttycs AppSupportURL=http://www.millardsoftware.com/puttycs @@ -70,11 +71,11 @@ Source: "README.txt"; DestDir: "{app}"; Flags: ignoreversion ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] -Name: "{group}\PuTTYCS 1.7"; Filename: "{app}\PuTTYCS.exe" +Name: "{group}\PuTTYCS 1.8.1"; Filename: "{app}\PuTTYCS.exe" Name: "{group}\README.txt"; Filename: "{app}\README.txt" -Name: "{userdesktop}\PuTTYCS 1.7"; Filename: "{app}\PuTTYCS.exe"; Tasks: desktopicon -Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\PuTTYCS 1.7"; Filename: "{app}\PuTTYCS.exe"; Tasks: quicklaunchicon +Name: "{userdesktop}\PuTTYCS 1.8.1"; Filename: "{app}\PuTTYCS.exe"; Tasks: desktopicon +Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\PuTTYCS 1.8.1"; 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.7}"; Flags: nowait postinstall skipifsilent +Filename: "{app}\PuTTYCS.exe"; Description: "{cm:LaunchProgram,PuTTY Command Sender 1.8.1}"; Flags: nowait postinstall skipifsilent