2004-05-17 22:15:10 +00:00
|
|
|
// $Id$
|
|
|
|
//
|
2004-04-10 09:11:03 +00:00
|
|
|
// The contents of this file are subject to the BOINC Public License
|
|
|
|
// Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
// compliance with the License. You may obtain a copy of the License at
|
|
|
|
// http://boinc.berkeley.edu/license_1.0.txt
|
|
|
|
//
|
|
|
|
// Software distributed under the License is distributed on an "AS IS"
|
|
|
|
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
// License for the specific language governing rights and limitations
|
|
|
|
// under the License.
|
|
|
|
//
|
|
|
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
|
|
|
//
|
|
|
|
// The Initial Developer of the Original Code is the SETI@home project.
|
|
|
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
|
|
|
// University of California at Berkeley. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Contributor(s):
|
|
|
|
//
|
2004-05-17 22:15:10 +00:00
|
|
|
// Revision History:
|
|
|
|
//
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-04-11 04:37:10 +00:00
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "MainFrame.h"
|
|
|
|
#endif
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
#include "stdwx.h"
|
2004-04-10 20:25:27 +00:00
|
|
|
#include "BOINCGUIApp.h"
|
|
|
|
#include "MainFrame.h"
|
2004-07-13 05:56:03 +00:00
|
|
|
#include "Events.h"
|
2004-09-21 01:30:29 +00:00
|
|
|
#include "BOINCBaseView.h"
|
|
|
|
#include "ViewProjects.h"
|
|
|
|
#include "ViewWork.h"
|
|
|
|
#include "ViewTransfers.h"
|
|
|
|
#include "ViewMessages.h"
|
|
|
|
#include "ViewResources.h"
|
2004-04-10 20:25:27 +00:00
|
|
|
#include "DlgAbout.h"
|
2004-04-11 04:12:44 +00:00
|
|
|
#include "DlgOptions.h"
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-04-11 04:12:44 +00:00
|
|
|
#include "res/BOINCGUIApp.xpm"
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CMainFrame, wxFrame)
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE (CMainFrame, wxFrame)
|
2004-09-24 02:01:53 +00:00
|
|
|
EVT_CLOSE(CMainFrame::OnClose)
|
|
|
|
EVT_MENU(wxID_EXIT, CMainFrame::OnExit)
|
|
|
|
EVT_MENU(ID_TOOLSOPTIONS, CMainFrame::OnToolsOptions)
|
|
|
|
EVT_MENU(wxID_ABOUT, CMainFrame::OnAbout)
|
2004-10-09 03:05:01 +00:00
|
|
|
EVT_IDLE(CMainFrame::OnIdle)
|
2004-10-21 14:29:59 +00:00
|
|
|
EVT_NOTEBOOK_PAGE_CHANGED(ID_FRAMENOTEBOOK, CMainFrame::OnNotebookSelectionChanged)
|
2004-10-05 02:55:26 +00:00
|
|
|
EVT_LIST_CACHE_HINT(wxID_ANY, CMainFrame::OnListCacheHint)
|
|
|
|
EVT_LIST_ITEM_SELECTED(wxID_ANY, CMainFrame::OnListSelected)
|
|
|
|
EVT_LIST_ITEM_DESELECTED(wxID_ANY, CMainFrame::OnListDeselected)
|
|
|
|
EVT_TIMER(ID_FRAMELISTRENDERTIMER, CMainFrame::OnListPanelRender)
|
|
|
|
EVT_TIMER(ID_FRAMETASKRENDERTIMER, CMainFrame::OnTaskPanelRender)
|
2004-05-21 06:27:15 +00:00
|
|
|
END_EVENT_TABLE ()
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-10-23 07:13:18 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
CMainFrame::CMainFrame()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CMainFrame::CMainFrame(wxString strTitle) :
|
|
|
|
wxFrame ((wxFrame *)NULL, -1, strTitle, wxDefaultPosition, wxDefaultSize,
|
|
|
|
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
|
|
|
|
{
|
|
|
|
m_pMenubar = NULL;
|
|
|
|
m_pNotebook = NULL;
|
|
|
|
m_pStatusbar = NULL;
|
|
|
|
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
SetIcon(wxICON(APP_ICON));
|
|
|
|
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
wxCHECK_RET(CreateMenu(), _T("Failed to create menu bar."));
|
|
|
|
wxCHECK_RET(CreateNotebook(), _T("Failed to create notebook."));
|
|
|
|
wxCHECK_RET(CreateStatusbar(), _T("Failed to create status bar."));
|
2004-05-21 06:27:15 +00:00
|
|
|
|
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
m_pFrameTaskPanelRenderTimer = new wxTimer(this, ID_FRAMETASKRENDERTIMER);
|
|
|
|
wxASSERT(NULL != m_pFrameTaskPanelRenderTimer);
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
m_pFrameListPanelRenderTimer = new wxTimer(this, ID_FRAMELISTRENDERTIMER);
|
|
|
|
wxASSERT(NULL != m_pFrameListPanelRenderTimer);
|
|
|
|
|
|
|
|
m_pFrameTaskPanelRenderTimer->Start(1000); // Send event every 1 second
|
2004-10-19 18:14:40 +00:00
|
|
|
m_pFrameListPanelRenderTimer->Start(5000); // Send event every 5 seconds
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
SetStatusBarPane(0);
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2004-05-22 01:36:36 +00:00
|
|
|
RestoreState();
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
CMainFrame::~CMainFrame()
|
|
|
|
{
|
2004-09-25 21:33:24 +00:00
|
|
|
wxASSERT(NULL != m_pFrameTaskPanelRenderTimer);
|
|
|
|
wxASSERT(NULL != m_pFrameListPanelRenderTimer);
|
2004-05-21 06:27:15 +00:00
|
|
|
wxASSERT(NULL != m_pMenubar);
|
|
|
|
wxASSERT(NULL != m_pNotebook);
|
|
|
|
wxASSERT(NULL != m_pStatusbar);
|
|
|
|
|
|
|
|
|
2004-05-22 01:36:36 +00:00
|
|
|
SaveState();
|
|
|
|
|
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
if (m_pFrameTaskPanelRenderTimer) {
|
|
|
|
m_pFrameTaskPanelRenderTimer->Stop();
|
|
|
|
delete m_pFrameTaskPanelRenderTimer;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_pFrameListPanelRenderTimer) {
|
|
|
|
m_pFrameListPanelRenderTimer->Stop();
|
|
|
|
delete m_pFrameListPanelRenderTimer;
|
2004-05-21 06:27:15 +00:00
|
|
|
}
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
if (m_pStatusbar)
|
|
|
|
wxCHECK_RET(DeleteStatusbar(), _T("Failed to delete status bar."));
|
2004-05-21 06:27:15 +00:00
|
|
|
|
|
|
|
if (m_pNotebook)
|
|
|
|
wxCHECK_RET(DeleteNotebook(), _T("Failed to delete notebook."));
|
|
|
|
|
|
|
|
if (m_pMenubar)
|
|
|
|
wxCHECK_RET(DeleteMenu(), _T("Failed to delete menu bar."));
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
bool CMainFrame::CreateMenu()
|
|
|
|
{
|
2004-04-10 09:11:03 +00:00
|
|
|
// File menu
|
|
|
|
wxMenu *menuFile = new wxMenu;
|
2004-10-09 03:05:01 +00:00
|
|
|
menuFile->Append(
|
|
|
|
wxID_EXIT,
|
|
|
|
_("E&xit"),
|
|
|
|
_("Exit the BOINC Manager")
|
|
|
|
);
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
// Tools menu
|
|
|
|
wxMenu *menuTools = new wxMenu;
|
2004-10-09 03:05:01 +00:00
|
|
|
menuTools->Append(
|
|
|
|
ID_TOOLSOPTIONS,
|
|
|
|
_("&Options"),
|
|
|
|
_("Configure GUI options and proxy settings")
|
|
|
|
);
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
// Help menu
|
|
|
|
wxMenu *menuHelp = new wxMenu;
|
2004-10-09 03:05:01 +00:00
|
|
|
menuHelp->Append(
|
|
|
|
wxID_ABOUT,
|
|
|
|
_("&About BOINC..."),
|
|
|
|
_("Displays general information about BOINC and BOINC Manager")
|
|
|
|
);
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
// construct menu
|
|
|
|
m_pMenubar = new wxMenuBar;
|
2004-10-09 03:05:01 +00:00
|
|
|
m_pMenubar->Append(
|
|
|
|
menuFile,
|
|
|
|
_("&File")
|
|
|
|
);
|
|
|
|
m_pMenubar->Append(
|
|
|
|
menuTools,
|
|
|
|
_("&Tools")
|
|
|
|
);
|
|
|
|
m_pMenubar->Append(
|
|
|
|
menuHelp,
|
|
|
|
_("&Help")
|
|
|
|
);
|
2004-04-10 09:11:03 +00:00
|
|
|
SetMenuBar(m_pMenubar);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
bool CMainFrame::CreateNotebook()
|
|
|
|
{
|
2004-04-10 09:11:03 +00:00
|
|
|
// create frame panel
|
|
|
|
wxPanel *pPanel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize,
|
|
|
|
wxTAB_TRAVERSAL|wxCLIP_CHILDREN|wxNO_BORDER);
|
|
|
|
|
|
|
|
// initialize notebook
|
2004-10-21 14:29:59 +00:00
|
|
|
m_pNotebook = new wxNotebook(pPanel, ID_FRAMENOTEBOOK, wxDefaultPosition, wxDefaultSize,
|
2004-04-10 09:11:03 +00:00
|
|
|
wxNB_FIXEDWIDTH|wxCLIP_CHILDREN);
|
|
|
|
|
|
|
|
wxNotebookSizer *pNotebookSizer = new wxNotebookSizer(m_pNotebook);
|
|
|
|
|
|
|
|
// layout frame panel
|
|
|
|
wxBoxSizer *pPanelSizer = new wxBoxSizer(wxVERTICAL);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
pPanelSizer->Add(new wxStaticLine(pPanel, -1), 0, wxEXPAND);
|
|
|
|
pPanelSizer->Add(0, 4);
|
|
|
|
pPanelSizer->Add(pNotebookSizer, 1, wxEXPAND);
|
2004-09-21 01:30:29 +00:00
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
pPanel->SetAutoLayout(true);
|
2004-04-10 09:11:03 +00:00
|
|
|
pPanel->SetSizerAndFit(pPanelSizer);
|
|
|
|
|
2004-10-22 10:02:14 +00:00
|
|
|
CreateNotebookPage( new CViewProjects( m_pNotebook ) );
|
|
|
|
CreateNotebookPage( new CViewWork( m_pNotebook ) );
|
|
|
|
CreateNotebookPage( new CViewTransfers( m_pNotebook ) );
|
|
|
|
CreateNotebookPage( new CViewMessages( m_pNotebook ) );
|
|
|
|
CreateNotebookPage( new CViewResources( m_pNotebook ) );
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-27 06:17:58 +00:00
|
|
|
template < class T >
|
2004-09-21 01:30:29 +00:00
|
|
|
bool CMainFrame::CreateNotebookPage(T pwndNewNotebookPage)
|
|
|
|
{
|
2004-04-13 00:33:40 +00:00
|
|
|
wxImageList* pImageList;
|
2004-05-29 00:09:41 +00:00
|
|
|
wxInt32 iImageIndex = 0;
|
2004-04-13 00:33:40 +00:00
|
|
|
|
2004-04-13 02:06:27 +00:00
|
|
|
wxASSERT(NULL != pwndNewNotebookPage);
|
|
|
|
wxASSERT(NULL != m_pNotebook);
|
2004-09-21 01:30:29 +00:00
|
|
|
wxASSERT(wxDynamicCast(pwndNewNotebookPage, CBOINCBaseView));
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
|
|
|
|
pImageList = m_pNotebook->GetImageList();
|
|
|
|
if (!pImageList) {
|
|
|
|
pImageList = new wxImageList(16, 16, true, 0);
|
|
|
|
wxASSERT(pImageList != NULL);
|
2004-04-13 02:06:27 +00:00
|
|
|
m_pNotebook->SetImageList(pImageList);
|
2004-04-13 00:33:40 +00:00
|
|
|
}
|
|
|
|
|
2004-05-27 06:17:58 +00:00
|
|
|
iImageIndex = pImageList->Add(wxBitmap(pwndNewNotebookPage->GetViewIcon()), wxColour(255, 0, 255));
|
|
|
|
m_pNotebook->AddPage(pwndNewNotebookPage, pwndNewNotebookPage->GetViewName(), TRUE, iImageIndex);
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
bool CMainFrame::CreateStatusbar()
|
|
|
|
{
|
2004-04-10 09:11:03 +00:00
|
|
|
if (m_pStatusbar)
|
|
|
|
return true;
|
|
|
|
|
2004-05-29 00:09:41 +00:00
|
|
|
wxInt32 ch = GetCharWidth();
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-05-29 00:09:41 +00:00
|
|
|
const wxInt32 widths[] = {-1, 20*ch, 15};
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
m_pStatusbar = CreateStatusBar(WXSIZEOF(widths), wxST_SIZEGRIP, ID_STATUSBAR);
|
2004-05-21 06:27:15 +00:00
|
|
|
wxASSERT(NULL != m_pStatusbar);
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
m_pStatusbar->SetStatusWidths(WXSIZEOF(widths), widths);
|
|
|
|
|
|
|
|
SetStatusBar(m_pStatusbar);
|
|
|
|
SendSizeEvent();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
bool CMainFrame::DeleteMenu()
|
|
|
|
{
|
2004-04-10 09:11:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
bool CMainFrame::DeleteNotebook()
|
|
|
|
{
|
2004-04-13 00:33:40 +00:00
|
|
|
wxImageList* pImageList;
|
|
|
|
|
2004-04-13 02:18:03 +00:00
|
|
|
wxASSERT(NULL != m_pNotebook);
|
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
pImageList = m_pNotebook->GetImageList();
|
2004-05-21 06:27:15 +00:00
|
|
|
|
|
|
|
wxASSERT(NULL != pImageList);
|
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
if (pImageList)
|
|
|
|
delete pImageList;
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
bool CMainFrame::DeleteStatusbar()
|
|
|
|
{
|
2004-04-10 09:11:03 +00:00
|
|
|
if (!m_pStatusbar)
|
|
|
|
return true;
|
|
|
|
|
2004-05-21 06:27:15 +00:00
|
|
|
SetStatusBar(NULL);
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
delete m_pStatusbar;
|
|
|
|
|
|
|
|
m_pStatusbar = NULL;
|
|
|
|
SendSizeEvent();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
bool CMainFrame::UpdateStatusbar( const wxString& strStatusbarText )
|
|
|
|
{
|
|
|
|
if (!m_pStatusbar)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if ( NULL != m_pStatusbar )
|
|
|
|
{
|
|
|
|
if ( m_pStatusbar->GetStatusText(0) != strStatusbarText )
|
|
|
|
{
|
|
|
|
SetStatusText(strStatusbarText, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
::wxSafeYield( NULL, true );
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
bool CMainFrame::SaveState()
|
|
|
|
{
|
2004-10-05 02:55:26 +00:00
|
|
|
wxString strBaseConfigLocation = wxString(wxT("/"));
|
2004-05-27 06:17:58 +00:00
|
|
|
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
|
2004-05-29 00:09:41 +00:00
|
|
|
wxWindow* pwndNotebookPage = NULL;
|
2004-10-05 02:55:26 +00:00
|
|
|
wxString strConfigLocation = wxString(wxT(""));
|
2004-05-29 00:09:41 +00:00
|
|
|
wxInt32 iIndex = 0;
|
|
|
|
wxInt32 iPageCount = 0;
|
2004-05-27 06:17:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
wxASSERT(NULL != pConfig);
|
|
|
|
wxASSERT(NULL != m_pNotebook);
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Save Frame State
|
|
|
|
//
|
|
|
|
pConfig->SetPath(strBaseConfigLocation);
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
pConfig->Write(wxT("CurrentPage"), m_pNotebook->GetSelection());
|
2004-05-27 06:17:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Save Page(s) State
|
|
|
|
//
|
2004-05-29 00:09:41 +00:00
|
|
|
|
|
|
|
// Convert to a zero based index
|
2004-05-27 06:17:58 +00:00
|
|
|
iPageCount = m_pNotebook->GetPageCount() - 1;
|
|
|
|
|
|
|
|
for ( iIndex = 0; iIndex <= iPageCount; iIndex++ ) {
|
|
|
|
|
|
|
|
pwndNotebookPage = m_pNotebook->GetPage(iIndex);
|
2004-09-21 01:30:29 +00:00
|
|
|
wxASSERT(wxDynamicCast(pwndNotebookPage, CBOINCBaseView));
|
|
|
|
|
2004-10-22 10:02:14 +00:00
|
|
|
if (wxDynamicCast(pwndNotebookPage, CViewProjects))
|
|
|
|
{
|
2004-09-21 01:30:29 +00:00
|
|
|
FireSaveStateEvent(wxDynamicCast(pwndNotebookPage, CViewProjects), pConfig);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewWork))
|
|
|
|
{
|
2004-09-21 01:30:29 +00:00
|
|
|
FireSaveStateEvent(wxDynamicCast(pwndNotebookPage, CViewWork), pConfig);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewTransfers))
|
|
|
|
{
|
2004-09-21 01:30:29 +00:00
|
|
|
FireSaveStateEvent(wxDynamicCast(pwndNotebookPage, CViewTransfers), pConfig);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewMessages))
|
|
|
|
{
|
2004-09-21 01:30:29 +00:00
|
|
|
FireSaveStateEvent(wxDynamicCast(pwndNotebookPage, CViewMessages), pConfig);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewResources))
|
|
|
|
{
|
2004-09-21 01:30:29 +00:00
|
|
|
FireSaveStateEvent(wxDynamicCast(pwndNotebookPage, CViewResources), pConfig);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CBOINCBaseView))
|
|
|
|
{
|
2004-09-21 01:30:29 +00:00
|
|
|
FireSaveStateEvent(wxDynamicCast(pwndNotebookPage, CBOINCBaseView), pConfig);
|
2004-05-27 06:17:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-05-21 06:27:15 +00:00
|
|
|
return true;
|
|
|
|
}
|
2004-04-10 20:25:27 +00:00
|
|
|
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2004-05-27 06:17:58 +00:00
|
|
|
template < class T >
|
2004-09-21 01:30:29 +00:00
|
|
|
bool CMainFrame::FireSaveStateEvent( T pPage, wxConfigBase* pConfig )
|
|
|
|
{
|
2004-10-05 02:55:26 +00:00
|
|
|
wxString strPreviousLocation = wxString(wxT(""));
|
|
|
|
wxString strConfigLocation = wxString(wxT(""));
|
2004-05-27 06:17:58 +00:00
|
|
|
|
|
|
|
strPreviousLocation = pConfig->GetPath();
|
|
|
|
strConfigLocation = strPreviousLocation + pPage->GetViewName();
|
|
|
|
|
|
|
|
pConfig->SetPath(strConfigLocation);
|
2004-05-29 00:09:41 +00:00
|
|
|
pPage->OnSaveState( pConfig );
|
2004-05-27 06:17:58 +00:00
|
|
|
pConfig->SetPath(strPreviousLocation);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
bool CMainFrame::RestoreState()
|
|
|
|
{
|
2004-10-05 02:55:26 +00:00
|
|
|
wxString strBaseConfigLocation = wxString(wxT("/"));
|
2004-05-27 06:17:58 +00:00
|
|
|
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
|
2004-05-29 00:09:41 +00:00
|
|
|
wxWindow* pwndNotebookPage = NULL;
|
2004-10-05 02:55:26 +00:00
|
|
|
wxString strConfigLocation = wxString(wxT(""));
|
2004-05-29 00:09:41 +00:00
|
|
|
wxInt32 iIndex = 0;
|
|
|
|
wxInt32 iPageCount = 0;
|
2004-05-27 06:17:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
wxASSERT(NULL != pConfig);
|
|
|
|
wxASSERT(NULL != m_pNotebook);
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Restore Frame State
|
|
|
|
//
|
2004-05-29 00:09:41 +00:00
|
|
|
wxInt32 iCurrentPage;
|
2004-05-27 06:17:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
pConfig->SetPath(strBaseConfigLocation);
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
pConfig->Read(wxT("CurrentPage"), &iCurrentPage, 1);
|
2004-05-29 00:09:41 +00:00
|
|
|
m_pNotebook->SetSelection(iCurrentPage);
|
2004-05-27 06:17:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Restore Page(s) State
|
|
|
|
//
|
|
|
|
|
2004-05-29 00:09:41 +00:00
|
|
|
// Convert to a zero based index
|
2004-05-27 06:17:58 +00:00
|
|
|
iPageCount = m_pNotebook->GetPageCount() - 1;
|
|
|
|
|
|
|
|
for ( iIndex = 0; iIndex <= iPageCount; iIndex++ ) {
|
|
|
|
|
|
|
|
pwndNotebookPage = m_pNotebook->GetPage(iIndex);
|
2004-09-21 01:30:29 +00:00
|
|
|
wxASSERT(wxDynamicCast(pwndNotebookPage, CBOINCBaseView));
|
|
|
|
|
2004-10-22 10:02:14 +00:00
|
|
|
if (wxDynamicCast(pwndNotebookPage, CViewProjects))
|
|
|
|
{
|
2004-09-21 01:30:29 +00:00
|
|
|
FireRestoreStateEvent(wxDynamicCast(pwndNotebookPage, CViewProjects), pConfig);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewWork))
|
|
|
|
{
|
2004-09-21 01:30:29 +00:00
|
|
|
FireRestoreStateEvent(wxDynamicCast(pwndNotebookPage, CViewWork), pConfig);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewTransfers))
|
|
|
|
{
|
2004-09-21 01:30:29 +00:00
|
|
|
FireRestoreStateEvent(wxDynamicCast(pwndNotebookPage, CViewTransfers), pConfig);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewMessages))
|
|
|
|
{
|
2004-09-21 01:30:29 +00:00
|
|
|
FireRestoreStateEvent(wxDynamicCast(pwndNotebookPage, CViewMessages), pConfig);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewResources))
|
|
|
|
{
|
2004-09-21 01:30:29 +00:00
|
|
|
FireRestoreStateEvent(wxDynamicCast(pwndNotebookPage, CViewResources), pConfig);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CBOINCBaseView))
|
|
|
|
{
|
2004-09-21 01:30:29 +00:00
|
|
|
FireRestoreStateEvent(wxDynamicCast(pwndNotebookPage, CBOINCBaseView), pConfig);
|
2004-05-27 06:17:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-05-21 06:27:15 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-27 06:17:58 +00:00
|
|
|
template < class T >
|
2004-09-21 01:30:29 +00:00
|
|
|
bool CMainFrame::FireRestoreStateEvent( T pPage, wxConfigBase* pConfig )
|
|
|
|
{
|
2004-10-05 02:55:26 +00:00
|
|
|
wxString strPreviousLocation = wxString(wxT(""));
|
|
|
|
wxString strConfigLocation = wxString(wxT(""));
|
2004-05-27 06:17:58 +00:00
|
|
|
|
|
|
|
strPreviousLocation = pConfig->GetPath();
|
|
|
|
strConfigLocation = strPreviousLocation + pPage->GetViewName();
|
|
|
|
|
|
|
|
pConfig->SetPath(strConfigLocation);
|
2004-05-29 00:09:41 +00:00
|
|
|
pPage->OnRestoreState( pConfig );
|
2004-05-27 06:17:58 +00:00
|
|
|
pConfig->SetPath(strPreviousLocation);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-23 23:40:11 +00:00
|
|
|
void CMainFrame::OnExit( wxCommandEvent& WXUNUSED(event) )
|
2004-09-21 01:30:29 +00:00
|
|
|
{
|
2004-05-21 06:27:15 +00:00
|
|
|
Close(true);
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-23 23:40:11 +00:00
|
|
|
void CMainFrame::OnClose( wxCloseEvent& event )
|
2004-09-21 01:30:29 +00:00
|
|
|
{
|
2004-10-23 23:40:11 +00:00
|
|
|
if ( !event.CanVeto() )
|
|
|
|
Destroy();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Hide();
|
|
|
|
event.Veto();
|
|
|
|
}
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-23 23:40:11 +00:00
|
|
|
void CMainFrame::OnToolsOptions( wxCommandEvent& WXUNUSED(event) )
|
2004-09-21 01:30:29 +00:00
|
|
|
{
|
2004-04-11 04:12:44 +00:00
|
|
|
CDlgOptions* pDlg = new CDlgOptions(this);
|
2004-05-21 06:27:15 +00:00
|
|
|
wxASSERT(NULL != pDlg);
|
2004-04-11 04:12:44 +00:00
|
|
|
|
|
|
|
pDlg->ShowModal();
|
|
|
|
|
|
|
|
if (pDlg)
|
2004-05-29 00:09:41 +00:00
|
|
|
pDlg->Destroy();
|
2004-04-11 04:12:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-23 23:40:11 +00:00
|
|
|
void CMainFrame::OnAbout( wxCommandEvent& WXUNUSED(event) )
|
2004-09-21 01:30:29 +00:00
|
|
|
{
|
2004-05-21 06:27:15 +00:00
|
|
|
CDlgAbout* pDlg = new CDlgAbout(this);
|
|
|
|
wxASSERT(NULL != pDlg);
|
|
|
|
|
|
|
|
pDlg->ShowModal();
|
|
|
|
|
|
|
|
if (pDlg)
|
2004-05-29 00:09:41 +00:00
|
|
|
pDlg->Destroy();
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-23 23:40:11 +00:00
|
|
|
void CMainFrame::OnIdle( wxIdleEvent& event )
|
2004-10-09 03:05:01 +00:00
|
|
|
{
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
if ( NULL != pDoc )
|
|
|
|
{
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
pDoc->OnIdle();
|
|
|
|
}
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-21 14:29:59 +00:00
|
|
|
void CMainFrame::OnNotebookSelectionChanged( wxNotebookEvent& event )
|
|
|
|
{
|
|
|
|
if ( (-1 != event.GetSelection()) && IsShown() )
|
|
|
|
{
|
|
|
|
wxWindow* pwndNotebookPage;
|
|
|
|
wxTimerEvent timerEvent;
|
|
|
|
|
|
|
|
wxASSERT(NULL != m_pNotebook);
|
|
|
|
|
|
|
|
|
|
|
|
pwndNotebookPage = m_pNotebook->GetPage( event.GetSelection() );
|
|
|
|
wxASSERT(NULL != pwndNotebookPage);
|
|
|
|
wxASSERT(wxDynamicCast(pwndNotebookPage, CBOINCBaseView));
|
|
|
|
|
2004-10-22 10:02:14 +00:00
|
|
|
if (wxDynamicCast(pwndNotebookPage, CViewProjects))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireTaskPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewProjects), timerEvent);
|
|
|
|
FireListPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewProjects), timerEvent);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewWork))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireTaskPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewWork), timerEvent);
|
|
|
|
FireListPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewWork), timerEvent);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewTransfers))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireTaskPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewTransfers), timerEvent);
|
|
|
|
FireListPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewTransfers), timerEvent);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewMessages))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireTaskPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewMessages), timerEvent);
|
|
|
|
FireListPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewMessages), timerEvent);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewResources))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireTaskPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewResources), timerEvent);
|
|
|
|
FireListPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewResources), timerEvent);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CBOINCBaseView))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireTaskPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CBOINCBaseView), timerEvent);
|
|
|
|
FireListPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CBOINCBaseView), timerEvent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
void CMainFrame::OnListCacheHint( wxListEvent& event )
|
2004-09-25 21:33:24 +00:00
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
if ( IsShown() )
|
|
|
|
{
|
|
|
|
wxWindow* pwndNotebookPage;
|
2004-09-25 21:33:24 +00:00
|
|
|
|
2004-10-21 14:29:59 +00:00
|
|
|
wxASSERT(NULL != m_pNotebook);
|
2004-09-25 21:33:24 +00:00
|
|
|
|
|
|
|
|
2004-10-22 10:02:14 +00:00
|
|
|
pwndNotebookPage = m_pNotebook->GetPage( event.GetId() - ID_LIST_BASE );
|
2004-10-21 14:29:59 +00:00
|
|
|
wxASSERT(NULL != pwndNotebookPage);
|
|
|
|
wxASSERT(wxDynamicCast(pwndNotebookPage, CBOINCBaseView));
|
|
|
|
|
2004-10-22 10:02:14 +00:00
|
|
|
if (wxDynamicCast(pwndNotebookPage, CViewProjects))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListOnCacheHintEvent(wxDynamicCast(pwndNotebookPage, CViewProjects), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewWork))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListOnCacheHintEvent(wxDynamicCast(pwndNotebookPage, CViewWork), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewTransfers))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListOnCacheHintEvent(wxDynamicCast(pwndNotebookPage, CViewTransfers), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewMessages))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListOnCacheHintEvent(wxDynamicCast(pwndNotebookPage, CViewMessages), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewResources))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListOnCacheHintEvent(wxDynamicCast(pwndNotebookPage, CViewResources), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CBOINCBaseView))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListOnCacheHintEvent(wxDynamicCast(pwndNotebookPage, CBOINCBaseView), event);
|
|
|
|
}
|
2004-09-25 21:33:24 +00:00
|
|
|
}
|
2004-10-21 14:29:59 +00:00
|
|
|
|
|
|
|
event.Skip();
|
2004-09-25 21:33:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
void CMainFrame::OnListSelected( wxListEvent& event )
|
2004-09-25 21:33:24 +00:00
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
if ( IsShown() )
|
|
|
|
{
|
|
|
|
wxWindow* pwndNotebookPage;
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2004-10-21 14:29:59 +00:00
|
|
|
wxASSERT(NULL != m_pNotebook);
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
|
2004-10-22 10:02:14 +00:00
|
|
|
pwndNotebookPage = m_pNotebook->GetPage( event.GetId() - ID_LIST_BASE );
|
2004-10-21 14:29:59 +00:00
|
|
|
wxASSERT(NULL != pwndNotebookPage);
|
|
|
|
wxASSERT(wxDynamicCast(pwndNotebookPage, CBOINCBaseView));
|
|
|
|
|
2004-10-22 10:02:14 +00:00
|
|
|
if (wxDynamicCast(pwndNotebookPage, CViewProjects))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListOnSelectedEvent(wxDynamicCast(pwndNotebookPage, CViewProjects), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewWork))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListOnSelectedEvent(wxDynamicCast(pwndNotebookPage, CViewWork), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewTransfers))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListOnSelectedEvent(wxDynamicCast(pwndNotebookPage, CViewTransfers), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewMessages))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListOnSelectedEvent(wxDynamicCast(pwndNotebookPage, CViewMessages), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewResources))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListOnSelectedEvent(wxDynamicCast(pwndNotebookPage, CViewResources), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CBOINCBaseView))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListOnSelectedEvent(wxDynamicCast(pwndNotebookPage, CBOINCBaseView), event);
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
}
|
2004-10-21 14:29:59 +00:00
|
|
|
|
|
|
|
event.Skip();
|
2004-10-05 02:55:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CMainFrame::OnListDeselected( wxListEvent& event )
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
if ( IsShown() )
|
|
|
|
{
|
|
|
|
wxWindow* pwndNotebookPage;
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2004-10-21 14:29:59 +00:00
|
|
|
wxASSERT(NULL != m_pNotebook);
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
|
2004-10-22 10:02:14 +00:00
|
|
|
pwndNotebookPage = m_pNotebook->GetPage( event.GetId() - ID_LIST_BASE );
|
2004-10-21 14:29:59 +00:00
|
|
|
wxASSERT(NULL != pwndNotebookPage);
|
|
|
|
wxASSERT(wxDynamicCast(pwndNotebookPage, CBOINCBaseView));
|
|
|
|
|
2004-10-22 10:02:14 +00:00
|
|
|
if (wxDynamicCast(pwndNotebookPage, CViewProjects))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListOnDeselectedEvent(wxDynamicCast(pwndNotebookPage, CViewProjects), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewWork))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListOnDeselectedEvent(wxDynamicCast(pwndNotebookPage, CViewWork), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewTransfers))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListOnDeselectedEvent(wxDynamicCast(pwndNotebookPage, CViewTransfers), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewMessages))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListOnDeselectedEvent(wxDynamicCast(pwndNotebookPage, CViewMessages), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewResources))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListOnDeselectedEvent(wxDynamicCast(pwndNotebookPage, CViewResources), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CBOINCBaseView))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListOnDeselectedEvent(wxDynamicCast(pwndNotebookPage, CBOINCBaseView), event);
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
}
|
2004-10-21 14:29:59 +00:00
|
|
|
|
|
|
|
event.Skip();
|
2004-09-25 21:33:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CMainFrame::OnListPanelRender ( wxTimerEvent &event )
|
2004-09-21 01:30:29 +00:00
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
if ( IsShown() )
|
|
|
|
{
|
|
|
|
wxWindow* pwndNotebookPage;
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2004-10-21 14:29:59 +00:00
|
|
|
wxASSERT(NULL != m_pNotebook);
|
2004-05-21 06:27:15 +00:00
|
|
|
|
|
|
|
|
2004-10-22 10:02:14 +00:00
|
|
|
pwndNotebookPage = m_pNotebook->GetPage( m_pNotebook->GetSelection() );
|
2004-10-21 14:29:59 +00:00
|
|
|
wxASSERT(NULL != pwndNotebookPage);
|
|
|
|
wxASSERT(wxDynamicCast(pwndNotebookPage, CBOINCBaseView));
|
|
|
|
|
2004-10-22 10:02:14 +00:00
|
|
|
if (wxDynamicCast(pwndNotebookPage, CViewProjects))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewProjects), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewWork))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewWork), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewTransfers))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewTransfers), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewMessages))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewMessages), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewResources))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewResources), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CBOINCBaseView))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireListPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CBOINCBaseView), event);
|
|
|
|
}
|
2004-05-27 06:17:58 +00:00
|
|
|
}
|
2004-10-21 14:29:59 +00:00
|
|
|
|
|
|
|
event.Skip();
|
2004-05-27 06:17:58 +00:00
|
|
|
}
|
2004-05-21 06:27:15 +00:00
|
|
|
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
void CMainFrame::OnTaskPanelRender ( wxTimerEvent &event )
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
if ( IsShown() )
|
|
|
|
{
|
|
|
|
wxWindow* pwndNotebookPage;
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2004-10-21 14:29:59 +00:00
|
|
|
wxASSERT(NULL != m_pNotebook);
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
|
2004-10-22 10:02:14 +00:00
|
|
|
pwndNotebookPage = m_pNotebook->GetPage( m_pNotebook->GetSelection() );
|
2004-10-21 14:29:59 +00:00
|
|
|
wxASSERT(NULL != pwndNotebookPage);
|
|
|
|
wxASSERT(wxDynamicCast(pwndNotebookPage, CBOINCBaseView));
|
|
|
|
|
2004-10-22 10:02:14 +00:00
|
|
|
if (wxDynamicCast(pwndNotebookPage, CViewProjects))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireTaskPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewProjects), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewWork))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireTaskPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewWork), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewTransfers))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireTaskPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewTransfers), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewMessages))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireTaskPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewMessages), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CViewResources))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireTaskPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CViewResources), event);
|
2004-10-22 10:02:14 +00:00
|
|
|
}
|
|
|
|
else if (wxDynamicCast(pwndNotebookPage, CBOINCBaseView))
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
FireTaskPanelRenderEvent(wxDynamicCast(pwndNotebookPage, CBOINCBaseView), event);
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
}
|
2004-10-21 14:29:59 +00:00
|
|
|
|
|
|
|
event.Skip();
|
2004-10-05 02:55:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template < class T >
|
|
|
|
void CMainFrame::FireListOnCacheHintEvent( T pPage, wxListEvent& event )
|
|
|
|
{
|
|
|
|
pPage->OnListCacheHint( event );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template < class T >
|
|
|
|
void CMainFrame::FireListOnSelectedEvent( T pPage, wxListEvent& event )
|
|
|
|
{
|
|
|
|
pPage->OnListSelected( event );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template < class T >
|
|
|
|
void CMainFrame::FireListOnDeselectedEvent( T pPage, wxListEvent& event )
|
|
|
|
{
|
|
|
|
pPage->OnListDeselected( event );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-27 06:17:58 +00:00
|
|
|
template < class T >
|
2004-10-05 02:55:26 +00:00
|
|
|
void CMainFrame::FireListPanelRenderEvent( T pPage, wxTimerEvent& event )
|
2004-09-21 01:30:29 +00:00
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
pPage->OnListRender( event );
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
template < class T >
|
|
|
|
void CMainFrame::FireTaskPanelRenderEvent( T pPage, wxTimerEvent& event )
|
|
|
|
{
|
2004-10-21 14:29:59 +00:00
|
|
|
pPage->OnTaskRender( event );
|
2004-10-05 02:55:26 +00:00
|
|
|
}
|
|
|
|
|