Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/apps/mplayerc/PlayerSeekBar.cpp')
-rw-r--r--src/apps/mplayerc/PlayerSeekBar.cpp55
1 files changed, 33 insertions, 22 deletions
diff --git a/src/apps/mplayerc/PlayerSeekBar.cpp b/src/apps/mplayerc/PlayerSeekBar.cpp
index 93ca04c90..416307963 100644
--- a/src/apps/mplayerc/PlayerSeekBar.cpp
+++ b/src/apps/mplayerc/PlayerSeekBar.cpp
@@ -43,16 +43,18 @@ CPlayerSeekBar::~CPlayerSeekBar()
BOOL CPlayerSeekBar::Create(CWnd* pParentWnd)
{
- if(!CDialogBar::Create(pParentWnd, IDD_PLAYERSEEKBAR, WS_CHILD|WS_VISIBLE|CBRS_ALIGN_BOTTOM, IDD_PLAYERSEEKBAR))
+ if(!CDialogBar::Create(pParentWnd, IDD_PLAYERSEEKBAR, WS_CHILD|WS_VISIBLE|CBRS_ALIGN_BOTTOM, IDD_PLAYERSEEKBAR)) {
return FALSE;
+ }
return TRUE;
}
BOOL CPlayerSeekBar::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!CDialogBar::PreCreateWindow(cs))
+ if(!CDialogBar::PreCreateWindow(cs)) {
return FALSE;
+ }
m_dwStyle &= ~CBRS_BORDER_TOP;
m_dwStyle &= ~CBRS_BORDER_BOTTOM;
@@ -75,10 +77,14 @@ void CPlayerSeekBar::GetRange(__int64& start, __int64& stop)
void CPlayerSeekBar::SetRange(__int64 start, __int64 stop)
{
- if(start > stop) start ^= stop, stop ^= start, start ^= stop;
+ if(start > stop) {
+ start ^= stop, stop ^= start, start ^= stop;
+ }
m_start = start;
m_stop = stop;
- if(m_pos < m_start || m_pos >= m_stop) SetPos(m_start);
+ if(m_pos < m_start || m_pos >= m_stop) {
+ SetPos(m_start);
+ }
}
__int64 CPlayerSeekBar::GetPos()
@@ -94,27 +100,31 @@ __int64 CPlayerSeekBar::GetPosReal()
void CPlayerSeekBar::SetPos(__int64 pos)
{
CWnd* w = GetCapture();
- if(w && w->m_hWnd == m_hWnd) return;
+ if(w && w->m_hWnd == m_hWnd) {
+ return;
+ }
SetPosInternal(pos);
}
void CPlayerSeekBar::SetPosInternal(__int64 pos)
{
- if(m_pos == pos) return;
+ if(m_pos == pos) {
+ return;
+ }
CRect before = GetThumbRect();
m_pos = min(max(pos, m_start), m_stop);
m_posreal = pos;
CRect after = GetThumbRect();
- if(before != after)
- {
+ if(before != after) {
InvalidateRect(before | after);
CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
- if((AfxGetAppSettings().fUseWin7TaskBar)&&(pFrame->m_pTaskbarList))
+ if((AfxGetAppSettings().fUseWin7TaskBar)&&(pFrame->m_pTaskbarList)) {
pFrame->m_pTaskbarList->SetProgressValue ( pFrame->m_hWnd, pos, m_stop );
+ }
}
}
@@ -129,7 +139,7 @@ CRect CPlayerSeekBar::GetChannelRect()
CRect CPlayerSeekBar::GetThumbRect()
{
-// bool fEnabled = m_fEnabled || m_start >= m_stop;
+ // bool fEnabled = m_fEnabled || m_start >= m_stop;
CRect r = GetChannelRect();
@@ -156,15 +166,19 @@ void CPlayerSeekBar::MoveThumb(CPoint point)
{
CRect r = GetChannelRect();
- if(r.left >= r.right) return;
+ if(r.left >= r.right) {
+ return;
+ }
- if(point.x < r.left) SetPos(m_start);
- else if(point.x >= r.right) SetPos(m_stop);
- else
- {
+ if(point.x < r.left) {
+ SetPos(m_start);
+ } else if(point.x >= r.right) {
+ SetPos(m_stop);
+ } else {
__int64 w = r.right - r.left;
- if(m_start < m_stop)
+ if(m_start < m_stop) {
SetPosInternal(m_start + ((m_stop - m_start) * (point.x - r.left) + (w/2)) / w);
+ }
}
}
@@ -215,8 +229,7 @@ void CPlayerSeekBar::OnPaint()
r.DeflateRect(1, 1, 0, 0);
dc.Draw3dRect(&r, shadow, bkg);
- if(fEnabled)
- {
+ if(fEnabled) {
r.DeflateRect(1, 1, 1, 2);
CPen white(PS_INSIDEFRAME, 1, white);
CPen* old = dc.SelectObject(&white);
@@ -272,8 +285,7 @@ void CPlayerSeekBar::OnSize(UINT nType, int cx, int cy)
void CPlayerSeekBar::OnLButtonDown(UINT nFlags, CPoint point)
{
- if(m_fEnabled && (GetChannelRect() | GetThumbRect()).PtInRect(point))
- {
+ if(m_fEnabled && (GetChannelRect() | GetThumbRect()).PtInRect(point)) {
SetCapture();
MoveThumb(point);
GetParent()->PostMessage(WM_HSCROLL, MAKEWPARAM((short)m_pos, SB_THUMBPOSITION), (LPARAM)m_hWnd);
@@ -292,8 +304,7 @@ void CPlayerSeekBar::OnLButtonUp(UINT nFlags, CPoint point)
void CPlayerSeekBar::OnMouseMove(UINT nFlags, CPoint point)
{
CWnd* w = GetCapture();
- if(w && w->m_hWnd == m_hWnd && (nFlags & MK_LBUTTON))
- {
+ if(w && w->m_hWnd == m_hWnd && (nFlags & MK_LBUTTON)) {
MoveThumb(point);
GetParent()->PostMessage(WM_HSCROLL, MAKEWPARAM((short)m_pos, SB_THUMBTRACK), (LPARAM)m_hWnd);
}