// Princed V3.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "Princed V3.h"
#include "MainFrm.h"
#include "ChildFrm.h"
#include "maps.h"
#include "Princed V3Doc.h"
#include "Princed V3View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPrincedV3App
BEGIN_MESSAGE_MAP(CPrincedV3App, CWinApp)
//{{AFX_MSG_MAP(CPrincedV3App)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
ON_COMMAND(ID_FILE_EXPORTTOIMAGE, OnFileExporttoimage)
ON_COMMAND(ID_HELP_PRINCEDHOMEPAGE, OnHelpPrincedhomepage)
ON_COMMAND(ID_ADDONS_EDITSAVEDGAME, OnAddonsEditsavedgame)
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
// Standard print setup command
//ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPrincedV3App construction
CPrincedV3App::CPrincedV3App()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CPrincedV3App object
CPrincedV3App theApp;
/////////////////////////////////////////////////////////////////////////////
// CPrincedV3App initialization
BOOL CPrincedV3App::InitInstance()
{
if (!AfxSocketInit()) {
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Princed Development Team-Princed V3"));
LoadStdProfileSettings(6); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_PRINCETYPE,
RUNTIME_CLASS(CPrincedV3Doc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CPrincedV3View));
AddDocTemplate(pDocTemplate);
// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) return FALSE;
m_pMainWnd = pMainFrame;
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if(!ProcessShellCommand(cmdInfo)) return FALSE;
// The main window has been initialized, so show and update it.
pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->UpdateWindow();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
#include "MyDialog.h"
class CAboutDlg : public CMyDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CMyDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CMyDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CMyDialog)
//{{AFX_MSG_MAP(CAboutDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CPrincedV3App::OnAppAbout()
{
CAboutDlg aboutDlg;aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CPrincedV3App message handlers
void CPrincedV3App::OnFileExporttoimage()
{
// TODO: Add your command handler code here
/*
cConfig c;
char* valor;
c.getSetting("pop1 path",valor);
msgBox(valor);
*/
}
void msgBox(char *text) {
AfxMessageBox(_T(text),MB_OK,MB_ICONINFORMATION);
}
//Open Princed's official homepage
void CPrincedV3App::OnHelpPrincedhomepage()
{
CWaitCursor cur; CString hp; hp.LoadString(IDS_PRINCED_HOMEPAGE);
::ShellExecute(*AfxGetMainWnd(), _T("open"), hp, NULL, NULL, SW_SHOW);
}
BOOL CPrincedV3App::OnIdle(LONG lCount)
{
CPrincedV3View *pView=DYNAMIC_DOWNCAST(CPrincedV3View, CWnd::GetFocus());
if(pView) return pView->HandleKey(); else return CWinApp::OnIdle(lCount);
}
void CPrincedV3App::OnAddonsEditsavedgame()
{
CDialog dlg(IDD_EDIT_SAV); dlg.DoModal();
}
BOOL CAboutDlg::OnInitDialog()
{
CMyDialog::OnInitDialog();
// TODO: Add extra initialization here
//void SetWindowText( LPCTSTR lpszString );
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}