Commit d90d77a9 authored by Charlie Fenton's avatar Charlie Fenton Committed by Oliver Bock

Mgr: More robust way to display "No notices" message

parent faf550f9
......@@ -7746,3 +7746,10 @@ Charlie 18 Dec 2012
clientgui/
ViewNotices.cpp,.h
Charlie 18 Dec 2012
- Mgr: More robust way to display "No notices" message.
clientgui/
NoticeListCtrl.cpp,.h
ViewNotices.cpp,.h
......@@ -476,11 +476,6 @@ wxString CNoticeListCtrl::OnGetItem(size_t i) const {
wxASSERT(pDoc);
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
if (m_bDisplayEmptyNotice) {
strBuffer = wxT("<table border=0 cellpadding=5><tr><td>");
strBuffer += _("There are no notices at this time.");
strBuffer += wxT("</font></td></tr></table><hr>");
} else
if (pDoc->IsConnected()) {
NOTICE* np = pDoc->notice((unsigned int)i);
......@@ -552,7 +547,6 @@ void CNoticeListCtrl::Clear() {
/*!
* Update the UI.
*/
bool CNoticeListCtrl::UpdateUI()
{
static bool bAlreadyRunning = false;
......@@ -563,12 +557,10 @@ bool CNoticeListCtrl::UpdateUI()
// Call Freeze() / Thaw() only when actually needed;
// otherwise it causes unnecessary redraws
if ((pDoc->GetNoticeCount() <= 0) || (!pDoc->IsConnected()) || m_bComputerChanged) {
int noticeCount = pDoc->GetNoticeCount();
if ((noticeCount <= 0) || (!pDoc->IsConnected()) || m_bComputerChanged) {
m_bDisplayEmptyNotice = true;
m_bComputerChanged = false;
Freeze();
SetItemCount(1);
Thaw();
return true;
}
......@@ -580,16 +572,15 @@ bool CNoticeListCtrl::UpdateUI()
if (
pDoc->IsConnected() &&
(pDoc->notices.complete ||
((int)GetItemCount() != pDoc->GetNoticeCount()) ||
((int)GetItemCount() != noticeCount) ||
((pDoc->GetNoticeCount() > 0) && (m_bDisplayEmptyNotice == true)))
) {
pDoc->notices.complete = false;
m_bDisplayEmptyNotice = false;
Freeze();
SetItemCount(pDoc->GetNoticeCount());
SetItemCount(noticeCount);
m_bDisplayEmptyNotice = false;
Thaw();
}
#ifdef __WXMAC__
// Enable accessibility only after drawing the page
// to avoid a mysterious crash bug
......
......@@ -116,8 +116,8 @@ public:
int GetItemHeight(size_t i) { return (int)OnGetItemHeight(i); }
private:
bool m_bDisplayEmptyNotice;
private:
bool m_bComputerChanged;
#ifdef __WXMAC__
CNoticeListCtrlAccessible* m_accessible;
......
......@@ -63,6 +63,12 @@ CViewNotices::CViewNotices(wxNotebook* pNotebook) :
itemFlexGridSizer->Add(m_pHtmlListPane, 1, wxGROW|wxALL, 1);
SetSizer(itemFlexGridSizer);
m_StatusText = new wxStaticText(
this, wxID_ANY,
_("There are no notices at this time."),
wxPoint(20, 20), wxDefaultSize, 0
);
}
......@@ -117,7 +123,7 @@ void CViewNotices::OnListRender(wxTimerEvent& WXUNUSED(event)) {
wxASSERT(pDoc);
wxASSERT(m_pHtmlListPane);
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
if (s_bInProgress) return;
s_bInProgress = true;
......@@ -131,7 +137,7 @@ void CViewNotices::OnListRender(wxTimerEvent& WXUNUSED(event)) {
// Don't call Freeze() / Thaw() here because it causes an unnecessary redraw
m_pHtmlListPane->UpdateUI();
m_StatusText->Show(m_pHtmlListPane->m_bDisplayEmptyNotice);
pDoc->UpdateUnreadNoticeState();
s_bInProgress = false;
......
......@@ -47,6 +47,7 @@ public:
protected:
CNoticeListCtrl* m_pHtmlListPane;
wxStaticText* m_StatusText;
virtual bool OnSaveState( wxConfigBase* pConfig );
virtual bool OnRestoreState( wxConfigBase* pConfig );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment