| 1 |
// NewCompilerSettingsPage.cpp : implementation file |
|---|
| 2 |
// |
|---|
| 3 |
|
|---|
| 4 |
#include "stdafx.h" |
|---|
| 5 |
#include "Elephant.h" |
|---|
| 6 |
#include "NewCompilerSettingsPage.h" |
|---|
| 7 |
|
|---|
| 8 |
#ifdef _DEBUG |
|---|
| 9 |
#define new DEBUG_NEW |
|---|
| 10 |
#undef THIS_FILE |
|---|
| 11 |
static char THIS_FILE[] = __FILE__; |
|---|
| 12 |
#endif |
|---|
| 13 |
|
|---|
| 14 |
///////////////////////////////////////////////////////////////////////////// |
|---|
| 15 |
// CNewCompilerSettingsPage dialog |
|---|
| 16 |
|
|---|
| 17 |
string dmDirFromDmd(const string& text ) |
|---|
| 18 |
{ |
|---|
| 19 |
string ret = text; |
|---|
| 20 |
unsigned long pos = ret.find_last_of("\\"); |
|---|
| 21 |
ret = text.substr(0,pos); |
|---|
| 22 |
|
|---|
| 23 |
pos = ret.find_last_of("\\"); |
|---|
| 24 |
ret = text.substr(0,pos); |
|---|
| 25 |
ret += "\\dm\\bin\\"; |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
return ret; |
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
} |
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
CNewCompilerSettingsPage::CNewCompilerSettingsPage(CWnd* pParent /*=NULL*/) |
|---|
| 35 |
|
|---|
| 36 |
{ |
|---|
| 37 |
//{{AFX_DATA_INIT(CNewCompilerSettingsPage) |
|---|
| 38 |
m_ccompilerPath = Globals::settings->baseSettings->GetCache("dmcPath").c_str(); |
|---|
| 39 |
m_rcCompilerPath = Globals::settings->baseSettings->GetCache("rcPath").c_str(); |
|---|
| 40 |
m_dcompiler = Globals::settings->baseSettings->GetCache("dmdPath").c_str(); |
|---|
| 41 |
m_csMakePath = Globals::settings->baseSettings->GetCache("makePath").c_str(); |
|---|
| 42 |
//}}AFX_DATA_INIT |
|---|
| 43 |
} |
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
void CNewCompilerSettingsPage::DoDataExchange(CDataExchange* pDX) |
|---|
| 47 |
{ |
|---|
| 48 |
CDialog::DoDataExchange(pDX); |
|---|
| 49 |
//{{AFX_DATA_MAP(CNewCompilerSettingsPage) |
|---|
| 50 |
DDX_Control(pDX, IDC_EDIT16, m_makefilePath); |
|---|
| 51 |
DDX_Control(pDX, IDC_BUTTON12, m_b4); |
|---|
| 52 |
DDX_Control(pDX, IDC_EDIT7, m_rc_compilerPath); |
|---|
| 53 |
DDX_Control(pDX, IDC_EDIT15, m_c_compilerPath); |
|---|
| 54 |
DDX_Control(pDX, IDC_EDIT1, m_compilerPath); |
|---|
| 55 |
DDX_Control(pDX, IDC_BUTTON6, m_b3); |
|---|
| 56 |
DDX_Control(pDX, IDC_BUTTON2, m_b2); |
|---|
| 57 |
DDX_Control(pDX, IDC_BUTTON10, m_b1); |
|---|
| 58 |
DDX_Text(pDX, IDC_EDIT15, m_rcCompilerPath); |
|---|
| 59 |
DDX_Text(pDX, IDC_EDIT7, m_ccompilerPath); |
|---|
| 60 |
DDX_Text(pDX, IDC_EDIT1, m_dcompiler); |
|---|
| 61 |
DDX_Text(pDX, IDC_EDIT16, m_csMakePath); |
|---|
| 62 |
//}}AFX_DATA_MAP |
|---|
| 63 |
} |
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
BEGIN_MESSAGE_MAP(CNewCompilerSettingsPage, CDialog) |
|---|
| 67 |
//{{AFX_MSG_MAP(CNewCompilerSettingsPage) |
|---|
| 68 |
ON_BN_CLICKED(IDC_BUTTON2, OnDCompilerBrowse) |
|---|
| 69 |
ON_BN_CLICKED(IDC_BUTTON6, OnRCBrowse) |
|---|
| 70 |
ON_BN_CLICKED(IDC_BUTTON10, OnCCompiler) |
|---|
| 71 |
ON_BN_CLICKED(IDC_BUTTON12, OnButton12) |
|---|
| 72 |
//}}AFX_MSG_MAP |
|---|
| 73 |
END_MESSAGE_MAP() |
|---|
| 74 |
|
|---|
| 75 |
///////////////////////////////////////////////////////////////////////////// |
|---|
| 76 |
// CNewCompilerSettingsPage message handlers |
|---|
| 77 |
|
|---|
| 78 |
BOOL CNewCompilerSettingsPage::OnInitDialog() |
|---|
| 79 |
{ |
|---|
| 80 |
CDialog::OnInitDialog(); |
|---|
| 81 |
m_compilerPath.SetFont(defaultFont); |
|---|
| 82 |
m_c_compilerPath.SetFont(defaultFont); |
|---|
| 83 |
m_rc_compilerPath.SetFont(defaultFont); |
|---|
| 84 |
m_makefilePath.SetFont(defaultFont); |
|---|
| 85 |
// m_compilerPath.SetText("Path to the D compiler."); |
|---|
| 86 |
// m_c_compilerPath.SetText("Path to C compiler."); |
|---|
| 87 |
// m_rc_compilerPath.SetText("Path to resource compiler."); |
|---|
| 88 |
// m_makefilePath.SetText("Path to make.exe"); |
|---|
| 89 |
//UpdateData(FALSE); |
|---|
| 90 |
|
|---|
| 91 |
SetupButton(&m_b1); |
|---|
| 92 |
SetupButton(&m_b2); |
|---|
| 93 |
SetupButton(&m_b3); |
|---|
| 94 |
SetupButton(&m_b4); |
|---|
| 95 |
return TRUE; // return TRUE unless you set the focus to a control |
|---|
| 96 |
// EXCEPTION: OCX Property Pages should return FALSE |
|---|
| 97 |
} |
|---|
| 98 |
|
|---|
| 99 |
void CNewCompilerSettingsPage::OnDCompilerBrowse() |
|---|
| 100 |
{ |
|---|
| 101 |
UpdateData(true); |
|---|
| 102 |
string file = ""; |
|---|
| 103 |
if ( GetFileFromCFileDialog(Globals::lastDir,file,"exe","D Compiler ( *.exe)|*.exe||" ) ) |
|---|
| 104 |
{ |
|---|
| 105 |
|
|---|
| 106 |
m_dcompiler = file.c_str(); |
|---|
| 107 |
string dirPath = StripDirPath(file); |
|---|
| 108 |
if ( m_rcCompilerPath == "" ) m_rcCompilerPath = string(dmDirFromDmd(dirPath) + "rc.exe").c_str(); |
|---|
| 109 |
if ( m_ccompilerPath == "" ) m_ccompilerPath = string(dmDirFromDmd(dirPath) + "dmc.exe").c_str(); |
|---|
| 110 |
if ( m_csMakePath == "" ) m_csMakePath = string(dmDirFromDmd(dirPath) + "make.exe").c_str(); |
|---|
| 111 |
UpdateData(FALSE); |
|---|
| 112 |
} |
|---|
| 113 |
|
|---|
| 114 |
} |
|---|
| 115 |
|
|---|
| 116 |
void CNewCompilerSettingsPage::OnRCBrowse() |
|---|
| 117 |
{ |
|---|
| 118 |
string file = ""; |
|---|
| 119 |
if ( GetFileFromCFileDialog(Globals::lastDir,file,"exe","D Compiler ( *.exe)|*.exe||" ) ) |
|---|
| 120 |
{ |
|---|
| 121 |
|
|---|
| 122 |
m_rcCompilerPath = file.c_str(); |
|---|
| 123 |
UpdateData(FALSE); |
|---|
| 124 |
} |
|---|
| 125 |
} |
|---|
| 126 |
|
|---|
| 127 |
void CNewCompilerSettingsPage::OnCCompiler() |
|---|
| 128 |
{ |
|---|
| 129 |
string file = ""; |
|---|
| 130 |
if ( GetFileFromCFileDialog(Globals::lastDir,file,"exe","D Compiler ( *.exe)|*.exe||" ) ) |
|---|
| 131 |
{ |
|---|
| 132 |
m_ccompilerPath = file.c_str(); |
|---|
| 133 |
UpdateData(FALSE); |
|---|
| 134 |
} |
|---|
| 135 |
|
|---|
| 136 |
} |
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
void CNewCompilerSettingsPage::OnButton12() |
|---|
| 140 |
{ |
|---|
| 141 |
string file = ""; |
|---|
| 142 |
if ( GetFileFromCFileDialog(Globals::lastDir,file,"exe","Make( *.exe)|*.exe||" ) ) |
|---|
| 143 |
{ |
|---|
| 144 |
|
|---|
| 145 |
m_csMakePath = file.c_str(); |
|---|
| 146 |
UpdateData(FALSE); |
|---|
| 147 |
} |
|---|
| 148 |
|
|---|
| 149 |
} |
|---|