001: // CTPuzzleDlg.h : header file

002: //

003: 
004: #if !defined(AFX_CTPUZZLEDLG_H__4309079D_C92E_4B33_AFED_393A7CF8836E__INCLUDED_)
005: #define AFX_CTPUZZLEDLG_H__4309079D_C92E_4B33_AFED_393A7CF8836E__INCLUDED_
006: 
007: #if _MSC_VER > 1000
008: #pragma once
009: #endif // _MSC_VER > 1000

010:                   
011: #include "UKPuzzleAdmin.h"
012: /////////////////////////////////////////////////////////////////////////////

013: // CCTPuzzleDlg dialog

014: 
015: class CCTPuzzleDlg : public CDialog
016: {
017: // Construction

018: public:
019:         CCTPuzzleDlg(CWnd* pParent = NULL);        // standard constructor

020: 
021: // Dialog Data

022:         //{{AFX_DATA(CCTPuzzleDlg)

023:         enum { IDD = IDD_CTPUZZLE_DIALOG };
024:         CString        m_strPastTime;
025:         CString        m_strSolutions;
026:         CString        m_strSolutionsPerSecond;
027:         CString        m_strSolutionsPerSecond2;
028:         //}}AFX_DATA

029: 
030:         // ClassWizard generated virtual function overrides

031:         //{{AFX_VIRTUAL(CCTPuzzleDlg)

032:         protected:
033:         virtual void DoDataExchange(CDataExchange* pDX);        // DDX/DDV support

034:         //}}AFX_VIRTUAL

035: 
036: public:
037:         BOOL PrepareDialog(LPCTSTR szCfgFileName){m_strInCfgFileName=szCfgFileName;return TRUE;}
038: 
039: // Implementation

040: protected:
041:         HICON m_hIcon;
042: 
043:         // Generated message map functions

044:         //{{AFX_MSG(CCTPuzzleDlg)

045:         virtual BOOL OnInitDialog();
046:         afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
047:         afx_msg void OnPaint();
048:         afx_msg HCURSOR OnQueryDragIcon();
049:         virtual void OnOK();
050:         virtual void OnCancel();
051:         afx_msg void OnStop();
052:         afx_msg void OnStart();
053:         afx_msg void OnPause();
054:         afx_msg void OnContinue();
055:         afx_msg void OnCloseDialog();
056:         afx_msg void OnClose();
057:         afx_msg void OnTimer(UINT nIDEvent);
058:         afx_msg void OnLoadConfig();
059:         //}}AFX_MSG

060:         afx_msg LRESULT OnUKWrite(WPARAM, LPARAM); 
061:         afx_msg LRESULT OnUKNotify(WPARAM, LPARAM); 
062:         afx_msg void OnUpdateButtonStop(CCmdUI* pCmdUI);
063:         afx_msg void OnUpdateButtonStart(CCmdUI* pCmdUI);
064:         afx_msg void OnUpdateButtonPause(CCmdUI* pCmdUI);
065:         afx_msg void OnUpdateButtonContinue(CCmdUI* pCmdUI);
066:         afx_msg void OnUpdateLoadConfig(CCmdUI* pCmdUI);
067:         DECLARE_MESSAGE_MAP()
068: 
069: protected:
070:         void __cdecl Write(LPCTSTR strText,...);
071:         void __cdecl WriteLn(LPCTSTR strText,...);
072: 
073:         //enum{enMaxAdminThreads=CUKPuzzleCore::enLastStoneToProof-CUKPuzzleCore::enFirstStoneToProof+1};

074:         
075:         BOOL        InitThreads();
076:         void        DeinitThreads();
077:         BOOL        m_bAdminVectorIsInit;
078: 
079:         long        m_nThreadCount;
080:         long        m_nMaxActiveThreads;
081:         long        m_nActiveThreads;
082: 
083:         struct SUKAdminThread
084:         {
085:                 SUKAdminThread(CWnd* pWnd,long nFirstStoneOnPos_0=-1,long nLastStoneOnPos_0=-1,LPCTSTR szIniFileName="",LPCTSTR szOutputFileName="")
086:                         :theThread(pWnd,nFirstStoneOnPos_0,nLastStoneOnPos_0,szIniFileName,szOutputFileName),
087:                          bWasStarted(FALSE),
088:                          bWasFinished(FALSE),
089:                          nResultCount(0){}
090: 
091:                 CUKPuzzleAdmin theThread;
092:                         
093:                 BOOL bWasStarted;
094:                 BOOL bWasFinished;
095: 
096:                 long nResultCount;
097:         };
098:         SUKAdminThread **m_pPuzzleAdminVector;//[enMaxAdminThreads];

099:         //CUKPuzzleAdmin* m_pPuzzleAdminVector[enMaxAdminThreads];

100: 
101:         UINT m_nTimerID1;
102:         UINT m_nTimerID2;
103: 
104:         long  m_nState;
105:         DWORD m_nTimerStart;
106:         DWORD m_nElapsedTime;//excluding the time since last start or continue

107: 
108:         //variables for displaying Time average over the last 100 

109:         enum {enSolutionAveraging=100};
110:         long m_nItemCount;
111:         long m_nLastItem;
112:         DWORD m_nLastResultCount[enSolutionAveraging];
113:         DWORD m_nLastResultTime[enSolutionAveraging];
114: 
115:         CString m_strConfigFileName;
116:         CString m_strOutputFileNameBase;
117: 
118:         //Input Attributes, given by prepare dialog

119:         CString m_strInCfgFileName;
120: 
121:         TCHAR m_szPrompt[16];//maxPromptSize

122: };
123: 
124: //{{AFX_INSERT_LOCATION}}

125: // Microsoft Visual C++ will insert additional declarations immediately before the previous line.

126: 
127: #endif // !defined(AFX_CTPUZZLEDLG_H__4309079D_C92E_4B33_AFED_393A7CF8836E__INCLUDED_)