diff --git a/clientgui/BOINCBaseView.cpp b/clientgui/BOINCBaseView.cpp index 259bae03df..8b58f6c7bc 100644 --- a/clientgui/BOINCBaseView.cpp +++ b/clientgui/BOINCBaseView.cpp @@ -161,6 +161,10 @@ void CBOINCBaseView::FireOnListRender(wxTimerEvent& event) { OnListRender(event); } +void CBOINCBaseView::FireOnShowItemProperties(int item) { + OnShowItemProperties(item); +} + void CBOINCBaseView::FireOnListSelected(wxListEvent& event) { OnListSelected(event); @@ -187,6 +191,10 @@ wxListItemAttr* CBOINCBaseView::FireOnListGetItemAttr(long item) const { } +void CBOINCBaseView::OnShowItemProperties( int item) { + //do nothing in base view +} + void CBOINCBaseView::OnListRender(wxTimerEvent& event) { if (!m_bProcessingListRenderEvent) { m_bProcessingListRenderEvent = true; diff --git a/clientgui/BOINCBaseView.h b/clientgui/BOINCBaseView.h index 903f11b600..1110d36918 100644 --- a/clientgui/BOINCBaseView.h +++ b/clientgui/BOINCBaseView.h @@ -100,6 +100,7 @@ public: virtual int GetListRowCount(); void FireOnListRender( wxTimerEvent& event ); + void FireOnShowItemProperties( int item ); void FireOnListSelected( wxListEvent& event ); void FireOnListDeselected( wxListEvent& event ); wxString FireOnListGetItemText( long item, long column ) const; @@ -114,6 +115,7 @@ protected: virtual bool OnRestoreState( wxConfigBase* pConfig ); virtual void OnListRender( wxTimerEvent& event ); + virtual void OnShowItemProperties( int item ); virtual void OnListSelected( wxListEvent& event ); virtual void OnListDeselected( wxListEvent& event ); virtual wxString OnListGetItemText( long item, long column ) const; diff --git a/clientgui/BOINCClientManager.cpp b/clientgui/BOINCClientManager.cpp index 15b65bd317..7161393dc9 100644 --- a/clientgui/BOINCClientManager.cpp +++ b/clientgui/BOINCClientManager.cpp @@ -112,7 +112,7 @@ int CBOINCClientManager::IsBOINCConfiguredAsDaemon() { bool CBOINCClientManager::IsBOINCCoreRunning() { wxLogTrace(wxT("Function Start/End"), wxT("CBOINCClientManager::IsBOINCCoreRunning - Function Begin")); - int retval; + int retval=-1; bool running = false; HOST_INFO hostinfo; RPC_CLIENT rpc; diff --git a/clientgui/BOINCGridCtrl.cpp b/clientgui/BOINCGridCtrl.cpp index 08ca8e7ae6..28ff417d64 100644 --- a/clientgui/BOINCGridCtrl.cpp +++ b/clientgui/BOINCGridCtrl.cpp @@ -119,6 +119,7 @@ static int CompareDateString(const wxString& first,const wxString& second) { /* ########## grid ctrl implementation ############### */ BEGIN_EVENT_TABLE (CBOINCGridCtrl, wxGrid) EVT_GRID_LABEL_LEFT_CLICK(CBOINCGridCtrl::OnLabelLClick) + EVT_GRID_CELL_LEFT_DCLICK(CBOINCGridCtrl::OnCellLDoubleClick) END_EVENT_TABLE () /* Constructor, don't call any grid methods here, because they could raise events, @@ -565,6 +566,12 @@ void CBOINCGridCtrl::DrawColLabel( wxDC& dc, int col ) } } +/* handles left button double click (to show properties, if supported by the view) */ +void CBOINCGridCtrl::OnCellLDoubleClick(wxGridEvent& ev) { + wxDynamicCast(GetParent(),CBOINCBaseView)->FireOnShowItemProperties(ev.GetRow()); + ev.Skip(); +} + /* handles left mouse click on column header */ void CBOINCGridCtrl::OnLabelLClick(wxGridEvent& ev) { if(ev.GetCol() != -1) { diff --git a/clientgui/BOINCGridCtrl.h b/clientgui/BOINCGridCtrl.h index 672dbf5ab1..d9031dcf55 100644 --- a/clientgui/BOINCGridCtrl.h +++ b/clientgui/BOINCGridCtrl.h @@ -93,6 +93,7 @@ public: int textOrientation = wxHORIZONTAL ); virtual void DrawColLabel( wxDC& dc, int col ); void OnLabelLClick(wxGridEvent& ev); + void OnCellLDoubleClick(wxGridEvent& ev); void SortData(); void SetColumnSortType(int col,int sortType=CST_STRING); wxArrayInt GetSelectedRows2(); diff --git a/clientgui/BOINCListCtrl.cpp b/clientgui/BOINCListCtrl.cpp index 5a47a0fb0d..64caf20e97 100644 --- a/clientgui/BOINCListCtrl.cpp +++ b/clientgui/BOINCListCtrl.cpp @@ -29,6 +29,10 @@ IMPLEMENT_DYNAMIC_CLASS(CBOINCListCtrl, wxListView) +BEGIN_EVENT_TABLE (CBOINCListCtrl, wxListView) + EVT_LEFT_DCLICK(CBOINCListCtrl::OnDoubleClick) +END_EVENT_TABLE () + CBOINCListCtrl::CBOINCListCtrl() {} @@ -145,6 +149,20 @@ bool CBOINCListCtrl::OnRestoreState(wxConfigBase* pConfig) { return true; } +void CBOINCListCtrl::OnDoubleClick(wxMouseEvent& event) { + wxLogTrace(wxT("Function Start/End"), wxT("CBOINCListCtrl::OnDoubleClick - Function Begin")); + wxString msg = wxEmptyString; + wxPoint pt; + + pt.x=event.GetX(); + pt.y=event.GetY(); + int flags= wxLIST_HITTEST_ONITEM; + int item = this->HitTest(pt,flags,NULL); + if(item > wxNOT_FOUND) { + wxDynamicCast(m_pParentView, CBOINCBaseView)->FireOnShowItemProperties(item); + } + wxLogTrace(wxT("Function Start/End"), wxT("CBOINCListCtrl::OnDoubleClick - Function End")); +} void CBOINCListCtrl::OnClick(wxCommandEvent& event) { wxLogTrace(wxT("Function Start/End"), wxT("CBOINCListCtrl::OnClick - Function Begin")); diff --git a/clientgui/BOINCListCtrl.h b/clientgui/BOINCListCtrl.h index 958bdfe26f..a7783ae13d 100644 --- a/clientgui/BOINCListCtrl.h +++ b/clientgui/BOINCListCtrl.h @@ -42,6 +42,7 @@ public: private: virtual void OnClick(wxCommandEvent& event); + virtual void OnDoubleClick(wxMouseEvent& event); virtual wxString OnGetItemText(long item, long column) const; virtual int OnGetItemImage(long item) const; @@ -51,6 +52,9 @@ private: CBOINCBaseView* m_pParentView; +protected: + DECLARE_EVENT_TABLE() + }; diff --git a/clientgui/DlgItemProperties.cpp b/clientgui/DlgItemProperties.cpp new file mode 100755 index 0000000000..fdfefd538f --- /dev/null +++ b/clientgui/DlgItemProperties.cpp @@ -0,0 +1,59 @@ +// Berkeley Open Infrastructure for Network Computing +// http://boinc.berkeley.edu +// Copyright (C) 2005 University of California +// +// This is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// either version 2.1 of the License, or (at your option) any later version. +// +// This software is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Lesser General Public License for more details. +// +// To view the GNU Lesser General Public License visit +// http://www.gnu.org/copyleft/lesser.html +// or write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +// +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma implementation "DlgItemProperties.h" +#endif + +#include "stdwx.h" +#include "DlgItemProperties.h" +#include "Events.h" + +IMPLEMENT_DYNAMIC_CLASS(CDlgItemProperties, wxDialog) + +BEGIN_EVENT_TABLE(CDlgItemProperties, wxDialog) + //buttons + EVT_BUTTON(wxID_OK,CDlgItemProperties::OnOK) +END_EVENT_TABLE() + +/* Constructor */ +CDlgItemProperties::CDlgItemProperties(wxWindow* parent) : CDlgItemPropertiesBase(parent,ID_ANYDIALOG) { +} + +void CDlgItemProperties::OnOK(wxCommandEvent& ev) { + ev.Skip(); +} + +CDlgItemProperties::~CDlgItemProperties() { +} + +void CDlgItemProperties::renderInfos(PROJECT* project) { + wxString html = wxEmptyString; + std::string name; + project->get_name(name); + html.append(wxT("

")); + html.append(_("project infos for ")); + html.append(wxString(name.c_str(),wxConvUTF8)); + html.append(wxT("

")); + this->m_html->SetPage(html); +} + +void CDlgItemProperties::renderInfos(RESULT* result) { +} + diff --git a/clientgui/DlgItemProperties.fbp b/clientgui/DlgItemProperties.fbp new file mode 100755 index 0000000000..21fe475cab --- /dev/null +++ b/clientgui/DlgItemProperties.fbp @@ -0,0 +1,185 @@ + + + + + + C++ + 1 + UTF-8 + connect + DlgItemPropertiesBase + 20000 + none + 1 + Item Properties + + . + + 1 + 0 + 0 + + + wxBOTH + + 1 + + + + 0 + ID_DEFAULT + + + CDlgItemPropertiesBase + + 503,480 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + + BOINC Manager - Item Properties + + wxWS_EX_VALIDATE_RECURSIVELY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer11 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + m_html + protected + + + wxHW_SCROLLBAR_AUTO + + + + + wxSIMPLE_BORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_BOTTOM|wxALIGN_CENTER_HORIZONTAL|wxALL + 0 + + + + 1 + 1 + + + 0 + wxID_OK + &Close + + + m_btnClose + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/clientgui/DlgItemProperties.h b/clientgui/DlgItemProperties.h new file mode 100755 index 0000000000..175e7bef79 --- /dev/null +++ b/clientgui/DlgItemProperties.h @@ -0,0 +1,43 @@ +// Berkeley Open Infrastructure for Network Computing +// http://boinc.berkeley.edu +// Copyright (C) 2005 University of California +// +// This is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// either version 2.1 of the License, or (at your option) any later version. +// +// This software is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Lesser General Public License for more details. +// +// To view the GNU Lesser General Public License visit +// http://www.gnu.org/copyleft/lesser.html +// or write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +// +#ifndef _DLGITEMPROPERTIES_H_ +#define _DLGITEMPROPERTIES_H_ + +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma interface "DlgItemProperties.cpp" +#endif + +#include "DlgItemPropertiesBase.h" +#include "MainDocument.h" + +class CDlgItemProperties : public CDlgItemPropertiesBase { + DECLARE_DYNAMIC_CLASS( CDlgItemProperties ) + DECLARE_EVENT_TABLE() +public: + CDlgItemProperties(wxWindow* parent=NULL);//to act as standard constructor set a default value + virtual ~CDlgItemProperties(); + // + void OnOK(wxCommandEvent& event); + void renderInfos(PROJECT* project); + void renderInfos(RESULT* result); +}; + +#endif // _DLGITEMPROPERTIES_H_ + diff --git a/clientgui/DlgItemPropertiesBase.cpp b/clientgui/DlgItemPropertiesBase.cpp new file mode 100755 index 0000000000..190ec16c4e --- /dev/null +++ b/clientgui/DlgItemPropertiesBase.cpp @@ -0,0 +1,35 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 16 2008) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "DlgItemPropertiesBase.h" + +/////////////////////////////////////////////////////////////////////////// + +CDlgItemPropertiesBase::CDlgItemPropertiesBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + this->SetExtraStyle( wxWS_EX_VALIDATE_RECURSIVELY ); + + wxBoxSizer* bSizer11; + bSizer11 = new wxBoxSizer( wxVERTICAL ); + + m_html = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO|wxSIMPLE_BORDER ); + bSizer11->Add( m_html, 1, wxALL|wxEXPAND, 5 ); + + m_btnClose = new wxButton( this, wxID_OK, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); + m_btnClose->SetDefault(); + bSizer11->Add( m_btnClose, 0, wxALIGN_BOTTOM|wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); + + this->SetSizer( bSizer11 ); + this->Layout(); + + this->Centre( wxBOTH ); +} + +CDlgItemPropertiesBase::~CDlgItemPropertiesBase() +{ +} diff --git a/clientgui/DlgItemPropertiesBase.h b/clientgui/DlgItemPropertiesBase.h new file mode 100755 index 0000000000..415735afab --- /dev/null +++ b/clientgui/DlgItemPropertiesBase.h @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 16 2008) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DlgItemPropertiesBase__ +#define __DlgItemPropertiesBase__ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +#define ID_DEFAULT wxID_ANY // Default + +/////////////////////////////////////////////////////////////////////////////// +/// Class CDlgItemPropertiesBase +/////////////////////////////////////////////////////////////////////////////// +class CDlgItemPropertiesBase : public wxDialog +{ + private: + + protected: + wxHtmlWindow* m_html; + wxButton* m_btnClose; + + public: + CDlgItemPropertiesBase( wxWindow* parent, wxWindowID id = ID_DEFAULT, const wxString& title = _("BOINC Manager - Item Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 503,480 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~CDlgItemPropertiesBase(); + +}; + +#endif //__DlgItemPropertiesBase__ diff --git a/clientgui/ViewProjects.cpp b/clientgui/ViewProjects.cpp index c8f8598455..9b80bb9877 100644 --- a/clientgui/ViewProjects.cpp +++ b/clientgui/ViewProjects.cpp @@ -743,5 +743,8 @@ wxInt32 CViewProjects::ConvertLinkToWebsiteIndex(const wxString& strLink, wxInt3 return 0; } +void CViewProjects::OnShowItemProperties(int item) { + wxMessageBox(wxT("show props here")); +} const char *BOINC_RCSID_b4edf777fc = "$Id$"; diff --git a/clientgui/ViewProjects.h b/clientgui/ViewProjects.h index 04dba9c469..7ee7139229 100644 --- a/clientgui/ViewProjects.h +++ b/clientgui/ViewProjects.h @@ -83,6 +83,8 @@ protected: virtual void UpdateSelection(); + virtual void OnShowItemProperties(int item); + wxInt32 FormatProjectName( wxInt32 item, wxString& strBuffer ) const; wxInt32 FormatAccountName( wxInt32 item, wxString& strBuffer ) const; wxInt32 FormatTeamName( wxInt32 item, wxString& strBuffer ) const; diff --git a/clientgui/ViewProjectsGrid.cpp b/clientgui/ViewProjectsGrid.cpp index 4e565f653c..841e2c86ac 100644 --- a/clientgui/ViewProjectsGrid.cpp +++ b/clientgui/ViewProjectsGrid.cpp @@ -32,7 +32,7 @@ #include "AdvancedFrame.h" #include "ViewProjectsGrid.h" #include "Events.h" - +#include "DlgItemProperties.h" #include "res/proj.xpm" @@ -933,3 +933,21 @@ void CViewProjectsGrid::OnListRender( wxTimerEvent& WXUNUSED(event) ) { wxLogTrace(wxT("Function Start/End"), wxT("CViewProjectsGrid::OnListRender - Function End")); } +void CViewProjectsGrid::OnShowItemProperties(int item) { + wxString strProjectURL = wxEmptyString; + wxString msg = wxEmptyString; + wxString temp = wxEmptyString; + + if(item<0) return; + + strProjectURL = HtmlEntityEncode( + m_pGridPane->GetCellValue(item,COLUMN_HIDDEN_URL).Trim(false) + ); + PROJECT* project = wxGetApp().GetDocument()->project(strProjectURL); + if(!project) return; + //displaying the infos on a dialog + CDlgItemProperties dlg(this); + dlg.renderInfos(project); + dlg.ShowModal(); +} + diff --git a/clientgui/ViewProjectsGrid.h b/clientgui/ViewProjectsGrid.h index c62b602e49..b86f5a6862 100644 --- a/clientgui/ViewProjectsGrid.h +++ b/clientgui/ViewProjectsGrid.h @@ -66,6 +66,7 @@ protected: virtual bool OnSaveState( wxConfigBase* pConfig ); virtual bool OnRestoreState( wxConfigBase* pConfig ); virtual void OnListRender( wxTimerEvent& event ); + virtual void OnShowItemProperties( int item ); void FormatProjectName( wxInt32 item, wxString& strBuffer ); void FormatAccountName( wxInt32 item, wxString& strBuffer ); @@ -80,6 +81,8 @@ protected: wxInt32 ConvertWebsiteIndexToLink( wxInt32 iProjectIndex, wxInt32 iWebsiteIndex, wxString& strLink ); wxInt32 ConvertLinkToWebsiteIndex( const wxString& strLink, wxInt32& iProjectIndex, wxInt32& iWebsiteIndex ); + wxString renderHTMLProject(PROJECT* p); + CBOINCGridCtrl* m_pGridPane; }; diff --git a/win_build/boincmgr_curl.vcproj b/win_build/boincmgr_curl.vcproj index 4fc893ba22..c0f643af53 100644 --- a/win_build/boincmgr_curl.vcproj +++ b/win_build/boincmgr_curl.vcproj @@ -1,7 +1,7 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - @@ -1570,7 +1562,7 @@ /> + + + + + + + + + + + @@ -2371,17 +2387,6 @@ CompileAs="2" /> - - - @@ -2395,19 +2400,6 @@ CompileAs="2" /> - - - @@ -2419,6 +2411,30 @@ CompileAs="2" /> + + + + + + @@ -2447,7 +2463,7 @@ /> - - - @@ -2521,7 +2529,7 @@ /> + + +