summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2006-02-03 01:05:14 (UTC)
committer Michael Krelin <hacker@klever.net>2006-02-03 01:05:14 (UTC)
commit51d59e6f7f45b8f4a60d2933e50bb8ee0c2ea20d (patch) (side-by-side diff)
treea6693752131aaa39e56ebbca841179a8df4230ef
parenta772d9f284b4c2a909c30ea33a132a487d932600 (diff)
downloadpumpkin-51d59e6f7f45b8f4a60d2933e50bb8ee0c2ea20d.zip
pumpkin-51d59e6f7f45b8f4a60d2933e50bb8ee0c2ea20d.tar.gz
pumpkin-51d59e6f7f45b8f4a60d2933e50bb8ee0c2ea20d.tar.bz2
made main window resizable
git-svn-id: http://svn.klever.net/kin/pumpkin/trunk@146 fe716a7a-6dde-0310-88d9-d003556173a8
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--PumpKINDlg.cpp84
-rw-r--r--PumpKINDlg.h13
-rw-r--r--help/pumpkin.rtf1
-rw-r--r--help/pumpkin.xml1
-rw-r--r--pumpkin.clw12
-rw-r--r--pumpkin.mak76
-rw-r--r--pumpkin.rc10
7 files changed, 124 insertions, 73 deletions
diff --git a/PumpKINDlg.cpp b/PumpKINDlg.cpp
index 4cb1633..9786ef0 100644
--- a/PumpKINDlg.cpp
+++ b/PumpKINDlg.cpp
@@ -129,6 +129,10 @@ void CPumpKINDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPumpKINDlg)
+ DDX_Control(pDX, ID_HELP, m_HelpCtl);
+ DDX_Control(pDX, IDC_PUT, m_PutCtl);
+ DDX_Control(pDX, IDC_GET, m_GetCtl);
+ DDX_Control(pDX, IDC_EXIT, m_ExitCtl);
DDX_Control(pDX, IDC_LISTENING, m_ListenCtl);
DDX_Control(pDX, IDC_ABORT, m_AbortCtl);
DDX_Control(pDX, IDC_OPTIONS, m_OptionsCtl);
@@ -156,6 +160,7 @@ BEGIN_MESSAGE_MAP(CPumpKINDlg, CDialog)
ON_BN_CLICKED(IDC_ABORT, OnAbort)
ON_WM_CLOSE()
ON_COMMAND(ID_TRAY_SHOWPUMPKINWINDOW, OnTrayShowpumpkinwindow)
+ ON_COMMAND(ID_TRAY_LISTEN, OnTrayListen)
ON_COMMAND(ID_TRAY_EXIT, OnTrayExit)
ON_COMMAND(ID_TRAY_ABOUTPUMPKIN, OnTrayAboutpumpkin)
ON_COMMAND(ID_TRAY_FETCHFILE, OnTrayFetchfile)
@@ -168,7 +173,8 @@ BEGIN_MESSAGE_MAP(CPumpKINDlg, CDialog)
ON_WM_DROPFILES()
ON_BN_CLICKED(ID_HELP, OnHelp)
ON_BN_CLICKED(IDC_LISTENING, OnListening)
- ON_COMMAND(ID_TRAY_LISTEN, OnTrayListen)
+ ON_WM_GETMINMAXINFO()
+ ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -201,7 +207,6 @@ BOOL CPumpKINDlg::OnInitDialog()
VERIFY(m_Retrier->Create(NULL,"PumpKIN-Retrier",WS_CHILD,CRect(0,0,0,0),this,0));
-
m_Images.Create(16,16,TRUE,2,1);
m_iRRQ = m_Images.Add(AfxGetApp()->LoadIcon(IDI_RRQ));
m_iWRQ = m_Images.Add(AfxGetApp()->LoadIcon(IDI_WRQ));
@@ -225,6 +230,20 @@ CRect listrc;
SetupButtons();
+CRect wrci, wrco;
+ GetWindowRect(&wrco);
+ GetClientRect(&wrci);
+CRect brc;
+ m_GetCtl.GetWindowRect(&brc); ScreenToClient(&brc);
+ m_rightGapButtons = wrci.right-brc.right;
+ m_List.GetWindowRect(&brc); ScreenToClient(&brc);
+ m_rightGapList = wrci.right-brc.right;
+ m_ListenCtl.GetWindowRect(&brc); ScreenToClient(&brc);
+ m_bottomGapListen = wrci.bottom-brc.bottom;
+ m_Log.GetWindowRect(&brc); ScreenToClient(&brc);
+ m_bottomGapLog = wrci.bottom-brc.bottom;
+ m_MinSize.cx = wrco.Width(); m_MinSize.cy=wrco.Height();
+
CRect rc, drc;
GetWindowRect(rc);
GetDesktopWindow()->GetWindowRect(drc);
@@ -2077,3 +2096,64 @@ void CPumpKINDlg::LogLine(LPCTSTR str)
}
}
}
+
+void CPumpKINDlg::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
+{
+ CDialog::OnGetMinMaxInfo(lpMMI);
+ if(m_MinSize.cx>0 && m_MinSize.cy>0){
+ lpMMI->ptMinTrackSize.x = m_MinSize.cx;
+ lpMMI->ptMinTrackSize.y = m_MinSize.cy;
+ }
+}
+
+void CPumpKINDlg::OnSize(UINT nType, int cx, int cy)
+{
+ CDialog::OnSize(nType, cx, cy);
+ if(nType==SIZE_RESTORED)
+ RecalcLayout(cx,cy);
+}
+
+void CPumpKINDlg::RecalcLayout(int,int)
+{
+ CRect wrc;
+ GetClientRect(&wrc);
+ AdjustButton(m_GetCtl,wrc);
+ AdjustButton(m_PutCtl,wrc);
+ AdjustButton(m_AbortCtl,wrc);
+ AdjustButton(m_HelpCtl,wrc);
+ AdjustButton(m_ExitCtl,wrc);
+ AdjustButton(m_OptionsCtl,wrc);
+ CRect brc;
+ m_List.GetWindowRect(&brc); ScreenToClient(&brc);
+ m_List.SetWindowPos(
+ 0,
+ brc.left, brc.top,
+ wrc.right-m_rightGapList-brc.left, brc.bottom-brc.top,
+ SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOZORDER|SWP_NOCOPYBITS );
+ m_Log.GetWindowRect(&brc); ScreenToClient(&brc);
+ m_Log.SetWindowPos(
+ 0,
+ brc.left, brc.top,
+ wrc.right-m_rightGapButtons-brc.left, wrc.bottom-m_bottomGapLog-brc.top,
+ SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOZORDER|SWP_NOCOPYBITS );
+ m_ListenCtl.GetWindowRect(&brc); ScreenToClient(&brc);
+ m_ListenCtl.SetWindowPos(
+ 0,
+ wrc.right-brc.Width()-m_rightGapButtons, wrc.bottom-brc.Height()-m_bottomGapListen,
+ 0,0,
+ SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS );
+ int i = m_Log.GetCount();
+ if(i!=LB_ERR)
+ m_Log.SetCurSel(i-1);
+}
+
+void CPumpKINDlg::AdjustButton(CWnd& w,CRect& wrc)
+{
+ CRect brc;
+ w.GetWindowRect(&brc); ScreenToClient(&brc);
+ w.SetWindowPos(
+ 0,
+ wrc.right-brc.Width()-m_rightGapButtons, brc.top,
+ 0, 0,
+ SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS );
+}
diff --git a/PumpKINDlg.h b/PumpKINDlg.h
index b247c56..c5469f1 100644
--- a/PumpKINDlg.h
+++ b/PumpKINDlg.h
@@ -367,6 +367,13 @@ class CPumpKINDlg : public CDialog
{
// Construction
public:
+ void AdjustButton(CWnd& w,CRect& wrc);
+ void RecalcLayout(int,int);
+ CSize m_MinSize;
+ UINT m_bottomGapLog;
+ UINT m_bottomGapListen;
+ UINT m_rightGapList;
+ UINT m_rightGapButtons;
CString m_lastlogerr;
void LogLine(LPCTSTR str);
CString m_LogFile;
@@ -430,6 +437,10 @@ public:
// Dialog Data
//{{AFX_DATA(CPumpKINDlg)
enum { IDD = IDD_PUMPKIN_DIALOG };
+ CButton m_HelpCtl;
+ CButton m_PutCtl;
+ CButton m_GetCtl;
+ CButton m_ExitCtl;
CButton m_ListenCtl;
CButton m_AbortCtl;
CButton m_OptionsCtl;
@@ -482,6 +493,8 @@ protected:
virtual void OnCancel();
afx_msg void OnHelp();
afx_msg void OnListening();
+ afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
+ afx_msg void OnSize(UINT nType, int cx, int cy);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
diff --git a/help/pumpkin.rtf b/help/pumpkin.rtf
index abdca4f..505cbf2 100644
--- a/help/pumpkin.rtf
+++ b/help/pumpkin.rtf
@@ -32,6 +32,7 @@ ${\footnote What's New}
\par\pard\plain\fi0\li0\f1\fs18 \bullet Added acess lists based on request IP address and TFTP opcode for automating access policy
\par\pard\plain\fi0\li0\f1\fs18 \bullet Added possibility to start/stop TFTP server, while keeping client functionality intact
\par\pard\plain\fi0\li0\f1\fs18 \bullet Logging to file
+\par\pard\plain\fi0\li0\f1\fs18 \bullet Resizable main window
\par\pard\plain\f1\fs24\qc\cf2\b 2.6 - August 6th, 2005
\par\pard\plain\fi0\li0\f1\fs18 \bullet more robust solution to the backslash/slash dilemma
\par\pard\plain\fi0\li0\f1\fs18 \bullet A bit more elaborate error reporting
diff --git a/help/pumpkin.xml b/help/pumpkin.xml
index 46e3bbc..5c951bb 100644
--- a/help/pumpkin.xml
+++ b/help/pumpkin.xml
@@ -13,6 +13,7 @@
<ni>Added acess lists based on request IP address and TFTP opcode for automating access policy</ni>
<ni>Added possibility to start/stop TFTP server, while keeping client functionality intact</ni>
<ni>Logging to file</ni>
+ <ni>Resizable main window</ni>
</newsfor>
<newsfor version="2.6" date="August 6th, 2005">
<ni>more robust solution to the backslash/slash dilemma</ni>
diff --git a/pumpkin.clw b/pumpkin.clw
index 5344bfd..213d8c1 100644
--- a/pumpkin.clw
+++ b/pumpkin.clw
@@ -2,7 +2,7 @@
[General Info]
Version=1
-LastClass=CPropsServer
+LastClass=CPumpKINDlg
LastTemplate=CComboBox
NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "PumpKIN.h"
@@ -16,14 +16,14 @@ ResourceCount=10
Resource1=IDD_REQUEST
Resource2=IDD_PROPS_NETWORK
Resource3=IDD_CONFIRM_RRQ
-Resource4=IDD_ABOUTBOX
+Resource4=IDD_PROPS_SERVER
Class4=CPropsServer
Class5=CPropsNetwork
Resource5=IDD_CONFIRM_WRQ
Resource6=IDD_PROPS_ACL
Class6=CConfirmRRQDlg
Class7=CConfirmWRQDlg
-Resource7=IDD_PUMPKIN_DIALOG
+Resource7=IDD_ABOUTBOX
Class8=CRequestDlg
Class9=CResolver
Class10=CRetrier
@@ -33,7 +33,7 @@ Class12=CPropsSounds
Resource9=IDM_POPUPS
Class13=CPropsACL
Class14=CACLTargetCombo
-Resource10=IDD_PROPS_SERVER
+Resource10=IDD_PUMPKIN_DIALOG
[CLS:CPumpKINApp]
Type=0
@@ -80,7 +80,7 @@ Control4=IDC_ABORT,button,1342259200
Control5=IDC_OPTIONS,button,1342259200
Control6=IDC_EXIT,button,1342259200
Control7=ID_HELP,button,1342259200
-Control8=IDC_LOG,listbox,1353728129
+Control8=IDC_LOG,listbox,1353728385
Control9=IDCANCEL,button,1073741824
Control10=IDC_LISTENING,button,1342275619
@@ -134,7 +134,7 @@ ImplementationFile=PropsServer.cpp
BaseClass=CPropertyPage
Filter=D
VirtualFilter=idWC
-LastObject=IDC_LOGFILE_BROWSE
+LastObject=CPropsServer
[CLS:CPropsNetwork]
Type=0
diff --git a/pumpkin.mak b/pumpkin.mak
index 7d2ec22..a22a6fa 100644
--- a/pumpkin.mak
+++ b/pumpkin.mak
@@ -38,7 +38,7 @@ NULL=nul
!ENDIF
################################################################################
# Begin Project
-# PROP Target_Last_Scanned "Install - Win32 Canned"
+# PROP Target_Last_Scanned "PumpKIN - Win32 Debug"
CPP=cl.exe
RSC=rc.exe
MTL=mktyplib.exe
@@ -706,6 +706,7 @@ DEP_CPP_PUMPK=\
DEP_CPP_PUMPK=\
".\pumpkin.h"\
".\PumpKINDlg.h"\
+ ".\shared-code\BellsNWhistles.h"\
".\shared-code\kHelpers.h"\
".\stdafx.h"\
@@ -738,9 +739,6 @@ DEP_CPP_PUMPK=\
# Begin Source File
SOURCE=.\PumpKINDlg.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_PUMPKI=\
".\ACLTargetCombo.h"\
".\ConfirmRRQDlg.h"\
@@ -760,30 +758,15 @@ DEP_CPP_PUMPKI=\
".\Trayer.h"\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\PumpKINDlg.obj" : $(SOURCE) $(DEP_CPP_PUMPKI) "$(INTDIR)"\
"$(INTDIR)\pumpkin.pch"
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Debug"
-DEP_CPP_PUMPKI=\
- ".\ACLTargetCombo.h"\
- ".\ConfirmRRQDlg.h"\
- ".\ConfirmWRQDlg.h"\
- ".\PropsACL.h"\
- ".\PropsNetwork.h"\
- ".\PropsServer.h"\
- ".\PropsSounds.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\RequestDlg.h"\
- ".\Resolver.h"\
- ".\Retrier.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
- ".\Trayer.h"\
-
"$(INTDIR)\PumpKINDlg.obj" : $(SOURCE) $(DEP_CPP_PUMPKI) "$(INTDIR)"\
"$(INTDIR)\pumpkin.pch"
@@ -794,24 +777,6 @@ DEP_CPP_PUMPKI=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Static"
-DEP_CPP_PUMPKI=\
- ".\ACLTargetCombo.h"\
- ".\ConfirmRRQDlg.h"\
- ".\ConfirmWRQDlg.h"\
- ".\PropsACL.h"\
- ".\PropsNetwork.h"\
- ".\PropsServer.h"\
- ".\PropsSounds.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\RequestDlg.h"\
- ".\Resolver.h"\
- ".\Retrier.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
- ".\Trayer.h"\
-
"$(INTDIR)\PumpKINDlg.obj" : $(SOURCE) $(DEP_CPP_PUMPKI) "$(INTDIR)"\
"$(INTDIR)\pumpkin.pch"
@@ -1041,6 +1006,7 @@ DEP_CPP_PROPS=\
DEP_CPP_PROPS=\
".\PropsServer.h"\
".\pumpkin.h"\
+ ".\shared-code\BellsNWhistles.h"\
".\shared-code\kHelpers.h"\
".\stdafx.h"\
@@ -1134,6 +1100,7 @@ DEP_CPP_CONFI=\
".\ConfirmRRQDlg.h"\
".\pumpkin.h"\
".\PumpKINDlg.h"\
+ ".\shared-code\BellsNWhistles.h"\
".\shared-code\kHelpers.h"\
".\stdafx.h"\
@@ -1189,6 +1156,7 @@ DEP_CPP_CONFIR=\
".\ConfirmWRQDlg.h"\
".\pumpkin.h"\
".\PumpKINDlg.h"\
+ ".\shared-code\BellsNWhistles.h"\
".\shared-code\kHelpers.h"\
".\stdafx.h"\
@@ -1283,6 +1251,7 @@ DEP_CPP_RESOL=\
".\pumpkin.h"\
".\PumpKINDlg.h"\
".\Resolver.h"\
+ ".\shared-code\BellsNWhistles.h"\
".\shared-code\kHelpers.h"\
".\stdafx.h"\
@@ -1338,6 +1307,7 @@ DEP_CPP_RETRI=\
".\pumpkin.h"\
".\PumpKINDlg.h"\
".\Retrier.h"\
+ ".\shared-code\BellsNWhistles.h"\
".\shared-code\kHelpers.h"\
".\stdafx.h"\
@@ -1392,6 +1362,7 @@ DEP_CPP_TRAYE=\
DEP_CPP_TRAYE=\
".\pumpkin.h"\
".\PumpKINDlg.h"\
+ ".\shared-code\BellsNWhistles.h"\
".\shared-code\kHelpers.h"\
".\stdafx.h"\
".\Trayer.h"\
@@ -1468,6 +1439,7 @@ DEP_CPP_PROPSS=\
".\PropsSounds.h"\
".\pumpkin.h"\
".\PumpKINDlg.h"\
+ ".\shared-code\BellsNWhistles.h"\
".\shared-code\kHelpers.h"\
".\stdafx.h"\
@@ -1501,9 +1473,6 @@ DEP_CPP_PROPSS=\
# Begin Source File
SOURCE=.\PropsACL.cpp
-
-!IF "$(CFG)" == "PumpKIN - Win32 Release"
-
DEP_CPP_PROPSA=\
".\ACLTargetCombo.h"\
".\PropsACL.h"\
@@ -1514,20 +1483,15 @@ DEP_CPP_PROPSA=\
".\stdafx.h"\
+!IF "$(CFG)" == "PumpKIN - Win32 Release"
+
+
"$(INTDIR)\PropsACL.obj" : $(SOURCE) $(DEP_CPP_PROPSA) "$(INTDIR)"\
"$(INTDIR)\pumpkin.pch"
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Debug"
-DEP_CPP_PROPSA=\
- ".\ACLTargetCombo.h"\
- ".\PropsACL.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
"$(INTDIR)\PropsACL.obj" : $(SOURCE) $(DEP_CPP_PROPSA) "$(INTDIR)"\
"$(INTDIR)\pumpkin.pch"
@@ -1538,15 +1502,6 @@ DEP_CPP_PROPSA=\
!ELSEIF "$(CFG)" == "PumpKIN - Win32 Static"
-DEP_CPP_PROPSA=\
- ".\ACLTargetCombo.h"\
- ".\PropsACL.h"\
- ".\pumpkin.h"\
- ".\PumpKINDlg.h"\
- ".\shared-code\BellsNWhistles.h"\
- ".\shared-code\kHelpers.h"\
- ".\stdafx.h"\
-
"$(INTDIR)\PropsACL.obj" : $(SOURCE) $(DEP_CPP_PROPSA) "$(INTDIR)"\
"$(INTDIR)\pumpkin.pch"
@@ -1581,6 +1536,7 @@ DEP_CPP_ACLTA=\
".\ACLTargetCombo.h"\
".\pumpkin.h"\
".\PumpKINDlg.h"\
+ ".\shared-code\BellsNWhistles.h"\
".\shared-code\kHelpers.h"\
".\stdafx.h"\
diff --git a/pumpkin.rc b/pumpkin.rc
index 87745db..9933454 100644
--- a/pumpkin.rc
+++ b/pumpkin.rc
@@ -94,8 +94,7 @@ BEGIN
END
IDD_PUMPKIN_DIALOG DIALOGEX 0, 0, 362, 193
-STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION |
- WS_SYSMENU
+STYLE DS_3DLOOK | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_ACCEPTFILES | WS_EX_APPWINDOW
CAPTION " PumpKIN"
FONT 8, "MS Sans Serif"
@@ -113,12 +112,13 @@ BEGIN
WS_EX_CLIENTEDGE
PUSHBUTTON "E&xit",IDC_EXIT,305,79,50,17,BS_NOTIFY,WS_EX_CLIENTEDGE
PUSHBUTTON "&Help",ID_HELP,305,97,50,17,BS_NOTIFY,WS_EX_CLIENTEDGE
- LISTBOX IDC_LOG,7,115,348,65,LBS_USETABSTOPS | LBS_NOSEL |
- WS_VSCROLL | WS_HSCROLL,WS_EX_DLGMODALFRAME
+ LISTBOX IDC_LOG,7,115,348,64,LBS_USETABSTOPS |
+ LBS_NOINTEGRALHEIGHT | LBS_NOSEL | WS_VSCROLL |
+ WS_HSCROLL,WS_EX_DLGMODALFRAME
PUSHBUTTON "..",IDCANCEL,0,183,6,7,NOT WS_VISIBLE | NOT WS_TABSTOP
CONTROL "&Server is running",IDC_LISTENING,"Button",
BS_AUTOCHECKBOX | BS_LEFTTEXT | BS_FLAT | WS_TABSTOP,286,
- 180,69,11,WS_EX_TRANSPARENT | WS_EX_STATICEDGE
+ 181,69,11,WS_EX_TRANSPARENT | WS_EX_STATICEDGE
END
IDD_PROPS_SERVER DIALOG DISCARDABLE 0, 0, 300, 201