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
This commit is contained in:
hyatt
1998-06-30 01:37:13 +00:00
parent 3c050c01d6
commit 5ebe31a123
5 changed files with 71 additions and 22 deletions

View File

@@ -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);

View File

@@ -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)

View File

@@ -310,6 +310,8 @@ public:
virtual void SetTotalLines( int );
virtual int GetTotalLines();
virtual void DestroyColumns();
protected:
//

View File

@@ -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();
}

View File

@@ -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();