MGR: preserve message filtering by project if Event Log is closed and reopened, but not when selecting a different host or exiting Manager

svn path=/trunk/boinc/; revision=22185
This commit is contained in:
Charlie Fenton 2010-08-11 08:07:14 +00:00
parent f039bf4bd8
commit efbaeb48a0
2 changed files with 36 additions and 36 deletions

View File

@ -200,7 +200,6 @@ bool CDlgEventLog::Create( wxWindow* parent, wxWindowID id, const wxString& capt
SetIcons(icons); SetIcons(icons);
CreateControls(); CreateControls();
// SetFilterButtonText();
// Create List Pane Items // Create List Pane Items
m_pList->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 109); m_pList->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 109);
@ -451,10 +450,7 @@ wxInt32 CDlgEventLog::GetDocCount() {
m_iTotalDocCount = wxGetApp().GetDocument()->GetMessageCount(); m_iTotalDocCount = wxGetApp().GetDocument()->GetMessageCount();
if (m_iTotalDocCount < m_iPreviousTotalDocCount) { if (m_iTotalDocCount < m_iPreviousTotalDocCount) {
// Usually due to a disconnect from client // Usually due to a disconnect from client
s_bIsFiltered = false; ResetMessageFiltering();
s_strFilteredProjectName.clear();
m_iFilteredIndexes.Clear();
SetFilterButtonText();
} }
if (s_bIsFiltered) { if (s_bIsFiltered) {
@ -497,10 +493,7 @@ void CDlgEventLog::OnRefresh() {
wxInt32 iRowCount = GetDocCount(); wxInt32 iRowCount = GetDocCount();
if (0 >= iRowCount) { if (0 >= iRowCount) {
m_pList->DeleteAllItems(); m_pList->DeleteAllItems();
s_bIsFiltered = false; ResetMessageFiltering();
s_strFilteredProjectName.clear();
m_iFilteredIndexes.Clear();
SetFilterButtonText();
} else { } else {
// If connected computer changed, reset message filtering // If connected computer changed, reset message filtering
isConnected = wxGetApp().GetDocument()->IsConnected(); isConnected = wxGetApp().GetDocument()->IsConnected();
@ -509,10 +502,7 @@ void CDlgEventLog::OnRefresh() {
if (strLastMachineName != strNewMachineName) { if (strLastMachineName != strNewMachineName) {
strLastMachineName = strNewMachineName; strLastMachineName = strNewMachineName;
was_connected = false; was_connected = false;
s_bIsFiltered = false; ResetMessageFiltering();
s_strFilteredProjectName.clear();
m_iFilteredIndexes.Clear();
SetFilterButtonText();
} }
} }
@ -781,33 +771,41 @@ void CDlgEventLog::OnButtonHelp( wxCommandEvent& event ) {
} }
void CDlgEventLog::ResetMessageFiltering() {
s_bIsFiltered = false;
s_strFilteredProjectName.clear();
m_iFilteredIndexes.Clear();
SetFilterButtonText();
}
void CDlgEventLog::UpdateButtons() { void CDlgEventLog::UpdateButtons() {
bool enableFilterButton = s_bIsFiltered; bool enableFilterButton = s_bIsFiltered;
bool enableCopySelectedButon = false; bool enableCopySelectedButon = false;
if (m_iTotalDocCount > 0) { if (m_iTotalDocCount > 0) {
int n = m_pList->GetSelectedItemCount(); int n = m_pList->GetSelectedItemCount();
if (n > 0) { if (n > 0) {
enableCopySelectedButon = true; enableCopySelectedButon = true;
}
if ((n == 1) && (! s_bIsFiltered)) {
n = m_pList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
MESSAGE* message = wxGetApp().GetDocument()->message(n);
if ((message->project).size() > 0) {
enableFilterButton = true;
}
}
} }
// To ensure that the button is large enough to fit the longer label, if ((n == 1) && (! s_bIsFiltered)) {
// don't change the button text (possibly to the shorter label) until n = m_pList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
// after the button has been drawn (disabled) with the longer text, MESSAGE* message = wxGetApp().GetDocument()->message(n);
// and don't enable the button until it has the correct label. if ((message->project).size() > 0) {
if (m_pFilterButton->IsEnabled() != enableFilterButton) { enableFilterButton = true;
SetFilterButtonText(); }
} }
m_pFilterButton->Enable(enableFilterButton); }
m_pCopySelectedButton->Enable(enableCopySelectedButon);
// To ensure that the button is large enough to fit the longer label,
// don't change the button text (possibly to the shorter label) until
// after the button has been drawn (disabled) with the longer text,
// and don't enable the button until it has the correct label.
if (m_pFilterButton->IsEnabled() != enableFilterButton) {
SetFilterButtonText();
}
m_pFilterButton->Enable(enableFilterButton);
m_pCopySelectedButton->Enable(enableCopySelectedButon);
} }

View File

@ -168,6 +168,8 @@ private:
void SetWindowDimensions(); void SetWindowDimensions();
void OnMouseUp(wxMouseEvent& event); void OnMouseUp(wxMouseEvent& event);
void ResetMessageFiltering();
bool EnsureLastItemVisible(); bool EnsureLastItemVisible();
wxInt32 FormatProjectName( wxInt32 item, wxString& strBuffer ) const; wxInt32 FormatProjectName( wxInt32 item, wxString& strBuffer ) const;