mirror of https://github.com/BOINC/boinc.git
MGR: More code cleanup, optimization and bug fixes
svn path=/trunk/boinc/; revision=21889
This commit is contained in:
parent
ec2c92665a
commit
994f17933d
|
@ -5008,3 +5008,17 @@ David 9 Jul 2010
|
|||
client_state.cpp,h
|
||||
work_fetch.cpp
|
||||
pers_file_xfer.h
|
||||
Charlie 9 Jul 2010
|
||||
- MGR: Fix accessibility code bug in Attach Wizard's ProjectListCtrl,
|
||||
consolidate and clean up Mac accessibility code.
|
||||
|
||||
Charlie 10 Jul 2010
|
||||
- MGR: More code cleanup, optimization and bug fixes.
|
||||
|
||||
clientgui/
|
||||
BOINCListCtrl.h
|
||||
DlgEventLogListCtrl.h
|
||||
NoticeListCtrl.cpp, .h
|
||||
ProjectListCtrl.cpp, .h
|
||||
mac/
|
||||
MacAccessiblity.cpp, .h
|
||||
|
|
|
@ -104,7 +104,7 @@ private:
|
|||
void SetupMacAccessibilitySupport();
|
||||
void RemoveMacAccessibilitySupport();
|
||||
|
||||
struct ListAccessData accessibilityHandlerData;
|
||||
ListAccessData accessibilityHandlerData;
|
||||
|
||||
EventHandlerRef m_pHeaderAccessibilityEventHandlerRef;
|
||||
EventHandlerRef m_pBodyAccessibilityEventHandlerRef;
|
||||
|
|
|
@ -61,7 +61,7 @@ private:
|
|||
void SetupMacAccessibilitySupport();
|
||||
void RemoveMacAccessibilitySupport();
|
||||
|
||||
struct ListAccessData accessibilityHandlerData;
|
||||
ListAccessData accessibilityHandlerData;
|
||||
|
||||
EventHandlerRef m_pHeaderAccessibilityEventHandlerRef;
|
||||
EventHandlerRef m_pBodyAccessibilityEventHandlerRef;
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
|
||||
#ifdef __WXMAC__
|
||||
|
||||
IMPLEMENT_CLASS( CNoticeListCtrlAccessible, wxObject )
|
||||
|
||||
CNoticeListCtrlAccessible::CNoticeListCtrlAccessible(wxWindow* win) {
|
||||
mp_win = win;
|
||||
SetupMacAccessibilitySupport();
|
||||
|
@ -464,7 +462,7 @@ bool CNoticeListCtrl::Create( wxWindow* parent )
|
|||
SetAccessible(new CNoticeListCtrlAccessible(this));
|
||||
#endif
|
||||
#ifdef __WXMAC__
|
||||
m_accessible = new CNoticeListCtrlAccessible(this);
|
||||
m_accessible = NULL;
|
||||
#endif
|
||||
////@end CNoticeListCtrl creation
|
||||
|
||||
|
@ -595,5 +593,11 @@ bool CNoticeListCtrl::UpdateUI()
|
|||
SetItemCount(pDoc->GetNoticeCount());
|
||||
pDoc->notices.complete = false;
|
||||
}
|
||||
#ifdef __WXMAC__
|
||||
if (m_accessible == NULL) {
|
||||
m_accessible = new CNoticeListCtrlAccessible(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -46,8 +46,6 @@ public:
|
|||
#ifndef __WXMAC__
|
||||
CNoticeListCtrlAccessible(wxWindow* win): wxWindowAccessible(win) {}
|
||||
#else
|
||||
DECLARE_CLASS( CNoticeListCtrlAccessible )
|
||||
|
||||
CNoticeListCtrlAccessible(wxWindow* win);
|
||||
virtual ~CNoticeListCtrlAccessible();
|
||||
#endif
|
||||
|
|
|
@ -36,8 +36,6 @@
|
|||
|
||||
#ifdef __WXMAC__
|
||||
|
||||
IMPLEMENT_CLASS( CProjectListCtrlAccessible, wxObject )
|
||||
|
||||
CProjectListCtrlAccessible::CProjectListCtrlAccessible(wxWindow* win) {
|
||||
mp_win = win;
|
||||
SetupMacAccessibilitySupport();
|
||||
|
|
|
@ -94,8 +94,6 @@ class CProjectListCtrlAccessible: public wxWindowAccessible
|
|||
public:
|
||||
|
||||
#ifdef __WXMAC__
|
||||
DECLARE_CLASS( CProjectListCtrlAccessible )
|
||||
|
||||
CProjectListCtrlAccessible(wxWindow* win);
|
||||
virtual ~CProjectListCtrlAccessible();
|
||||
#else
|
||||
|
|
|
@ -184,7 +184,14 @@ void CDlgEventLogListCtrl::RemoveMacAccessibilitySupport() {
|
|||
}
|
||||
|
||||
|
||||
typedef struct {
|
||||
CProjectListCtrlAccessible* pProjectListCtrlAccessible;
|
||||
CNoticeListCtrlAccessible* pNoticeListCtrlAccessible;
|
||||
} HTMLListAccessibilityHandlerData;
|
||||
|
||||
|
||||
void CProjectListCtrlAccessible::SetupMacAccessibilitySupport() {
|
||||
static HTMLListAccessibilityHandlerData userData;
|
||||
OSErr err;
|
||||
|
||||
CProjectListCtrl* pCtrl = wxDynamicCast(mp_win, CProjectListCtrl);
|
||||
|
@ -194,10 +201,12 @@ void CProjectListCtrlAccessible::SetupMacAccessibilitySupport() {
|
|||
{
|
||||
m_listView = (HIViewRef)pCtrl->GetHandle();
|
||||
err = HIViewSetEnabled(m_listView, true);
|
||||
userData.pProjectListCtrlAccessible = this;
|
||||
userData.pNoticeListCtrlAccessible = NULL;
|
||||
|
||||
err = InstallHIObjectEventHandler((HIObjectRef)m_listView, NewEventHandlerUPP(HTMLListAccessibilityEventHandler),
|
||||
sizeof(myAccessibilityEvents) / sizeof(EventTypeSpec), myAccessibilityEvents,
|
||||
this, &m_plistAccessibilityEventHandlerRef);
|
||||
&userData, &m_plistAccessibilityEventHandlerRef);
|
||||
} else {
|
||||
m_plistAccessibilityEventHandlerRef = NULL;
|
||||
}
|
||||
|
@ -213,6 +222,7 @@ void CProjectListCtrlAccessible::RemoveMacAccessibilitySupport() {
|
|||
|
||||
|
||||
void CNoticeListCtrlAccessible::SetupMacAccessibilitySupport() {
|
||||
static HTMLListAccessibilityHandlerData userData;
|
||||
OSErr err;
|
||||
|
||||
CNoticeListCtrl* pCtrl = wxDynamicCast(mp_win, CNoticeListCtrl);
|
||||
|
@ -222,10 +232,12 @@ void CNoticeListCtrlAccessible::SetupMacAccessibilitySupport() {
|
|||
{
|
||||
m_listView = (HIViewRef)pCtrl->GetHandle();
|
||||
err = HIViewSetEnabled(m_listView, true);
|
||||
userData.pProjectListCtrlAccessible = NULL;
|
||||
userData.pNoticeListCtrlAccessible = this;
|
||||
|
||||
err = InstallHIObjectEventHandler((HIObjectRef)m_listView, NewEventHandlerUPP(HTMLListAccessibilityEventHandler),
|
||||
sizeof(myAccessibilityEvents) / sizeof(EventTypeSpec), myAccessibilityEvents,
|
||||
this, &m_plistAccessibilityEventHandlerRef);
|
||||
&userData, &m_plistAccessibilityEventHandlerRef);
|
||||
} else {
|
||||
m_plistAccessibilityEventHandlerRef = NULL;
|
||||
}
|
||||
|
@ -330,12 +342,12 @@ pascal OSStatus BOINCListAccessibilityEventHandler( EventHandlerCallRef inHandle
|
|||
const UInt32 eventClass = GetEventClass(inEvent);
|
||||
const UInt32 eventKind = GetEventKind(inEvent);
|
||||
OSStatus err;
|
||||
wxGenericListCtrl* pList = ((struct ListAccessData*)pData)->pList;
|
||||
CBOINCBaseView* pView = ((struct ListAccessData*)pData)->pView;
|
||||
HIViewRef headerView = ((struct ListAccessData*)pData)->headerView;
|
||||
HIViewRef bodyView = ((struct ListAccessData*)pData)->bodyView;
|
||||
CDlgEventLog* pEventLog = ((struct ListAccessData*)pData)->pEventLog;
|
||||
Boolean snowLeopard = ((struct ListAccessData*)pData)->snowLeopard;
|
||||
wxGenericListCtrl* pList = ((ListAccessData*)pData)->pList;
|
||||
CBOINCBaseView* pView = ((ListAccessData*)pData)->pView;
|
||||
HIViewRef headerView = ((ListAccessData*)pData)->headerView;
|
||||
HIViewRef bodyView = ((ListAccessData*)pData)->bodyView;
|
||||
CDlgEventLog* pEventLog = ((ListAccessData*)pData)->pEventLog;
|
||||
Boolean snowLeopard = ((ListAccessData*)pData)->snowLeopard;
|
||||
|
||||
if (eventClass != kEventClassAccessibility) {
|
||||
return eventNotHandledErr;
|
||||
|
@ -370,6 +382,7 @@ pascal OSStatus BOINCListAccessibilityEventHandler( EventHandlerCallRef inHandle
|
|||
long theRow = wxNOT_FOUND;
|
||||
long ignored;
|
||||
int hitflags;
|
||||
int x = 0;
|
||||
|
||||
// Only the whole view or rows can be tested since the cells don't have sub-parts.
|
||||
if (col >= 0) {
|
||||
|
@ -383,8 +396,16 @@ pascal OSStatus BOINCListAccessibilityEventHandler( EventHandlerCallRef inHandle
|
|||
wxPoint p((int)where.x, (int)where.y);
|
||||
pList->ScreenToClient(&p.x, &p.y);
|
||||
|
||||
int xoff = pList->GetScrollPos(wxHORIZONTAL);
|
||||
if (xoff) {
|
||||
int ppux, ppuy;
|
||||
wxScrolledWindow * win = ((CBOINCListCtrl*)pList)->GetMainWin();
|
||||
win->GetScrollPixelsPerUnit(&ppux, &ppuy);
|
||||
x -= (xoff * ppux);
|
||||
}
|
||||
|
||||
// HitTest returns the column only on wxMSW
|
||||
int x = 0, n = pList->GetColumnCount();
|
||||
int n = pList->GetColumnCount();
|
||||
for (col=0; col<n; col++) {
|
||||
x += pList->GetColumnWidth(col);
|
||||
if (p.x < x) break;
|
||||
|
@ -1001,7 +1022,7 @@ pascal OSStatus BOINCListAccessibilityEventHandler( EventHandlerCallRef inHandle
|
|||
} else if ( CFStringCompare( attribute, kAXPositionAttribute, 0 ) == kCFCompareEqualTo ) {
|
||||
HIPoint pt;
|
||||
wxRect r;
|
||||
int i, x = 0, y = 0;
|
||||
int i, x = 0, y = 0, xoff = 0, ppux, ppuy;
|
||||
|
||||
// Return the position of this part as an HIPoint.
|
||||
// First get the position relative to the ListCtrl
|
||||
|
@ -1016,6 +1037,12 @@ pascal OSStatus BOINCListAccessibilityEventHandler( EventHandlerCallRef inHandle
|
|||
x = r.x;
|
||||
}
|
||||
}
|
||||
xoff = pList->GetScrollPos(wxHORIZONTAL);
|
||||
if (xoff) {
|
||||
wxScrolledWindow * win = ((CBOINCListCtrl*)pList)->GetMainWin();
|
||||
win->GetScrollPixelsPerUnit(&ppux, &ppuy);
|
||||
x -= (xoff * ppux);
|
||||
}
|
||||
// Now convert to global coordinates
|
||||
pList->ClientToScreen(&x, &y);
|
||||
pt.x = x;
|
||||
|
@ -1257,14 +1284,14 @@ pascal OSStatus HTMLListAccessibilityEventHandler( EventHandlerCallRef inHandler
|
|||
CNoticeListCtrl* pNoticeListCtrl = NULL;
|
||||
OSStatus err;
|
||||
|
||||
pProjectListCtrlAccessible = wxDynamicCast(pData, CProjectListCtrlAccessible);
|
||||
pProjectListCtrlAccessible = ((HTMLListAccessibilityHandlerData*)pData)->pProjectListCtrlAccessible;
|
||||
pNoticeListCtrlAccessible = ((HTMLListAccessibilityHandlerData*)pData)->pNoticeListCtrlAccessible;
|
||||
if (pProjectListCtrlAccessible != NULL) {
|
||||
pProjectListCtrl = wxDynamicCast(pProjectListCtrlAccessible->GetWindow(), CProjectListCtrl);
|
||||
if (pProjectListCtrl == NULL) {
|
||||
return eventNotHandledErr;
|
||||
}
|
||||
} else {
|
||||
pNoticeListCtrlAccessible = wxDynamicCast(pData, CNoticeListCtrlAccessible);
|
||||
if (pNoticeListCtrlAccessible == NULL) {
|
||||
return eventNotHandledErr;
|
||||
}
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
#include "DlgEventLog.h"
|
||||
#include "wx/generic/listctrl.h"
|
||||
|
||||
struct ListAccessData {
|
||||
typedef struct {
|
||||
wxGenericListCtrl* pList;
|
||||
CBOINCBaseView* pView;
|
||||
CDlgEventLog* pEventLog;
|
||||
HIViewRef headerView;
|
||||
HIViewRef bodyView;
|
||||
Boolean snowLeopard;
|
||||
};
|
||||
} ListAccessData;
|
||||
|
||||
void AccessibilityIgnoreAllChildren(HIViewRef parent, int recursionLevel);
|
||||
|
||||
|
|
Loading…
Reference in New Issue