From: John L. <jr...@us...> - 2007-05-22 03:27:59
|
Update of /cvsroot/wxlua/wxLua/modules/wxluadebug/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv8900/wxLua/modules/wxluadebug/src Modified Files: splttree.cpp staktree.cpp Log Message: Changed wxLuaStackDialog to use a wxListCtrl instead of a hacked wxTreeCtrl that tries to be a wxListCtrl. Works better. Removed all code in splttree.h/cpp before removing it completely. Index: splttree.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/splttree.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** splttree.cpp 12 Dec 2006 01:23:40 -0000 1.15 --- splttree.cpp 22 May 2007 03:27:54 -0000 1.16 *************** *** 12,841 **** // Licence: wxWidgets licence ///////////////////////////////////////////////////////////////////////////// - - // ============================================================================ - // declarations - // ============================================================================ - - // ---------------------------------------------------------------------------- - // headers - // ---------------------------------------------------------------------------- - - // For compilers that support precompilation, includes "wx/wx.h". - #include "wx/wxprec.h" - - #ifdef __BORLANDC__ - #pragma hdrstop - #endif - - // for all others, include the necessary headers (this file is usually all you - // need because it includes almost all "standard" wxWidgets headers) - #ifndef WX_PRECOMP - #include "wx/wx.h" - #endif - - #ifdef __WXMSW__ - #include <windows.h> - #include "wx/msw/winundef.h" - #endif // __WXMSW__ - - #include "wxluadebug/include/splttree.h" - #include <math.h> - - static wxTreeItemId defaultTreeItemId; - - /* - * wxRemotelyScrolledTreeCtrl - */ - - #if USE_GENERIC_TREECTRL - IMPLEMENT_ABSTRACT_CLASS(wxRemotelyScrolledTreeCtrl, wxGenericTreeCtrl) - #else - IMPLEMENT_ABSTRACT_CLASS(wxRemotelyScrolledTreeCtrl, wxTreeCtrl) - #endif - - #if USE_GENERIC_TREECTRL - BEGIN_EVENT_TABLE(wxRemotelyScrolledTreeCtrl, wxGenericTreeCtrl) - #else - BEGIN_EVENT_TABLE(wxRemotelyScrolledTreeCtrl, wxTreeCtrl) - #endif - EVT_SIZE(wxRemotelyScrolledTreeCtrl::OnSize) - EVT_PAINT(wxRemotelyScrolledTreeCtrl::OnPaint) - EVT_TREE_ITEM_EXPANDED(wxID_ANY, wxRemotelyScrolledTreeCtrl::OnExpand) - EVT_TREE_ITEM_COLLAPSED(wxID_ANY, wxRemotelyScrolledTreeCtrl::OnExpand) - EVT_SCROLLWIN(wxRemotelyScrolledTreeCtrl::OnScroll) - EVT_TREE_SEL_CHANGED(wxID_ANY, wxRemotelyScrolledTreeCtrl::OnSelChanged) - END_EVENT_TABLE() - - wxRemotelyScrolledTreeCtrl::wxRemotelyScrolledTreeCtrl(wxWindow *parent, - wxWindowID id, - const wxPoint& pt, - const wxSize& sz, - long style) - : wxTreeCtrl(parent, id, pt, sz, style & ~wxTR_ROW_LINES), - m_lastTreeItemId(defaultTreeItemId) - { - m_firstCompanionWindow = NULL; - m_secondCompanionWindow = NULL; - - // We draw the row lines ourself so they match what's done - // by the companion window. That is why the flag is turned - // off above, so wxGenericTreeCtrl doesn't draw them in a - // different colour. - m_drawRowLines = (style & wxTR_ROW_LINES) != 0; - } - - wxRemotelyScrolledTreeCtrl::~wxRemotelyScrolledTreeCtrl() - { - } - - void wxRemotelyScrolledTreeCtrl::HideVScrollbar() - { - #if defined(__WXMSW__) - #if USE_GENERIC_TREECTRL - if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl))) - #endif - { - ::ShowScrollBar((HWND) GetHWND(), SB_VERT, false); - } - #if USE_GENERIC_TREECTRL - else - { - // Implicit in overriding SetScrollbars - } - #endif - #endif - } - - // Number of pixels per user unit (0 or -1 for no scrollbar) - // Length of virtual canvas in user units - // Length of page in user units - void wxRemotelyScrolledTreeCtrl::SetScrollbars(int pixelsPerUnitX, - int pixelsPerUnitY, - int noUnitsX, - int noUnitsY, - int xPos, - int yPos, - bool noRefresh) - { - #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) - if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) - { - wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; - win->wxGenericTreeCtrl::SetScrollbars(pixelsPerUnitX, pixelsPerUnitY, noUnitsX, 0, xPos, 0, /* noRefresh */ true); - - wxScrolledWindow* scrolledWindow = GetScrolledWindow(); - if (scrolledWindow) - { - scrolledWindow->SetScrollbars(0, pixelsPerUnitY, 0, noUnitsY, 0, yPos, noRefresh); - scrolledWindow->AdjustScrollbars(); // FIXME - this is for the broken wxWindow's wxScrolledWindow - } - } - #else - # ifdef UNREFERENCED_PARAMETER - UNREFERENCED_PARAMETER(pixelsPerUnitX); - UNREFERENCED_PARAMETER(pixelsPerUnitY); - UNREFERENCED_PARAMETER(noUnitsX); - UNREFERENCED_PARAMETER(noUnitsY); - UNREFERENCED_PARAMETER(xPos); - UNREFERENCED_PARAMETER(yPos); - UNREFERENCED_PARAMETER(noRefresh); - # endif - #endif - } - - // In case we're using the generic tree control. - int wxRemotelyScrolledTreeCtrl::GetScrollPos(int orient) const - { - #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) - wxScrolledWindow* scrolledWindow = GetScrolledWindow(); - - if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) - { - wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; - - if (orient == wxHORIZONTAL) - return win->wxGenericTreeCtrl::GetScrollPos(orient); - else - return scrolledWindow->GetScrollPos(orient); - } - #else - # ifdef UNREFERENCED_PARAMETER - UNREFERENCED_PARAMETER(orient); - # endif - #endif - return 0; - } - - void wxRemotelyScrolledTreeCtrl::DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const - { - // wxTreeCtrl is not a scrolled window in MSW so don't do anything - #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) - int vx = 0, vy = 0; - GetViewStart(&vx, &vy); - - int pixelsPerUnitX = 0, pixelsPerUnitY = 0; - GetScrollPixelsPerUnit(&pixelsPerUnitX, &pixelsPerUnitY); - - if (xx) *xx = x - vx*pixelsPerUnitX; - if (yy) *yy = y - vy*pixelsPerUnitY; - #else - if (xx) *xx = x; - if (yy) *yy = y; - #endif - } - void wxRemotelyScrolledTreeCtrl::DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const - { - #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) - int vx = 0, vy = 0; - GetViewStart(&vx, &vy); - - int pixelsPerUnitX = 0, pixelsPerUnitY = 0; - GetScrollPixelsPerUnit(&pixelsPerUnitX, &pixelsPerUnitY); - - if (xx) *xx = x + vx*pixelsPerUnitX; - if (yy) *yy = y + vy*pixelsPerUnitY; - #else - if (xx) *xx = x; - if (yy) *yy = y; - #endif - } - - - // In case we're using the generic tree control. - // Get the view start - void wxRemotelyScrolledTreeCtrl::GetViewStart(int *x, int *y) const - { - wxScrolledWindow* scrolledWindow = GetScrolledWindow(); - - #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) - if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) - { - wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; - int x1 = 0, y1 = 0, x2 = 0, y2 = 0; - win->wxGenericTreeCtrl::GetViewStart(& x1, & y1); - * x = x1; * y = y1; - if (!scrolledWindow) - return; - - scrolledWindow->GetViewStart(& x2, & y2); - * y = y2; - } - else - #endif - { - // x is wrong since the horizontal scrollbar is controlled by the - // tree control, but we probably don't need it. - scrolledWindow->GetViewStart(x, y); - } - } - - // In case we're using the generic tree control. - void wxRemotelyScrolledTreeCtrl::PrepareDC( - #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) - wxDC& dc - #else - wxDC& WXUNUSED(dc) - #endif - ) - { - #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) - if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) - { - wxScrolledWindow* scrolledWindow = GetScrolledWindow(); - - wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; - - int startX, startY; - GetViewStart(& startX, & startY); - - int xppu1, yppu1, xppu2, yppu2; - win->wxGenericTreeCtrl::GetScrollPixelsPerUnit(& xppu1, & yppu1); - scrolledWindow->GetScrollPixelsPerUnit(& xppu2, & yppu2); - - dc.SetDeviceOrigin( -startX * xppu1, -startY * yppu2 ); - // dc.SetUserScale( win->GetScaleX(), win->GetScaleY() ); - } - #endif - } - - // Scroll to the given line (in scroll units where each unit is - // the height of an item) - void wxRemotelyScrolledTreeCtrl::ScrollToLine(int WXUNUSED(posHoriz), int posVert) - { - #ifdef __WXMSW__ - #if USE_GENERIC_TREECTRL - if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl))) - #endif // USE_GENERIC_TREECTRL - { - UINT sbCode = SB_THUMBPOSITION; - HWND vertScrollBar = 0; - #if !wxCHECK_VERSION(2,5,0) - MSWDefWindowProc((WXUINT) WM_VSCROLL, MAKELONG(sbCode, posVert), (WXHWND) vertScrollBar); - #else // wxCHECK_VERSION(2,5,0) - MSWDefWindowProc((WXUINT) WM_VSCROLL, MAKELONG(sbCode, posVert), (WXLPARAM) vertScrollBar); - #endif // wxCHECK_VERSION(2,5,0) - } - #if USE_GENERIC_TREECTRL - else - #endif // USE_GENERIC_TREECTRL - #endif // __WXMSW__ - - #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) - { - wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; - win->Refresh(); - } - #endif - } - - void wxRemotelyScrolledTreeCtrl::OnSize(wxSizeEvent& event) - { - HideVScrollbar(); - AdjustRemoteScrollbars(); - if (m_firstCompanionWindow) - m_firstCompanionWindow->Refresh(true); - if (m_secondCompanionWindow) - m_secondCompanionWindow->Refresh(true); - event.Skip(); - } - - void wxRemotelyScrolledTreeCtrl::OnExpand(wxTreeEvent& event) - { - AdjustRemoteScrollbars(); - event.Skip(); - - // If we don't have this, we get some bits of lines still remaining - if (event.GetEventType() == wxEVT_COMMAND_TREE_ITEM_COLLAPSED) - Refresh(); - - // Pass on the event - if (m_secondCompanionWindow) - m_secondCompanionWindow->GetEventHandler()->ProcessEvent(event); - if (m_firstCompanionWindow) - m_firstCompanionWindow->GetEventHandler()->ProcessEvent(event); - } - - void wxRemotelyScrolledTreeCtrl::OnSelChanged(wxTreeEvent& event) - { - const wxTreeItemId &itemId = GetFirstVisibleItem(); - if (m_lastTreeItemId != itemId) - { - AdjustRemoteScrollbars(); - event.Skip(); - - Refresh(); - - // Pass on the event - if (m_secondCompanionWindow) - m_secondCompanionWindow->GetEventHandler()->ProcessEvent(event); - if (m_firstCompanionWindow) - m_firstCompanionWindow->GetEventHandler()->ProcessEvent(event); - - m_lastTreeItemId = itemId; - } - else - event.Skip(); - } - - void wxRemotelyScrolledTreeCtrl::OnPaint(wxPaintEvent& event) - { - wxPaintDC dc(this); - - wxTreeCtrl::OnPaint(event); - - if (! m_drawRowLines) - return; - - // Reset the device origin since it may have been set - dc.SetDeviceOrigin(0, 0); - - wxPen pen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID); - dc.SetPen(pen); - dc.SetBrush(*wxTRANSPARENT_BRUSH); - - wxSize clientSize = GetClientSize(); - wxRect itemRect; - int cy = 0; - wxTreeItemId h, lastH; - for(h = GetFirstVisibleItem(); h && IsVisible(h); h = GetNextVisible(h)) - { - if (GetBoundingRect(h, itemRect)) - { - cy = itemRect.GetTop(); - dc.DrawLine(0, cy, clientSize.x, cy); - lastH = h; - } - } - - if (lastH.IsOk() && GetBoundingRect(lastH, itemRect)) - { - cy = itemRect.GetBottom(); - dc.DrawLine(0, cy, clientSize.x, cy); - } - } - - - // Adjust the containing wxScrolledWindow's scrollbars appropriately - void wxRemotelyScrolledTreeCtrl::AdjustRemoteScrollbars() - { - #if USE_GENERIC_TREECTRL || !defined(__WXMSW__) - if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) - { - // This is for the generic tree control. - // It calls SetScrollbars which has been overridden - // to adjust the parent scrolled window vertical - // scrollbar. - ((wxGenericTreeCtrl*) this)->AdjustMyScrollbars(); - return; - } - else - #endif // USE_GENERIC_TREECTRL || !defined(__WXMSW__) - { - // This is for the wxMSW tree control - wxScrolledWindow* scrolledWindow = GetScrolledWindow(); - if (scrolledWindow) - { - wxRect itemRect; - if (GetBoundingRect(GetFirstVisibleItem(), itemRect)) // newer method - //if (GetBoundingRect(GetRootItem(), itemRect)) - { - // Actually, the real height seems to be 1 less than reported - // (e.g. 16 instead of 16) - int itemHeight = itemRect.GetHeight() - 1; - - int w, h; - GetClientSize(&w, &h); - - wxRect rect(0, 0, 0, 0); - CalcTreeSize(rect); - - double f = ((double) (rect.GetHeight()) / (double) itemHeight) ; - int treeViewHeight = (int) ceil(f); - - int scrollPixelsPerLine = itemHeight; - int scrollPos = - (itemRect.y / itemHeight); - - scrolledWindow->SetScrollbars(0, scrollPixelsPerLine, 0, treeViewHeight - 1, 0, scrollPos); - - // Ensure that when a scrollbar becomes hidden or visible, - // the contained window sizes are right. - // Problem: this is called too early (?) - wxSizeEvent event(scrolledWindow->GetSize(), scrolledWindow->GetId()); - scrolledWindow->GetEventHandler()->ProcessEvent(event); - } - } - } - } - - void wxRemotelyScrolledTreeCtrl::DeleteAllItems() - { - wxTreeCtrl::DeleteAllItems(); - if (m_firstCompanionWindow) - m_firstCompanionWindow->Refresh(true); - if (m_secondCompanionWindow) - m_secondCompanionWindow->Refresh(true); - } - - // Calculate the area that contains both rectangles - static wxRect CombineRectangles(const wxRect& rect1, const wxRect& rect2) - { - wxRect rect; - - int right1 = rect1.GetRight(); - int bottom1 = rect1.GetBottom(); - int right2 = rect2.GetRight(); - int bottom2 = rect2.GetBottom(); - - wxPoint topLeft = wxPoint(wxMin(rect1.x, rect2.x), wxMin(rect1.y, rect2.y)); - wxPoint bottomRight = wxPoint(wxMax(right1, right2), wxMax(bottom1, bottom2)); - - rect.x = topLeft.x; rect.y = topLeft.y; - rect.SetRight(bottomRight.x); - rect.SetBottom(bottomRight.y); - - return rect; - } - - // Calculate the tree overall size so we can set the scrollbar - // correctly - void wxRemotelyScrolledTreeCtrl::CalcTreeSize(wxRect& rect) - { - CalcTreeSize(GetRootItem(), rect); - } - - void wxRemotelyScrolledTreeCtrl::CalcTreeSize(const wxTreeItemId& id, wxRect& rect) - { - // More efficient implementation would be to find the last item (but how?) - // Q: is the bounding rect relative to the top of the virtual tree workspace - // or the top of the window? How would we convert? - wxRect itemSize; - if (GetBoundingRect(id, itemSize)) - { - rect = CombineRectangles(rect, itemSize); - } - - wxTreeItemIdValue cookie; - wxTreeItemId childId = GetFirstChild(id, cookie); - - #if wxCHECK_VERSION(2,7,0) - while (childId != wxTreeItemId((void*)0)) - #else //!wxCHECK_VERSION(2,7,0) - while (childId != wxTreeItemId((long)0)) - #endif //wxCHECK_VERSION(2,7,0) - { - CalcTreeSize(childId, rect); - childId = GetNextChild(childId, cookie); - } - } - - // Find the scrolled window that contains this control - wxScrolledWindow* wxRemotelyScrolledTreeCtrl::GetScrolledWindow() const - { - wxWindow* parent = wxWindow::GetParent(); - while (parent) - { - if (parent->IsKindOf(CLASSINFO(wxScrolledWindow))) - return (wxScrolledWindow*) parent; - parent = parent->GetParent(); - } - return NULL; - } - - void wxRemotelyScrolledTreeCtrl::OnScroll(wxScrollWinEvent& event) - { - int orient = event.GetOrientation(); - if (orient == wxHORIZONTAL) - { - event.Skip(); - return; - } - - wxScrolledWindow* scrollWin = GetScrolledWindow(); - if (!scrollWin) - return; - - int x, y; - scrollWin->GetViewStart(& x, & y); - - ScrollToLine(-1, y); - - // Pass on the event - if (m_secondCompanionWindow) - m_secondCompanionWindow->GetEventHandler()->ProcessEvent(event); - if (m_firstCompanionWindow) - m_firstCompanionWindow->GetEventHandler()->ProcessEvent(event); - } - - /* - * wxTreeCompanionWindow - * - * A window displaying values associated with tree control items. - */ - - IMPLEMENT_ABSTRACT_CLASS(wxTreeCompanionWindow, wxWindow) - - BEGIN_EVENT_TABLE(wxTreeCompanionWindow, wxWindow) - EVT_PAINT(wxTreeCompanionWindow::OnPaint) - EVT_SCROLLWIN(wxTreeCompanionWindow::OnScroll) - EVT_TREE_ITEM_EXPANDED(-1, wxTreeCompanionWindow::OnExpand) - EVT_TREE_ITEM_COLLAPSED(-1, wxTreeCompanionWindow::OnExpand) - EVT_TREE_SEL_CHANGED(-1, wxTreeCompanionWindow::OnSelChanged) - END_EVENT_TABLE() - - wxTreeCompanionWindow::wxTreeCompanionWindow(wxWindow* parent, wxWindowID id, - const wxPoint& pos, - const wxSize& sz, - long style): - wxWindow(parent, id, pos, sz, style) - { - m_treeControl = NULL; - } - - wxTreeCompanionWindow::~wxTreeCompanionWindow() - { - } - - void wxTreeCompanionWindow::DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect) - { - if (m_treeControl) - { - wxString text = m_treeControl->GetItemText(id); - - dc.SetTextForeground(*wxBLACK); - dc.SetBackgroundMode(wxTRANSPARENT); - - int textW, textH; - dc.GetTextExtent(text, &textW, &textH); - - int x = 5; - int y = rect.GetY() + wxMax(0, (rect.GetHeight() - textH) / 2); - - dc.DrawText(text, x, y); - } - } - - void wxTreeCompanionWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) - { - if (m_treeControl == NULL) - return; - - wxMemoryDC tempDC; - wxSize clientSize = GetClientSize(); - - wxBitmap tempBitmap(clientSize.x, clientSize.y); - - tempDC.SelectObject(tempBitmap); - - tempDC.Clear(); - - #if wxCHECK_VERSION(2,6,0) - wxPen pen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID); - wxFont font(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); - #else //!wxCHECK_VERSION(2,6,0) - wxPen pen(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID); - wxFont font(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); - #endif //wxCHECK_VERSION(2,6,0) - - tempDC.SetPen(pen); - tempDC.SetBrush(*wxTRANSPARENT_BRUSH); - tempDC.SetFont(font); - - wxRect itemRect; - int cy = 0; - wxTreeItemId h, lastH; - for(h = m_treeControl->GetFirstVisibleItem(); - h && m_treeControl->IsVisible(h); - h = m_treeControl->GetNextVisible(h)) - { - if (m_treeControl->GetBoundingRect(h, itemRect)) - { - cy = itemRect.GetTop(); - wxRect drawItemRect(0, cy, clientSize.x, itemRect.GetHeight()); - - lastH = h; - - // Draw the actual item - DrawItem(tempDC, h, drawItemRect); - tempDC.DrawLine(0, cy, clientSize.x, cy); - } - } - - if (lastH.IsOk() && m_treeControl->GetBoundingRect(lastH, itemRect)) - { - cy = itemRect.GetBottom(); - tempDC.DrawLine(0, cy, clientSize.x, cy); - } - - wxPaintDC dc(this); - dc.Blit(0, 0, clientSize.x, clientSize.y, &tempDC, 0, 0); - tempDC.SelectObject(wxNullBitmap); - } - - void wxTreeCompanionWindow::OnScroll(wxScrollWinEvent& event) - { - int orient = event.GetOrientation(); - if (orient == wxHORIZONTAL) - { - event.Skip(); - return; - } - - if (!m_treeControl) - return; - - // TODO: scroll the window physically instead of just refreshing. - Refresh(true); - } - - void wxTreeCompanionWindow::OnExpand(wxTreeEvent& WXUNUSED(event)) - { - // TODO: something more optimized than simply refresh the whole - // window when the tree is expanded/collapsed. Tricky. - Refresh(); - } - - void wxTreeCompanionWindow::OnSelChanged(wxTreeEvent& WXUNUSED(event)) - { - Refresh(); - } - - /* - * wxThinSplitterWindow - */ - - IMPLEMENT_ABSTRACT_CLASS(wxThinSplitterWindow, wxSplitterWindow) - - BEGIN_EVENT_TABLE(wxThinSplitterWindow, wxSplitterWindow) - EVT_SIZE(wxThinSplitterWindow::OnSize) - END_EVENT_TABLE() - - wxThinSplitterWindow::wxThinSplitterWindow(wxWindow* parent, wxWindowID id, - const wxPoint& pos, - const wxSize& sz, - long style): - wxSplitterWindow(parent, id, pos, sz, style) - { - } - - void wxThinSplitterWindow::SizeWindows() - { - // The client size may have changed inbetween - // the sizing of the first window and the sizing of - // the second. So repeat SizeWindows. - wxSplitterWindow::SizeWindows(); - wxSplitterWindow::SizeWindows(); - } - - // Tests for x, y over sash - bool wxThinSplitterWindow::SashHitTest(int x, int y, int WXUNUSED(tolerance)) - { - return wxSplitterWindow::SashHitTest(x, y, 4); - } - - void wxThinSplitterWindow::DrawSash(wxDC& dc) - { - if ( m_sashPosition == 0 || !m_windowTwo) - return; - if (GetWindowStyle() & wxSP_NOSASH) - return; - - int w, h; - GetClientSize(&w, &h); - - wxColour faceColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); - wxPen facePen(faceColour, 1, wxSOLID); - wxBrush faceBrush(faceColour, wxSOLID); - - if ( m_splitMode == wxSPLIT_VERTICAL ) - { - dc.SetPen(facePen); - dc.SetBrush(faceBrush); - int h1 = h-1; - int y1 = 0; - if ( (GetWindowStyleFlag() & wxSP_BORDER) != wxSP_BORDER && (GetWindowStyleFlag() & wxSP_3DBORDER) != wxSP_3DBORDER ) - h1 += 1; // Not sure why this is necessary... - if ( (GetWindowStyleFlag() & wxSP_3DBORDER) == wxSP_3DBORDER) - { - y1 = 2; h1 -= 3; - } - dc.DrawRectangle(m_sashPosition, y1, 3, h1); // 3 == m_sashSize now gone in wxWidgets >= 2.5 - } - else - { - dc.SetPen(facePen); - dc.SetBrush(faceBrush); - int w1 = w-1; - int x1 = 0; - if ( (GetWindowStyleFlag() & wxSP_BORDER) != wxSP_BORDER && (GetWindowStyleFlag() & wxSP_3DBORDER) != wxSP_3DBORDER ) - w1 ++; - if ( (GetWindowStyleFlag() & wxSP_3DBORDER) == wxSP_3DBORDER) - { - x1 = 2; w1 -= 3; - } - dc.DrawRectangle(x1, m_sashPosition, w1, 3); - } - - dc.SetPen(wxNullPen); - dc.SetBrush(wxNullBrush); - } - - void wxThinSplitterWindow::OnSize(wxSizeEvent& event) - { - wxSplitterWindow::OnSize(event); - } - - /* - * wxSplitterScrolledWindow - */ - - IMPLEMENT_ABSTRACT_CLASS(wxSplitterScrolledWindow, wxScrolledWindow) - - BEGIN_EVENT_TABLE(wxSplitterScrolledWindow, wxScrolledWindow) - EVT_SCROLLWIN(wxSplitterScrolledWindow::OnScroll) - EVT_SIZE(wxSplitterScrolledWindow::OnSize) - END_EVENT_TABLE() - - wxSplitterScrolledWindow::wxSplitterScrolledWindow(wxWindow* parent, wxWindowID id, - const wxPoint& pos, - const wxSize& sz, - long style): - wxScrolledWindow(parent, id, pos, sz, style) - { - } - - void wxSplitterScrolledWindow::OnSize(wxSizeEvent& WXUNUSED(event)) - { - wxSize sz = GetClientSize(); - if (GetChildren().GetFirst()) - { - ((wxWindow*) GetChildren().GetFirst()->GetData())->SetSize(0, 0, sz.x, sz.y); - } - } - - void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event) - { - // Ensure that events being propagated back up the window hierarchy - // don't cause an infinite loop - static bool inOnScroll = false; - if (inOnScroll) - { - event.Skip(); - return; - } - inOnScroll = true; - - int orient = event.GetOrientation(); - - int nScrollInc = CalcScrollInc(event); - if (nScrollInc == 0) - { - inOnScroll = false; - return; - } - - if (orient == wxHORIZONTAL) - { - inOnScroll = false; - event.Skip(); - return; - } - else - { - int newPos = m_yScrollPosition + nScrollInc; - SetScrollPos(wxVERTICAL, newPos, true ); - } - - if (orient == wxHORIZONTAL) - { - m_xScrollPosition += nScrollInc; - } - else - { - m_yScrollPosition += nScrollInc; - } - - // Find targets in splitter window and send the event to them - wxWindowListNode* node = GetChildren().GetFirst(); - while (node) - { - wxWindow* child = (wxWindow*) node->GetData(); - if (child->IsKindOf(CLASSINFO(wxSplitterWindow))) - { - wxSplitterWindow* splitter = (wxSplitterWindow*) child; - if (splitter->GetWindow1()) - splitter->GetWindow1()->ProcessEvent(event); - if (splitter->GetWindow2()) - splitter->GetWindow2()->ProcessEvent(event); - break; - } - node = node->GetNext(); - } - - #if defined(__WXMAC_CLASSIC__) && !(wxCHECK_VERSION(2,5,3)) - m_targetWindow->MacUpdateImmediately() ; - #else // this should be OK for all modern versions of wx: - m_targetWindow->Update(); - #endif - - inOnScroll = false; - } --- 12,13 ---- Index: staktree.cpp =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxluadebug/src/staktree.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** staktree.cpp 21 May 2007 01:07:59 -0000 1.38 --- staktree.cpp 22 May 2007 03:27:54 -0000 1.39 *************** *** 36,51 **** BEGIN_EVENT_TABLE(wxLuaStackDialog, wxDialog) EVT_COMBOBOX( ID_WXLUA_STACKDIALOG_COMBO, wxLuaStackDialog::OnSelectStack) ! EVT_TREE_ITEM_EXPANDING(ID_WXLUA_STACKDIALOG_STACKTREE, wxLuaStackDialog::OnItemExpanding) END_EVENT_TABLE() void wxLuaStackDialog::Init() { ! m_treeControl = NULL; ! m_treeSplitter = NULL; ! m_valueSplitter = NULL; ! m_scrolledWindow = NULL; ! m_firstValueWindow = NULL; ! m_secondValueWindow = NULL; ! m_stackComboBox = NULL; m_stack_sel = -1; --- 36,47 ---- BEGIN_EVENT_TABLE(wxLuaStackDialog, wxDialog) EVT_COMBOBOX( ID_WXLUA_STACKDIALOG_COMBO, wxLuaStackDialog::OnSelectStack) ! EVT_LIST_ITEM_ACTIVATED( ID_WXLUA_STACKDIALOG_LISTCTRL, wxLuaStackDialog::OnItemActivated) ! EVT_LIST_DELETE_ITEM( ID_WXLUA_STACKDIALOG_LISTCTRL, wxLuaStackDialog::OnItemDeleted) ! EVT_LIST_DELETE_ALL_ITEMS( ID_WXLUA_STACKDIALOG_LISTCTRL, wxLuaStackDialog::OnAllItemsDeleted) END_EVENT_TABLE() void wxLuaStackDialog::Init() { ! m_listCtrl = NULL; m_stackComboBox = NULL; m_stack_sel = -1; *************** *** 73,126 **** wxCB_DROPDOWN | wxCB_READONLY); ! m_scrolledWindow = new wxSplitterScrolledWindow(panel, ! ID_WXLUA_STACKDIALOG_SCRWIN, ! wxDefaultPosition, wxSize(400, 350), ! wxNO_BORDER | wxCLIP_CHILDREN | wxVSCROLL); ! m_treeSplitter = new wxThinSplitterWindow(m_scrolledWindow, ! ID_WXLUA_STACKDIALOG_SPLITWIN, ! wxDefaultPosition, wxDefaultSize, ! wxSP_3DBORDER | wxCLIP_CHILDREN); ! m_treeSplitter->SetSashSize(2); - m_treeControl = new wxRemotelyScrolledTreeCtrl(m_treeSplitter, - ID_WXLUA_STACKDIALOG_STACKTREE, - wxDefaultPosition, wxDefaultSize, - wxTR_HAS_BUTTONS | wxTR_NO_LINES | wxNO_BORDER | wxTR_ROW_LINES); // | wxTR_HIDE_ROOT ); m_imageList = new wxImageList(16, 16, true); m_imageList->Add(wxArtProvider::GetIcon(wxART_FOLDER, wxART_TOOLBAR, wxSize(16,16))); m_imageList->Add(wxArtProvider::GetIcon(wxART_NORMAL_FILE, wxART_TOOLBAR, wxSize(16,16))); ! m_treeControl->SetImageList(m_imageList); ! ! m_valueSplitter = new wxThinSplitterWindow(m_treeSplitter, ! ID_WXLUA_STACKDIALOG_VALUE_SPLITWIN, ! wxDefaultPosition, wxDefaultSize, ! wxSP_NOBORDER | wxCLIP_CHILDREN); ! m_valueSplitter->SetSashSize(2); ! ! m_firstValueWindow = new wxLuaStackDataWindow(m_valueSplitter, ! ID_WXLUA_STACKDIALOG_VALUE_WIN1, ! wxDefaultPosition, wxDefaultSize, ! wxNO_BORDER); ! m_secondValueWindow = new wxLuaStackDataWindow(m_valueSplitter, ! ID_WXLUA_STACKDIALOG_VALUE_WIN2, ! wxDefaultPosition, wxDefaultSize, ! wxNO_BORDER, false); ! ! m_treeSplitter->SplitVertically(m_treeControl, m_valueSplitter); ! m_treeSplitter->SetSashPosition(200); ! m_treeSplitter->SetMinimumPaneSize(10); ! ! m_valueSplitter->SplitVertically(m_firstValueWindow, m_secondValueWindow); ! m_valueSplitter->SetSashPosition(125); ! m_valueSplitter->SetMinimumPaneSize(10); ! ! m_scrolledWindow->SetTargetWindow(m_treeControl); ! m_scrolledWindow->EnableScrolling(false, false); ! ! // Let the two controls know about each other ! m_firstValueWindow->SetTreeCtrl(m_treeControl); ! m_secondValueWindow->SetTreeCtrl(m_treeControl); ! m_treeControl->SetCompanionWindows(m_firstValueWindow, m_secondValueWindow); // set the frame icon --- 69,89 ---- wxCB_DROPDOWN | wxCB_READONLY); ! m_listCtrl = new wxListCtrl( panel, ID_WXLUA_STACKDIALOG_LISTCTRL, ! wxDefaultPosition, wxDefaultSize, ! wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_HRULES|wxLC_VRULES ); ! m_listCtrl->InsertColumn(0, wxT("Name"), wxLIST_FORMAT_LEFT, -1); ! m_listCtrl->InsertColumn(1, wxT("Type"), wxLIST_FORMAT_LEFT, -1); ! m_listCtrl->InsertColumn(2, wxT("Value"), wxLIST_FORMAT_LEFT, -1); ! ! m_listCtrl->SetColumnWidth(0, 250); ! m_listCtrl->SetColumnWidth(1, 100); ! m_listCtrl->SetColumnWidth(2, 100); m_imageList = new wxImageList(16, 16, true); m_imageList->Add(wxArtProvider::GetIcon(wxART_FOLDER, wxART_TOOLBAR, wxSize(16,16))); + m_imageList->Add(wxArtProvider::GetIcon(wxART_NEW_DIR, wxART_TOOLBAR, wxSize(16,16))); m_imageList->Add(wxArtProvider::GetIcon(wxART_NORMAL_FILE, wxART_TOOLBAR, wxSize(16,16))); ! m_listCtrl->SetImageList(m_imageList, wxIMAGE_LIST_SMALL); // set the frame icon *************** *** 130,134 **** wxBoxSizer* rootSizer = new wxBoxSizer(wxVERTICAL); rootSizer->Add(m_stackComboBox, 0, wxEXPAND|wxBOTTOM, 4); ! rootSizer->Add(m_scrolledWindow, 1, wxEXPAND); rootSizer->SetMinSize(450, 400); panel->SetSizer(rootSizer); --- 93,97 ---- wxBoxSizer* rootSizer = new wxBoxSizer(wxVERTICAL); rootSizer->Add(m_stackComboBox, 0, wxEXPAND|wxBOTTOM, 4); ! rootSizer->Add(m_listCtrl, 1, wxEXPAND); rootSizer->SetMinSize(450, 400); panel->SetSizer(rootSizer); *************** *** 142,146 **** wxLuaStackDialog::~wxLuaStackDialog() { ! if (m_treeControl) m_treeControl->SetImageList(NULL); delete m_imageList; --- 105,111 ---- wxLuaStackDialog::~wxLuaStackDialog() { ! DeleteAllListItemData(); ! ! if (m_listCtrl) m_listCtrl->SetImageList(NULL, wxIMAGE_LIST_SMALL); delete m_imageList; *************** *** 169,173 **** FillStackEntry(nEntry, debugData); } ! void wxLuaStackDialog::EnumerateTable(int nRef, int nEntry, const wxTreeItemId& treeId) { wxCHECK_RET(m_wxlState.Ok(), wxT("Invalid wxLuaState")); --- 134,138 ---- FillStackEntry(nEntry, debugData); } ! void wxLuaStackDialog::EnumerateTable(int nRef, int nEntry, long lc_item) { wxCHECK_RET(m_wxlState.Ok(), wxT("Invalid wxLuaState")); *************** *** 175,181 **** wxLuaDebugData debugData; debugData.EnumerateTable(m_wxlState, nRef, nEntry, m_luaReferences); ! FillTableEntry(treeId, debugData); } ! void wxLuaStackDialog::EnumerateGlobalData(const wxTreeItemId& treeId) { wxCHECK_RET(m_wxlState.Ok(), wxT("Invalid wxLuaState")); --- 140,146 ---- wxLuaDebugData debugData; debugData.EnumerateTable(m_wxlState, nRef, nEntry, m_luaReferences); ! FillTableEntry(lc_item, debugData); } ! void wxLuaStackDialog::EnumerateGlobalData(long lc_item) { wxCHECK_RET(m_wxlState.Ok(), wxT("Invalid wxLuaState")); *************** *** 183,187 **** wxLuaDebugData debugData; debugData.EnumerateTable(m_wxlState, -1, -1, m_luaReferences); // Get global table ! FillTableEntry(treeId, debugData); } --- 148,152 ---- wxLuaDebugData debugData; debugData.EnumerateTable(m_wxlState, -1, -1, m_luaReferences); // Get global table ! FillTableEntry(lc_item, debugData); } *************** *** 208,214 **** void wxLuaStackDialog::FillStackEntry(int WXUNUSED(nEntry), const wxLuaDebugData& debugData) { ! m_treeControl->DeleteAllItems(); ! wxTreeItemId rootItem = m_treeControl->AddRoot(_("Locals"), -1, -1); ! m_treeControl->AdjustRemoteScrollbars(); if (debugData.GetCount() > 0u) --- 173,180 ---- void wxLuaStackDialog::FillStackEntry(int WXUNUSED(nEntry), const wxLuaDebugData& debugData) { ! DeleteAllListItemData(); ! m_listCtrl->DeleteAllItems(); ! ! long rootItem = m_listCtrl->InsertItem(0, _("Locals"), 0); if (debugData.GetCount() > 0u) *************** *** 217,257 **** // If at global scope, process globals if (m_stack_sel == (int)m_stackEntries.GetCount() - 1) ! { ! EnumerateGlobalData(rootItem); ! ! if (m_wxlState.Ok()) ! GetDerivedAndTrackedItems(m_treeControl, rootItem); ! } ! m_treeControl->Expand(rootItem); //not if wxTR_HIDE_ROOT } ! void wxLuaStackDialog::FillTableEntry(wxTreeItemId treeId, const wxLuaDebugData& debugData) { if (debugData.GetCount() == 0) ! m_treeControl->SetItemHasChildren(treeId, false); else { size_t n, count = debugData.GetCount(); for (n = 0; n < count; ++n) { const wxLuaDebugDataItem *item = debugData.Item(n); ! int nOffset = (item->GetReference() != LUA_NOREF) ? 0 : 1; ! wxTreeItemId treeNode = m_treeControl->AppendItem(treeId, ! item->GetName(), ! nOffset, ! nOffset, ! new wxLuaDebugDataItem(*item)); if (item->GetReference() != LUA_NOREF) ! m_treeControl->SetItemHasChildren(treeNode); } } - - //if (treeId != m_treeControl->GetRootItem()) not if wxTR_HIDE_ROOT - m_treeControl->Expand(treeId); } ! void wxLuaStackDialog::GetDerivedAndTrackedItems(wxRemotelyScrolledTreeCtrl *treeControl, const wxTreeItemId& rootItem) { wxLuaState wxlState(m_wxlState); --- 183,237 ---- // If at global scope, process globals if (m_stack_sel == (int)m_stackEntries.GetCount() - 1) ! EnumerateGlobalData(m_listCtrl->GetItemCount()); ! if (m_wxlState.Ok()) ! GetDerivedAndTrackedItems(); } ! void wxLuaStackDialog::FillTableEntry(long lc_item_, const wxLuaDebugData& debugData) { + wxCHECK_RET(lc_item_ <= m_listCtrl->GetItemCount(), wxT("Attempting to add list item past end")); + if (debugData.GetCount() == 0) ! return; //m_treeControl->SetItemHasChildren(treeId, false); else { + wxString levelStr; + + // If less than the count we're expanding a item, else adding a new root + if (lc_item_ < m_listCtrl->GetItemCount()) + { + wxString levelText(m_listCtrl->GetItemText(lc_item_).BeforeLast(wxT(' '))); + levelStr = levelText + wxT("--> "); + } + else + lc_item_--; + size_t n, count = debugData.GetCount(); + long lc_item = lc_item_; for (n = 0; n < count; ++n) { const wxLuaDebugDataItem *item = debugData.Item(n); ! //wxPrintf(wxT("FillTableEntry %ld %ld n %d %ld '%s'\n"), lc_item_, lc_item, n, (long)item, item->GetName().c_str()); ! wxListItem info; ! info.SetId(lc_item+1); ! info.SetText(levelStr + item->GetName()); ! info.SetData(new wxLuaDebugDataItem(*item)); if (item->GetReference() != LUA_NOREF) ! info.SetImage(0); ! else ! info.SetImage(2); ! ! lc_item = m_listCtrl->InsertItem(info); ! info.SetId(lc_item); ! ! m_listCtrl->SetItem(lc_item, 1, item->GetType()); ! m_listCtrl->SetItem(lc_item, 2, item->GetValue()); } } } ! void wxLuaStackDialog::GetDerivedAndTrackedItems() { wxLuaState wxlState(m_wxlState); *************** *** 263,280 **** int destroyCount = wxlState.GetTrackedWinDestroyCallbackList()->GetCount(); ! wxLuaDebugDataItem* trackedItem = new wxLuaDebugDataItem(_("Tracked List"), wxT("wxLuaData"), wxString::Format(wxT("%d"), trackedCount), wxT(""), LUA_NOREF, 0); ! wxLuaDebugDataItem* callbackItem = new wxLuaDebugDataItem(_("Event Callback List"), wxT("wxLuaData"), wxString::Format(wxT("%d"), callbackCount), wxT(""), LUA_NOREF, 0); ! wxLuaDebugDataItem* windowItem = new wxLuaDebugDataItem(_("wxWindow List"), wxT("wxLuaData"), wxString::Format(wxT("%d"), windowCount), wxT(""), LUA_NOREF, 0); ! wxLuaDebugDataItem* destroyItem = new wxLuaDebugDataItem(_("wxWindow Destroy Callback List"), wxT("wxLuaData"), wxString::Format(wxT("%d"), destroyCount), wxT(""), LUA_NOREF, 0); ! wxTreeItemId treeNode; ! treeNode = treeControl->AppendItem(rootItem, wxT("Tracked List"), 1, 1, trackedItem); ! if (trackedCount > 0) m_treeControl->SetItemHasChildren(treeNode); ! treeNode = treeControl->AppendItem(rootItem, wxT("Event Callback List"), 1, 1, callbackItem); ! if (callbackCount > 0) m_treeControl->SetItemHasChildren(treeNode); ! treeNode = treeControl->AppendItem(rootItem, wxT("wxWindow List"), 1, 1, windowItem); ! if (windowCount > 0) m_treeControl->SetItemHasChildren(treeNode); ! treeNode = treeControl->AppendItem(rootItem, wxT("wxWindow Destroy List"), 1, 1, destroyItem); } --- 243,271 ---- int destroyCount = wxlState.GetTrackedWinDestroyCallbackList()->GetCount(); ! // note: don't have spaces here since we use them to mark expanded levels ! wxLuaDebugDataItem* trackedItem = new wxLuaDebugDataItem(_("Tracked_List"), wxT("wxLuaData"), wxString::Format(wxT("Count %d"), trackedCount), wxT(""), 1, 0); ! wxLuaDebugDataItem* callbackItem = new wxLuaDebugDataItem(_("Event_Callback_List"), wxT("wxLuaData"), wxString::Format(wxT("Count %d"), callbackCount), wxT(""), 1, 0); ! wxLuaDebugDataItem* windowItem = new wxLuaDebugDataItem(_("Top_Level_wxWindow_List"), wxT("wxLuaData"), wxString::Format(wxT("Count %d"), windowCount), wxT(""), 1, 0); ! wxLuaDebugDataItem* destroyItem = new wxLuaDebugDataItem(_("wxWindow_Destroy_List"), wxT("wxLuaData"), wxString::Format(wxT("Count %d"), destroyCount), wxT(""), 1, 0); ! wxLuaDebugData dataArr; // this deletes the items ! dataArr.Add(trackedItem); ! dataArr.Add(callbackItem); ! dataArr.Add(windowItem); ! dataArr.Add(destroyItem); ! FillTableEntry(m_listCtrl->GetItemCount(), dataArr); ! } ! ! void wxLuaStackDialog::OnItemDeleted(wxListEvent &event) ! { ! wxLuaDebugDataItem* wxlDItem = (wxLuaDebugDataItem*)event.GetData(); ! if (wxlDItem != NULL) ! delete wxlDItem; ! } ! void wxLuaStackDialog::OnAllItemsDeleted(wxListEvent &event) ! { ! DeleteAllListItemData(); ! event.Skip(); } *************** *** 293,321 **** } ! void wxLuaStackDialog::OnItemExpanding(wxTreeEvent &event) { ! ItemExpanding(event.GetItem()); } ! void wxLuaStackDialog::ItemExpanding(const wxTreeItemId &itemNode) { ! if (itemNode) { ! wxLuaDebugDataItem *pDebugDataItem = (wxLuaDebugDataItem *)m_treeControl->GetItemData(itemNode); if ((pDebugDataItem != NULL) && !pDebugDataItem->IsExpanded()) { ! pDebugDataItem->SetExpanded(true); ! ! int nRef = pDebugDataItem->GetReference(); ! if (nRef != LUA_NOREF) { ! int nIndex = pDebugDataItem->GetIndex() + 1; ! EnumerateTable(nRef, nIndex, itemNode); } ! else if (m_wxlState.Ok() && ! ((pDebugDataItem->GetName() == _("Tracked List")) || ! (pDebugDataItem->GetName() == _("Event Callback List")) || ! (pDebugDataItem->GetName() == _("wxWindow List")))) { wxLuaState wxlState(m_wxlState); --- 284,330 ---- } ! void wxLuaStackDialog::OnItemActivated(wxListEvent &event) { ! ItemExpanding(event.GetIndex()); //.GetIndex()); } ! void wxLuaStackDialog::ItemExpanding(long lc_item) { ! if (1) { ! wxLuaDebugDataItem *pDebugDataItem = (wxLuaDebugDataItem *)m_listCtrl->GetItemData(lc_item); ! ! // only expand items once if ((pDebugDataItem != NULL) && !pDebugDataItem->IsExpanded()) { ! // Check and block linked tables already shown ! if (pDebugDataItem->GetType() == wxT("Table")) { ! wxString val = pDebugDataItem->GetValue(); ! int n, count = m_listCtrl->GetItemCount(); ! for (n = 0; n < count; n++) ! { ! wxLuaDebugDataItem *itm = (wxLuaDebugDataItem *)m_listCtrl->GetItemData(n); ! if (itm && (itm != pDebugDataItem) && (itm->GetValue() == val) && itm->IsExpanded()) ! { ! wxMessageBox(wxT("Cannot expand linked tables,\nplease see the already expanded table."), ! wxT("wxLua Stack"), ! wxOK | wxCENTRE, this); ! ! m_listCtrl->SetItemState(n, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); ! m_listCtrl->SetItemState(n, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); ! m_listCtrl->EnsureVisible(n); ! return; ! } ! } } ! ! int nRef = pDebugDataItem->GetReference(); ! if (m_wxlState.Ok() && ! ((pDebugDataItem->GetName() == _("Tracked_List")) || ! (pDebugDataItem->GetName() == _("Event_Callback_List")) || ! (pDebugDataItem->GetName() == _("Top_Level_wxWindow_List")) || ! (pDebugDataItem->GetName() == _("wxWindow_Destroy_List")))) { wxLuaState wxlState(m_wxlState); *************** *** 324,328 **** wxArrayInt counts; ! if (pDebugDataItem->GetName() == _("Tracked List")) { wxLongToLongHashMap::iterator it; --- 333,337 ---- wxArrayInt counts; ! if (pDebugDataItem->GetName() == _("Tracked_List")) { wxLongToLongHashMap::iterator it; *************** *** 349,353 **** } } ! else if (pDebugDataItem->GetName() == _("Event Callback List")) { wxList::compatibility_iterator node = wxlState.GetTrackedCallbackList()->GetFirst(); --- 358,362 ---- } } ! else if (pDebugDataItem->GetName() == _("Event_Callback_List")) { wxList::compatibility_iterator node = wxlState.GetTrackedCallbackList()->GetFirst(); *************** *** 382,386 **** } } ! else { wxWindowList::compatibility_iterator node = wxlState.GetLuaStateData()->m_windowList.GetFirst(); --- 391,395 ---- } } ! else if (pDebugDataItem->GetName() == _("Top_Level_wxWindow_List")) { wxWindowList::compatibility_iterator node = wxlState.GetLuaStateData()->m_windowList.GetFirst(); *************** *** 405,408 **** --- 414,440 ---- } } + else if (pDebugDataItem->GetName() == _("wxWindow_Destroy_List")) + { + wxList::compatibility_iterator node = wxlState.GetTrackedWinDestroyCallbackList()->GetFirst(); + while (node) + { + wxLuaWinDestroyCallback *pCallback = (wxLuaWinDestroyCallback *) node->GetData(); + wxCHECK_RET(pCallback, wxT("Invalid wxLuaWinDestroyCallback")); + + wxString name(wxT("Unknown Tracked Window Type")); + + wxObject* obj = (wxObject*)pCallback->GetEvtHandler(); + if (obj && obj->GetClassInfo() && obj->GetClassInfo()->GetClassName()) + name = obj->GetClassInfo()->GetClassName(); + + names.Add(name); + counts.Add(1); + + node = node->GetNext(); + } + } + + pDebugDataItem->SetExpanded(true); + m_listCtrl->SetItemImage(lc_item, 1); wxLuaDebugData dataArr; *************** *** 414,418 **** } ! FillTableEntry(itemNode, dataArr); } } --- 446,458 ---- } ! FillTableEntry(lc_item, dataArr); ! } ! else if (nRef != LUA_NOREF) ! { ! pDebugDataItem->SetExpanded(true); ! m_listCtrl->SetItemImage(lc_item, 1); ! ! int nIndex = pDebugDataItem->GetIndex() + 1; ! EnumerateTable(nRef, nIndex, lc_item); } } *************** *** 420,462 **** } ! // ---------------------------------------------------------------------------- ! // wxLuaStackDataWindow ! // ---------------------------------------------------------------------------- ! IMPLEMENT_ABSTRACT_CLASS(wxLuaStackDataWindow, wxTreeCompanionWindow) ! ! wxLuaStackDataWindow::wxLuaStackDataWindow(wxWindow *parent, wxWindowID id, ! const wxPoint &pos, const wxSize &sz, ! long style, bool first_window) ! :wxTreeCompanionWindow(parent, id, pos, sz, style), m_first_window(first_window) ! { ! m_text_height = 0; ! SetBackgroundColour(*wxWHITE); ! } ! ! void wxLuaStackDataWindow::DrawItem(wxDC &dc, wxTreeItemId id, const wxRect &rect) { ! if (!m_treeControl) return; ! ! wxLuaDebugDataItem *itemData = (wxLuaDebugDataItem *)m_treeControl->GetItemData(id); ! ! if (itemData != NULL) { ! dc.SetTextForeground(*wxBLACK); ! dc.SetBackgroundMode(wxTRANSPARENT); ! ! wxString txt(m_first_window ? itemData->GetType() : itemData->GetValue()); ! ! if (m_text_height == 0) ! { ! int text_width = 0; ! dc.GetTextExtent(wxT("1234ABCDEabcdejZ"), &text_width, &m_text_height); ! } ! ! int x = 5; ! int y = (rect.GetHeight() - m_text_height) / 2; // try to center it, else pin to top ! ! y = rect.GetY() + wxMax(0, y); ! ! dc.DrawText(txt, x, y); } } --- 460,471 ---- } ! void wxLuaStackDialog::DeleteAllListItemData() { ! int i, count = m_listCtrl->GetItemCount(); ! for (i = 0; i < count; i++) { ! wxLuaDebugDataItem* wxlDItem = (wxLuaDebugDataItem*)m_listCtrl->GetItemData(i); ! if (wxlDItem != NULL) ! delete wxlDItem; } } |