home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / feorphn2.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  4.1 KB  |  129 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #include "stdafx.h"
  20.  
  21. #include "ipframe.h"
  22. #include "netsdoc.h"
  23. #include "mainfrm.h"
  24. #include "netsvw.h"
  25. #include "template.h"
  26. #ifdef MOZ_MAIL_NEWS
  27. #include "addrfrm.h"
  28. #include "compfrm.h"
  29. #endif
  30. #ifdef EDITOR
  31. #include "edview.h"
  32. #include "edframe.h"
  33. #endif
  34.  
  35. /////////////////////////////////////////////
  36. //
  37. // Initialize our templates here so that we
  38. // Don't have to include every doc, view, and
  39. // frame header in netscape.cpp
  40. //
  41. // Returns our choice of startup template,
  42. // NULL on failure
  43. //
  44.  
  45. CDocTemplate *WFE_InitializeTemplates()
  46. {
  47.     // Register the application's document templates.  Document templates
  48.     //    serve as the connection between documents, frame windows and views.
  49.     theApp.m_ViewTmplate = new CNetscapeDocTemplate(IDR_MAINFRAME,
  50.         RUNTIME_CLASS(CNetscapeDoc),
  51.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  52.         RUNTIME_CLASS(CNetscapeView));
  53.  
  54. #ifdef MOZ_MAIL_NEWS
  55.     theApp.m_AddrTemplate = new CNetscapeAddrTemplate(IDR_ADDRESS_MENU,
  56.         RUNTIME_CLASS(CNetscapeDoc),
  57.         RUNTIME_CLASS(CAddrFrame),            // address book window
  58.         RUNTIME_CLASS(CNetscapeView));
  59.  
  60.     theApp.m_TextComposeTemplate = new CNetscapeTextComposeTemplate(IDR_COMPOSEPLAIN,
  61.         RUNTIME_CLASS(CNetscapeDoc),
  62.         RUNTIME_CLASS(CComposeFrame),
  63.         RUNTIME_CLASS(CNetscapeEditView));
  64.  
  65.     theApp.m_ComposeTemplate = new CNetscapeComposeTemplate(IDR_COMPOSEFRAME,
  66.         RUNTIME_CLASS(CNetscapeDoc),
  67.         RUNTIME_CLASS(CComposeFrame),
  68.         RUNTIME_CLASS(CNetscapeEditView));
  69. #endif // MOZ_MAIL_NEWS
  70.  
  71. #ifdef EDITOR
  72. // CLM - Template for Editor frame and view - both derived from browser
  73.     theApp.m_EditTmplate = new CNetscapeEditTemplate(IDR_EDITFRAME,
  74.         RUNTIME_CLASS(CNetscapeDoc),
  75.         RUNTIME_CLASS(CEditFrame),        // Derived from CMainFrame
  76.         RUNTIME_CLASS(CNetscapeEditView));    // Derived from CNetscapeView
  77. #endif // EDITOR
  78.  
  79. #ifdef MOZ_MAIL_NEWS
  80.     if (!theApp.m_AddrTemplate) return NULL;
  81.     if (!theApp.m_ComposeTemplate) return NULL;
  82.     if (!theApp.m_TextComposeTemplate) return NULL;
  83. #endif // MOZ_MAIL_NEWS
  84.     if (!theApp.m_ViewTmplate) return NULL;
  85.  
  86. #ifdef EDITOR
  87.     if (!theApp.m_EditTmplate) return NULL;
  88. #endif
  89.  
  90.     theApp.AddDocTemplate(theApp.m_ViewTmplate);
  91. #ifdef MOZ_MAIL_NEWS
  92.     theApp.AddDocTemplate(theApp.m_ComposeTemplate);
  93.     theApp.AddDocTemplate(theApp.m_TextComposeTemplate);
  94.     theApp.AddDocTemplate(theApp.m_AddrTemplate);
  95. #endif // MOZ_MAIL_NEWS
  96.  
  97. #ifdef EDITOR
  98.     theApp.AddDocTemplate(theApp.m_EditTmplate);
  99. #endif
  100.  
  101.     // Select which template to use at startup
  102.     CDocTemplate *pTemplate;
  103. #ifdef EDITOR
  104.     BOOL bEditFrame = (bIsGold && theApp.m_bCmdEdit);
  105.     if( bEditFrame ){
  106.         pTemplate = (CDocTemplate*)theApp.m_EditTmplate;
  107.     } else 
  108. #endif
  109.     {
  110.         pTemplate = (CDocTemplate*)theApp.m_ViewTmplate;
  111.     }
  112.  
  113.     //  In Place Container menu and accelerators....
  114.     pTemplate->SetContainerInfo(IDR_NETSCAPETYPE_CNTR_IP);
  115.  
  116.     //    See srvritem.cpp for this code (delays loading menus until needed).
  117.     //    Register the OLE server portion.
  118. //#ifdef DEBUG
  119.     //    To avoid assertion in debug mode, let it load from the start.
  120.     pTemplate->SetServerInfo(IDR_SRVR_EMBEDDED, IDR_SRVR_INPLACE,
  121.             RUNTIME_CLASS(CInPlaceFrame), RUNTIME_CLASS(CNetscapeView));
  122. //#else
  123. //    pTemplate->SetServerInfo(NULL, NULL,
  124. //    RUNTIME_CLASS(CInPlaceFrame), RUNTIME_CLASS(CNetscapeView));
  125. //#endif
  126.  
  127.     return pTemplate;
  128. }
  129.