/
MainFrm.h
143 lines (118 loc) · 3.85 KB
/
MainFrm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
// MainFrm.h : interface of the CMainFrame class
//
// Copyright (c) 2004, Steven Scott (progoth@gmail.com)
//
// This file is part of iSnooze.
//
// iSnooze is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// iSnooze is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with iSnooze; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#pragma once
#include "ChildView.h"
#include "SystemTray.h"
#include "ConfigDlg.h"
#include <list>
#define WM_ICON_NOTIFY WM_APP+10
#define WM_CONFIG_UPDATE WM_APP+11
#define WM_DO_ALARM WM_APP+12
#define WM_SET_VOLUME WM_APP+13
#define WM_USER_RETURNED WM_APP+14
#define WM_USER_GONE WM_APP+15
#define WM_CLOSE_ITI WM_APP+16
typedef enum { VI_NOOP, VI_INCREASE, VI_PAUSE } VolumeIncreaseState;
class CMainFrame : public CFrameWnd
{
public:
CMainFrame();
protected:
DECLARE_DYNAMIC(CMainFrame)
// Attributes
public:
// Operations
public:
// Overrides
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL LoadFrame(UINT nIDResource, DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, CWnd* pParentWnd = NULL, CCreateContext* pContext = NULL);
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
void timeCheck();
void setVolume( UINT level );
void closeITI();
int getVolumeLength()
{ return m_inclength; }
VolumeIncreaseState increasingVolume()
{ return m_volumeIncreasing; }
bool snoozeDlgOpened()
{ return m_snoozeDlgOpen; }
void userReturned();
void userGone();
void StartTray();
// Generated message map functions
protected:
CSystemTray m_systray;
CMutex m_systrayMutex;
CConfigDlg *m_config;
RegMap m_reg;
/*long m_hour;
long m_minute;
long m_thour;
long m_tminute;*/
//DayTime::TimeAndDays m_alarmTime;
DayTime::TimeAndDays m_snoozeAlarmTime;
CMutex m_snoozeTimeMutex;
volatile bool m_snoozing;
ITID m_pls;
tstring m_plsname;
volatile bool m_shuffle;
volatile bool m_increase;
volatile bool m_minimize;
volatile bool m_enableSnooze;
volatile unsigned char m_snoozeTime;
volatile int m_inclength;
volatile VolumeIncreaseState m_volumeIncreasing;
volatile bool m_muteOnRet;
volatile bool m_snoozeDlgOpen;
volatile bool m_alarmEnabled;
volatile bool m_oneAlarmExists;
volatile bool m_oneAlarmEnabled;
DWORD m_mainThread;
std::vector< std::list<DayTime::TimeAndDays*> > m_alarms;
CMutex m_alarmsMutex;
void LoadReg();
void InitReg();
void SetToolTip();
void SetIcon();
afx_msg void OnFileClose();
afx_msg void OnClose();
DECLARE_MESSAGE_MAP()
public:
afx_msg LRESULT OnTrayNotification(UINT wParam, LONG lParam);
afx_msg LRESULT OnConfigUpdate(UINT wParam, LONG lParam);
afx_msg LRESULT DoAlarm(UINT wParam, LONG lParam);
afx_msg LRESULT DoCloseITI(UINT wParam, LONG lParam);
afx_msg LRESULT OnSetVolume(UINT wParam, LONG lParam);
afx_msg LRESULT OnUserReturned(UINT wParam, LONG lParam);
afx_msg LRESULT OnUserGone(UINT wParam, LONG lParam);
afx_msg void OnAppConfigure();
afx_msg void OnPoopTestbubble();
afx_msg void OnTestLaunch();
afx_msg void OnAlarmEnabled();
afx_msg void OnAppCancelsnooze();
afx_msg void OnUpdateAppCancelsnooze(CCmdUI *pCmdUI);
};