Skip to content

Commit

Permalink
1.6 commit - Added support for PuTTYtel, TuTTY, and PieTTY. Added sup…
Browse files Browse the repository at this point in the history
…port for user defined cascade size. Changed scripting to send CR on last line if Carriage Return is enabled.
  • Loading branch information
jsm174 committed Feb 7, 2016
1 parent 19aa3c9 commit 8c9d0cb
Show file tree
Hide file tree
Showing 10 changed files with 370 additions and 82 deletions.
29 changes: 23 additions & 6 deletions Defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_)
Expand All @@ -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" )
Expand All @@ -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||+*")

Expand Down Expand Up @@ -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" )
Expand Down Expand Up @@ -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
Expand Down
145 changes: 140 additions & 5 deletions PreferencesDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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()
*/
Expand Down Expand Up @@ -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))->
Expand Down Expand Up @@ -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) /
Expand Down Expand Up @@ -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()
*/
Expand Down Expand Up @@ -572,4 +706,5 @@ void CPreferencesDialog::OnEmulateCopyPasteCheckbox()
void CPreferencesDialog::OnOKButton()
{
CDialog::OnOK();
}
}

14 changes: 14 additions & 0 deletions PreferencesDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_)
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand All @@ -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()

Expand Down
32 changes: 19 additions & 13 deletions PuTTYCS.clw
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[General Info]
Version=1
LastClass=CPuTTYCSDialog
LastClass=CPreferencesDialog
LastTemplate=CDialog
NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "puttycs.h"
Expand All @@ -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]
Expand Down Expand Up @@ -65,7 +65,7 @@ HeaderFile=PreferencesDialog.h
ImplementationFile=PreferencesDialog.cpp
Filter=D
VirtualFilter=dWC
LastObject=CPreferencesDialog
LastObject=IDC_FIND_BUTTON

[CLS:CPuTTYCSApp]
Type=0
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading

0 comments on commit 8c9d0cb

Please sign in to comment.