#if !defined(AFX_DLGOBJECTBASE_H__AF411833_39CE_4B0D_A270_FE0CD3E73C32__INCLUDED_) #define AFX_DLGOBJECTBASE_H__AF411833_39CE_4B0D_A270_FE0CD3E73C32__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // DlgObjectBase.h : header file // #include "dlgobjectproperties.h" // to get the common defines #include "Childofdialogmessagepusher.h" // to get a child static that sends all it's children's messages to it's parent //!!!!!WARNING!!!!! // If you change any of the below typedefs you will have to be carefull to maintain the Allocate_... functions // which support them. They need to know how to point internally to the various portions of the data when allocated // since none of them use fixed size arrays internally. // typedef enum { ePlus = 0, eMinus, eMultiply, eDivide } CDOPMATHTYPE; ///////////////////////////////////////////////////////////////////////////// // CDlgObjectBalance dialog class CDlgObjectBalance : public CDialog { public: public: // Construction public: CDlgObjectBalance(CWnd* pParent = NULL); // standard constructor ~CDlgObjectBalance(); // Dialog Data //{{AFX_DATA(CDlgObjectBalance) enum { IDD = IDD_OBJECTBALANCE }; CChildOfDialogMessagePusher m_staticPropertiesGroup; CScrollBar m_sbScrollBarVert; CScrollBar m_sbScrollBarHorz; //}}AFX_DATA // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CDlgObjectBalance) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); //}}AFX_VIRTUAL void CreateSubControlsForProperties(); void ClearObjectDataSet(); BOOL SaveObjectData(); BOOL LoadObjectData(LPCSTR szDirectoryToSearchFor /*Directory passed in must end in a backslash*/, DIRECTORYSEARCHTYPE eSearchType); BOOL LoadDataFilesFromSubdirectory(CString strSubdirectory); BOOL LoadObjectDataFromFile(CString strFullWeaponFilename, BOOL fReadOnly ); void OnOK(); void OnCancel(); BOOL DisableAllControls(); BOOL MoveCurSelDataToOrFromControls(BOOL fToControls); public: // // These functions have to be called before DoModal is called since they set important information // // // Sets the root directory to search under. Only goes one level deep currently // BOOL SetObjectFilesDirectory(LPCSTR lpszDirectoryPath); // // Sets the root file name type to search for like "*.data" // BOOL SetFileNameToSearchSubdirectoriesFor(LPCSTR lpszFileSearchString); // // Allows additional control over what files are accepted. ie... you can filter out "basic.data" // BOOL SetFileFilterCallBack(FileFilterCallback fnFilterFunction) { m_fnFilterFunction = fnFilterFunction; return TRUE; }; void SetHorizontalControlSize(int nSize) {m_nHorzControlSize = nSize;}; void SetAllowPresentToChange(BOOL fAllowPresentToChange) {m_fAllowPresentToChange = fAllowPresentToChange;}; // // Specify the properties of the files that you want editted here. // // // !!!WARNING: We only store the pointer, we don't copy the data so be sure to // verify that the data is in scope the whole time the dialog is up. // BOOL SetPropertyListToEdit(CDOPPROPERTIES_TO_EDIT_ARRAY * ppteaPropertyToEdit) {m_paPropertiesToEdit = ppteaPropertyToEdit; return TRUE;}; // Specifies whether the list box should show the whole name of the object including // directory path. Cuts off everything up until the last "\" BOOL ShowFullObjectNames(BOOL fShowFullObjectName) {m_fShowFullObjectName = fShowFullObjectName; return TRUE;}; // Specifies whether the static for each property should show the whole name including // the page name or just the entry name BOOL ShowFullPropertyName(BOOL fShowFullPropertyName) {m_fShowFullPropertyName = fShowFullPropertyName; return TRUE;}; BOOL ShowPageOnly() {m_fShowPageOnly = TRUE; m_fShowFullPropertyName = FALSE; return TRUE;}; BOOL ShowEntryOnly() {m_fShowPageOnly = FALSE; m_fShowFullPropertyName = FALSE; return TRUE;}; // Specify whether you want to search just the root directory, the // first subdirectory or all subdirectories BOOL SetSearchWhichSubdirectories(DIRECTORYSEARCHTYPE eSearchType) {m_eSearchType = eSearchType; return TRUE;}; // // These structure have to be setup correctly when allocated and should never be created on the stack // // CDOPPROPERTIES_TO_EDIT_ARRAY * Allocate_CDOPPROPERTIES_TO_EDIT_ARRAY(int nPropertyCount, CDOPPROPERTIES_TO_EDIT_ARRAY * * ppCDOPPROPERTIES_TO_EDIT_ARRAY = NULL); CDOPPROPERTIES_OBJECT_PROPERTIES * Allocate_CDOPPROPERTIES_OBJECT_PROPERTIES(int nPropertyCount, CDOPPROPERTIES_OBJECT_PROPERTIES * * ppCDOPPROPERTIES_OBJECT_PROPERTIES = NULL); CDOPPROPERTIES_OBJECT_LIST * Allocate_CDOPPROPERTIES_OBJECT_LIST(int nObjectCount, int nPropertyCount, CDOPPROPERTIES_OBJECT_LIST ** ppCDOPPROPERTIES_OBJECT_LIST = NULL); // // Memcpy and memcmp can not be used on these structures since they contain pointers to memory // BOOL Copy_CDOPPROPERTIES_TO_EDIT_ARRAY(CDOPPROPERTIES_TO_EDIT_ARRAY * pCDOPPROPERTIES_TO_EDIT_ARRAY_DEST, CDOPPROPERTIES_TO_EDIT_ARRAY * pCDOPPROPERTIES_TO_EDIT_ARRAY_SRC); BOOL Copy_CDOPPROPERTIES_OBJECT_PROPERTIES(CDOPPROPERTIES_OBJECT_PROPERTIES * pCDOPPROPERTIES_OBJECT_PROPERTIES_DEST, CDOPPROPERTIES_OBJECT_PROPERTIES * pCDOPPROPERTIES_OBJECT_PROPERTIES_SRC); BOOL Copy_CDOPPROPERTIES_OBJECT_LIST(CDOPPROPERTIES_OBJECT_LIST * pCDOPPROPERTIES_OBJECT_LIST_DEST, CDOPPROPERTIES_OBJECT_LIST * pCDOPPROPERTIES_OBJECT_LIST_SRC); BOOL IsEqual_CDOPPROPERTIES_TO_EDIT_ARRAY(CDOPPROPERTIES_TO_EDIT_ARRAY * pCDOPPROPERTIES_TO_EDIT_ARRAY1, CDOPPROPERTIES_TO_EDIT_ARRAY * pCDOPPROPERTIES_TO_EDIT_ARRAY2); BOOL IsEqual_CDOPPROPERTIES_OBJECT_PROPERTIES(CDOPPROPERTIES_OBJECT_PROPERTIES * pCDOPPROPERTIES_OBJECT_PROPERTIES1, CDOPPROPERTIES_OBJECT_PROPERTIES * pCDOPPROPERTIES_OBJECT_PROPERTIES2); BOOL IsEqual_CDOPPROPERTIES_OBJECT_LIST(CDOPPROPERTIES_OBJECT_LIST * pCDOPPROPERTIES_OBJECT_LIST1, CDOPPROPERTIES_OBJECT_LIST * pCDOPPROPERTIES_OBJECT_LIST2); // // This function allows you to create the properties array easily by calling this function with the format: // CreatePropertiesToEditArray(2, // efloat, "GameData\Heat", // eint, "GameData\Ammo"); // CDOPPROPERTIES_TO_EDIT_ARRAY * CreatePropertiesToEditArray(int nCount, ...); BOOL UpdateControlData(BOOL fToControls); LPCSTR GetEntryNameToPropertyName(LPCSTR szPropertyName); LPCSTR GetPageNameToPropertyName(LPCSTR szPropertyName) ; LPCSTR GetShortObjectName(LPCSTR szObjectName); void AlterAllProperties(CDOPMATHTYPE eMathType); void AlterProperty(int nProperty, void * pValueToAlterWith, CDOPMATHTYPE eMath); // Override to do parameter checking inline virtual BOOL OnNotify_Public(WPARAM wParam, LPARAM lParam, LRESULT* pResult) {return OnNotify(wParam, lParam, pResult);}; inline virtual BOOL OnCommand_Public(WPARAM wParam, LPARAM lParam) {return OnCommand(wParam, lParam);}; virtual int DoModal(); protected: BOOL GetBOOLFromControl(UINT uiID, BOOL * pfDest); BOOL GetfloatFromControl(UINT uiID, float * pfltDest); BOOL GetLPSTRFromControl(UINT uiID, LPSTR pszDest); BOOL GetintFromControl(UINT uiID, int * pnDest); BOOL GetVector3DFromControl(UINT uiID, float * pfltx, float * pflty, float * pfltz); BOOL GetBOOLFromButton(UINT uiID, BOOL * pfDest); BOOL SetBOOLToButton(UINT uiID, BOOL fSrc); BOOL SetBOOLToControl(UINT uiID, BOOL fSrc); BOOL SetfloatToControl(UINT uiID, float fltSrc); BOOL SetLPSTRToControl(UINT uiID, LPSTR pszSrc); BOOL SetintToControl(UINT uiID, int nSrc); BOOL SetVector3DToControl(UINT uiID, float fltx, float flty, float fltz); void DoTheMath(int * pValue, int * pModifier, CDOPMATHTYPE eMath); void DoTheMath(float * pValue, float * pModifier, CDOPMATHTYPE eMath); void ClearModifierCells(); BOOL IsCreatedControl(int uID); BOOL IsCreatedPresentButton(int uID); BOOL IsCreatedApplyButton(int uID); void SetAllApplyButtons(int nState); virtual BOOL OnNotifyCreatedControl(WPARAM wParam, LPARAM lParam, LRESULT* pResult); virtual BOOL OnCommandCreatedControl(WPARAM wParam, LPARAM lParam); BOOL IsRectTotallyWithinHorizontally(LPRECT pRectToTest, LPRECT pOuterRect); // used for scrolling BOOL IsHorizontallyScrollable(CWnd * pChildWindow); int GetStateForApplyAllButton(); // this returns 0 for all off, 1 for all on, and 2 for a mix // Data // Object list, these are the "files" that we are editting. CDOPPROPERTIES_OBJECT_LIST * m_pObjectList; // This is the properties list that the caller is requesting. It is just a pointer to // the callers memory. CDOPPROPERTIES_TO_EDIT_ARRAY * m_paPropertiesToEdit; // Root directory to search in CString m_strObjectFilesRootDirectory; // Wild card specification for what files we are looking for ie... "*.data" CString m_strFileNameToSearchSubdirectoriesFor; // This function if specified gets called for ever file we think should be added // it will FileFilterCallback m_fnFilterFunction; BOOL m_fShowFullObjectName; BOOL m_fShowFullPropertyName; DIRECTORYSEARCHTYPE m_eSearchType; UINT m_nLastControlID; BOOL m_fDirty; BOOL m_fAllowPresentToChange; int m_nMaxVisibleVert; int m_nCurScrollPosVert; int m_nScrollIncrementVert; int m_nMaxVisibleHorz; int m_nCurScrollPosHorz; int m_nScrollIncrementHorz; BOOL m_fShowPageOnly; // show only page, or show only entry when not showing full length int m_nHorzControlSize; // Implementation protected: // Generated message map functions //{{AFX_MSG(CDlgObjectBalance) virtual BOOL OnInitDialog(); afx_msg void OnValuePlus(); afx_msg void OnValueMultiply(); afx_msg void OnValueMinus(); afx_msg void OnValueDivide(); afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); afx_msg void OnFillAllValues(); afx_msg void OnCheckallApplyButtons(); //}}AFX_MSG afx_msg BOOL OnEraseBkgnd( CDC* pDC ); DECLARE_MESSAGE_MAP() }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_DLGOBJECTBASE_H__AF411833_39CE_4B0D_A270_FE0CD3E73C32__INCLUDED_)