source: abuse/branches/win32/LispEditor/LispEditor.cpp @ 608

Last change on this file since 608 was 100, checked in by Sam Hocevar, 15 years ago
  • Importing an old Win32 port by Jeremy "Marauder" Scott.
  • Property svn:keywords set to Id
File size: 4.7 KB
Line 
1// LispEditor.cpp : Defines the class behaviors for the application.
2//
3
4#include "stdafx.h"
5#include "LispEditor.h"
6
7#include "MainFrm.h"
8#include "ChildFrm.h"
9#include "LispEditorDoc.h"
10#include "LispEditorView.h"
11
12#ifdef _DEBUG
13#define new DEBUG_NEW
14#undef THIS_FILE
15static char THIS_FILE[] = __FILE__;
16#endif
17
18/////////////////////////////////////////////////////////////////////////////
19// CLispEditorApp
20
21BEGIN_MESSAGE_MAP(CLispEditorApp, CWinApp)
22        //{{AFX_MSG_MAP(CLispEditorApp)
23        ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
24                // NOTE - the ClassWizard will add and remove mapping macros here.
25                //    DO NOT EDIT what you see in these blocks of generated code!
26        //}}AFX_MSG_MAP
27        // Standard file based document commands
28        ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
29        ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
30        // Standard print setup command
31        ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
32END_MESSAGE_MAP()
33
34/////////////////////////////////////////////////////////////////////////////
35// CLispEditorApp construction
36
37CLispEditorApp::CLispEditorApp()
38{
39        // TODO: add construction code here,
40        // Place all significant initialization in InitInstance
41}
42
43/////////////////////////////////////////////////////////////////////////////
44// The one and only CLispEditorApp object
45
46CLispEditorApp theApp;
47
48/////////////////////////////////////////////////////////////////////////////
49// CLispEditorApp initialization
50
51BOOL CLispEditorApp::InitInstance()
52{
53        // Initialize OLE libraries
54        if (!AfxOleInit())
55        {
56                AfxMessageBox(IDP_OLE_INIT_FAILED);
57                return FALSE;
58        }
59
60        AfxEnableControlContainer();
61
62        // Standard initialization
63        // If you are not using these features and wish to reduce the size
64        //  of your final executable, you should remove from the following
65        //  the specific initialization routines you do not need.
66
67#ifdef _AFXDLL
68        Enable3dControls();                     // Call this when using MFC in a shared DLL
69#else
70        Enable3dControlsStatic();       // Call this when linking to MFC statically
71#endif
72
73        // Change the registry key under which our settings are stored.
74        // TODO: You should modify this string to be something appropriate
75        // such as the name of your company or organization.
76        SetRegistryKey(_T("Local AppWizard-Generated Applications"));
77
78        LoadStdProfileSettings();  // Load standard INI file options (including MRU)
79
80        // Register the application's document templates.  Document templates
81        //  serve as the connection between documents, frame windows and views.
82
83        CMultiDocTemplate* pDocTemplate;
84        pDocTemplate = new CMultiDocTemplate(
85                IDR_LISPTYPE,
86                RUNTIME_CLASS(CLispEditorDoc),
87                RUNTIME_CLASS(CChildFrame), // custom MDI child frame
88                RUNTIME_CLASS(CLispEditorView));
89        pDocTemplate->SetContainerInfo(IDR_LISPTYPE_CNTR_IP);
90        AddDocTemplate(pDocTemplate);
91
92        // create main MDI Frame window
93        CMainFrame* pMainFrame = new CMainFrame;
94        if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
95                return FALSE;
96        m_pMainWnd = pMainFrame;
97
98        // Enable drag/drop open
99        m_pMainWnd->DragAcceptFiles();
100
101        // Enable DDE Execute open
102        EnableShellOpen();
103        RegisterShellFileTypes(TRUE);
104
105        // Parse command line for standard shell commands, DDE, file open
106        CCommandLineInfo cmdInfo;
107        ParseCommandLine(cmdInfo);
108
109        // Dispatch commands specified on the command line
110        if (!ProcessShellCommand(cmdInfo))
111                return FALSE;
112
113        // The main window has been initialized, so show and update it.
114        pMainFrame->ShowWindow(m_nCmdShow);
115        pMainFrame->UpdateWindow();
116
117        return TRUE;
118}
119
120
121/////////////////////////////////////////////////////////////////////////////
122// CAboutDlg dialog used for App About
123
124class CAboutDlg : public CDialog
125{
126public:
127        CAboutDlg();
128
129// Dialog Data
130        //{{AFX_DATA(CAboutDlg)
131        enum { IDD = IDD_ABOUTBOX };
132        //}}AFX_DATA
133
134        // ClassWizard generated virtual function overrides
135        //{{AFX_VIRTUAL(CAboutDlg)
136        protected:
137        virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
138        //}}AFX_VIRTUAL
139
140// Implementation
141protected:
142        //{{AFX_MSG(CAboutDlg)
143                // No message handlers
144        //}}AFX_MSG
145        DECLARE_MESSAGE_MAP()
146};
147
148CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
149{
150        //{{AFX_DATA_INIT(CAboutDlg)
151        //}}AFX_DATA_INIT
152}
153
154void CAboutDlg::DoDataExchange(CDataExchange* pDX)
155{
156        CDialog::DoDataExchange(pDX);
157        //{{AFX_DATA_MAP(CAboutDlg)
158        //}}AFX_DATA_MAP
159}
160
161BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
162        //{{AFX_MSG_MAP(CAboutDlg)
163                // No message handlers
164        //}}AFX_MSG_MAP
165END_MESSAGE_MAP()
166
167// App command to run the dialog
168void CLispEditorApp::OnAppAbout()
169{
170        CAboutDlg aboutDlg;
171        aboutDlg.DoModal();
172}
173
174/////////////////////////////////////////////////////////////////////////////
175// CLispEditorApp message handlers
176
Note: See TracBrowser for help on using the repository browser.