Support for templates added to SHACK. More properties added to front end.

This commit is contained in:
hyatt%netscape.com 1998-09-22 00:24:26 +00:00
Родитель 65cab71175
Коммит 9594fd2d58
6 изменённых файлов: 288 добавлений и 267 удалений

Просмотреть файл

@ -1572,10 +1572,12 @@ void CPaneCX::DisplayBuiltin(MWContext *pContext, int iLocation, LO_BuiltinStruc
char* url = LO_GetBuiltInAttribute(pBuiltin_struct, "data");
char* target = LO_GetBuiltInAttribute(pBuiltin_struct, "target");
if (pBuiltin_struct->FE_Data == NULL ){
char* templateType = LO_GetBuiltInAttribute(pBuiltin_struct, "template");
#ifdef OJI
CRDFContentView* pWnd = CRDFContentView::DisplayRDFTreeFromSHACK(pContext, cWnd, xPos, yPos, width, height, url == NULL ? "" :url , pBuiltin_struct->attributes.n, pBuiltin_struct->attributes.names, pBuiltin_struct->attributes.values);
CRDFContentView* pWnd = CRDFContentView::DisplayRDFTreeFromSHACK(pContext, cWnd, xPos, yPos, width, height, url == NULL ? "" :url , templateType, pBuiltin_struct->attributes.n, pBuiltin_struct->attributes.names, pBuiltin_struct->attributes.values);
#else
CRDFContentView* pWnd = CRDFContentView::DisplayRDFTreeFromSHACK(pContext, cWnd, xPos, yPos, width, height, url == NULL ? "" :url , pBuiltin_struct->attribute_cnt, pBuiltin_struct->attribute_list, pBuiltin_struct->value_list);
CRDFContentView* pWnd = CRDFContentView::DisplayRDFTreeFromSHACK(pContext, cWnd, xPos, yPos, width, height, url == NULL ? "" :url , templateType, pBuiltin_struct->attribute_cnt, pBuiltin_struct->attribute_list, pBuiltin_struct->value_list);
#endif
((CRDFOutliner*)pWnd->GetOutlinerParent()->GetOutliner())->SetWindowTarget(target);
pBuiltin_struct->FE_Data = pWnd;

Просмотреть файл

@ -131,8 +131,36 @@ void CNavTitleBar::OnPaint( )
CRect controlStripRect(rect);
CRect titleBarRect(rect);
controlStripRect.top = NAVBAR_TOTAL_HEIGHT - NAVBAR_CONTROLSTRIP_HEIGHT;
controlStripRect.bottom = NAVBAR_TOTAL_HEIGHT;
int navBarTotalHeight = 0;
int navBarControlStripHeight = 0;
int navBarTitleBarHeight = 0;
HT_GetTemplateData(topNode, gNavCenter->showTitleBar, HT_COLUMN_STRING, &data);
if (data)
{
CString answer((char*)data);
if (answer.GetLength() > 0 && (answer.GetAt(0) == 'Y' || answer.GetAt(0) == 'y'))
{
navBarTotalHeight += NAVBAR_TITLEBAR_HEIGHT;
navBarTitleBarHeight += NAVBAR_TITLEBAR_HEIGHT;
}
}
// Whether or not to show the control strip.
HT_GetTemplateData(topNode, gNavCenter->showControlStrip, HT_COLUMN_STRING, &data);
if (data)
{
CString answer((char*)data);
if (answer.GetLength() > 0 && (answer.GetAt(0) == 'Y' || answer.GetAt(0) == 'y'))
{
navBarTotalHeight += NAVBAR_CONTROLSTRIP_HEIGHT;
navBarControlStripHeight = NAVBAR_CONTROLSTRIP_HEIGHT;
}
}
controlStripRect.top = navBarTitleBarHeight;
controlStripRect.bottom = navBarTotalHeight;
titleBarRect.top = 0;
titleBarRect.bottom = controlStripRect.top;
@ -172,7 +200,8 @@ void CNavTitleBar::OnPaint( )
dc.FillRect(&controlStripRect, &controlStripFaceBrush);
}
if (navBarTitleBarHeight > 0)
{
// Draw the title strip text.
CString titleText(HT_GetNodeName(HT_TopNode(m_View)));
@ -210,6 +239,13 @@ void CNavTitleBar::OnPaint( )
oldColor = dc.SetTextColor(m_ForegroundColor);
CIntlWin::DrawText(CS_UTF8, dc.m_hDC, titleText.GetBuffer(0), -1, &sizeRect, nFormat);
dc.SetTextColor(oldColor);
dc.SetBkMode(nOldBkMode);
::SelectObject(dc.m_hDC, hOldFont);
}
if (navBarControlStripHeight > 0)
{
// Draw the control strip text.
CFont smallArialFont;
LOGFONT lf2;
@ -219,7 +255,7 @@ void CNavTitleBar::OnPaint( )
strcpy(lf2.lfFaceName, "Arial");
smallArialFont.CreatePointFontIndirect(&lf2, &dc);
HFONT smallFont = (HFONT)smallArialFont.GetSafeHandle();
::SelectObject(dc.m_hDC, smallFont);
HFONT hOldFont = (HFONT)::SelectObject(dc.m_hDC, smallFont);
// The ADD button
CString addText("Add Page"); // Will use an extensible HT mechanism eventually. Hardcode for now.
@ -276,7 +312,6 @@ void CNavTitleBar::OnPaint( )
cachedModeRect.bottom = controlStripRect.bottom;
cachedModeRect.right = cachedModeRect.left + modeRect.Width() + 3;
// Now compute the close box rect.
CString closeText("Close");
HT_GetTemplateData(topNode, gNavCenter->controlStripCloseText, HT_COLUMN_STRING, &data);
if (data)
@ -300,16 +335,34 @@ void CNavTitleBar::OnPaint( )
arrowRect.right = arrowRect.left + 12;
arrowRect.bottom = controlStripRect.bottom;
DrawArrow(dc.m_hDC, m_ControlStripForegroundColor, LEFT_ARROW, arrowRect, TRUE);
// Cache the rect
cachedCloseRect.top = controlStripRect.top;
cachedCloseRect.left = arrowRect.left;
cachedCloseRect.bottom = controlStripRect.bottom;
cachedCloseRect.right = closeRect.right + 3;
// Now compute the close box rect.
HT_Pane pane = HT_GetPane(HT_GetView(topNode));
if (HT_GetWindowType(pane) == HT_STANDALONE_WINDOW ||
HT_GetWindowType(pane) == HT_EMBEDDED_WINDOW)
{
// Don't allow the close box to exist.
cachedCloseRect.SetRect(0,0,0,0);
closeRect.SetRect(0,0,0,0);
arrowRect.SetRect(0,0,0,0);
}
if (HT_GetWindowType(pane) != HT_STANDALONE_WINDOW &&
HT_GetWindowType(pane) != HT_EMBEDDED_WINDOW)
DrawArrow(dc.m_hDC, m_ControlStripForegroundColor, LEFT_ARROW, arrowRect, TRUE);
// Draw the text
dc.SetTextColor(m_ControlStripForegroundColor);
int nOldBkMode = dc.SetBkMode(TRANSPARENT);
int oldColor = dc.SetTextColor(m_ControlStripForegroundColor);
UINT nFormat = DT_SINGLELINE | DT_VCENTER | DT_EXTERNALLEADING;
if (HT_GetWindowType(pane) != HT_STANDALONE_WINDOW &&
HT_GetWindowType(pane) != HT_EMBEDDED_WINDOW)
CIntlWin::DrawText(CS_UTF8, dc.m_hDC, closeText.GetBuffer(0), -1, &closeRect, nFormat);
CIntlWin::DrawText(CS_UTF8, dc.m_hDC, modeText.GetBuffer(0), -1, &modeRect, nFormat);
CIntlWin::DrawText(CS_UTF8, dc.m_hDC, addText.GetBuffer(0), -1, &addRect, nFormat);
@ -333,6 +386,7 @@ void CNavTitleBar::OnPaint( )
dc.SetTextColor(oldColor);
dc.SetBkMode(nOldBkMode);
::SelectObject(dc.m_hDC, hOldFont);
}
}
int CNavTitleBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
@ -491,3 +545,34 @@ void CNavTitleBar::OnTimer(UINT nIDEvent)
CWnd::OnTimer(nIDEvent);
}
int CNavTitleBar::GetHeightBasedOnProperties()
{
if (!m_View)
return 0;
HT_Resource topNode = HT_TopNode(m_View);
void* data;
PRBool foundData = FALSE;
// Whether or not to show the title bar.
int height = 0;
HT_GetTemplateData(topNode, gNavCenter->showTitleBar, HT_COLUMN_STRING, &data);
if (data)
{
CString answer((char*)data);
if (answer.GetLength() > 0 && (answer.GetAt(0) == 'Y' || answer.GetAt(0) == 'y'))
height += NAVBAR_TITLEBAR_HEIGHT;
}
// Whether or not to show the control strip.
HT_GetTemplateData(topNode, gNavCenter->showControlStrip, HT_COLUMN_STRING, &data);
if (data)
{
CString answer((char*)data);
if (answer.GetLength() > 0 && (answer.GetAt(0) == 'Y' || answer.GetAt(0) == 'y'))
height += NAVBAR_CONTROLSTRIP_HEIGHT;
}
return height;
}

Просмотреть файл

@ -1,88 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef NAVMENUBAR_H
#define NAVMENUBAR_H
#include "htrdf.h"
#include "usertlbr.h"
#define NAVBAR_CONTROLSTRIP_HEIGHT 18
#define NAVBAR_TITLEBAR_HEIGHT 23
#define NAVBAR_TOTAL_HEIGHT 41
#define NAVBAR_CLOSEBOX 16
class CNavTitleBar : public CWnd, public CCustomImageObject
{
BOOL m_bHasFocus; // Determines what colors to use for the caption (OBSOLETE)
CPoint m_PointHit; // MouseDown tracking
COLORREF m_ControlStripForegroundColor;
COLORREF m_ControlStripBackgroundColor;
CString m_ControlStripBackgroundImageURL;
CRDFImage* m_pControlStripBackgroundImage;
COLORREF m_ForegroundColor;
COLORREF m_BackgroundColor;
CString m_BackgroundImageURL;
CRDFImage* m_pBackgroundImage;
HT_View m_View; // The current HT_View.
BOOL m_bShowTitleText;
CRect cachedCloseRect;
CRect cachedAddRect;
CRect cachedModeRect;
BOOL m_bDrawCloseFrame;
BOOL m_bDrawModeFrame;
BOOL m_bDrawAddFrame;
UINT m_hFocusTimer;
public:
CNavTitleBar();
~CNavTitleBar();
void SetHTView(HT_View theView);
void NotifyFocus(BOOL hasFocus) { m_bHasFocus = hasFocus; Invalidate(); }
void LoadComplete(HT_Resource r) { Invalidate(); }
//{{AFX_MSG(CNavTitleBar)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code!
afx_msg void OnPaint();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnLButtonDown (UINT nFlags, CPoint point );
afx_msg void OnLButtonUp (UINT nFlags, CPoint point );
afx_msg void OnMouseMove (UINT nFlags, CPoint point );
afx_msg void OnSize( UINT nType, int cx, int cy );
afx_msg void OnTimer(UINT nIDEvent);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#define IDT_STRIPFOCUS 30000
#define STRIPFOCUS_DELAY_MS 10
#endif // NAVBAR_H

Просмотреть файл

@ -1052,13 +1052,18 @@ void CRDFOutliner::ToggleModes()
show = stricmp(answer, "No");
}
((CRDFOutlinerParent*)GetParent())->EnableHeaders(show);
CRDFOutlinerParent* pParent = (CRDFOutlinerParent*)GetParent();
pParent->EnableHeaders(show);
// Need to invalidate the title strip.
// Need to invalidate the title strip and figure out exactly how tall it is.
CRDFContentView* pView = (CRDFContentView*)(GetParent()->GetParent());
pView->GetTitleBar()->Invalidate();
Invalidate();
CRect parentRect;
pParent->GetClientRect(&parentRect);
int titleHeight = pView->GetTitleBar()->GetHeightBasedOnProperties();
pView->GetTitleBar()->MoveWindow(CRect(0, 0, parentRect.Width(), titleHeight));
pParent->MoveWindow(CRect(0, titleHeight, parentRect.Width(), parentRect.Height() - titleHeight));
}
void CRDFOutliner::OnSelDblClk(int iLine)
@ -1845,7 +1850,6 @@ void CRDFOutliner::OnPaint()
m_bDrawDividers = TRUE;
m_bUseSingleClick = FALSE;
m_bUseInlineEditing = TRUE;
m_bUseSelection = TRUE;
// Foreground color
HT_GetTemplateData(top, gNavCenter->viewFGColor, HT_COLUMN_STRING, &data);
@ -1912,14 +1916,6 @@ void CRDFOutliner::OnPaint()
m_bDrawDividers = FALSE;
}
HT_GetTemplateData(top, gNavCenter->useSelection, HT_COLUMN_STRING, &data);
if (data)
{
CString answer((char*)data);
if (answer.GetLength() > 0 && (answer.GetAt(0) == 'n' || answer.GetAt(0) == 'N'))
m_bUseSelection = FALSE;
}
HT_GetTemplateData(top, gNavCenter->useInlineEditing, HT_COLUMN_STRING, &data);
if (data)
{
@ -3862,15 +3858,37 @@ void CRDFOutlinerParent::CreateColumns ( void )
uint32 tokenType;
UINT index = 0;
int visibleCount = 0;
while (HT_GetNextColumn(columnCursor, &columnName, &columnWidth, &token, &tokenType))
{
// We have retrieved a new column. Contruct a front end column object
CRDFColumn* newColumn = new CRDFColumn(columnName, columnWidth, token, tokenType);
index = (UINT)columnMap.AddCommand(newColumn);
m_pOutliner->AddColumn(columnName, index, 50, 10000, ColumnVariable, 100);
PRBool visible = HT_GetColumnVisibility(theView, token, tokenType);
if (visible)
visibleCount++;
}
if (visibleCount == 0)
visibleCount++;
HT_DeleteColumnCursor(columnCursor);
m_pOutliner->SetVisibleColumns(1); // For now... TODO: Get visible/invisible info!
// If column headers aren't shown, assume only one visible column.
// Whether or not to show column headers
void* data;
HT_GetTemplateData(HT_TopNode(theView), gNavCenter->showColumnHeaders, HT_COLUMN_STRING, &data);
BOOL show = TRUE;
if (data)
{
char* answer = (char*)data;
show = stricmp(answer, "No");
}
if (!show)
visibleCount = 1;
m_pOutliner->SetVisibleColumns(visibleCount);
m_pOutliner->SetImageColumn(m_pOutliner->m_pColumn[0]->iCommand);
// Make it so
@ -4084,8 +4102,9 @@ void CRDFContentView::OnSize ( UINT nType, int cx, int cy )
CView::OnSize ( nType, cx, cy );
if (IsWindow(m_pOutlinerParent->m_hWnd))
{
m_pNavBar->MoveWindow(0,0, cx, NAVBAR_TOTAL_HEIGHT);
m_pOutlinerParent->MoveWindow ( 0, NAVBAR_TOTAL_HEIGHT, cx, cy-NAVBAR_TOTAL_HEIGHT);
int titleHeight = m_pNavBar->GetHeightBasedOnProperties();
m_pNavBar->MoveWindow(0,0, cx, titleHeight);
m_pOutlinerParent->MoveWindow ( 0, titleHeight, cx, cy-titleHeight);
}
}
@ -4163,7 +4182,9 @@ CRDFContentView* CRDFContentView::DisplayRDFTreeFromResource(CWnd* pParent,
return DisplayRDFTreeFromPane(pParent, xPos, yPos, width, height, thePane, pContext);
}
CRDFContentView* CRDFContentView::DisplayRDFTreeFromSHACK(MWContext *pContext, CWnd* pParent, int xPos, int yPos, int width, int height, char* url, int32 param_count, char** param_names, char** param_values)
CRDFContentView* CRDFContentView::DisplayRDFTreeFromSHACK(MWContext *pContext, CWnd* pParent,
int xPos, int yPos, int width, int height, char* url, char* templateType,
int32 param_count, char** param_names, char** param_values)
{
HT_Notification ns = new HT_NotificationStruct;
XP_BZERO(ns, sizeof(HT_NotificationStruct));
@ -4172,7 +4193,7 @@ CRDFContentView* CRDFContentView::DisplayRDFTreeFromSHACK(MWContext *pContext, C
theApp.m_pRDFCX->TrackRDFWindow(pParent);
// Construct the pane and give it our notification struct
HT_Pane thePane = HT_PaneFromURL(pContext, url, ns, 0, param_count, param_names, param_values);
HT_Pane thePane = HT_PaneFromURL(pContext, url, templateType, ns, 0, param_count, param_names, param_values);
// Now call our helper function
return DisplayRDFTreeFromPane(pParent, xPos, yPos, width, height, thePane);

Просмотреть файл

@ -455,7 +455,7 @@ public:
CNavTitleBar* GetTitleBar() { return m_pNavBar; }
static CRDFContentView* DisplayRDFTreeFromSHACK(MWContext *pContext, CWnd* pParent, int xPos, int yPos, int width,
int height, char* url, int32 param_count, char** param_names, char** param_values);
int height, char* url, char* templateType, int32 param_count, char** param_names, char** param_values);
// This function can be called to create an embedded RDF tree view using an
// external URL and specified targeting.

Просмотреть файл

@ -1516,9 +1516,10 @@ CRDFToolbar* CRDFToolbar::CreateUserToolbar(HT_View theView, CWnd* pParent)
char *data;
HT_GetTemplateData(HT_TopNode(theView), gNavCenter->toolbarDisplayMode, HT_COLUMN_STRING,
(void **)&data);
int style = StyleFromHTDescriptor(data);
if (style < 0)
style = theApp.m_pToolbarStyle;
int style = theApp.m_pToolbarStyle;
if (data)
style = StyleFromHTDescriptor(data);
CRDFToolbar* pToolbar = new CRDFToolbar(theView, MAX_TOOLBAR_BUTTONS, style, 43, 27, 27);