зеркало из https://github.com/mozilla/pjs.git
Make the stand alone state of XFE_RDFView a member that can be toggled.
Fix a bunch of warnings. Make the notif_cb a static member of XFE_NavCenterView as it should be.
This commit is contained in:
Родитель
a1d79335a3
Коммит
60175de152
|
@ -135,7 +135,7 @@ XFE_NavCenterFrame::commandToString(CommandType cmd, void* calldata,
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
extern "C" MWContext *
|
extern "C" MWContext *
|
||||||
fe_showNavCenter(Widget toplevel, XFE_Frame *parent_frame, Chrome *chromespec, URL_Struct *url)
|
fe_showNavCenter(Widget toplevel, XFE_Frame *parent_frame, Chrome *chromespec, URL_Struct * /* url */)
|
||||||
{
|
{
|
||||||
// not a static global, since we can have multiple browsers.
|
// not a static global, since we can have multiple browsers.
|
||||||
XFE_NavCenterFrame *theFrame;
|
XFE_NavCenterFrame *theFrame;
|
||||||
|
|
|
@ -150,11 +150,13 @@ XFE_NavCenterView::XFE_NavCenterView(XFE_Component *toplevel_component,
|
||||||
|
|
||||||
m_htview = NULL;
|
m_htview = NULL;
|
||||||
m_pane = NULL;
|
m_pane = NULL;
|
||||||
m_rdfview = new XFE_RDFView(this, rdf_parent, this,
|
|
||||||
context, m_isStandalone);
|
m_rdfview = new XFE_RDFView(this, rdf_parent, this, context);
|
||||||
|
|
||||||
|
m_rdfview->setStandAloneState(m_isStandalone);
|
||||||
|
|
||||||
HT_Notification ns = new HT_NotificationStruct;
|
HT_Notification ns = new HT_NotificationStruct;
|
||||||
ns->notifyProc = notify_cb;
|
ns->notifyProc = &XFE_NavCenterView::notify_cb;
|
||||||
ns->data = this;
|
ns->data = this;
|
||||||
|
|
||||||
m_pane = HT_NewPane(ns);
|
m_pane = HT_NewPane(ns);
|
||||||
|
@ -186,17 +188,22 @@ XFE_NavCenterView::~XFE_NavCenterView()
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void notify_cb(HT_Notification ns, HT_Resource n,
|
/* static */ void
|
||||||
HT_Event whatHappened, void *token, uint32 tokenType)
|
XFE_NavCenterView::notify_cb(HT_Notification ns,
|
||||||
|
HT_Resource n,
|
||||||
|
HT_Event whatHappened,
|
||||||
|
void * /* token */,
|
||||||
|
uint32 /* tokenType */)
|
||||||
{
|
{
|
||||||
XFE_NavCenterView* theView = (XFE_NavCenterView*)ns->data;
|
XFE_NavCenterView * theView = (XFE_NavCenterView *) ns->data;
|
||||||
|
|
||||||
theView->notify(ns, n, whatHappened);
|
theView->notify(ns, n, whatHappened);
|
||||||
}
|
}
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void
|
void
|
||||||
XFE_NavCenterView::notify(HT_Notification ns, HT_Resource n,
|
XFE_NavCenterView::notify(HT_Notification ns,
|
||||||
HT_Event whatHappened)
|
HT_Resource n,
|
||||||
|
HT_Event whatHappened)
|
||||||
{
|
{
|
||||||
switch (whatHappened) {
|
switch (whatHappened) {
|
||||||
case HT_EVENT_VIEW_CLOSED:
|
case HT_EVENT_VIEW_CLOSED:
|
||||||
|
@ -286,7 +293,7 @@ void
|
||||||
XFE_NavCenterView::addRDFView(HT_View view)
|
XFE_NavCenterView::addRDFView(HT_View view)
|
||||||
{
|
{
|
||||||
|
|
||||||
static int counter=1;
|
// static int counter=1;
|
||||||
|
|
||||||
XFE_RDFImage * rdfImage = NULL;
|
XFE_RDFImage * rdfImage = NULL;
|
||||||
|
|
||||||
|
@ -365,9 +372,9 @@ XFE_NavCenterView::addRDFView(HT_View view)
|
||||||
}
|
}
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
void
|
void
|
||||||
XFE_NavCenterView::selector_activate_cb(Widget w,
|
XFE_NavCenterView::selector_activate_cb(Widget /* w */,
|
||||||
XtPointer clientData,
|
XtPointer clientData,
|
||||||
XtPointer callData)
|
XtPointer /* callData */)
|
||||||
{
|
{
|
||||||
SelectorCBStruct *cbdata = (SelectorCBStruct *)clientData;
|
SelectorCBStruct *cbdata = (SelectorCBStruct *)clientData;
|
||||||
|
|
||||||
|
@ -375,9 +382,9 @@ XFE_NavCenterView::selector_activate_cb(Widget w,
|
||||||
}
|
}
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
void
|
void
|
||||||
XFE_NavCenterView::selector_destroy_cb(Widget w,
|
XFE_NavCenterView::selector_destroy_cb(Widget /* w */,
|
||||||
XtPointer clientData,
|
XtPointer clientData,
|
||||||
XtPointer callData)
|
XtPointer /* callData */)
|
||||||
{
|
{
|
||||||
SelectorCBStruct *cbdata = (SelectorCBStruct *)clientData;
|
SelectorCBStruct *cbdata = (SelectorCBStruct *)clientData;
|
||||||
|
|
||||||
|
|
|
@ -75,10 +75,15 @@ private:
|
||||||
static void imageCacheInitialize();
|
static void imageCacheInitialize();
|
||||||
|
|
||||||
static const unsigned int MaxRdfImages;
|
static const unsigned int MaxRdfImages;
|
||||||
|
|
||||||
|
static void notify_cb(HT_Notification ns,
|
||||||
|
HT_Resource n,
|
||||||
|
HT_Event whatHappened,
|
||||||
|
void * token,
|
||||||
|
uint32 tokenType);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void notify_cb(HT_Notification ns, HT_Resource n,
|
|
||||||
HT_Event whatHappened, void *token, uint32 tokenType);
|
|
||||||
|
|
||||||
#endif /* _xfe_navcenterview_h */
|
#endif /* _xfe_navcenterview_h */
|
||||||
|
|
||||||
|
|
|
@ -153,10 +153,12 @@ public:
|
||||||
|
|
||||||
static XFE_CommandList* my_commands = 0;
|
static XFE_CommandList* my_commands = 0;
|
||||||
|
|
||||||
XFE_RDFView::XFE_RDFView(XFE_Component *toplevel, Widget parent,
|
XFE_RDFView::XFE_RDFView(XFE_Component * toplevel,
|
||||||
XFE_View *parent_view, MWContext *context,
|
Widget parent,
|
||||||
XP_Bool isStandalone)
|
XFE_View * parent_view,
|
||||||
: XFE_View(toplevel, parent_view, context)
|
MWContext * context) :
|
||||||
|
XFE_View(toplevel, parent_view, context),
|
||||||
|
_standAloneState(False)
|
||||||
{
|
{
|
||||||
m_rdfview = NULL;
|
m_rdfview = NULL;
|
||||||
m_popup = NULL;
|
m_popup = NULL;
|
||||||
|
@ -183,7 +185,7 @@ XFE_RDFView::XFE_RDFView(XFE_Component *toplevel, Widget parent,
|
||||||
XmNbottomAttachment, XmATTACH_FORM,
|
XmNbottomAttachment, XmATTACH_FORM,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
Widget closeRDFView = XtVaCreateManagedWidget("X",
|
/* Widget closeRDFView = */XtVaCreateManagedWidget("X",
|
||||||
xmPushButtonWidgetClass,
|
xmPushButtonWidgetClass,
|
||||||
rdfControlsParent,
|
rdfControlsParent,
|
||||||
XmNtopAttachment, XmATTACH_FORM,
|
XmNtopAttachment, XmATTACH_FORM,
|
||||||
|
@ -213,7 +215,6 @@ XFE_RDFView::XFE_RDFView(XFE_Component *toplevel, Widget parent,
|
||||||
XmNheadingRows, 1,
|
XmNheadingRows, 1,
|
||||||
XmNvisibleRows, 14,
|
XmNvisibleRows, 14,
|
||||||
XmNhideUnhideButtons, True,
|
XmNhideUnhideButtons, True,
|
||||||
XmNvisibleColumns, (isStandalone ? 0 : 1),
|
|
||||||
//XmNdebugLevel, 1,
|
//XmNdebugLevel, 1,
|
||||||
/* Form resources */
|
/* Form resources */
|
||||||
XmNtopAttachment, XmATTACH_WIDGET,
|
XmNtopAttachment, XmATTACH_WIDGET,
|
||||||
|
@ -378,6 +379,7 @@ XFE_RDFView::refresh(HT_Resource node)
|
||||||
HT_Resource child;
|
HT_Resource child;
|
||||||
|
|
||||||
HT_Cursor child_cursor = HT_NewCursor(node);
|
HT_Cursor child_cursor = HT_NewCursor(node);
|
||||||
|
|
||||||
while (child = HT_GetNextItem(child_cursor))
|
while (child = HT_GetNextItem(child_cursor))
|
||||||
{
|
{
|
||||||
add_row(child);
|
add_row(child);
|
||||||
|
@ -488,7 +490,7 @@ XFE_RDFView::deselect_row(int row)
|
||||||
}
|
}
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
void
|
void
|
||||||
XFE_RDFView::notify(HT_Notification ns, HT_Resource n,
|
XFE_RDFView::notify(HT_Notification /* ns */, HT_Resource n,
|
||||||
HT_Event whatHappened)
|
HT_Event whatHappened)
|
||||||
{
|
{
|
||||||
switch (whatHappened) {
|
switch (whatHappened) {
|
||||||
|
@ -835,7 +837,7 @@ XFE_RDFView::add_column(int index, char *name, uint32 width,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
XFE_RDFView::delete_column(HT_Resource cursor)
|
XFE_RDFView::delete_column(HT_Resource /* cursor */)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -980,13 +982,13 @@ XFE_RDFPopupMenu::XFE_RDFPopupMenu(String name, Widget parent,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
XFE_RDFPopupMenu::PushButtonActivate(Widget w, XtPointer userData)
|
XFE_RDFPopupMenu::PushButtonActivate(Widget /* w */, XtPointer userData)
|
||||||
{
|
{
|
||||||
HT_DoMenuCmd(m_pane, (HT_MenuCmd)(int)userData);
|
HT_DoMenuCmd(m_pane, (HT_MenuCmd)(int)userData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
XFE_RDFView::closeRdfView_cb(Widget, XtPointer clientData, XtPointer callData)
|
XFE_RDFView::closeRdfView_cb(Widget /* w */, XtPointer clientData, XtPointer /* callData */)
|
||||||
{
|
{
|
||||||
|
|
||||||
closeRdfViewCBStruct * obj = (closeRdfViewCBStruct *) clientData;
|
closeRdfViewCBStruct * obj = (closeRdfViewCBStruct *) clientData;
|
||||||
|
@ -994,7 +996,7 @@ XFE_RDFView::closeRdfView_cb(Widget, XtPointer clientData, XtPointer callData)
|
||||||
|
|
||||||
Widget selector = (Widget )ncview->getSelector();
|
Widget selector = (Widget )ncview->getSelector();
|
||||||
|
|
||||||
Widget nc_base_widget = ncview->getBaseWidget();
|
// Widget nc_base_widget = ncview->getBaseWidget();
|
||||||
Widget parent = XtParent(obj->rdfview->rdfControlsParent);
|
Widget parent = XtParent(obj->rdfview->rdfControlsParent);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1009,3 +1011,29 @@ XFE_RDFView::closeRdfView_cb(Widget, XtPointer clientData, XtPointer callData)
|
||||||
NULL);
|
NULL);
|
||||||
XtManageChild(selector);
|
XtManageChild(selector);
|
||||||
}
|
}
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Toggle the stand alone state
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
void
|
||||||
|
XFE_RDFView::setStandAloneState(XP_Bool state)
|
||||||
|
{
|
||||||
|
XP_ASSERT( XfeIsAlive(m_tree) );
|
||||||
|
|
||||||
|
_standAloneState = state;
|
||||||
|
|
||||||
|
int visibleColumns = (_standAloneState ? 0 : 1);
|
||||||
|
|
||||||
|
XtVaSetValues(m_tree,
|
||||||
|
XmNvisibleColumns, visibleColumns,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
XP_Bool
|
||||||
|
XFE_RDFView::getStandAloneState()
|
||||||
|
{
|
||||||
|
return _standAloneState;
|
||||||
|
}
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ class XFE_RDFView : public XFE_View
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
XFE_RDFView(XFE_Component *toplevel, Widget parent,
|
XFE_RDFView(XFE_Component *toplevel, Widget parent,
|
||||||
XFE_View *parent_view, MWContext *context, XP_Bool isStandalone);
|
XFE_View *parent_view, MWContext *context);
|
||||||
|
|
||||||
~XFE_RDFView();
|
~XFE_RDFView();
|
||||||
|
|
||||||
|
@ -74,6 +74,9 @@ public:
|
||||||
|
|
||||||
void doPopup(XEvent *event);
|
void doPopup(XEvent *event);
|
||||||
|
|
||||||
|
void setStandAloneState(XP_Bool state);
|
||||||
|
XP_Bool getStandAloneState();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//HT_Pane m_Pane; // The pane that owns this view
|
//HT_Pane m_Pane; // The pane that owns this view
|
||||||
HT_View m_rdfview; // The view as registered in the hypertree
|
HT_View m_rdfview; // The view as registered in the hypertree
|
||||||
|
@ -82,6 +85,9 @@ private:
|
||||||
Widget m_tree; // The tree widget
|
Widget m_tree; // The tree widget
|
||||||
XFE_RDFPopupMenu *m_popup;
|
XFE_RDFPopupMenu *m_popup;
|
||||||
|
|
||||||
|
// Is this a stand alone view ?
|
||||||
|
XP_Bool _standAloneState;
|
||||||
|
|
||||||
// icons for use in the bookmark window.
|
// icons for use in the bookmark window.
|
||||||
static fe_icon bookmark;
|
static fe_icon bookmark;
|
||||||
static fe_icon openedFolder;
|
static fe_icon openedFolder;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче