ref: e27b68138a81047e955042b9bf09f3232448e51b
parent: f451c32474504a0329b572f436f8eacd904fba9c
author: xfhobbes <xfhobbes>
date: Sun Apr 1 06:54:05 EDT 2001
added general user input tracking during job list processing and question for target directory creation where appropriate
--- /dev/null
+++ b/wingui/AskCreateDirectoryDialog.cpp
@@ -1,0 +1,74 @@
+// AskCreateDirectoryDialog.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "faac_wingui.h"
+#include "AskCreateDirectoryDialog.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CAskCreateDirectoryDialog dialog
+
+
+CAskCreateDirectoryDialog::CAskCreateDirectoryDialog(const CString &oDirectory, CWnd* pParent /*=NULL*/)
+ : CDialog(CAskCreateDirectoryDialog::IDD, pParent)
+{
+ //{{AFX_DATA_INIT(CAskCreateDirectoryDialog)
+ m_oLabelTargetDir = _T("");
+ //}}AFX_DATA_INIT
+ m_oLabelTargetDir=oDirectory;
+}
+
+CAskCreateDirectoryDialog::~CAskCreateDirectoryDialog()
+{
+}
+
+void CAskCreateDirectoryDialog::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CAskCreateDirectoryDialog)
+ DDX_Text(pDX, IDC_LABELTARGETDIR, m_oLabelTargetDir);
+ //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(CAskCreateDirectoryDialog, CDialog)
+ //{{AFX_MSG_MAP(CAskCreateDirectoryDialog)
+ ON_BN_CLICKED(IDC_BUTTONYES, OnButtonYes)
+ ON_BN_CLICKED(IDC_BUTTONNO, OnButtonNo)
+ ON_BN_CLICKED(IDC_BUTTONALWAYS, OnButtonAlways)
+ ON_BN_CLICKED(IDC_BUTTONNEVER, OnButtonNever)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CAskCreateDirectoryDialog message handlers
+
+void CAskCreateDirectoryDialog::OnButtonYes()
+{
+ // TODO: Add your control notification handler code here
+ EndDialog(eYes);
+}
+
+void CAskCreateDirectoryDialog::OnButtonNo()
+{
+ // TODO: Add your control notification handler code here
+ EndDialog(eNo);
+}
+
+void CAskCreateDirectoryDialog::OnButtonAlways()
+{
+ // TODO: Add your control notification handler code here
+ EndDialog(eAlways);
+}
+
+void CAskCreateDirectoryDialog::OnButtonNever()
+{
+ // TODO: Add your control notification handler code here
+ EndDialog(eNever);
+}
--- /dev/null
+++ b/wingui/AskCreateDirectoryDialog.h
@@ -1,0 +1,59 @@
+#if !defined(AFX_ASKCREATEDIRECTORYDIALOG_H__5D3060C2_1CA9_11D5_8402_0080C88C25BD__INCLUDED_)
+#define AFX_ASKCREATEDIRECTORYDIALOG_H__5D3060C2_1CA9_11D5_8402_0080C88C25BD__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// AskCreateDirectoryDialog.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CAskCreateDirectoryDialog dialog
+
+class CAskCreateDirectoryDialog : public CDialog
+{
+// Construction
+public:
+ CAskCreateDirectoryDialog(const CString &oDirectory, CWnd* pParent = NULL); // standard constructor
+ virtual ~CAskCreateDirectoryDialog();
+
+// Dialog Data
+ //{{AFX_DATA(CAskCreateDirectoryDialog)
+ enum { IDD = IDD_ASKCREATEDIRECTORYDIALOG };
+ CString m_oLabelTargetDir;
+ //}}AFX_DATA
+
+ // one of the following values is returned by DoModal()
+ enum ECreateDirectoryDialogReturn
+ {
+ eNo,
+ eYes,
+ eAlways,
+ eNever,
+ };
+
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CAskCreateDirectoryDialog)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+
+ // Generated message map functions
+ //{{AFX_MSG(CAskCreateDirectoryDialog)
+ afx_msg void OnButtonYes();
+ afx_msg void OnButtonNo();
+ afx_msg void OnButtonAlways();
+ afx_msg void OnButtonNever();
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_ASKCREATEDIRECTORYDIALOG_H__5D3060C2_1CA9_11D5_8402_0080C88C25BD__INCLUDED_)
--- /dev/null
+++ b/wingui/JobProcessingDynamicUserInputInfo.cpp
@@ -1,0 +1,92 @@
+// JobProcessingDynamicUserInputInfo.cpp: implementation of the CJobProcessingDynamicUserInputInfo class.
+// Author: Torsten Landmann
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "faac_wingui.h"
+#include "JobProcessingDynamicUserInputInfo.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CJobProcessingDynamicUserInputInfo::CJobProcessingDynamicUserInputInfo():
+ m_eAutoCreateDirectories(eYes)
+{
+
+}
+
+CJobProcessingDynamicUserInputInfo::~CJobProcessingDynamicUserInputInfo()
+{
+
+}
+
+CJobProcessingDynamicUserInputInfo::EAutoCreateDirectories CJobProcessingDynamicUserInputInfo::GetAutoCreateDirectories(const CString &oCurrentDirToCreate, bool bReturnOnlyYesOrNo)
+{
+ switch (m_eAutoCreateDirectories)
+ {
+ case eNo:
+ case eYes:
+ {
+ // must ask the user
+ CAskCreateDirectoryDialog oDlg(oCurrentDirToCreate);
+ m_eAutoCreateDirectories=TranslateFromAskDialog((CAskCreateDirectoryDialog::ECreateDirectoryDialogReturn)oDlg.DoModal());
+ break;
+ }
+ default:
+ {
+ // don't need to ask the user
+ break;
+ }
+ }
+
+ EAutoCreateDirectories eToReturn(m_eAutoCreateDirectories);
+
+ if (bReturnOnlyYesOrNo)
+ {
+ if (eToReturn==eAlways) eToReturn=eYes;
+ if (eToReturn==eNever) eToReturn=eNo;
+ }
+
+ return eToReturn;
+}
+
+bool CJobProcessingDynamicUserInputInfo::GetAutoCreateDirectoryBool(const CString &oCurrentDirToCreate)
+{
+ return GetAutoCreateDirectories(oCurrentDirToCreate, true)==eYes;
+}
+
+CJobProcessingDynamicUserInputInfo::EAutoCreateDirectories CJobProcessingDynamicUserInputInfo::TranslateFromAskDialog(CAskCreateDirectoryDialog::ECreateDirectoryDialogReturn eDialogReturn)
+{
+ switch (eDialogReturn)
+ {
+ case CAskCreateDirectoryDialog::eNo:
+ {
+ return eNo;
+ }
+ case CAskCreateDirectoryDialog::eYes:
+ {
+ return eYes;
+ }
+ case CAskCreateDirectoryDialog::eAlways:
+ {
+ return eAlways;
+ }
+ default:
+ {
+ // unknown parameter value
+ ASSERT(false);
+ }
+ case CAskCreateDirectoryDialog::eNever:
+ {
+ return eNever;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+++ b/wingui/JobProcessingDynamicUserInputInfo.h
@@ -1,0 +1,44 @@
+// JobProcessingDynamicUserInputInfo.h: interface for the CJobProcessingDynamicUserInputInfo class.
+// Author: Torsten Landmann
+//
+// This class asks questions to the user and/or saves the referring answers for
+// future reuse during the processing of a job list
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_JOBPROCESSINGDYNAMICUSERINPUTINFO_H__5D3060C1_1CA9_11D5_8402_0080C88C25BD__INCLUDED_)
+#define AFX_JOBPROCESSINGDYNAMICUSERINPUTINFO_H__5D3060C1_1CA9_11D5_8402_0080C88C25BD__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "AskCreateDirectoryDialog.h"
+
+class CJobProcessingDynamicUserInputInfo
+{
+public:
+ CJobProcessingDynamicUserInputInfo();
+ virtual ~CJobProcessingDynamicUserInputInfo();
+
+ enum EAutoCreateDirectories
+ {
+ eNo,
+ eYes,
+ eAlways,
+ eNever,
+ };
+
+ // finds out if the necessary directory for a target
+ // file is to be created (if not usually the
+ // processing of the file will fail)
+ EAutoCreateDirectories GetAutoCreateDirectories(const CString &oCurrentDirToCreate, bool bReturnOnlyYesOrNo=true);
+ // this is an easier to use version of the last member
+ bool GetAutoCreateDirectoryBool(const CString &oCurrentDirToCreate);
+
+private:
+ EAutoCreateDirectories m_eAutoCreateDirectories;
+ static EAutoCreateDirectories TranslateFromAskDialog(CAskCreateDirectoryDialog::ECreateDirectoryDialogReturn eDialogReturn);
+};
+
+#endif // !defined(AFX_JOBPROCESSINGDYNAMICUSERINPUTINFO_H__5D3060C1_1CA9_11D5_8402_0080C88C25BD__INCLUDED_)