-rw-r--r-- | BigBrotherDoc.h | 183 |
1 files changed, 183 insertions, 0 deletions
diff --git a/BigBrotherDoc.h b/BigBrotherDoc.h new file mode 100644 index 0000000..3343e18 --- a/dev/null +++ b/BigBrotherDoc.h | |||
@@ -0,0 +1,183 @@ | |||
1 | // BigBrotherDoc.h : interface of the CBigBrotherDoc class | ||
2 | // | ||
3 | ///////////////////////////////////////////////////////////////////////////// | ||
4 | |||
5 | class CLogEntry : public CObject { | ||
6 | public: | ||
7 | enum{ | ||
8 | flagsSeparator=1 | ||
9 | }; | ||
10 | UINT flags; | ||
11 | virtual void Serialize(CArchive& ar); | ||
12 | CLogEntry(CLogEntry& src); | ||
13 | CLogEntry& operator=(CLogEntry& src); | ||
14 | BOOL m_bReached; | ||
15 | CString m_Status; | ||
16 | ULONG m_RTT; | ||
17 | CTime m_Time; | ||
18 | |||
19 | CLogEntry(); | ||
20 | DECLARE_SERIAL(CLogEntry) | ||
21 | }; | ||
22 | |||
23 | typedef CTypedPtrList<CObList,CLogEntry*>CLogList; | ||
24 | |||
25 | class CBrother; | ||
26 | class CAction: public CObject { | ||
27 | public: | ||
28 | static CString FormatLine(LPCTSTR fmt,CBrother *b); | ||
29 | BOOL operator!=(CAction& a); | ||
30 | BOOL operator==(CAction& a); | ||
31 | virtual void Serialize(CArchive& ar); | ||
32 | void PerformAction(CBrother *b); | ||
33 | static BOOL PlayASound(LPCTSTR sound); | ||
34 | CAction& operator=(CAction& src); | ||
35 | void CleanUp(); | ||
36 | enum{ | ||
37 | flagsPlayASound = 1, | ||
38 | flagsRunCustom = 2 | ||
39 | }; | ||
40 | UINT flags; | ||
41 | CString m_Sound; | ||
42 | CString m_Custom; | ||
43 | |||
44 | CAction(); | ||
45 | DECLARE_SERIAL(CAction) | ||
46 | }; | ||
47 | |||
48 | class CBrother : public CObject{ | ||
49 | public: | ||
50 | void AppendSeparator(); | ||
51 | CBrother& operator=(CBrother& b); | ||
52 | BOOL operator!=(CBrother& b); | ||
53 | BOOL operator==(CBrother& b); | ||
54 | BOOL m_bToKill; | ||
55 | void Suicide(); | ||
56 | virtual void Serialize(CArchive& ar); | ||
57 | BOOL m_bUp; | ||
58 | CRect m_rc; | ||
59 | BOOL IsValuable(); | ||
60 | ~CBrother(); | ||
61 | UINT m_HowDown; | ||
62 | BOOL m_bPinging; | ||
63 | UINT Check(); | ||
64 | CDocument* m_Doc; | ||
65 | static UINT DoCheck(LPVOID pParam); | ||
66 | BOOL m_bIsUp; | ||
67 | BOOL m_bPending; | ||
68 | CTime m_Pinged; | ||
69 | BOOL m_bPinged; | ||
70 | CLogList m_Log; | ||
71 | HTREEITEM m_Item; | ||
72 | void ParentalAdjust(BOOL cleanUp=FALSE); | ||
73 | void CleanUp(); | ||
74 | CBrother(CBrother* daddy); | ||
75 | CBrother* m_Daddy; | ||
76 | UINT m_Retries; | ||
77 | DWORD m_TimeOut; | ||
78 | UINT m_IntervalBad; | ||
79 | UINT m_IntervalGood; | ||
80 | BOOL m_bLog; | ||
81 | CAction m_Down; | ||
82 | CAction m_Up; | ||
83 | enum{ | ||
84 | flagsOverrideIntervals=1, | ||
85 | flagsOverrideTimeout=2, | ||
86 | flagsOverrideRetries=4, | ||
87 | flagsOverrideActions=8, | ||
88 | flagsOverrideLogging=16, | ||
89 | flagsExpandedTree=32, | ||
90 | flagsCurrentBrother=64 | ||
91 | }; | ||
92 | UINT flags; | ||
93 | CString m_Desc; | ||
94 | CString m_Host; | ||
95 | |||
96 | CBrother(); | ||
97 | DECLARE_SERIAL(CBrother) | ||
98 | }; | ||
99 | |||
100 | typedef CTypedPtrList<CObList,CBrother*>CBrotherList; | ||
101 | typedef CMap<DWORD,DWORD,CBrother*,CBrother*>CThisMap; | ||
102 | |||
103 | class CBigBrotherView; | ||
104 | class CActivityView; | ||
105 | class CBigBrotherDoc : public CDocument | ||
106 | { | ||
107 | protected: // create from serialization only | ||
108 | CBigBrotherDoc(); | ||
109 | DECLARE_SERIAL(CBigBrotherDoc) | ||
110 | |||
111 | // Attributes | ||
112 | public: | ||
113 | BOOL m_bStoreLastActivity; | ||
114 | enum{ | ||
115 | flagsSuspended=1, | ||
116 | flagsShowProps=2 | ||
117 | }; | ||
118 | UINT flags; | ||
119 | CTime m_AutoSaved; | ||
120 | void LogLine(LPCTSTR str); | ||
121 | CTimeSpan m_AutoSave; | ||
122 | BOOL m_bSaveOnShutdown; | ||
123 | CThisMap m_ThisMap; | ||
124 | CString m_LogFile; | ||
125 | void GetFamily(CBrother *b,CBrotherList *bh); | ||
126 | CBrother* GetCurrentBrother(); | ||
127 | void CleanUp(); | ||
128 | UINT m_PingSize; | ||
129 | int m_MaxThreads; | ||
130 | int m_Threads; | ||
131 | void TryBrother(CBrother *b); | ||
132 | BOOL CheckPendingBrother(CBrother* b,CTime& currentTime,CTime& nearestCheck,BOOL nearested); | ||
133 | void CheckPendingQueue(); | ||
134 | CTimeSpan m_MaxLogTime; | ||
135 | CActivityView *m_AView; | ||
136 | CBigBrotherView* m_BBView; | ||
137 | CBrotherList m_Brotherhood; | ||
138 | CBrother* m_RootBrother; | ||
139 | |||
140 | // Operations | ||
141 | public: | ||
142 | |||
143 | // Overrides | ||
144 | // ClassWizard generated virtual function overrides | ||
145 | //{{AFX_VIRTUAL(CBigBrotherDoc) | ||
146 | public: | ||
147 | virtual BOOL OnNewDocument(); | ||
148 | virtual void Serialize(CArchive& ar); | ||
149 | virtual void OnChangedViewList(); | ||
150 | virtual void DeleteContents(); | ||
151 | virtual void OnCloseDocument(); | ||
152 | protected: | ||
153 | virtual BOOL SaveModified(); | ||
154 | //}}AFX_VIRTUAL | ||
155 | |||
156 | // Implementation | ||
157 | public: | ||
158 | virtual ~CBigBrotherDoc(); | ||
159 | #ifdef _DEBUG | ||
160 | virtual void AssertValid() const; | ||
161 | virtual void Dump(CDumpContext& dc) const; | ||
162 | #endif | ||
163 | |||
164 | protected: | ||
165 | |||
166 | // Generated message map functions | ||
167 | protected: | ||
168 | //{{AFX_MSG(CBigBrotherDoc) | ||
169 | afx_msg void OnBrothersNew(); | ||
170 | afx_msg void OnUpdateBrothersAddbrother(CCmdUI* pCmdUI); | ||
171 | afx_msg void OnBrothersAddbrother(); | ||
172 | afx_msg void OnUpdateBrothersDelete(CCmdUI* pCmdUI); | ||
173 | afx_msg void OnBrothersDelete(); | ||
174 | afx_msg void OnFilePreferences(); | ||
175 | afx_msg void OnUpdateFilePause(CCmdUI* pCmdUI); | ||
176 | afx_msg void OnFilePause(); | ||
177 | afx_msg void OnUpdateViewHostproperties(CCmdUI* pCmdUI); | ||
178 | afx_msg void OnViewHostproperties(); | ||
179 | //}}AFX_MSG | ||
180 | DECLARE_MESSAGE_MAP() | ||
181 | }; | ||
182 | |||
183 | ///////////////////////////////////////////////////////////////////////////// | ||