From 5bc5ea684fddd5ec0e9efadcab4243752c8ed74f Mon Sep 17 00:00:00 2001 From: ramiro Date: Wed, 15 Apr 1998 02:06:22 +0000 Subject: [PATCH] The Great Chrome Rewrite of 1998. Use a chrome manager instead of doAttachments(). Fixes numerous toolbox bugs and completely simplifies the way xfe does chrome. Reviewed by slamm. git-svn-id: svn://10.0.0.236/trunk@291 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/cmd/xfe/src/AddrBookFrame.cpp | 11 +- mozilla/cmd/xfe/src/BookmarkFrame.cpp | 14 +- mozilla/cmd/xfe/src/BrowserFrame.cpp | 15 +- mozilla/cmd/xfe/src/ComposeFrame.cpp | 20 +- mozilla/cmd/xfe/src/DownloadFrame.cpp | 6 +- mozilla/cmd/xfe/src/EditorFrame.cpp | 18 +- mozilla/cmd/xfe/src/FolderFrame.cpp | 12 +- mozilla/cmd/xfe/src/Frame.cpp | 420 ++++++++++------------ mozilla/cmd/xfe/src/Frame.h | 30 +- mozilla/cmd/xfe/src/HTMLDialogFrame.cpp | 9 +- mozilla/cmd/xfe/src/HistoryFrame.cpp | 15 +- mozilla/cmd/xfe/src/LdapSearchFrame.cpp | 2 +- mozilla/cmd/xfe/src/MNSearchFrame.cpp | 2 +- mozilla/cmd/xfe/src/MailDownloadFrame.cpp | 2 +- mozilla/cmd/xfe/src/MsgFrame.cpp | 12 +- mozilla/cmd/xfe/src/NavCenterFrame.cpp | 9 +- mozilla/cmd/xfe/src/ThreadFrame.cpp | 20 +- mozilla/cmd/xfe/src/Toolbox.cpp | 4 +- mozilla/cmd/xfe/src/context_funcs.cpp | 1 - 19 files changed, 238 insertions(+), 384 deletions(-) diff --git a/mozilla/cmd/xfe/src/AddrBookFrame.cpp b/mozilla/cmd/xfe/src/AddrBookFrame.cpp index 42beef1b9cf..8557d08d2f1 100644 --- a/mozilla/cmd/xfe/src/AddrBookFrame.cpp +++ b/mozilla/cmd/xfe/src/AddrBookFrame.cpp @@ -189,21 +189,12 @@ XFE_AddrBookFrame::XFE_AddrBookFrame(Widget toplevel, * import from XFE_BookmarkFrame::XFE_BookmarkFrame */ XFE_AB2PaneView *view = new XFE_AB2PaneView(this, - getViewParent(), + getChromeParent(), NULL, m_context, AB_BOOK); m_abView = (XFE_AddrBookView *) view->getEntriesListView(); - /* Attachment - */ - XtVaSetValues(view->getBaseWidget(), - XmNleftAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - NULL); - setView(view); setMenubar(menu_bar_spec); diff --git a/mozilla/cmd/xfe/src/BookmarkFrame.cpp b/mozilla/cmd/xfe/src/BookmarkFrame.cpp index c5d842913af..7095abcef71 100644 --- a/mozilla/cmd/xfe/src/BookmarkFrame.cpp +++ b/mozilla/cmd/xfe/src/BookmarkFrame.cpp @@ -133,17 +133,12 @@ XFE_BookmarkFrame::XFE_BookmarkFrame(Widget toplevel, XP_ASSERT( m_bookmarkFrame == NULL ); // create the bookmark view - XFE_BookmarkView *view = new XFE_BookmarkView(this, getViewParent(), - NULL, m_context); + XFE_BookmarkView *view = new XFE_BookmarkView(this, + getChromeParent(), + NULL, + m_context); setView(view); - XtVaSetValues(view->getBaseWidget(), - XmNleftAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - NULL); - setMenubar(menu_bar_spec); // @@ -164,6 +159,7 @@ XFE_BookmarkFrame::XFE_BookmarkFrame(Widget toplevel, m_dashboard->setShowProgressBar(True); realize(); + resize(600,580); //XXX Default size for now main_bm_context = m_context; diff --git a/mozilla/cmd/xfe/src/BrowserFrame.cpp b/mozilla/cmd/xfe/src/BrowserFrame.cpp index bdf97334c7e..cae9962579b 100644 --- a/mozilla/cmd/xfe/src/BrowserFrame.cpp +++ b/mozilla/cmd/xfe/src/BrowserFrame.cpp @@ -229,7 +229,7 @@ XFE_BrowserFrame::XFE_BrowserFrame(Widget toplevel, #endif /* notyet */ - htmlview = new XFE_HTMLView(this, getViewParent(), NULL, m_context); + htmlview = new XFE_HTMLView(this, getChromeParent(), NULL, m_context); // Create url bar m_urlBar = new XFE_URLBar(this,m_toolbox); @@ -259,13 +259,6 @@ XFE_BrowserFrame::XFE_BrowserFrame(Widget toplevel, if (!chromespec || (chromespec && chromespec->show_url_bar)) m_urlBar->show(); - XtVaSetValues(htmlview->getBaseWidget(), - XmNleftAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - NULL); - // register drop site on HTMLView m_browserDropSite=new XFE_BrowserDrop(htmlview->getBaseWidget(),this); m_browserDropSite->enable(); @@ -348,9 +341,6 @@ XFE_BrowserFrame::doCommand(CommandType cmd, // Configure the logo configureLogo(); - // Do the attachments - doAttachments(); - // Update prefs toolboxItemChangeShowing(m_urlBar); @@ -370,9 +360,6 @@ XFE_BrowserFrame::doCommand(CommandType cmd, // Configure the logo configureLogo(); - // Do the attachments - doAttachments(); - // Update prefs toolboxItemChangeShowing(m_personalToolbar); diff --git a/mozilla/cmd/xfe/src/ComposeFrame.cpp b/mozilla/cmd/xfe/src/ComposeFrame.cpp index d8b5a933a3c..2c553c5d2cb 100644 --- a/mozilla/cmd/xfe/src/ComposeFrame.cpp +++ b/mozilla/cmd/xfe/src/ComposeFrame.cpp @@ -243,18 +243,16 @@ XDEBUG( printf ("in XFE_ComposeFrame::XFE_ComposeFrame()\n");) // create the compose view XFE_ComposeView *view = new XFE_ComposeView(this, - getViewParent(), NULL, m_context, - old_context, fields, NULL, - draftInitialText, preferToUseHtml); - setView(view); - + getChromeParent(), + NULL, + m_context, + old_context, + fields, + NULL, + draftInitialText, + preferToUseHtml); - XtVaSetValues(view->getBaseWidget(), - XmNleftAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - NULL); + setView(view); view->show(); diff --git a/mozilla/cmd/xfe/src/DownloadFrame.cpp b/mozilla/cmd/xfe/src/DownloadFrame.cpp index 6e724d7b057..2820f280019 100644 --- a/mozilla/cmd/xfe/src/DownloadFrame.cpp +++ b/mozilla/cmd/xfe/src/DownloadFrame.cpp @@ -275,8 +275,10 @@ XFE_DownloadFrame::XFE_DownloadFrame(Widget toplevel, XFE_Frame *parent_frame) Arg av[10]; int ac; - XFE_DownloadView *v = new XFE_DownloadView(this, getViewParent(), - NULL, m_context); + XFE_DownloadView *v = new XFE_DownloadView(this, + getChromeParent(), + NULL, + m_context); ac = 0; XtSetArg(av[ac], XmNdialogType, XmDIALOG_TEMPLATE); ac++; diff --git a/mozilla/cmd/xfe/src/EditorFrame.cpp b/mozilla/cmd/xfe/src/EditorFrame.cpp index c703288128f..5ee3a3c3b50 100644 --- a/mozilla/cmd/xfe/src/EditorFrame.cpp +++ b/mozilla/cmd/xfe/src/EditorFrame.cpp @@ -713,7 +713,7 @@ XFE_EditorFrame::XFE_EditorFrame(Widget toplevel, // create html view XFE_EditorView *editorview = new XFE_EditorView(this, - getViewParent(), + getChromeParent(), NULL, m_context); @@ -721,13 +721,6 @@ XFE_EditorFrame::XFE_EditorFrame(Widget toplevel, this, (XFE_FunctionNotification)newPageLoading_cb); - XtVaSetValues(editorview->getBaseWidget(), - XmNleftAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - NULL); - /* * Hacks to make old XFE code work. These should go away * as old XFE code is sent to pasture. @@ -843,15 +836,6 @@ XFE_EditorFrame::doCommand(CommandType cmd, // Toggle the showing state m_format_toolbar->toggle(); - // - // The doAttachments() call is needed in case the resulting - // toggle operation causes all toolbars to go away. The frame - // needs to attach things accordingly. - // - - // Do the attachments - doAttachments(); - // // The toolboxItemChangeShowing() call is needed to make the // state of toolbars persistent. diff --git a/mozilla/cmd/xfe/src/FolderFrame.cpp b/mozilla/cmd/xfe/src/FolderFrame.cpp index 9ba3ac7e8e3..47e251076fa 100644 --- a/mozilla/cmd/xfe/src/FolderFrame.cpp +++ b/mozilla/cmd/xfe/src/FolderFrame.cpp @@ -155,7 +155,7 @@ XFE_FolderFrame::XFE_FolderFrame(Widget toplevel, D( printf ("in XFE_FolderFrame::XFE_FolderFrame()\n");) // create the folder view - XFE_FolderView *view = new XFE_FolderView(this, getViewParent(), NULL, m_context); + XFE_FolderView *view = new XFE_FolderView(this, getChromeParent(), NULL, m_context); char banner_title[1024]; m_banner = new XFE_MNBanner(this, m_toolbox); @@ -177,13 +177,6 @@ D( printf ("in XFE_FolderFrame::XFE_FolderFrame()\n");) setTitle(title ); - XtVaSetValues(view->getBaseWidget(), - XmNleftAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - NULL); - setMenubar(menu_bar_spec); setToolbar(toolbar_spec); @@ -263,9 +256,6 @@ XFE_FolderFrame::doCommand(CommandType cmd, // Configure the logo configureLogo(); - // Do the attachments - doAttachments(); - // Update prefs toolboxItemChangeShowing(m_banner); diff --git a/mozilla/cmd/xfe/src/Frame.cpp b/mozilla/cmd/xfe/src/Frame.cpp index 8e0c771785b..507eb5d3851 100644 --- a/mozilla/cmd/xfe/src/Frame.cpp +++ b/mozilla/cmd/xfe/src/Frame.cpp @@ -64,8 +64,9 @@ #include #include -#include +#include #include +#include #include // For MWM_DECOR_XXX #include "XmL/Grid.h" @@ -806,6 +807,7 @@ XFE_Frame::XFE_Frame(char *name, m_toolbar = NULL; m_toolbox = NULL; m_activeLogo = NULL; + m_chrome = NULL; #ifdef NETCASTER_ZAXIS_HACKERY m_zaxis_BelowHandlerInstalled = False; @@ -856,7 +858,14 @@ XFE_Frame::XFE_Frame(char *name, m_haveHTMLDisplay = haveHTMLDisplay; - createShellAndChromeParent(name, toplevel); + + createBaseWidgetShell(toplevel,name); + + XP_ASSERT( XfeIsAlive(m_widget) ); + + createChromeManager(m_widget,"chrome"); + + XP_ASSERT( XfeIsAlive(m_chrome) ); // XXXX // now we do all the funky MWContext stuff. @@ -870,35 +879,16 @@ XFE_Frame::XFE_Frame(char *name, m_context->restricted_target=chromespec->restricted_target; if (haveDashboard) - { - m_dashboard = new XFE_Dashboard(this, getChromeParent(), this); - - if (!chromespec || (chromespec && chromespec->show_bottom_status_bar)) - m_dashboard->show(); - - } + { + m_dashboard = new XFE_Dashboard(this,m_chrome,this); + + if (!chromespec || (chromespec && chromespec->show_bottom_status_bar)) + m_dashboard->show(); + + } else m_dashboard = NULL; - // The main form holds the toolbox, m_viewparent and possibly - // the above_view component. This new component is necessary to - // avoid all the annoying problems with toolbars dissapearing. - m_mainform = XtVaCreateManagedWidget("mainForm", - xmFormWidgetClass, - m_chromeparent, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - NULL); - - m_viewparent = XtVaCreateManagedWidget("viewParent", - xmFormWidgetClass, - m_mainform, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - NULL); - if (chromespec) { m_chrome_close_callback = chromespec->close_callback; @@ -957,20 +947,8 @@ XFE_Frame::XFE_Frame(char *name, if (needToolbox) { // Create the toolbox as a child of the main form - m_toolbox = new XFE_Toolbox(this,m_mainform); + m_toolbox = new XFE_Toolbox(this,m_chrome); - // I was having trouble with the frame geomtry because of the - // dynamic nature of the toolbox (ie, collapsing toolbars) so - // i had to add this function which takes care of all the - // layout for the main form, toolbox and possibly the above_view - // component. - // - // This function installs the event handers and callbacks needed - // to support the this. There is probably a more sane way of - // accomplishing this, bug we ran out of time for 4.x and - // this works. - XfeToolBoxAddLayoutSupport(m_mainform,m_toolbox->getBaseWidget()); - // Notify when a toolbox item is snapped in place m_toolbox->registerInterest( XFE_Toolbox::toolbarSnap, @@ -1038,8 +1016,6 @@ XFE_Frame::XFE_Frame(char *name, m_view = NULL; m_belowview = NULL; - m_attachmentsNeeded = True; - if (needNavigationToolbar) { m_toolbar->registerInterest(Command::doCommandCallback, @@ -1196,108 +1172,150 @@ XFE_Frame::~XFE_Frame() // XFE_MozillaApp::theApp()->unregisterFrame(this); } - +////////////////////////////////////////////////////////////////////////// +// +// This method creates the toplevel shell of this frame. It handles +// modality here as well. So, as an offshoot, we can now support +// any type of modal window, not just dialogs. +// +////////////////////////////////////////////////////////////////////////// void -XFE_Frame::createShellAndChromeParent(char *name, Widget parent) +XFE_Frame::createBaseWidgetShell(Widget parent,String name) { - Arg av[20]; - int ac; - Widget shell; + XP_ASSERT( XfeIsAlive(parent) ); + XP_ASSERT( name != NULL ); - ac = 0; - - XtSetArg (av[ac], XmNvisual, XFE_DisplayFactory::theFactory()->getVisual()); ac++; - XtSetArg (av[ac], XmNdepth, XFE_DisplayFactory::theFactory()->getVisualDepth()); ac++; + Arg av[20]; + Cardinal ac = 0; + Widget shell = NULL; + + XtSetArg(av[ac], XmNvisual, XFE_DisplayFactory::theFactory()->getVisual()); ac++; + XtSetArg(av[ac], XmNdepth, XFE_DisplayFactory::theFactory()->getVisualDepth()); ac++; if (m_haveHTMLDisplay) - { - /* we only need our own colormap if we're displaying html */ - m_cmap = XFE_DisplayFactory::theFactory()->getPrivateColormap(); - - XtSetArg (av[ac], XmNcolormap, fe_getColormap(m_cmap)); ac++; - } + { + /* we only need our own colormap if we're displaying html */ + m_cmap = XFE_DisplayFactory::theFactory()->getPrivateColormap(); + + XtSetArg (av[ac], XmNcolormap, fe_getColormap(m_cmap)); ac++; + } else - { - m_cmap = XFE_DisplayFactory::theFactory()->getSharedColormap(); - - XtSetArg (av[ac], XmNcolormap, fe_getColormap(m_cmap)); ac++; - } + { + m_cmap = XFE_DisplayFactory::theFactory()->getSharedColormap(); + + XtSetArg (av[ac], XmNcolormap, fe_getColormap(m_cmap)); ac++; + } XtSetArg (av[ac], XmNallowShellResize, False); ac++; - + // I think we should deal with modality in XfeFrameShell...that + // would simplify XFE_Frame a lot. -re if (m_ismodal && m_parentframe) + { + XtSetArg (av[ac], XmNdialogType, XmDIALOG_PROMPT); ac++; + XtSetArg (av[ac], XmNautoUnmanage, False); ac++; + XtSetArg (av[ac], XmNborderWidth, 0); ac++; + + XtSetArg (av[ac], XmNautoUnmanage, False); ac++; + XtSetArg (av[ac], XmNmarginWidth, 0); ac++; + XtSetArg (av[ac], XmNmarginHeight, 0); ac++; + XtSetArg (av[ac], XmNdialogStyle, XmDIALOG_PRIMARY_APPLICATION_MODAL); ac++; + + XtSetArg (av[ac], XmNnoResize, !m_allowresize); ac++; + XtSetArg (av[ac], XmNresizePolicy, XmRESIZE_ANY); ac++; + + shell = XmCreateDialogShell(m_parentframe->getDialogParent(), + name,av,ac); + + MWContext *fooContext = fe_WidgetToMWContext(m_parentframe->getDialogParent()); + + if (fooContext && ViewGlue_getFrame(fooContext) != NULL) { - XtSetArg (av[ac], XmNdialogType, XmDIALOG_PROMPT); ac++; - XtSetArg (av[ac], XmNautoUnmanage, False); ac++; - XtSetArg (av[ac], XmNborderWidth, 0); ac++; - - XtSetArg (av[ac], XmNautoUnmanage, False); ac++; - XtSetArg (av[ac], XmNmarginWidth, 0); ac++; - XtSetArg (av[ac], XmNmarginHeight, 0); ac++; - XtSetArg (av[ac], XmNdialogStyle, XmDIALOG_PRIMARY_APPLICATION_MODAL); ac++; - - XtSetArg (av[ac], XmNnoResize, !m_allowresize); ac++; - XtSetArg (av[ac], XmNresizePolicy, XmRESIZE_ANY); ac++; + m_parentframe = ViewGlue_getFrame(fooContext); - m_chromeparent = XmCreateFormDialog(m_parentframe->getDialogParent(), - "form", av, ac); - - shell = XtParent(m_chromeparent); - - MWContext *fooContext = fe_WidgetToMWContext(m_parentframe->getDialogParent()); - - if (fooContext && ViewGlue_getFrame(fooContext) != NULL) - { - m_parentframe = ViewGlue_getFrame(fooContext); - - fe_ProtectContext(m_parentframe->getContext()); - } + fe_ProtectContext(m_parentframe->getContext()); } + } else + { + m_ismodal = False; + + // Warning Warning!! + + // This hackery must die. It will go away as soon as the + // XfeFrameShell widget supports all the XmNiconic magic + // and friends. + // + // -ramiro + + // Make sure the iconic state is set before the shell gets + // created or else it does not work + if (!fe_GetCommandLineDone() && + fe_globalData.startup_iconic && + !m_chromespec_provided) { - m_ismodal = False; - - // Make sure the iconic state is set before the shell gets - // created or else it does not work - if (!fe_GetCommandLineDone() && - fe_globalData.startup_iconic && - !m_chromespec_provided) - { - XtSetArg (av[ac], XmNinitialState, IconicState); ac++; - XtSetArg (av[ac], XmNiconic, True); ac++; - } - - shell = XfeCreateFrameShell(parent,name,av,ac); - - m_chromeparent = XtCreateManagedWidget("form", - xmFormWidgetClass, - shell, - NULL, 0); - - XtAddEventHandler(shell, StructureNotifyMask, - True, (XtEventHandler)resizeHandler, - (XtPointer)this); - - if (!m_allowresize) - { - XtVaSetValues(shell, - XmNmwmFunctions, - MWM_FUNC_ALL|MWM_FUNC_RESIZE|MWM_FUNC_MAXIMIZE, - NULL); - } + XtSetArg (av[ac], XmNinitialState, IconicState); ac++; + XtSetArg (av[ac], XmNiconic, True); ac++; } + + shell = XfeCreateFrameShell(parent,name,av,ac); + + // This hackery must die too. It will go away as soon as the + // XfeFrameShell widget supports XmNresizeCallback and + // XmNmoveCallback. + XtAddEventHandler(shell, StructureNotifyMask, + True, (XtEventHandler)resizeHandler, + (XtPointer)this); + + if (!m_allowresize) + { + XtVaSetValues(shell, + XmNmwmFunctions, + MWM_FUNC_ALL|MWM_FUNC_RESIZE|MWM_FUNC_MAXIMIZE, + NULL); + } + } - + // This hackery must die too. It will go away as soon as the + // XfeFrameShell widget supports XmNtrackEditres #ifndef __sgi XtAddEventHandler(shell, (EventMask)0, True, (XtEventHandler)_XEditResCheckMessages, 0); #endif + XP_ASSERT( XfeIsAlive(shell) ); + setBaseWidget(shell); installDestroyHandler(); } +////////////////////////////////////////////////////////////////////////// +// +// This method creates the chrome manager. The chrome manager +// takes care of placing all the chrome elements. +// +////////////////////////////////////////////////////////////////////////// +void +XFE_Frame::createChromeManager(Widget parent,String name) +{ + XP_ASSERT( XfeIsAlive(parent) ); + XP_ASSERT( name != NULL ); + XP_ASSERT( m_chrome == NULL ); + + m_chrome = XtVaCreateWidget(name, + xfeChromeWidgetClass, + m_widget, + XmNusePreferredWidth, False, + XmNusePreferredHeight, False, + NULL); + + // Manage the chrome widget if we are not modal. + if (!m_ismodal) + { + XtManageChild(m_chrome); + } +} +////////////////////////////////////////////////////////////////////////// static void resizeHandler(Widget, XtPointer p, XEvent *event, Boolean *) { if (event->type == ConfigureNotify && p != 0) @@ -2125,71 +2143,6 @@ XFE_Frame::setToolbar(ToolbarSpec *toolbar_spec) return; } -void -XFE_Frame::doAttachments(XP_Bool force) -{ - Widget topguy = NULL; - Widget bottomguy = NULL; - - if (!force && !isShown()) - { - m_attachmentsNeeded = True; - return; - } - - // we lay things out from the top and bottom inward, since the view attaches - // to widgets on top and below it. - if (m_menubar && m_menubar->isShown()) - { - XtVaSetValues(m_menubar->getBaseWidget(), - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_NONE, - NULL); - topguy = m_menubar->getBaseWidget(); - } - - if (m_dashboard && m_dashboard->isShown()) - { - XtVaSetValues(m_dashboard->getBaseWidget(), - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_NONE, - NULL); - bottomguy = m_dashboard->getBaseWidget(); - } - - if (m_belowview && m_belowview->isShown()) - { - XtVaSetValues(m_belowview->getBaseWidget(), - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_NONE, - XmNbottomAttachment, (bottomguy ? XmATTACH_WIDGET : XmATTACH_FORM), - XmNbottomWidget, bottomguy, - NULL); - bottomguy = m_belowview->getBaseWidget(); - } - - // The above view component does not need to be cnfigured, since - // the mainform will take care of it. - - // Configure the main form - XtVaSetValues(m_mainform, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, (topguy ? XmATTACH_WIDGET : XmATTACH_FORM), - XmNtopWidget, topguy, - XmNbottomAttachment, (bottomguy ? XmATTACH_WIDGET : XmATTACH_FORM), - XmNbottomWidget, bottomguy, - NULL); - - // Attachments not needed anymore - m_attachmentsNeeded = False; -} - int XFE_Frame::getSecurityStatus() { @@ -2241,7 +2194,8 @@ XFE_Frame::realize() { Widget widget; /* the widget we want to realize */ - widget = m_ismodal ? m_chromeparent : m_widget; +// widget = m_ismodal ? m_chromeparent : m_widget; + widget = m_widget; if (!XtIsRealized(widget)) { @@ -2250,12 +2204,13 @@ XFE_Frame::realize() // Configure the logo for the first time configureLogo(); - - // Do attachments if needed - if (m_attachmentsNeeded) - { - doAttachments(True); - } + + // Warning Warning!! + + // All this geometry and command line hackery makes me sick. + // The XfeFrameShell widget will eventually take care of all this + // + // -ramiro // // The forcing and saving of prefs should only happen if a chromespec @@ -2289,6 +2244,11 @@ XFE_Frame::realize() Position fy; Dimension fwidth; Dimension fheight; + + // I've found that this does not always work. More + // testing is needed to make sure that this works on + // all window managers. For sure, the function could + // probably be made more robust via some cleverness... -re // Get geometry from the app shell's XmNgeometry mask = XfeShellGetGeometryFromResource(shell,&fx,&fy, @@ -2339,6 +2299,15 @@ XFE_Frame::realize() XtRealizeWidget(widget); + // Add the most disgusting feature in the universe to XMozilla: + // Z-Axis fascist hackery, puke puke puke. + + // Yeah...About a year ago I as given Netcaster koolaid to drink. + // After drinking the sutff, I realized how the webtop would + // take over the universe and added the zaxis hackery support + // needed by the webtop - there remained a funny feeling in my + // stomach, though... -ramiro + // Add z order support if needed if (XtIsTopLevelShell(m_widget) && m_chromespec_provided) { @@ -2367,7 +2336,8 @@ XFE_Frame::realize() (XFE_FunctionNotification)updateBusyState_cb, (void*)False); - hackTranslations(m_chromeparent); // XX assumes that the m_chromparent is the child of the shell + // XX assumes that the m_chromparent is the child of the shell + hackTranslations(m_chrome); notifyInterested(XFE_Component::afterRealizeCallback); @@ -2423,12 +2393,19 @@ XFE_Frame::show() for (cons = fe_all_MWContexts ; cons; cons = cons->next) fe_fixFocusAndGrab(cons->context); // XXXX No looping over contexts!!! - D(printf ("Managing chrome parent\n");) + D(printf ("Managing chrome widget\n");) - XtManageChild(m_chromeparent); + XtManageChild(m_chrome); } else { + // Warning Warning!! + + // All this geometry and command line hackery makes me sick. + // The XfeFrameShell widget will eventually take care of all this + // + // -ramiro + // Do not XtPopup() an iconic shell the first time it is // shown and the command line is still being processed. // @@ -2492,7 +2469,7 @@ void XFE_Frame::hide() { if (m_ismodal) - XtUnmanageChild(m_chromeparent); + XtUnmanageChild(m_chrome); else XtPopdown(m_widget); } @@ -2743,9 +2720,6 @@ XFE_Frame::respectChrome(Chrome * chrome) else if (m_bottommost) XLowerWindow(XtDisplay(m_widget), XtWindow(m_widget)); } - - // Do the attachments just in case - doAttachments(); } XFE_View * @@ -3077,22 +3051,12 @@ XFE_Frame::setHeight(int height) NULL); } -Widget -XFE_Frame::getViewParent() -{ - return m_viewparent; -} - -Widget -XFE_Frame::getMainForm() -{ - return m_mainform; -} - Widget XFE_Frame::getChromeParent() { - return m_chromeparent; + XP_ASSERT( XfeIsAlive(m_chrome) ); + + return m_chrome; } Widget @@ -3113,30 +3077,37 @@ XFE_Frame::getContext() return m_context; } +////////////////////////////////////////////////////////////////////////// void XFE_Frame::setView(XFE_View *new_view) { - XP_ASSERT(m_view == NULL); + XP_ASSERT( XfeIsAlive(m_chrome) ); m_view = new_view; - doAttachments(); + XtVaSetValues(m_chrome,XmNcenterView,m_view->getBaseWidget(),NULL); } - +////////////////////////////////////////////////////////////////////////// void XFE_Frame::setAboveViewArea(XFE_Component *above_view) { - m_aboveview = above_view; - doAttachments(); -} + XP_ASSERT( XfeIsAlive(m_chrome) ); + m_aboveview = above_view; + + XtVaSetValues(m_chrome,XmNtopView,m_aboveview->getBaseWidget(),NULL); +} +////////////////////////////////////////////////////////////////////////// void XFE_Frame::setBelowViewArea(XFE_Component *below_view) { - m_belowview = below_view; - doAttachments(); -} + XP_ASSERT( XfeIsAlive(m_chrome) ); + m_belowview = below_view; + + XtVaSetValues(m_chrome,XmNbottomView,m_belowview->getBaseWidget(),NULL); +} +////////////////////////////////////////////////////////////////////////// void XFE_Frame::setTitle(char *title) { @@ -3373,10 +3344,6 @@ XFE_Frame::doCommand(CommandType cmd, void *calldata, XFE_CommandInfo* info) else m_menubar->show(); - // there should probably another way to do this... This seems fairly - // expensive. - doAttachments(); - notifyInterested(XFE_View::chromeNeedsUpdating); } } @@ -3389,9 +3356,6 @@ XFE_Frame::doCommand(CommandType cmd, void *calldata, XFE_CommandInfo* info) // Configure the logo configureLogo(); - // Do the attachments - doAttachments(); - // Update prefs toolboxItemChangeShowing(m_toolbar); @@ -3537,7 +3501,7 @@ XFE_Frame::doCommand(CommandType cmd, void *calldata, XFE_CommandInfo* info) if (m_belowview) delete m_belowview; - minibuffer = new XFE_Minibuffer(this, getChromeParent()); + minibuffer = new XFE_Minibuffer(this,m_chrome); minibuffer->show(); setBelowViewArea(minibuffer); } diff --git a/mozilla/cmd/xfe/src/Frame.h b/mozilla/cmd/xfe/src/Frame.h index c8f953ee896..4788e5bc145 100644 --- a/mozilla/cmd/xfe/src/Frame.h +++ b/mozilla/cmd/xfe/src/Frame.h @@ -136,8 +136,6 @@ public: virtual int getWidth(); virtual int getHeight(); - virtual Widget getViewParent(); - virtual Widget getMainForm(); virtual Widget getChromeParent(); virtual Widget getDialogParent(); virtual fe_colormap *getColormap(); @@ -224,11 +222,6 @@ public: // returns False if javascript has said the window is unclosable. XP_Bool isWMClosable(); - // recomputes the attachments for our chunks. If force is false, - // we put off the layout if the Frame is not popped up, until it - // is popped up. - void doAttachments(XP_Bool force = False); - // Returns the index for the security status icon // (differs between mail & browser) virtual int getSecurityStatus(); @@ -273,11 +266,14 @@ protected: // shown, but after it is realized. void realize(); - // this method creates the toplevel shell of this frame. It handles + // This method creates the toplevel shell of this frame. It handles // modality here as well. So, as an offshoot, we can now support // any type of modal window, not just dialogs. - void createShellAndChromeParent(char *name, - Widget parent); + void createBaseWidgetShell(Widget parent,String name); + + // This method creates the chrome manager. The chrome manager + // takes care of placing all the chrome elements. + void createChromeManager(Widget parent,String name); // The bastard catch all structure from hell. It is here now, since // it represents for all the FE code one toplevel window. @@ -290,19 +286,10 @@ protected: // Add Z order support void zaxis_AddSupport(); - // baseWidget() in case of a frame points to the shell. - - // the widget used as the parent of the view - Widget m_viewparent; - - // the widget used as the parent of the m_view_parent, toolbox and above_view - Widget m_mainform; - - // the widget used as the parent for all the chrome. - Widget m_chromeparent; + // Widget that manages all the chrome + Widget m_chrome; XFE_MenuBar * m_menubar; -// XFE_ToolboxItem * m_toolbar; XFE_Toolbar * m_toolbar; XFE_Toolbox * m_toolbox; XFE_Component * m_aboveview; @@ -385,7 +372,6 @@ protected: XP_Bool m_haveHTMLDisplay; XP_Bool m_destroyOnClose; - XP_Bool m_attachmentsNeeded; // if we defer the attachments, this will be true. Widget m_toplevelWidget; // the parent widget to this window static MenuSpec new_menu_spec[]; diff --git a/mozilla/cmd/xfe/src/HTMLDialogFrame.cpp b/mozilla/cmd/xfe/src/HTMLDialogFrame.cpp index fcf6283f364..b94f614ff0e 100644 --- a/mozilla/cmd/xfe/src/HTMLDialogFrame.cpp +++ b/mozilla/cmd/xfe/src/HTMLDialogFrame.cpp @@ -51,19 +51,12 @@ XFE_HTMLDialogFrame::XFE_HTMLDialogFrame(Widget toplevel, D(printf ("in XFE_HTMLDialogFrame::XFE_HTMLDialogFrame()\n");) - htmlview = new XFE_HTMLView(this, getViewParent(), NULL, m_context); + htmlview = new XFE_HTMLView(this, getChromeParent(), NULL, m_context); setView(htmlview); fe_set_scrolled_default_size(m_context); - XtVaSetValues(htmlview->getBaseWidget(), - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - NULL); - htmlview->show(); respectChrome(chrome_spec); diff --git a/mozilla/cmd/xfe/src/HistoryFrame.cpp b/mozilla/cmd/xfe/src/HistoryFrame.cpp index 9e285ea5dc7..2e70858d758 100644 --- a/mozilla/cmd/xfe/src/HistoryFrame.cpp +++ b/mozilla/cmd/xfe/src/HistoryFrame.cpp @@ -110,15 +110,12 @@ XFE_HistoryFrame::XFE_HistoryFrame(Widget toplevel, XFE_Frame *parent_frame, Chr FRAME_HISTORY, chromespec, False, True, False, True, False) { // create the History view - XFE_HistoryView *view = new XFE_HistoryView(this, getViewParent(), NULL, m_context); - setView(view); + XFE_HistoryView *view = new XFE_HistoryView(this, + getChromeParent(), + NULL, + m_context); - XtVaSetValues(view->getBaseWidget(), - XmNleftAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - NULL); + setView(view); setMenubar(menu_bar_spec); @@ -138,6 +135,8 @@ XFE_HistoryFrame::XFE_HistoryFrame(Widget toplevel, XFE_Frame *parent_frame, Chr m_dashboard->setShowStatusBar(True); m_dashboard->setShowProgressBar(True); + + resize(600,580); //XXX Default size for now } ////////////////////////////////////////////////////////////////////////// XFE_HistoryFrame::~XFE_HistoryFrame() diff --git a/mozilla/cmd/xfe/src/LdapSearchFrame.cpp b/mozilla/cmd/xfe/src/LdapSearchFrame.cpp index e5a4193bb4e..f9c0ca1640a 100644 --- a/mozilla/cmd/xfe/src/LdapSearchFrame.cpp +++ b/mozilla/cmd/xfe/src/LdapSearchFrame.cpp @@ -34,7 +34,7 @@ XFE_LdapSearchFrame::XFE_LdapSearchFrame(Widget toplevel, { XFE_LdapSearchView *view = new XFE_LdapSearchView(this, - getViewParent(), + getChromeParent(), this, NULL, m_context, diff --git a/mozilla/cmd/xfe/src/MNSearchFrame.cpp b/mozilla/cmd/xfe/src/MNSearchFrame.cpp index ac13eceb206..46aa35f6d20 100644 --- a/mozilla/cmd/xfe/src/MNSearchFrame.cpp +++ b/mozilla/cmd/xfe/src/MNSearchFrame.cpp @@ -48,7 +48,7 @@ XFE_MNSearchFrame::XFE_MNSearchFrame(Widget toplevel, XFE_Frame *parent_frame, XP_ASSERT(mnview != NULL); XFE_MNSearchView *view = new XFE_MNSearchView(this, - getViewParent(), + getChromeParent(), this, mnview, m_context, diff --git a/mozilla/cmd/xfe/src/MailDownloadFrame.cpp b/mozilla/cmd/xfe/src/MailDownloadFrame.cpp index 109d98c1782..b9d4d577f31 100644 --- a/mozilla/cmd/xfe/src/MailDownloadFrame.cpp +++ b/mozilla/cmd/xfe/src/MailDownloadFrame.cpp @@ -196,7 +196,7 @@ XFE_MailDownloadFrame::XFE_MailDownloadFrame(Widget toplevel, { Widget form; - XFE_MailDownloadView *v = new XFE_MailDownloadView(this, getViewParent(), + XFE_MailDownloadView *v = new XFE_MailDownloadView(this, getChromeParent(), NULL, m_context, parent_pane); XFE_Component *belowView; diff --git a/mozilla/cmd/xfe/src/MsgFrame.cpp b/mozilla/cmd/xfe/src/MsgFrame.cpp index 4ace671f606..784a27827fa 100644 --- a/mozilla/cmd/xfe/src/MsgFrame.cpp +++ b/mozilla/cmd/xfe/src/MsgFrame.cpp @@ -266,7 +266,7 @@ XFE_MsgFrame::XFE_MsgFrame(Widget toplevel, XFE_Frame *parent_frame, Chrome *chr // create the msg view XFE_MsgView *mview; - mview = new XFE_MsgView(this, getViewParent(), NULL, m_context); + mview = new XFE_MsgView(this, getChromeParent(), NULL, m_context); mview->registerInterest(XFE_MsgView::spacebarAtMsgBottom, this, (XFE_FunctionNotification)spaceAtMsgEnd_cb); @@ -283,13 +283,6 @@ XFE_MsgFrame::XFE_MsgFrame(Widget toplevel, XFE_Frame *parent_frame, Chrome *chr setView(mview); - XtVaSetValues(mview->getBaseWidget(), - XmNleftAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - NULL); - setMenubar(menu_bar_spec); setToolbar(toolbar_spec); @@ -377,9 +370,6 @@ XFE_MsgFrame::doCommand(CommandType cmd, // Configure the logo configureLogo(); - // Do the attachments - doAttachments(); - // Update prefs toolboxItemChangeShowing(m_banner); diff --git a/mozilla/cmd/xfe/src/NavCenterFrame.cpp b/mozilla/cmd/xfe/src/NavCenterFrame.cpp index 04578a669dd..427c29285e5 100644 --- a/mozilla/cmd/xfe/src/NavCenterFrame.cpp +++ b/mozilla/cmd/xfe/src/NavCenterFrame.cpp @@ -62,18 +62,11 @@ XFE_NavCenterFrame::XFE_NavCenterFrame(Widget toplevel, D(printf("XFE_NavCenterFrame SUB-SYSTEM INSTANCIATING\n");) // create the bookmark view - XFE_View *view = new XFE_NavCenterView(this, getViewParent(), + XFE_View *view = new XFE_NavCenterView(this, getChromeParent(), NULL, m_context); setView(view); setMenubar(menu_bar_spec); - XtVaSetValues(view->getBaseWidget(), - XmNleftAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - NULL); - //setMenubar(menu_bar_spec); #ifdef NOTYET diff --git a/mozilla/cmd/xfe/src/ThreadFrame.cpp b/mozilla/cmd/xfe/src/ThreadFrame.cpp index f920d00eb3f..21a9cf39419 100644 --- a/mozilla/cmd/xfe/src/ThreadFrame.cpp +++ b/mozilla/cmd/xfe/src/ThreadFrame.cpp @@ -334,12 +334,12 @@ XFE_ThreadFrame::XFE_ThreadFrame(Widget toplevel, XFE_Frame *parent_frame, m_banner->setShowFolder(show_folder); /* This has to be set before view creation */ - view3 = new XFE_ThreePaneView(this, getViewParent(), NULL, m_context); + view3 = new XFE_ThreePaneView(this, getChromeParent(), NULL, m_context); tview = (XFE_ThreadView*)(view3->getThreadView()); #else - tview = new XFE_ThreadView(this, getViewParent(), NULL, m_context); + tview = new XFE_ThreadView(this, getChromeParent(), NULL, m_context); #endif @@ -358,21 +358,8 @@ XFE_ThreadFrame::XFE_ThreadFrame(Widget toplevel, XFE_Frame *parent_frame, #ifdef USE_3PANE setView(view3); - XtVaSetValues(view3->getBaseWidget(), - XmNleftAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - NULL); #else setView(tview); - - XtVaSetValues(tview->getBaseWidget(), - XmNleftAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - NULL); #endif @@ -896,9 +883,6 @@ XFE_ThreadFrame::doCommand(CommandType cmd, // Configure the logo configureLogo(); - // Do the attachments - doAttachments(); - // Update prefs toolboxItemChangeShowing(m_banner); diff --git a/mozilla/cmd/xfe/src/Toolbox.cpp b/mozilla/cmd/xfe/src/Toolbox.cpp index 855061649f6..b196460f11f 100644 --- a/mozilla/cmd/xfe/src/Toolbox.cpp +++ b/mozilla/cmd/xfe/src/Toolbox.cpp @@ -286,9 +286,7 @@ XFE_Toolbox::createMain(Widget parent) xfeToolBoxWidgetClass, parent, XmNusePreferredWidth, False, -// XmNusePreferredHeight, True, - XmNusePreferredHeight, False, - XmNheight, 200, + XmNusePreferredHeight, True, NULL); // Create all the tab icons diff --git a/mozilla/cmd/xfe/src/context_funcs.cpp b/mozilla/cmd/xfe/src/context_funcs.cpp index e42c8a37d85..c964e52a1c8 100644 --- a/mozilla/cmd/xfe/src/context_funcs.cpp +++ b/mozilla/cmd/xfe/src/context_funcs.cpp @@ -1137,7 +1137,6 @@ FE_UpdateChrome(MWContext *context, /* in */ if (frame == NULL) return; frame->respectChrome(chrome); - frame->doAttachments(); } #ifdef MOZ_LDAP