diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-04-09 18:12:59 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-04-09 18:12:59 +0400 |
commit | efbc9d9043ff8ff92716ddd00a5f61412d535593 (patch) | |
tree | 8f3e621f756cf1f5b4d64d97964c7e7abd8aaf08 /src/apps/mplayerc/PlayerInfoBar.cpp | |
parent | df6b139a6d9027156f614b68687e039e3a5854db (diff) |
revert r1783
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1785 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/apps/mplayerc/PlayerInfoBar.cpp')
-rw-r--r-- | src/apps/mplayerc/PlayerInfoBar.cpp | 232 |
1 files changed, 116 insertions, 116 deletions
diff --git a/src/apps/mplayerc/PlayerInfoBar.cpp b/src/apps/mplayerc/PlayerInfoBar.cpp index 95743a97e..6f2908da6 100644 --- a/src/apps/mplayerc/PlayerInfoBar.cpp +++ b/src/apps/mplayerc/PlayerInfoBar.cpp @@ -40,128 +40,128 @@ CPlayerInfoBar::~CPlayerInfoBar() void CPlayerInfoBar::SetLine(CString label, CString info)
{
- if(info.IsEmpty())
- {
- RemoveLine(label);
- return;
- }
-
- for(size_t idx = 0; idx < m_label.GetCount(); idx++)
- {
- CString tmp;
- m_label[idx]->GetWindowText(tmp);
- if(label == tmp)
- {
- m_info[idx]->GetWindowText(tmp);
- if(info != tmp) m_info[idx]->SetWindowText(info);
- return;
- }
- }
-
- CAutoPtr<CStatusLabel> l(DNew CStatusLabel(true, false));
- l->Create(label, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SS_OWNERDRAW, CRect(0, 0, 0, 0), this);
- m_label.Add(l);
-
- CAutoPtr<CStatusLabel> i(DNew CStatusLabel(false, true));
- i->Create(info, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SS_OWNERDRAW, CRect(0, 0, 0, 0), this);
- m_info.Add(i);
-
- Relayout();
+ if(info.IsEmpty())
+ {
+ RemoveLine(label);
+ return;
+ }
+
+ for(size_t idx = 0; idx < m_label.GetCount(); idx++)
+ {
+ CString tmp;
+ m_label[idx]->GetWindowText(tmp);
+ if(label == tmp)
+ {
+ m_info[idx]->GetWindowText(tmp);
+ if(info != tmp) m_info[idx]->SetWindowText(info);
+ return;
+ }
+ }
+
+ CAutoPtr<CStatusLabel> l(DNew CStatusLabel(true, false));
+ l->Create(label, WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS|SS_OWNERDRAW, CRect(0,0,0,0), this);
+ m_label.Add(l);
+
+ CAutoPtr<CStatusLabel> i(DNew CStatusLabel(false, true));
+ i->Create(info, WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS|SS_OWNERDRAW, CRect(0,0,0,0), this);
+ m_info.Add(i);
+
+ Relayout();
}
void CPlayerInfoBar::GetLine(CString label, CString& info)
{
- info.Empty();
-
- for(size_t idx = 0; idx < m_label.GetCount(); idx++)
- {
- CString tmp;
- m_label[idx]->GetWindowText(tmp);
- if(label == tmp)
- {
- m_info[idx]->GetWindowText(tmp);
- info = tmp;
- return;
- }
- }
+ info.Empty();
+
+ for(size_t idx = 0; idx < m_label.GetCount(); idx++)
+ {
+ CString tmp;
+ m_label[idx]->GetWindowText(tmp);
+ if(label == tmp)
+ {
+ m_info[idx]->GetWindowText(tmp);
+ info = tmp;
+ return;
+ }
+ }
}
void CPlayerInfoBar::RemoveLine(CString label)
{
- for(size_t i = 0; i < m_label.GetCount(); i++)
- {
- CString tmp;
- m_label[i]->GetWindowText(tmp);
- if(label == tmp)
- {
- m_label.RemoveAt(i);
- m_info.RemoveAt(i);
- break;
- }
- }
-
- Relayout();
+ for(size_t i = 0; i < m_label.GetCount(); i++)
+ {
+ CString tmp;
+ m_label[i]->GetWindowText(tmp);
+ if(label == tmp)
+ {
+ m_label.RemoveAt(i);
+ m_info.RemoveAt(i);
+ break;
+ }
+ }
+
+ Relayout();
}
void CPlayerInfoBar::RemoveAllLines()
{
- m_label.RemoveAll();
- m_info.RemoveAll();
+ m_label.RemoveAll();
+ m_info.RemoveAll();
- Relayout();
+ Relayout();
}
BOOL CPlayerInfoBar::Create(CWnd* pParentWnd)
{
- return CDialogBar::Create(pParentWnd, IDD_PLAYERINFOBAR, WS_CHILD | WS_VISIBLE | CBRS_ALIGN_BOTTOM, IDD_PLAYERINFOBAR);
+ return CDialogBar::Create(pParentWnd, IDD_PLAYERINFOBAR, WS_CHILD|WS_VISIBLE|CBRS_ALIGN_BOTTOM, IDD_PLAYERINFOBAR);
}
BOOL CPlayerInfoBar::PreCreateWindow(CREATESTRUCT& cs)
{
- if(!CDialogBar::PreCreateWindow(cs))
- return FALSE;
+ if(!CDialogBar::PreCreateWindow(cs))
+ return FALSE;
- m_dwStyle &= ~CBRS_BORDER_TOP;
- m_dwStyle &= ~CBRS_BORDER_BOTTOM;
+ m_dwStyle &= ~CBRS_BORDER_TOP;
+ m_dwStyle &= ~CBRS_BORDER_BOTTOM;
- return TRUE;
+ return TRUE;
}
CSize CPlayerInfoBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
{
- CRect r;
- GetParent()->GetClientRect(&r);
- r.bottom = r.top + m_label.GetCount() * 17 + (m_label.GetCount() ? 4 : 0);
- return r.Size();
+ CRect r;
+ GetParent()->GetClientRect(&r);
+ r.bottom = r.top + m_label.GetCount() * 17 + (m_label.GetCount() ? 4 : 0);
+ return r.Size();
}
void CPlayerInfoBar::Relayout()
{
- CRect r;
- GetParent()->GetClientRect(&r);
-
- int w = m_nFirstColWidth, h = 17, y = 2;
-
- for(size_t i = 0; i < m_label.GetCount(); i++)
- {
- CDC* pDC = m_label[i]->GetDC();
- CString str;
- m_label[i]->GetWindowText(str);
- w = max(w, pDC->GetTextExtent(str).cx);
- m_label[i]->ReleaseDC(pDC);
- }
-
- for(size_t i = 0; i < m_label.GetCount(); i++, y += h)
- {
- m_label[i]->MoveWindow(1, y, w - 10, h);
- m_info[i]->MoveWindow(w + 10, y, r.Width() - (w + 10) - 1, h);
- }
+ CRect r;
+ GetParent()->GetClientRect(&r);
+
+ int w = m_nFirstColWidth, h = 17, y = 2;
+
+ for(size_t i = 0; i < m_label.GetCount(); i++)
+ {
+ CDC* pDC = m_label[i]->GetDC();
+ CString str;
+ m_label[i]->GetWindowText(str);
+ w = max(w, pDC->GetTextExtent(str).cx);
+ m_label[i]->ReleaseDC(pDC);
+ }
+
+ for(size_t i = 0; i < m_label.GetCount(); i++, y += h)
+ {
+ m_label[i]->MoveWindow(1, y, w - 10, h);
+ m_info[i]->MoveWindow(w + 10, y, r.Width()-(w+10)-1, h);
+ }
}
BEGIN_MESSAGE_MAP(CPlayerInfoBar, CDialogBar)
- ON_WM_ERASEBKGND()
- ON_WM_SIZE()
- ON_WM_LBUTTONDOWN()
+ ON_WM_ERASEBKGND()
+ ON_WM_SIZE()
+ ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()
@@ -170,49 +170,49 @@ END_MESSAGE_MAP() BOOL CPlayerInfoBar::OnEraseBkgnd(CDC* pDC)
{
- for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow())
- {
- CRect r;
- pChild->GetClientRect(&r);
- pChild->MapWindowPoints(this, &r);
- pDC->ExcludeClipRect(&r);
- }
+ for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow())
+ {
+ CRect r;
+ pChild->GetClientRect(&r);
+ pChild->MapWindowPoints(this, &r);
+ pDC->ExcludeClipRect(&r);
+ }
- CRect r;
- GetClientRect(&r);
+ CRect r;
+ GetClientRect(&r);
- CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
+ CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
+
+ if(pFrame->m_pLastBar != this || pFrame->m_fFullScreen)
+ r.InflateRect(0, 0, 0, 1);
- if(pFrame->m_pLastBar != this || pFrame->m_fFullScreen)
- r.InflateRect(0, 0, 0, 1);
+ if(pFrame->m_fFullScreen)
+ r.InflateRect(1, 0, 1, 0);
- if(pFrame->m_fFullScreen)
- r.InflateRect(1, 0, 1, 0);
+ pDC->Draw3dRect(&r, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
- pDC->Draw3dRect(&r, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
+ r.DeflateRect(1, 1);
- r.DeflateRect(1, 1);
+ pDC->FillSolidRect(&r, 0);
- pDC->FillSolidRect(&r, 0);
-
- return TRUE;
+ return TRUE;
}
void CPlayerInfoBar::OnSize(UINT nType, int cx, int cy)
{
- CDialogBar::OnSize(nType, cx, cy);
+ CDialogBar::OnSize(nType, cx, cy);
- Relayout();
+ Relayout();
- Invalidate();
+ Invalidate();
}
void CPlayerInfoBar::OnLButtonDown(UINT nFlags, CPoint point)
{
- CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
- if(!pFrame->m_fFullScreen)
- {
- MapWindowPoints(pFrame, &point, 1);
- pFrame->PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x, point.y));
- }
+ CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
+ if(!pFrame->m_fFullScreen)
+ {
+ MapWindowPoints(pFrame, &point, 1);
+ pFrame->PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x, point.y));
+ }
}
|