This commit is contained in:
slamm%netscape.com 1998-08-26 18:35:01 +00:00
Родитель 7c94532e77
Коммит 431caf2a17
4 изменённых файлов: 83 добавлений и 262 удалений

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

@ -164,7 +164,7 @@ XFE_RDFTreeView::XFE_RDFTreeView(XFE_Component * toplevel,
XFE_View * parent_view,
MWContext * context) :
XFE_View(toplevel, parent_view, context),
_ht_rdfView(NULL),
XFE_RDFBase(),
_popup(NULL),
_standAloneState(False),
_isCellEditable(False)
@ -266,31 +266,11 @@ XFE_RDFTreeView::init_pixmaps(void)
void
XFE_RDFTreeView::activate_row(int row)
{
HT_Resource node = HT_GetNthItem(_ht_rdfView, row);
HT_Resource node = HT_GetNthItem(_ht_view, row);
if (!node) return;
#if 0
if (data->ctrl)
{
HT_ToggleSelection(node);
m_outliner->toggleSelected(data->row);
}
else if (data->shift)
{
HT_SetSelectionRange(node, m_node);
m_outliner->trimOrExpandSelection(data->row);
}
else
{
HT_SetSelection(node);
m_outliner->selectItemExclusive(data->row);
}
getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating);
#endif /*0*/
if (!HT_IsContainer(node)) {
if (!HT_IsContainer(node) && !HT_IsSeparator(node)) {
// Dispatch in new window
char *s = HT_GetNodeURL (node);
URL_Struct *url = NET_CreateURLStruct (s, NET_DONT_RELOAD);
@ -328,7 +308,7 @@ XFE_RDFTreeView::resize(XtPointer callData)
void
XFE_RDFTreeView::refresh(HT_Resource node)
{
if (!_ht_rdfView) return;
if (!_ht_view) return;
XP_ASSERT(HT_IsContainer(node));
if (!HT_IsContainer(node)) return;
@ -339,7 +319,7 @@ XFE_RDFTreeView::refresh(HT_Resource node)
HT_Cursor child_cursor = HT_NewCursor(node);
while (child = HT_GetNextItem(child_cursor))
while ( (child = HT_GetNextItem(child_cursor)) )
{
add_row(child);
@ -350,7 +330,7 @@ XFE_RDFTreeView::refresh(HT_Resource node)
}
else
{
int row = HT_GetNodeIndex(_ht_rdfView, node);
int row = HT_GetNodeIndex(_ht_view, node);
XmLTreeDeleteChildren(m_widget, row);
}
@ -374,7 +354,7 @@ XFE_RDFTreeView::edit_cell(XtPointer callData)
return;
XmLGridCallbackStruct *cbs = (XmLGridCallbackStruct*)callData;
HT_Resource node = HT_GetNthItem (_ht_rdfView, cbs->row);
HT_Resource node = HT_GetNthItem (_ht_view, cbs->row);
if (node && cbs->reason == XmCR_EDIT_COMPLETE)
{
@ -418,7 +398,7 @@ XFE_RDFTreeView::select_cb(Widget,
void
XFE_RDFTreeView::select_row(int row)
{
HT_Resource node = HT_GetNthItem(_ht_rdfView, row);
HT_Resource node = HT_GetNthItem(_ht_view, row);
if (!node) return;
@ -441,7 +421,7 @@ XFE_RDFTreeView::deselect_cb(Widget,
void
XFE_RDFTreeView::deselect_row(int row)
{
HT_Resource node = HT_GetNthItem(_ht_rdfView, row);
HT_Resource node = HT_GetNthItem(_ht_view, row);
if (!node) return;
@ -449,22 +429,17 @@ XFE_RDFTreeView::deselect_row(int row)
}
//////////////////////////////////////////////////////////////////////////
void
XFE_RDFTreeView::notify(HT_Notification /* ns */, HT_Resource n,
HT_Event whatHappened)
XFE_RDFTreeView::notify(HT_Resource n, HT_Event whatHappened)
{
switch (whatHappened) {
case HT_EVENT_NODE_ADDED:
D(printf("RDFView::HT_Event: %s on %s\n","HT_EVENT_NODE_ADDED",
D(printf("RDFTreeView::HT_Event: %s on %s\n","NODE_ADDED",
HT_GetNodeName(n)););
add_row(n);
break;
case HT_EVENT_NODE_DELETED_DATA:
D(printf("RDFView::HT_Event: %s on %s\n","HT_EVENT_NODE_DELETED_DATA",
HT_GetNodeName(n)););
break;
case HT_EVENT_NODE_DELETED_NODATA:
{
D(printf("RDFView::HT_Event: %s on %s\n","HT_EVENT_NODE_DELETED_NODATA",
D(printf("RDFTreeView::HT_Event: %s on %s\n","NODE_DELETED_NODATA",
HT_GetNodeName(n)););
#ifdef UNDEF
// Is this a container node?
@ -476,33 +451,25 @@ XFE_RDFTreeView::notify(HT_Notification /* ns */, HT_Resource n,
HT_GetOpenState(n, &isExpanded);
}
int row = HT_GetNodeIndex(_ht_rdfView, n);
int row = HT_GetNodeIndex(_ht_view, n);
delete_row(row);
#endif /* UNDEF */
break;
}
case HT_EVENT_NODE_VPROP_CHANGED:
D(printf("RDFView::HT_Event: %s on %s\n","HT_EVENT_NODE_VPROP_CHANGED",
HT_GetNodeName(n)););
break;
case HT_EVENT_NODE_SELECTION_CHANGED:
D(printf("RDFView::HT_Event: %s on %s\n","HT_EVENT_NODE_SELECTION_CHANGED",
HT_GetNodeName(n)););
break;
case HT_EVENT_NODE_OPENCLOSE_CHANGED:
{
D(printf("RDFView::HT_Event: %s on %s\n","HT_EVENT_NODE_OPENCLOSE_CHANGED",
D(printf("RDFView::HT_Event: %s on %s\n","NODE_OPENCLOSE_CHANGED",
HT_GetNodeName(n)););
refresh(n);
Boolean expands = HT_IsContainer(n);
Boolean expands = HT_IsContainer(n);
if (expands)
{
PRBool isExpanded = False;
HT_GetOpenState(n, &isExpanded);
int row = HT_GetNodeIndex(_ht_rdfView, n);
int row = HT_GetNodeIndex(_ht_view, n);
if (isExpanded) // The node has been opened
{
@ -517,41 +484,29 @@ XFE_RDFTreeView::notify(HT_Notification /* ns */, HT_Resource n,
XmNrowIsExpanded, False, NULL);
}
}
break;
}
case HT_EVENT_VIEW_CLOSED:
D(printf("RDFView::HT_Event: %s on %s\n","HT_EVENT_VIEW_CLOSED",
HT_GetNodeName(n)););
break;
case HT_EVENT_VIEW_SELECTED:
{
XP_ASSERT( 0 );
}
break;
case HT_EVENT_NODE_OPENCLOSE_CHANGING:
{
D(printf("RDFView::HT_Event: %s on %s\n","HT_EVENT_NODE_OPENCLOSE_CHANGING",
HT_GetNodeName(n)););
break;
{
setHTView(HT_GetView(n));
break;
}
case HT_EVENT_NODE_EDIT:
{
int row = HT_GetNodeIndex(_ht_rdfView, n);
int row = HT_GetNodeIndex(_ht_view, n);
XmLGridEditBegin(m_widget, True, row, 0);
break;
}
case HT_EVENT_VIEW_REFRESH:
{
int row = HT_GetNodeIndex(_ht_rdfView, n);
int row = HT_GetNodeIndex(_ht_view, n);
PRBool expands = HT_IsContainer(n);
PRBool isExpanded = False;
if (expands)
HT_GetOpenState(n, &isExpanded);
if (expands && isExpanded)
{
if (n == HT_TopNode(_ht_rdfView))
if (n == HT_TopNode(_ht_view))
/* It is the top most node. Delete all rows */
XmLGridDeleteAllRows(m_widget, XmCONTENT);
else
@ -563,45 +518,28 @@ XFE_RDFTreeView::notify(HT_Notification /* ns */, HT_Resource n,
break;
}
default:
D(printf("RDFView::HT_Event: Unknown type on %s\n",HT_GetNodeName(n)););
// Fall through and let RDFBase handle the event
break;
}
XFE_RDFBase::notify(n,whatHappened);
}
//////////////////////////////////////////////////////////////////////
void
XFE_RDFTreeView::setHTView(HT_View htview)
XFE_RDFTreeView::updateRoot()
{
if (htview == _ht_rdfView)
{
return;
}
_ht_rdfView = htview;
if (!_ht_rdfView)
{
return;
}
fill_tree();
setHTTreeViewProperties(_ht_rdfView);
}
//////////////////////////////////////////////////////////////////////
HT_View
XFE_RDFTreeView::getHTView()
{
return _ht_rdfView;
setHTTreeViewProperties(_ht_view);
}
//////////////////////////////////////////////////////////////////////
void
XFE_RDFTreeView::fill_tree()
{
XP_ASSERT(m_widget);
if (!_ht_rdfView || !m_widget)
if (!_ht_view || !m_widget)
return;
int item_count = HT_GetItemListCount(_ht_rdfView);
void * data=NULL;
int item_count = HT_GetItemListCount(_ht_view);
//void * data=NULL;
/* This s'd eventually be replaced by the HT property useInlineEditing */
if (getStandAloneState())
@ -633,7 +571,7 @@ XFE_RDFTreeView::fill_tree()
void *token;
uint32 token_type;
int ii = 0;
HT_Cursor column_cursor = HT_NewColumnCursor (_ht_rdfView);
HT_Cursor column_cursor = HT_NewColumnCursor (_ht_view);
while (HT_GetNextColumn(column_cursor, &column_name, &column_width,
&token, &token_type)) {
add_column(ii, column_name, column_width, token, token_type);
@ -671,7 +609,7 @@ XFE_RDFTreeView::destroy_tree()
void
XFE_RDFTreeView::add_row(int row)
{
HT_Resource node = HT_GetNthItem (_ht_rdfView, row);
HT_Resource node = HT_GetNthItem (_ht_view, row);
add_row(node);
}
@ -679,8 +617,8 @@ void
XFE_RDFTreeView::add_row
(HT_Resource node)
{
//HT_Resource node = GetNthItem (_ht_rdfView, row);
int row = HT_GetNodeIndex(_ht_rdfView, node);
//HT_Resource node = GetNthItem (_ht_view, row);
int row = HT_GetNodeIndex(_ht_view, node);
char *name = HT_GetNodeName(node);
int depth = HT_GetItemIndentation(node);
Boolean expands = HT_IsContainer(node);
@ -835,7 +773,7 @@ XFE_RDFTreeView::expand_row_cb(Widget,
void
XFE_RDFTreeView::expand_row(int row)
{
HT_Resource node = HT_GetNthItem (_ht_rdfView, row);
HT_Resource node = HT_GetNthItem (_ht_view, row);
HT_SetOpenState (node, (PRBool)TRUE);
}
@ -856,7 +794,7 @@ XFE_RDFTreeView::collapse_row_cb(Widget,
void
XFE_RDFTreeView::collapse_row(int row)
{
HT_Resource node = HT_GetNthItem (_ht_rdfView, row);
HT_Resource node = HT_GetNthItem (_ht_view, row);
HT_SetOpenState (node, (PRBool)FALSE);
}
@ -928,7 +866,7 @@ XFE_RDFTreeView::doPopup(XEvent * event)
_popup = new XFE_RDFPopupMenu("popup",
//getFrame(),
FE_GetToplevelWidget(),
_ht_rdfView,
_ht_view,
FALSE, // not isWorkspace
FALSE); // no background commands for now
@ -1131,9 +1069,10 @@ XFE_RDFTreeView::setHTTreeViewProperties( HT_View view)
}
/* useInlineEditing. This doesn't work now for teh same reason as above */
HT_GetTemplateData(HT_TopNode(_ht_rdfView), gNavCenter->useInlineEditing, HT_COLUMN_STRING, &data);
HT_GetTemplateData(getRootFolder(),
gNavCenter->useInlineEditing,
HT_COLUMN_STRING, &data);
if (data)
{
/* Decide if cells are editable */
@ -1145,8 +1084,6 @@ XFE_RDFTreeView::setHTTreeViewProperties( HT_View view)
#ifdef UNDEF /* Properties that can't be set yet in the tree widget */
@ -1204,20 +1141,20 @@ fe_getPixelFromRGB(MWContext * context, char * color, Pixel *pixel)
}
};
extern "C"
{
void
treeview_bg_image_cb(XtPointer client_data)
{
extern "C" {
void
treeview_bg_image_cb(XtPointer client_data)
{
callbackClientData * cb = (callbackClientData *) client_data;
Widget tree = (Widget )cb->widget;
Dimension b_width=0, b_height=0;
callbackClientData * cb = (callbackClientData *) client_data;
Widget tree = (Widget )cb->widget;
//Dimension b_width=0, b_height=0;
XtVaSetValues(tree, XmNbackgroundPixmap, cb->image, NULL);
XP_FREE(cb);
XtVaSetValues(tree, XmNbackgroundPixmap, cb->image, NULL);
XP_FREE(cb);
}
}
}; /* extern C */

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

@ -47,7 +47,8 @@ protected:
HT_Pane m_pane;
};
class XFE_RDFTreeView : public XFE_View
class XFE_RDFTreeView : public XFE_View,
public XFE_RDFBase
{
public:
XFE_RDFTreeView(XFE_Component *toplevel, Widget parent,
@ -60,26 +61,23 @@ public:
// row < 0 indicates heading row; otherwise it is a content row
// (starting from 0)
//
virtual char *getCellTipString(int /* row */, int /* column */) {return NULL;}
virtual char *getCellDocString(int /* row */, int /* column */) {return NULL;}
virtual char *getCellTipString(int /*row*/, int /*column*/) {return NULL;}
virtual char *getCellDocString(int /*row*/, int /*column*/) {return NULL;}
// Refresh the outliner
void refresh(HT_Resource node);
void updateRoot();
// Open properties dialog
//void openPropertiesWindow();
//void closePropertiesWindow();
// RDF Specific calls
void notify(HT_Notification ns, HT_Resource n, HT_Event whatHappened);
// Override RDFBase method
void notify(HT_Resource n, HT_Event whatHappened);
void doPopup(XEvent *event);
// HT view set/get methods
void setHTView(HT_View view);
HT_View getHTView();
// Stand alone set/get methods
void setStandAloneState(XP_Bool state);
XP_Bool getStandAloneState();
@ -89,9 +87,6 @@ public:
private:
// The view as registered in the hypertree
HT_View _ht_rdfView;
// The popup menu
XFE_RDFPopupMenu * _popup;

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

@ -61,7 +61,6 @@ XFE_RDFView::XFE_RDFView(XFE_Component * toplevel,
XFE_View * parent_view,
MWContext * context) :
XFE_View(toplevel, parent_view, context),
_ht_rdfView(NULL),
_viewLabel(NULL),
_controlToolBar(NULL),
_addBookmarkControl(NULL),
@ -161,46 +160,33 @@ XFE_RDFView::~XFE_RDFView()
}
//////////////////////////////////////////////////////////////////////////
void
XFE_RDFView::notify(HT_Notification ns,
HT_Resource n,
XFE_RDFView::updateRoot()
{
char * label = HT_GetViewName(_ht_view);
XP_ASSERT( _rdfTreeView != NULL );
// XXX Aurora NEED TO LOCALIZE XXX
XmString xmstr = XmStringCreateLocalized(label);
XtVaSetValues(_viewLabel,XmNlabelString,xmstr,NULL);
XmStringFree(xmstr);
// Set the HT properties
setHTTitlebarProperties(_ht_view, _viewLabel);
}
void
XFE_RDFView::notify(HT_Resource n,
HT_Event whatHappened)
{
// HT_EVENT_VIEW_SELECTED
if (whatHappened == HT_EVENT_VIEW_SELECTED)
{
HT_View htView = HT_GetView(n);
char * label = HT_GetViewName(htView);
XP_ASSERT( _rdfTreeView != NULL );
if (_rdfTreeView->getHTView() != htView)
{
_rdfTreeView->setHTView(htView);
// XXX Aurora NEED TO LOCALIZE XXX
XmString xmstr = XmStringCreateLocalized(label);
XtVaSetValues(_viewLabel,XmNlabelString,xmstr,NULL);
XmStringFree(xmstr);
// Set the HT properties
setHTTitlebarProperties(htView, _viewLabel);
}
setHTView(HT_GetView(n));
}
else
{
XP_ASSERT( _rdfTreeView != NULL );
_rdfTreeView->notify(ns,n,whatHappened);
}
}
//////////////////////////////////////////////////////////////////////
void
XFE_RDFView::setHTView(HT_View htview)
{
XP_ASSERT( _rdfTreeView != NULL );
_rdfTreeView->setHTView(htview);
_rdfTreeView->notify(n, whatHappened);
}
//////////////////////////////////////////////////////////////////////
void
@ -210,22 +196,23 @@ XFE_RDFView::closeRdfView_cb(Widget /* w */, XtPointer clientData, XtPointer /*
closeRdfViewCBStruct * obj = (closeRdfViewCBStruct *) clientData;
XFE_NavCenterView * ncview = obj->ncview;
Widget selector = (Widget )ncview->getSelector();
// Widget nc_base_widget = ncview->getBaseWidget();
Widget parent = XtParent(obj->rdfview->_controlToolBar);
/* XtVaSetValues(nc_base_widget, XmNresizable, True, NULL); */
XtUnmanageChild(parent);
XtUnmanageChild(selector);
#ifdef USE_SELECTOR_BAR
Widget selector = (Widget )ncview->getSelector();
XtUnmanageChild(selector);
XtVaSetValues(selector, XmNrightAttachment, XmATTACH_FORM,
XmNleftAttachment, XmATTACH_FORM,
XmNtopAttachment, XmATTACH_FORM,
XmNbottomAttachment, XmATTACH_FORM,
NULL);
XtManageChild(selector);
#endif /*USE_SELECTOR_BAR*/
}
//////////////////////////////////////////////////////////////////////////
//

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

@ -1,98 +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.
*/
/*
RDFView.h -- class definition for XFE_RDFView
Created: Stephen Lamm <slamm@netscape.com>, 5-Nov-97.
*/
#ifndef _xfe_rdfview_h
#define _xfe_rdfview_h
#include "View.h"
#include "IconGroup.h"
#include "htrdf.h"
#include "NavCenterView.h"
#include "RDFTreeView.h"
class XFE_RDFView : public XFE_View
{
public:
XFE_RDFView(XFE_Component *toplevel, Widget parent,
XFE_View *parent_view, MWContext *context);
~XFE_RDFView();
// Get tooltipString & docString;
// returned string shall be freed by the callee
// row < 0 indicates heading row; otherwise it is a content row
// (starting from 0)
//
virtual char *getCellTipString(int /* row */, int /* column */) {return NULL;}
virtual char *getCellDocString(int /* row */, int /* column */) {return NULL;}
// Refresh the outliner
void refresh(HT_Resource node);
// Open properties dialog
//void openPropertiesWindow();
//void closePropertiesWindow();
// RDF Specific calls
void notify(HT_Notification ns, HT_Resource n, HT_Event whatHappened);
// HT view set/get methods
void setHTView(HT_View view);
void setHTTitlebarProperties(HT_View view, Widget titleBar);
// Stand alone set/get methods
void setStandAloneState(XP_Bool state);
XP_Bool getStandAloneState();
private:
// The view as registered in the hypertree
HT_View _ht_rdfView;
// The label that displays the currently open pane
Widget _viewLabel;
// Parent of the label and the button on top
Widget _controlToolBar;
// Toggle tree operating mode
Widget _addBookmarkControl;
// Close the view
Widget _closeControl;
// Toggle tree operating mode
Widget _modeControl;
// The rdf tree view component
XFE_RDFTreeView * _rdfTreeView;
// Is this a stand alone view ?
XP_Bool _standAloneState;
static void closeRdfView_cb(Widget, XtPointer, XtPointer);
};
#endif /* _xfe_rdfview_h */