]> icculus.org git repositories - taylor/freespace2.git/blob - src/helped/helped.cpp
Initial revision
[taylor/freespace2.git] / src / helped / helped.cpp
1 // HelpEd.cpp : Defines the class behaviors for the application.
2 //
3
4 #include "stdafx.h"
5 #include "helped.h"
6
7 #include "mainfrm.h"
8 #include "helpeddoc.h"
9 #include "helpedview.h"
10
11 #ifdef _DEBUG
12 #define new DEBUG_NEW
13 #undef THIS_FILE
14 static char THIS_FILE[] = __FILE__;
15 #endif
16
17 /////////////////////////////////////////////////////////////////////////////
18 // CHelpEdApp
19
20 BEGIN_MESSAGE_MAP(CHelpEdApp, CWinApp)
21         //{{AFX_MSG_MAP(CHelpEdApp)
22         ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
23                 // NOTE - the ClassWizard will add and remove mapping macros here.
24                 //    DO NOT EDIT what you see in these blocks of generated code!
25         //}}AFX_MSG_MAP
26         // Standard file based document commands
27         ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
28         ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
29 END_MESSAGE_MAP()
30
31 /////////////////////////////////////////////////////////////////////////////
32 // CHelpEdApp construction
33
34 CHelpEdApp::CHelpEdApp()
35 {
36         // TODO: add construction code here,
37         // Place all significant initialization in InitInstance
38 }
39
40 /////////////////////////////////////////////////////////////////////////////
41 // The one and only CHelpEdApp object
42
43 CHelpEdApp theApp;
44
45 /////////////////////////////////////////////////////////////////////////////
46 // CHelpEdApp initialization
47
48 BOOL CHelpEdApp::InitInstance()
49 {
50         // Standard initialization
51         // If you are not using these features and wish to reduce the size
52         //  of your final executable, you should remove from the following
53         //  the specific initialization routines you do not need.
54
55 #ifdef _AFXDLL
56         Enable3dControls();                     // Call this when using MFC in a shared DLL
57 #else
58         Enable3dControlsStatic();       // Call this when linking to MFC statically
59 #endif
60
61         // Change the registry key under which our settings are stored.
62         // TODO: You should modify this string to be something appropriate
63         // such as the name of your company or organization.
64         SetRegistryKey(_T("Local AppWizard-Generated Applications"));
65
66         LoadStdProfileSettings();  // Load standard INI file options (including MRU)
67
68         // Register the application's document templates.  Document templates
69         //  serve as the connection between documents, frame windows and views.
70
71         CSingleDocTemplate* pDocTemplate;
72         pDocTemplate = new CSingleDocTemplate(
73                 IDR_MAINFRAME,
74                 RUNTIME_CLASS(CHelpEdDoc),
75                 RUNTIME_CLASS(CMainFrame),       // main SDI frame window
76                 RUNTIME_CLASS(CHelpEdView));
77         AddDocTemplate(pDocTemplate);
78
79         // Enable DDE Execute open
80         EnableShellOpen();
81         RegisterShellFileTypes(TRUE);
82
83         // Parse command line for standard shell commands, DDE, file open
84         CCommandLineInfo cmdInfo;
85         ParseCommandLine(cmdInfo);
86
87         // Dispatch commands specified on the command line
88         if (!ProcessShellCommand(cmdInfo))
89                 return FALSE;
90
91         // The one and only window has been initialized, so show and update it.
92         m_pMainWnd->ShowWindow(SW_SHOW);
93         m_pMainWnd->UpdateWindow();
94
95         // Enable drag/drop open
96         m_pMainWnd->DragAcceptFiles();
97
98         return TRUE;
99 }
100
101
102 /////////////////////////////////////////////////////////////////////////////
103 // CAboutDlg dialog used for App About
104
105 class CAboutDlg : public CDialog
106 {
107 public:
108         CAboutDlg();
109
110 // Dialog Data
111         //{{AFX_DATA(CAboutDlg)
112         enum { IDD = IDD_ABOUTBOX };
113         //}}AFX_DATA
114
115         // ClassWizard generated virtual function overrides
116         //{{AFX_VIRTUAL(CAboutDlg)
117         protected:
118         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
119         //}}AFX_VIRTUAL
120
121 // Implementation
122 protected:
123         //{{AFX_MSG(CAboutDlg)
124                 // No message handlers
125         //}}AFX_MSG
126         DECLARE_MESSAGE_MAP()
127 };
128
129 CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
130 {
131         //{{AFX_DATA_INIT(CAboutDlg)
132         //}}AFX_DATA_INIT
133 }
134
135 void CAboutDlg::DoDataExchange(CDataExchange* pDX)
136 {
137         CDialog::DoDataExchange(pDX);
138         //{{AFX_DATA_MAP(CAboutDlg)
139         //}}AFX_DATA_MAP
140 }
141
142 BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
143         //{{AFX_MSG_MAP(CAboutDlg)
144                 // No message handlers
145         //}}AFX_MSG_MAP
146 END_MESSAGE_MAP()
147
148 // App command to run the dialog
149 void CHelpEdApp::OnAppAbout()
150 {
151         CAboutDlg aboutDlg;
152         aboutDlg.DoModal();
153 }
154
155 /////////////////////////////////////////////////////////////////////////////
156 // CHelpEdApp message handlers
157