From 5ebe31a1235e4e4545af319ae682bce8eb642ffa Mon Sep 17 00:00:00 2001 From: hyatt Date: Tue, 30 Jun 1998 01:37:13 +0000 Subject: [PATCH] More improvements to the tree view, plus a bug fix for composer's bookmarks menu. git-svn-id: svn://10.0.0.236/branches/RDF_BRANCH_060398@4691 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/cmd/winfe/framinit.cpp | 41 +++++++++++++++++++++------------- mozilla/cmd/winfe/outliner.cpp | 18 +++++++++++++++ mozilla/cmd/winfe/outliner.h | 2 ++ mozilla/cmd/winfe/rdfliner.cpp | 23 +++++++++++++++---- mozilla/cmd/winfe/rdfliner.h | 9 ++++++-- 5 files changed, 71 insertions(+), 22 deletions(-) diff --git a/mozilla/cmd/winfe/framinit.cpp b/mozilla/cmd/winfe/framinit.cpp index c1fe8b8224f..f0db63c559c 100755 --- a/mozilla/cmd/winfe/framinit.cpp +++ b/mozilla/cmd/winfe/framinit.cpp @@ -260,6 +260,21 @@ int colorCubeSize = 216; #define TEXT_WIDTH 49 #endif +// The Event Handler for the top-level bookmarks menu in a frame. +static void qfNotifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened) +{ + if (whatHappened == HT_EVENT_NODE_OPENCLOSE_CHANGED) + { + // The node was opened. + PRBool openState; + HT_GetOpenState(n, &openState); + if (openState) + { + CGenericFrame* pFrame = (CGenericFrame*)ns->data; + pFrame->FinishMenuExpansion(n); + } + } +} int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { @@ -276,6 +291,16 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) pIStatusBar->Create( this ); pIStatusBar->Release(); } + + if (!theApp.m_bInGetCriticalFiles) + { + // Get the top level menu going. + // Construct the notification struct used by HT + HT_Notification ns = new HT_NotificationStruct; + ns->notifyProc = qfNotifyProcedure; + ns->data = this; + m_BookmarkMenuPane = theApp.m_bInGetCriticalFiles ? NULL : HT_NewQuickFilePane(ns); + } } else { LPNSSTATUSBAR pIStatusBar = NULL; @@ -472,22 +497,6 @@ int CMainFrame::CreateMainToolbar(void) return TRUE; } -// The Event Handler for the top-level bookmarks menu in a frame. -static void qfNotifyProcedure (HT_Notification ns, HT_Resource n, HT_Event whatHappened) -{ - if (whatHappened == HT_EVENT_NODE_OPENCLOSE_CHANGED) - { - // The node was opened. - PRBool openState; - HT_GetOpenState(n, &openState); - if (openState) - { - CGenericFrame* pFrame = (CGenericFrame*)ns->data; - pFrame->FinishMenuExpansion(n); - } - } -} - void CMainFrame::BeginStreamingOfRDFToolbars() { GetChrome()->CreateRDFToolbar("Browser", 5, TRUE); diff --git a/mozilla/cmd/winfe/outliner.cpp b/mozilla/cmd/winfe/outliner.cpp index 6c98576b76f..4f6d132bfae 100644 --- a/mozilla/cmd/winfe/outliner.cpp +++ b/mozilla/cmd/winfe/outliner.cpp @@ -230,6 +230,24 @@ COutliner::~COutliner ( ) delete m_pTip; } +void COutliner::DestroyColumns() +{ + if ( m_pColumn ) + { + while ( m_iNumColumns ) + { + if (m_pColumn[ m_iNumColumns - 1]->pHeader) + free((char*)m_pColumn[ m_iNumColumns - 1]->pHeader); + delete(m_pColumn[ m_iNumColumns - 1 ]); + m_iNumColumns--; + } + free(m_pColumn); + m_pColumn = NULL; + } + + m_iNumColumns = 0; +} + STDMETHODIMP COutliner::QueryInterface( REFIID refiid, LPVOID * ppv) diff --git a/mozilla/cmd/winfe/outliner.h b/mozilla/cmd/winfe/outliner.h index 8896c24fb5a..b659c894ab3 100644 --- a/mozilla/cmd/winfe/outliner.h +++ b/mozilla/cmd/winfe/outliner.h @@ -310,6 +310,8 @@ public: virtual void SetTotalLines( int ); virtual int GetTotalLines(); + virtual void DestroyColumns(); + protected: // diff --git a/mozilla/cmd/winfe/rdfliner.cpp b/mozilla/cmd/winfe/rdfliner.cpp index 6f66db761bc..0c89a1e96cc 100644 --- a/mozilla/cmd/winfe/rdfliner.cpp +++ b/mozilla/cmd/winfe/rdfliner.cpp @@ -992,6 +992,16 @@ void CRDFOutliner::OnSelDblClk(int iLine) } } +void CRDFOutliner::SetHTView(HT_View v) +{ + m_Pane = HT_GetPane(v); + m_View = v; + m_iSelection = m_iFocus = -1; + int newCount = HT_GetItemListCount(m_View); + SetTotalLines(newCount); // Update the outliner's visible lines + m_iTopLine = 0; +} + void CRDFOutliner::DisplayURL() { char* url = HT_GetNodeURL(m_Node); @@ -2538,6 +2548,12 @@ void CRDFOutliner::ColumnsSwapped() SetImageColumn(m_pColumn[0]->iCommand); } +void CRDFOutliner::DestroyColumns() +{ + m_Parent->DestroyColumns(); + COutliner::DestroyColumns(); +} + CRect CRDFOutliner::GetColumnRect(int iLine, int column) { CRect rectColumn; @@ -3643,7 +3659,7 @@ void CRDFOutlinerParent::CreateColumns ( void ) } HT_DeleteColumnCursor(columnCursor); m_pOutliner->SetVisibleColumns(1); // For now... TODO: Get visible/invisible info! - m_pOutliner->SetImageColumn(0); + m_pOutliner->SetImageColumn(m_pOutliner->m_pColumn[0]->iCommand); // Make it so RECT rcClient; @@ -3722,9 +3738,7 @@ BOOL CRDFOutlinerParent::ColumnCommand( int iColumn ) if (enSortType == HT_SORT_ASCENDING) sort = FALSE; - pOutliner->SetSelectedColumn(pOutliner->m_pColumn[ iColumn ]->iCommand); - - Invalidate(); + pOutliner->SetSelectedColumn(iColumn); HT_SetSortColumn(pOutliner->GetHTView(), enSortType == HT_NO_SORT ? NULL : theColumn->GetToken(), @@ -3860,6 +3874,7 @@ void CRDFContentView::OnSetFocus ( CWnd * pOldWnd ) void CRDFContentView::SwitchHTViews(HT_View newView) { m_pOutlinerParent->SetHTView(newView); + m_pOutlinerParent->GetOutliner()->DestroyColumns(); CreateColumns(); } diff --git a/mozilla/cmd/winfe/rdfliner.h b/mozilla/cmd/winfe/rdfliner.h index ebf67075085..0091f954e9e 100644 --- a/mozilla/cmd/winfe/rdfliner.h +++ b/mozilla/cmd/winfe/rdfliner.h @@ -139,8 +139,8 @@ public: int GetSortColumn() { return m_nSortColumn; } int GetSortType() { return m_nSortType; } - void SetHTView(HT_View v) { m_Pane = HT_GetPane(v); m_View = v; } - + void SetHTView(HT_View v); + // Setters void SetSortType(int sortType) { m_nSortType = sortType; } void SetSortColumn(int sortColumn) { m_nSortColumn = sortColumn; } @@ -151,6 +151,9 @@ public: // overridden. That is, unless I state otherwise, all virtual functions // are overridden versions of COutliner functions. + virtual void DestroyColumns(); + // Overridden to destroy the outliner's columns and clear our RDF column command map. + virtual void InitializeItemHeight(int iDesiredSize) { m_itemHeight = 19; } // Overridden to place a pixel of padding on either side of the line and to add a pixel for the // divider that is drawn between lines. @@ -379,6 +382,8 @@ public: BOOL PreCreateWindow(CREATESTRUCT& cs); COutliner* GetOutliner(); void CreateColumns(); + void DestroyColumns() { columnMap.Clear(); } + BOOL RenderData( int iColumn, CRect & rect, CDC &dc, LPCTSTR text ); BOOL ColumnCommand( int iColumn ); void Initialize();