| 1 |
// MainFrm.cpp : implementation of the CMainFrame class |
|---|
| 2 |
// |
|---|
| 3 |
ID_NAVIGATION_SELECTTOOLBAR_SELECTCODETOOLBAR |
|---|
| 4 |
#include "stdafx.h" |
|---|
| 5 |
#include "Elephant.h" |
|---|
| 6 |
#include "ElSettings/elephantsettings.h" |
|---|
| 7 |
#include "MainFrm.h" |
|---|
| 8 |
#include "SettingsDlg.h" |
|---|
| 9 |
#include "NewProjectDlg.h" |
|---|
| 10 |
#include "AddNewProjectWizard.h" |
|---|
| 11 |
#include "StoreRegister.h" |
|---|
| 12 |
#include "ConfigureToolsDlg.h" |
|---|
| 13 |
#include "ManageRegistersDlg.h" |
|---|
| 14 |
#include "QuickFindAndReplaceDlg.h" |
|---|
| 15 |
#include "AdvancedFindAndReplaceDlg.h" |
|---|
| 16 |
//#include "ElProject/elproject.h" |
|---|
| 17 |
#include "Executor.h" |
|---|
| 18 |
#include "ExecuteScript.h" |
|---|
| 19 |
#include "pcre/filegrep.h" |
|---|
| 20 |
#include "parsingfunctions.h" |
|---|
| 21 |
#include"CompilerClass/compilerclass.h" |
|---|
| 22 |
#include "GUIComponents\Splasher.h" |
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
#ifdef _DEBUG |
|---|
| 27 |
#define new DEBUG_NEW |
|---|
| 28 |
#undef THIS_FILE |
|---|
| 29 |
static char THIS_FILE[] = __FILE__; |
|---|
| 30 |
#endif |
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
#define ID_RECENT_PROJECTS1 33100 |
|---|
| 34 |
#define ID_RECENT_PROJECTS2 33101 |
|---|
| 35 |
#define ID_RECENT_PROJECTS3 33102 |
|---|
| 36 |
#define ID_RECENT_PROJECTS4 33103 |
|---|
| 37 |
#define ID_RECENT_PROJECTS5 33104 |
|---|
| 38 |
|
|---|
| 39 |
#define ID_TOOLS1 1024 |
|---|
| 40 |
#define ID_TOOLS2 1025 |
|---|
| 41 |
#define ID_TOOLS3 1026 |
|---|
| 42 |
#define ID_TOOLS4 1027 |
|---|
| 43 |
#define ID_TOOLS5 1028 |
|---|
| 44 |
#define ID_TOOLS6 1029 |
|---|
| 45 |
#define ID_TOOLS7 1030 |
|---|
| 46 |
#define ID_TOOLS8 1031 |
|---|
| 47 |
#define ID_TOOLS9 1032 |
|---|
| 48 |
|
|---|
| 49 |
class CCompileSplash : public CSplashWnd |
|---|
| 50 |
{ |
|---|
| 51 |
public: |
|---|
| 52 |
//Constructors / Destructors |
|---|
| 53 |
CCompileSplash() { SetBitmapToUse(COMPILING_BMP); } |
|---|
| 54 |
|
|---|
| 55 |
DECLARE_DYNCREATE(CCompileSplash); |
|---|
| 56 |
}; |
|---|
| 57 |
|
|---|
| 58 |
IMPLEMENT_DYNCREATE(CCompileSplash, CSplashWnd); |
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
///////////////////////////////////////////////////////////////////////////// |
|---|
| 63 |
// CMainFrame |
|---|
| 64 |
|
|---|
| 65 |
IMPLEMENT_DYNAMIC(CMainFrame, CXTMDIFrameWnd) |
|---|
| 66 |
|
|---|
| 67 |
BEGIN_MESSAGE_MAP(CMainFrame, CXTMDIFrameWnd) |
|---|
| 68 |
//{{AFX_MSG_MAP(CMainFrame) |
|---|
| 69 |
ON_WM_CREATE() |
|---|
| 70 |
ON_WM_CLOSE() |
|---|
| 71 |
ON_COMMAND(ID_SETTINGS_SETTINGS, OnSettingsSettings) |
|---|
| 72 |
ON_COMMAND(ID_FILE_NEW_NEWPROJECT, OnFileNewNewproject) |
|---|
| 73 |
ON_COMMAND(ID_FILE_NEW_NEWADDPROJECTWIZARD, OnFileNewNewaddprojectwizard) |
|---|
| 74 |
ON_COMMAND(ID_REGISTERS_STOREINREGISTER1, OnRegistersStoreinregister1) |
|---|
| 75 |
ON_COMMAND(ID_REGISTERS_STOREINREGISTER2, OnRegistersStoreinregister2) |
|---|
| 76 |
ON_COMMAND(ID_REGISTERS_STOREINREGISTER3, OnRegistersStoreinregister3) |
|---|
| 77 |
ON_COMMAND(ID_REGISTERS_STOREINREGISTER4, OnRegistersStoreinregister4) |
|---|
| 78 |
ON_COMMAND(ID_REGISTERS_STOREINREGISTER5, OnRegistersStoreinregister5) |
|---|
| 79 |
ON_COMMAND(ID_SETTINGS_PROJECTSETTINGS, OnSettingsProjectsettings) |
|---|
| 80 |
ON_COMMAND(ID_TOOLS_CONFIGURETOOLS, OnToolsConfiguretools) |
|---|
| 81 |
ON_COMMAND(ID_REGISTERS_MANGEREGISTERS, OnRegistersMangeregisters) |
|---|
| 82 |
ON_COMMAND(ID_EDIT_QUICKFINDANDREPLACE, OnEditQuickfindandreplace) |
|---|
| 83 |
ON_COMMAND(ID_EDIT_QUICKFIND, OnEditQuickfind) |
|---|
| 84 |
ON_COMMAND(ID_EDIT_FINDANDREPLACE, OnEditFindandreplace) |
|---|
| 85 |
ON_COMMAND(ID_FILETREE_ADDFOLDER, OnFiletreeAddfolder) |
|---|
| 86 |
ON_COMMAND(ID_FILE_SAVE_SAVEPROJECT, OnFileSaveSaveproject) |
|---|
| 87 |
ON_COMMAND(ID_FILETREE_ADDFILE, OnFiletreeAddfile) |
|---|
| 88 |
ON_COMMAND(ID_FILETREE_INSERTFILE, OnFiletreeInsertfile) |
|---|
| 89 |
ON_COMMAND(ID_FILETREE_REMOVEDIRECTORY, OnFiletreeRemoveFolder) |
|---|
| 90 |
ON_COMMAND(ID_NAVIGATION_BACKONEPAGE, OnNavigationBackonepage) |
|---|
| 91 |
ON_COMMAND(ID_NAVIGATION_FORWARD, OnNavigationForward) |
|---|
| 92 |
ON_COMMAND(ID_NAVIGATION_FOLDALL, OnNavigationFoldall) |
|---|
| 93 |
ON_COMMAND(ID_NAVIGATION_EXPANDALL, OnNavigationExpandall) |
|---|
| 94 |
ON_COMMAND(ID_NAVIGATION_ISOLATE, OnNavigationIsolate) |
|---|
| 95 |
ON_COMMAND(ID_NAVIGATION_GOTOLINE, OnNavigationGotoline) |
|---|
| 96 |
ON_COMMAND(ID_NAVIGATION_CENTERLINE, OnNavigationCenterline) |
|---|
| 97 |
ON_COMMAND(ID_NAVIGATION_MAKELINETOP, OnNavigationMakelinetop) |
|---|
| 98 |
ON_COMMAND(ID_REGISTERS_PASTEREGISTER1, OnRegistersPasteregister1) |
|---|
| 99 |
ON_COMMAND(ID_REGISTERS_PASTEREGISTER2, OnRegistersPasteregister2) |
|---|
| 100 |
ON_COMMAND(ID_REGISTERS_PASTEREGISTER4, OnRegistersPasteregister4) |
|---|
| 101 |
ON_COMMAND(ID_REGISTERS_PASTEREGISTER3, OnRegistersPasteregister3) |
|---|
| 102 |
ON_COMMAND(ID_REGISTERS_PASTEREGISTER5, OnRegistersPasteregister5) |
|---|
| 103 |
ON_COMMAND(ID_NAVIGATION_EXECGOTOFILE, OnNavigationExecgotofile) |
|---|
| 104 |
ON_COMMAND(ID_SETTINGS_CHANGEFONT, OnSettingsChangefont) |
|---|
| 105 |
ON_COMMAND(ID_TOOLS_STARTRECORDINGMACRO, OnToolsStartrecordingmacro) |
|---|
| 106 |
ON_COMMAND(ID_TOOLS_STOPRECORDINGMACRO, OnToolsStoprecordingmacro) |
|---|
| 107 |
ON_COMMAND(ID_TOOLS_EXECUTESCRIPTORMACRO, OnToolsExecutescriptormacro) |
|---|
| 108 |
ON_COMMAND(ID_EDIT_PASTE, OnEditPaste) |
|---|
| 109 |
ON_COMMAND(ID_EDIT_UNDOX, OnEditUndox) |
|---|
| 110 |
ON_COMMAND(ID_EDIT_COPYX, OnEditCopyx) |
|---|
| 111 |
ON_COMMAND(ID_EDIT_CUTX, OnEditCutx) |
|---|
| 112 |
ON_COMMAND(ID_FILE_NEW_NEWFILE, OnFileNewNewfile) |
|---|
| 113 |
ON_COMMAND(ID_FILE_NEW_NEWFILEFROMTEMPLATE, OnFileNewNewfilefromtemplate) |
|---|
| 114 |
ON_COMMAND(ID_FILE_SAVE_SAVEALL, OnFileSaveSaveall) |
|---|
| 115 |
ON_COMMAND(ID_EDIT_COMMENTSELECT, OnEditCommentselect) |
|---|
| 116 |
ON_COMMAND(ID_EDIT_UNCOMMONSELECTION, OnEditUncommonselection) |
|---|
| 117 |
ON_COMMAND(ID_POPUP_OPENFINDDIALOG, OnGotoAdvancedFileAndReplace ) |
|---|
| 118 |
ON_COMMAND(ID_COMPILE_COMPILEPROJECT, OnCompileCompileProject) |
|---|
| 119 |
ON_COMMAND(ID_NAVIGATION_NEXTERROR, OnNavigationNexterror) |
|---|
| 120 |
ON_COMMAND(ID_NAVIGATION_PREVIOUSERROR, OnNavigationPreviouserror) |
|---|
| 121 |
ON_COMMAND(ID_NAVIGATION_COMPILEROUTPUT, OnNavigationCompileroutput) |
|---|
| 122 |
ON_COMMAND(ID_COMPILE_COMPILEANDRUN, OnCompileCompileandrun) |
|---|
| 123 |
ON_COMMAND(ID_COMPILE_COMPILEFILE, OnCompileCompilefile) |
|---|
| 124 |
ON_COMMAND(ID_COMPILE_CLEAN, OnCompileClean) |
|---|
| 125 |
ON_COMMAND(ID_EDIT_PARSER_UPDATEPROJECTPARSER, OnEditParserUpdateprojectparser) |
|---|
| 126 |
ON_COMMAND(ID_VIEW_SHOWHIDEOUTPUTBAR, OnViewShowhideoutputbar) |
|---|
| 127 |
ON_COMMAND(ID_VIEW_SHOWHIDEWORKSPACE, OnViewShowhideworkspace) |
|---|
| 128 |
ON_COMMAND(ID_VIEW_SHOWHIDEFILETOOLBAR, OnViewShowhidefiletoolbar) |
|---|
| 129 |
ON_COMMAND(ID_VIEW_SHOWHIDECODETOOLBAR, OnViewShowhidecodetoolbar) |
|---|
| 130 |
ON_COMMAND(ID_VIEW_SHOWHIDEFINDTOOLBAR, OnViewShowhidefindtoolbar) |
|---|
| 131 |
ON_COMMAND(ID_VIEW_SHOWHIDESTANDARDTOOLBAR, OnViewShowhidestandardtoolbar) |
|---|
| 132 |
ON_COMMAND(ID_VIEW_SHOWHIDESTATUSBAR, OnViewShowhidestatusbar) |
|---|
| 133 |
ON_COMMAND(ID_NAVIGATION_BUILDREPORTOUTPUT, OnNavigationBuildreportoutput) |
|---|
| 134 |
ON_COMMAND(ID_NAVIGATION_FINDBAROUTPUT, OnNavigationFindbaroutput) |
|---|
| 135 |
ON_COMMAND(ID_VIEW_MAXIMIZEVIEW, OnViewMaximizeview) |
|---|
| 136 |
ON_COMMAND(ID_COMPILE_EVALUATEBUFFER, OnCompileEvaluatebuffer) |
|---|
| 137 |
ON_COMMAND(ID_DESCENT_AUTOCOMPLETEAVAILABLELIBRARIES, OnDescentAutocompleteavailablelibraries) |
|---|
| 138 |
ON_COMMAND(ID_DESCENT_AUTOCOMPLETEAVAILABLEIMPORTS, OnDescentAutocompleteavailableimports) |
|---|
| 139 |
ON_COMMAND(ID_DESCENT_AUTOCOMPLETECODE, OnDescentAutocompletecode) |
|---|
| 140 |
ON_COMMAND(ID_VIEW_SHOWHIDECONFIGTOOLBAR, OnViewShowhideconfigtoolbar) |
|---|
| 141 |
ON_COMMAND(ID_HELP_BUILDHELP, OnHelpBuildhelp) |
|---|
| 142 |
ON_COMMAND(ID_FILE_OPEN, OnFileOpen) |
|---|
| 143 |
ON_COMMAND(ID_NAVIGATION_LINEUP, OnNavigationLineup) |
|---|
| 144 |
ON_COMMAND(ID_NAVIGATION_LINEDOWN, OnNavigationLinedown) |
|---|
| 145 |
ON_COMMAND(ID_WINDOW_CLOSEALL, OnWindowCloseall) |
|---|
| 146 |
ON_COMMAND(ID_FILETREE_INSERTADDONPROJECT, OnFiletreeInsertaddonproject) |
|---|
| 147 |
ON_COMMAND(ID_FILETREE_REMOVEADDONPROJECT, OnFiletreeRemoveaddonproject) |
|---|
| 148 |
ON_COMMAND(ID_FILETREE_ACTIVATEADDONPROJECT, OnFiletreeActivateaddonproject) |
|---|
| 149 |
ON_COMMAND(ID_FILETREE_BUILDSELECTEDPROJECT, OnFiletreeBuildselectedproject) |
|---|
| 150 |
ON_COMMAND(ID_APP_EXIT_RELAY, OnAppExitRelay) |
|---|
| 151 |
ON_COMMAND(ID_NAVIGATION_OPENMODULE, OnNavigationOpenmodule) |
|---|
| 152 |
ON_COMMAND(ID_PROJECT_UPDATEPROJECTPARSER, OnProjectUpdateprojectparser) |
|---|
| 153 |
ON_COMMAND(ID_NAVIGATION_FILEBROWSER, OnNavigationFilebrowser) |
|---|
| 154 |
ON_COMMAND(ID_NAVIGATION_SOURCEBROWSER, OnNavigationSourcebrowser) |
|---|
| 155 |
ON_COMMAND(ID_NAVIGATION_HISTORYBROWSER, OnNavigationHistorybrowser) |
|---|
| 156 |
ON_COMMAND(ID_NAVIGATION_SELECTTOOLBAR_SELECTFILETOOLBAR, OnNavigationSelecttoolbarSelectfiletoolbar) |
|---|
| 157 |
ON_COMMAND(ID_NAVIGATION_SELECTTOOLBAR_SELECTCODETOOLBAR, OnNavigationSelecttoolbarSelectcodetoolbar) |
|---|
| 158 |
ON_COMMAND(ID_NAVIGATION_SELECTTOOLBAR_SELECTSETTINGSTOOLBAR, OnNavigationSelecttoolbarSelectsettingstoolbar) |
|---|
| 159 |
ON_COMMAND(ID_NAVIGATION_SELECTTAB_LOGBROWSER, OnNavigationSelecttabLogbrowser) |
|---|
| 160 |
ON_COMMAND(ID_NAVIGATION_SELECTCOMBOBOX_SELECTCODESYMBOL, OnNavigationSelectcomboboxSelectcodesymbol) |
|---|
| 161 |
ON_COMMAND(ID_NAVIGATION_SELECTCOMBOBOX_SELECTPROJECTCONFIGURATION, OnNavigationSelectcomboboxSelectprojectconfiguration) |
|---|
| 162 |
ON_COMMAND(ID_FILETREE_CLEANSELECTEDPROJECT, OnFiletreeCleanselectedproject) |
|---|
| 163 |
ON_COMMAND(ID_NAVIGATION_EXECGOTOSYMBOL, OnNavigationExecgotosymbol) |
|---|
| 164 |
ON_COMMAND(ID_FILETREE_REMOVEFILE, OnFiletreeRemovefile) |
|---|
| 165 |
ON_COMMAND(ID_VIEW_MINIMIZEVIEW, OnViewMinimizeview) |
|---|
| 166 |
ON_COMMAND(ID_EDIT_FINDFIND, OnFindBarFind ) |
|---|
| 167 |
ON_COMMAND(ID_EDIT_FINDREPLACE, OnFindBarReplace) |
|---|
| 168 |
ON_COMMAND(ID_COMPILE_COMPILEFILE_WITHBUILD, OnCompileCompilefileWithbuild) |
|---|
| 169 |
//}}AFX_MSG_MAP |
|---|
| 170 |
|
|---|
| 171 |
|
|---|
| 172 |
|
|---|
| 173 |
ON_COMMAND(ID_RECENT_PROJECTS1, OnRecentProjectSelected1) |
|---|
| 174 |
ON_COMMAND(ID_RECENT_PROJECTS2, OnRecentProjectSelected2) |
|---|
| 175 |
ON_COMMAND(ID_RECENT_PROJECTS3, OnRecentProjectSelected3) |
|---|
| 176 |
ON_COMMAND(ID_RECENT_PROJECTS4, OnRecentProjectSelected4) |
|---|
| 177 |
ON_COMMAND(ID_RECENT_PROJECTS5, OnRecentProjectSelected5) |
|---|
| 178 |
|
|---|
| 179 |
|
|---|
| 180 |
ON_COMMAND(ID_PROJECT_NODE1, OnProjectSelectprojectnodeSelectnode1) |
|---|
| 181 |
ON_COMMAND(ID_PROJECT_NODE2, OnProjectSelectprojectnodeSelectnode2) |
|---|
| 182 |
ON_COMMAND(ID_PROJECT_NODE3, OnProjectSelectprojectnodeSelectnode3) |
|---|
| 183 |
ON_COMMAND(ID_PROJECT_NODE4, OnProjectSelectprojectnodeSelectnode4) |
|---|
| 184 |
ON_COMMAND(ID_PROJECT_NODE5, OnProjectSelectprojectnodeSelectnode5) |
|---|
| 185 |
ON_COMMAND(ID_PROJECT_NODE6, OnProjectSelectprojectnodeSelectnode6) |
|---|
| 186 |
ON_COMMAND(ID_PROJECT_NODE7, OnProjectSelectprojectnodeSelectnode7) |
|---|
| 187 |
|
|---|
| 188 |
ON_COMMAND(ID_TOOLS1, OnTools1 ) |
|---|
| 189 |
ON_COMMAND(ID_TOOLS2, OnTools2 ) |
|---|
| 190 |
ON_COMMAND(ID_TOOLS3, OnTools3 ) |
|---|
| 191 |
ON_COMMAND(ID_TOOLS4, OnTools4 ) |
|---|
| 192 |
ON_COMMAND(ID_TOOLS5, OnTools5 ) |
|---|
| 193 |
ON_COMMAND(ID_TOOLS6, OnTools6 ) |
|---|
| 194 |
ON_COMMAND(ID_TOOLS7, OnTools7 ) |
|---|
| 195 |
ON_COMMAND(ID_TOOLS8, OnTools8 ) |
|---|
| 196 |
ON_COMMAND(ID_TOOLS9, OnTools9 ) |
|---|
| 197 |
|
|---|
| 198 |
END_MESSAGE_MAP() |
|---|
| 199 |
|
|---|
| 200 |
static UINT indicators[] = |
|---|
| 201 |
{ |
|---|
| 202 |
ID_SEPARATOR, // status line indicator |
|---|
| 203 |
ID_INDICATOR_CAPS, |
|---|
| 204 |
ID_INDICATOR_NUM, |
|---|
| 205 |
ID_INDICATOR_SCRL, |
|---|
| 206 |
}; |
|---|
| 207 |
|
|---|
| 208 |
///////////////////////////////////////////////////////////////////////////// |
|---|
| 209 |
// CMainFrame construction/destruction |
|---|
| 210 |
|
|---|
| 211 |
CMainFrame::CMainFrame() |
|---|
| 212 |
{ |
|---|
| 213 |
xtAfxData.bXPMode = Globals::settings->baseSettings->GetCache("m_xpstyle") == "1"; |
|---|
| 214 |
xtAfxData.bMenuShadows = Globals::settings->baseSettings->GetCache("m_menuShadows") == "1"; |
|---|
| 215 |
currentErrorNumber = 0; |
|---|
| 216 |
cRet = lRet = 0; |
|---|
| 217 |
srandInit = false; |
|---|
| 218 |
} |
|---|
| 219 |
|
|---|
| 220 |
CMainFrame::~CMainFrame() |
|---|
| 221 |
{ |
|---|
| 222 |
} |
|---|
| 223 |
|
|---|
| 224 |
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) |
|---|
| 225 |
{ |
|---|
| 226 |
|
|---|
| 227 |
|
|---|
| 228 |
|
|---|
| 229 |
if (CXTMDIFrameWnd::OnCreate(lpCreateStruct) == -1) |
|---|
| 230 |
return -1; |
|---|
| 231 |
|
|---|
| 232 |
if (!m_wndMenuBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP |
|---|
| 233 |
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || |
|---|
| 234 |
!m_wndMenuBar.LoadMenuBar(IDR_MAINFRAME)) |
|---|
| 235 |
{ |
|---|
| 236 |
TRACE0("Failed to create menubar\n"); |
|---|
| 237 |
return -1; // fail to create |
|---|
| 238 |
} |
|---|
| 239 |
|
|---|
| 240 |
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP |
|---|
| 241 |
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,CRect(0,0,0,0 ) , 59525) || |
|---|
| 242 |
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME) ) |
|---|
| 243 |
{ |
|---|
| 244 |
TRACE0("Failed to create toolbar\n"); |
|---|
| 245 |
return -1; // fail to create |
|---|
| 246 |
} |
|---|
| 247 |
|
|---|
| 248 |
|
|---|
| 249 |
m_wndToolBar.SetWindowText("Standard Toolbar"); |
|---|
| 250 |
|
|---|
| 251 |
if (!m_wndOutputBar.Create(this, IDW_OUTPUTBAR, _T("Output"), |
|---|
| 252 |
CSize(150, 150), CBRS_BOTTOM)) |
|---|
| 253 |
{ |
|---|
| 254 |
TRACE0("Failed to create output dock window\n"); |
|---|
| 255 |
return -1; // fail to create |
|---|
| 256 |
} |
|---|
| 257 |
|
|---|
| 258 |
if( !m_wndTabDockBar.Create(this, IDW_TABDOCKBAR, _T("Workspace"), |
|---|
| 259 |
CSize(200, 150), CBRS_LEFT)) |
|---|
| 260 |
{ |
|---|
| 261 |
TRACE0("Failed to create workspace dock window\n"); |
|---|
| 262 |
return -1; // fail to create |
|---|
| 263 |
} |
|---|
| 264 |
|
|---|
| 265 |
if (!m_wndStatusBar.Create(this) || |
|---|
| 266 |
!m_wndStatusBar.SetIndicators(indicators, |
|---|
| 267 |
sizeof(indicators)/sizeof(UINT))) |
|---|
| 268 |
{ |
|---|
| 269 |
TRACE0("Failed to create status bar\n"); |
|---|
| 270 |
return -1; // fail to create |
|---|
| 271 |
} |
|---|
| 272 |
|
|---|
| 273 |
if (!m_wndFindToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP |
|---|
| 274 |
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0,0,0,0), 59528 ) || |
|---|
| 275 |
!m_wndFindToolBar.LoadToolBar(IDR_SIMPLEFIND)) |
|---|
| 276 |
{ |
|---|
| 277 |
AfxMessageBox("Failed to create find toolbar\r\n"); |
|---|
| 278 |
return -1; // fail to create |
|---|
| 279 |
} |
|---|
| 280 |
|
|---|
| 281 |
m_wndFindToolBar.SetWindowText(_T("Find Toolbar")); |
|---|
| 282 |
|
|---|
| 283 |
|
|---|
| 284 |
|
|---|
| 285 |
|
|---|
| 286 |
m_findEdit.DisableFlatLook(false); |
|---|
| 287 |
|
|---|
| 288 |
if (!m_wndCodeToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP |
|---|
| 289 |
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,CRect(0,0,0,0 ) , 59526) || |
|---|
| 290 |
!m_wndCodeToolBar.LoadToolBar(IDR_CODETOOLBAR)) |
|---|
| 291 |
{ |
|---|
| 292 |
TRACE0("Failed to create toolbar\n"); |
|---|
| 293 |
return -1; // fail to create |
|---|
| 294 |
} |
|---|
| 295 |
|
|---|
| 296 |
|
|---|
| 297 |
if (!m_wndFileToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP |
|---|
| 298 |
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,CRect(0,0,0,0 ) , 59527) || |
|---|
| 299 |
!m_wndFileToolBar.LoadToolBar(IDR_FILETOOLBAR)) |
|---|
| 300 |
{ |
|---|
| 301 |
TRACE0("Failed to create toolbar\n"); |
|---|
| 302 |
return -1; // fail to create |
|---|
| 303 |
} |
|---|
| 304 |
|
|---|
| 305 |
// |
|---|
| 306 |
if (!m_wndConfigToolbar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP |
|---|
| 307 |
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,CRect(0,0,0,0 ) , 59556) || |
|---|
| 308 |
!m_wndConfigToolbar.LoadToolBar(IDR_CONFIG_TOOLBAR)) |
|---|
| 309 |
{ |
|---|
| 310 |
TRACE0("Failed to create toolbar\n"); |
|---|
| 311 |
return -1; // fail to create |
|---|
| 312 |
} |
|---|
| 313 |
|
|---|
| 314 |
|
|---|
| 315 |
m_wndConfigToolbar.SetWindowText("Config Toolbar"); |
|---|
| 316 |
m_wndCodeToolBar.SetWindowText("Code Toolbar"); |
|---|
| 317 |
m_wndFileToolBar.SetWindowText("File Toolbar"); |
|---|
| 318 |
|
|---|
| 319 |
|
|---|
| 320 |
CFont font; |
|---|
| 321 |
font.CreateFont( |
|---|
| 322 |
12, // nHeight |
|---|
| 323 |
0, // nWidth |
|---|
| 324 |
0, // nEscapement |
|---|
| 325 |
0, // nOrientation |
|---|
| 326 |
FW_NORMAL, // nWeight |
|---|
| 327 |
FALSE, // bItalic |
|---|
| 328 |
FALSE, // bUnderline |
|---|
| 329 |
0, // cStrikeOut |
|---|
| 330 |
ANSI_CHARSET, // nCharSet |
|---|
| 331 |
OUT_DEFAULT_PRECIS, // nOutPrecision |
|---|
| 332 |
CLIP_DEFAULT_PRECIS, // nClipPrecision |
|---|
| 333 |
DEFAULT_QUALITY, // nQuality |
|---|
| 334 |
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily |
|---|
| 335 |
"Verdana"); // lpszFacename |
|---|
| 336 |
|
|---|
| 337 |
|
|---|
| 338 |
CRect rect; |
|---|
| 339 |
int nIndex = m_wndCodeToolBar.GetToolBarCtrl().CommandToIndex(ID_TAGFILECOMBO); |
|---|
| 340 |
m_wndCodeToolBar.SetButtonInfo(nIndex, ID_TAGFILECOMBO, TBBS_SEPARATOR, 235); |
|---|
| 341 |
m_wndCodeToolBar.GetToolBarCtrl().GetItemRect(nIndex, &rect); |
|---|
| 342 |
rect.top = 0; |
|---|
| 343 |
rect.bottom = rect.top + 350 /*drop height*/; |
|---|
| 344 |
|
|---|
| 345 |
|
|---|
| 346 |
|
|---|
| 347 |
|
|---|
| 348 |
if(!m_fileTagComboBox.Create(CBS_DROPDOWNLIST | WS_VISIBLE | |
|---|
| 349 |
WS_TABSTOP | WS_VSCROLL | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS, rect, &m_wndCodeToolBar, ID_TAGFILECOMBO)) |
|---|
| 350 |
{ |
|---|
| 351 |
TRACE(_T("Failed to create combo-box\r\n")); |
|---|
| 352 |
return FALSE; |
|---|
| 353 |
} |
|---|
| 354 |
|
|---|
| 355 |
|
|---|
| 356 |
|
|---|
| 357 |
nIndex = m_wndConfigToolbar.GetToolBarCtrl().CommandToIndex(ID_CONFIG_COMBO); |
|---|
| 358 |
m_wndConfigToolbar.SetButtonInfo(nIndex, ID_CONFIG_COMBO, TBBS_SEPARATOR, 235); |
|---|
| 359 |
m_wndConfigToolbar.GetToolBarCtrl().GetItemRect(nIndex, &rect); |
|---|
| 360 |
rect.top = 0; |
|---|
| 361 |
rect.bottom = rect.top + 350 /*drop height*/; |
|---|
| 362 |
|
|---|
| 363 |
if(!m_configComboBox.Create(CBS_DROPDOWNLIST | WS_VISIBLE | |
|---|
| 364 |
WS_TABSTOP | WS_VSCROLL | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS, rect, &m_wndConfigToolbar, ID_CONFIG_COMBO)) |
|---|
| 365 |
{ |
|---|
| 366 |
TRACE(_T("Failed to create combo-box\r\n")); |
|---|
| 367 |
return FALSE; |
|---|
| 368 |
} |
|---|
| 369 |
|
|---|
| 370 |
|
|---|
| 371 |
if ( !m_comboImageList.Create( 16, 16, ILC_COLOR24 | ILC_MASK, 16, 16 ) ) |
|---|
| 372 |
{ |
|---|
| 373 |
TRACE("Failed to create image list.\n"); |
|---|
| 374 |
return -1; |
|---|
| 375 |
} |
|---|
| 376 |
else TRACE("Succeeded creating image list"); |
|---|
| 377 |
|
|---|
| 378 |
|
|---|
| 379 |
|
|---|
| 380 |
m_comboBitmap.LoadBitmap( IDB_BITMAP3 ); |
|---|
| 381 |
m_comboImageList.Add( &m_comboBitmap, RGB( 0x00,0xff,0x00 ) ); |
|---|
| 382 |
|
|---|
| 383 |
m_configComboBox.SetImageList( &m_comboImageList ); |
|---|
| 384 |
m_configComboBox.SetColumnCount(0); |
|---|
| 385 |
m_configComboBox.SetColumnWidth(0,100); |
|---|
| 386 |
|
|---|
| 387 |
//m_fileTagComboBox.DisableFlatLook(false); |
|---|
| 388 |
m_configComboBox.SetFont(&font ); |
|---|
| 389 |
m_configComboBox.AddString("Project Configuration"); |
|---|
| 390 |
m_configComboBox.SetItemImage(0,3); |
|---|
| 391 |
|
|---|
| 392 |
m_configComboBox.SetCurSel(0); |
|---|
| 393 |
|
|---|
| 394 |
|
|---|
| 395 |
if ( !m_imageList.Create( 16, 16, ILC_COLOR24 | ILC_MASK, 16, 16 ) ) |
|---|
| 396 |
{ |
|---|
| 397 |
TRACE("Failed to create image list.\n"); |
|---|
| 398 |
return -1; |
|---|
| 399 |
} |
|---|
| 400 |
else TRACE("Succeeded creating image list"); |
|---|
| 401 |
|
|---|
| 402 |
|
|---|
| 403 |
|
|---|
| 404 |
m_bitmap.LoadBitmap( PARSER_ENTITIES_BMP ); |
|---|
| 405 |
m_imageList.Add( &m_bitmap, RGB( 0x00,0xff,0x00 ) ); |
|---|
| 406 |
|
|---|
| 407 |
m_fileTagComboBox.SetImageList( &m_imageList ); |
|---|
| 408 |
m_fileTagComboBox.SetColumnCount(0); |
|---|
| 409 |
m_fileTagComboBox.SetColumnWidth(0,100); |
|---|
| 410 |
|
|---|
| 411 |
//m_fileTagComboBox.DisableFlatLook(false); |
|---|
| 412 |
m_fileTagComboBox.SetFont(&font ); |
|---|
| 413 |
m_fileTagComboBox.AddString("File Tags"); |
|---|
| 414 |
m_fileTagComboBox.SetItemImage(0,0); |
|---|
| 415 |
|
|---|
| 416 |
m_fileTagComboBox.SetCurSel(0); |
|---|
| 417 |
|
|---|
| 418 |
m_configComboBox.SetFont(&font); |
|---|
| 419 |
|
|---|
| 420 |
nIndex = m_wndCodeToolBar.GetToolBarCtrl().CommandToIndex(ID_TAGSCOMBO); |
|---|
| 421 |
m_wndCodeToolBar.SetButtonInfo(nIndex, ID_TAGSCOMBO, TBBS_SEPARATOR, 320); |
|---|
| 422 |
m_wndCodeToolBar.GetToolBarCtrl().GetItemRect(nIndex, &rect); |
|---|
| 423 |
rect.top = 1; |
|---|
| 424 |
|
|---|
| 425 |
rect.bottom = rect.top + 350 /*drop height*/; |
|---|
| 426 |
|
|---|
| 427 |
if(!m_tagComboBox.Create(CBS_DROPDOWNLIST | WS_VISIBLE | |
|---|
| 428 |
WS_TABSTOP | WS_VSCROLL | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS, rect, &m_wndCodeToolBar, ID_TAGSCOMBO)) |
|---|
| 429 |
{ |
|---|
| 430 |
TRACE(_T("Failed to create code combo-box\r\n")); |
|---|
| 431 |
return FALSE; |
|---|
| 432 |
} |
|---|
| 433 |
|
|---|
| 434 |
|
|---|
| 435 |
// m_tagComboBox.DisableFlatLook(false); |
|---|
| 436 |
m_tagComboBox.SetFont(&font ); |
|---|
| 437 |
m_tagComboBox.AddString("Code Box"); |
|---|
| 438 |
m_tagComboBox.SetCurSel(0); |
|---|
| 439 |
|
|---|
| 440 |
m_tagComboBox.SetImageList( &m_imageList ); |
|---|
| 441 |
m_tagComboBox.SetColumnCount(0); |
|---|
| 442 |
m_tagComboBox.SetColumnWidth(0,100); |
|---|
| 443 |
|
|---|
| 444 |
m_tagComboBox.SetItemImage(0,0); |
|---|
| 445 |
|
|---|
| 446 |
|
|---|
| 447 |
if ( !m_imageList2.Create( 16, 16, ILC_COLOR24 | ILC_MASK, 1, 1 ) ) |
|---|
| 448 |
{ |
|---|
| 449 |
TRACE0("Failed to create image list.\n"); |
|---|
| 450 |
return -1; |
|---|
| 451 |
} |
|---|
| 452 |
|
|---|
| 453 |
m_bitmap2.LoadBitmap( IDB_IMGLIST_VIEW ); |
|---|
| 454 |
m_imageList2.Add( &m_bitmap2, RGB( 0x00,0xff,0x00 ) ); |
|---|
| 455 |
|
|---|
| 456 |
|
|---|
| 457 |
|
|---|
| 458 |
|
|---|
| 459 |
|
|---|
| 460 |
|
|---|
| 461 |
nIndex = m_wndFileToolBar.GetToolBarCtrl().CommandToIndex(ID_FILEHISTORYCOMBO); |
|---|
| 462 |
m_wndFileToolBar.SetButtonInfo(nIndex, ID_FILEHISTORYCOMBO, TBBS_SEPARATOR, 235); |
|---|
| 463 |
m_wndFileToolBar.GetToolBarCtrl().GetItemRect(nIndex, &rect); |
|---|
| 464 |
rect.top = 1; |
|---|
| 465 |
|
|---|
| 466 |
rect.bottom = rect.top + 350 /*drop height*/; |
|---|
| 467 |
|
|---|
| 468 |
if(!m_fileHistoryComboBox.Create(CBS_DROPDOWNLIST | WS_VISIBLE | |
|---|
| 469 |
WS_TABSTOP | WS_VSCROLL | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS, rect, &m_wndFileToolBar, ID_FILEHISTORYCOMBO)) |
|---|
| 470 |
{ |
|---|
| 471 |
TRACE(_T("Failed to create combo-box\r\n")); |
|---|
| 472 |
return FALSE; |
|---|
| 473 |
} |
|---|
| 474 |
|
|---|
| 475 |
// m_fileHistoryComboBox.DisableFlatLook(false); |
|---|
| 476 |
m_fileHistoryComboBox.SetFont(&font ); |
|---|
| 477 |
m_fileHistoryComboBox.AddString("All Open Files"); |
|---|
| 478 |
m_fileHistoryComboBox.SetCurSel(0); |
|---|
| 479 |
m_fileHistoryComboBox.SetImageList( &m_imageList2 ); |
|---|
| 480 |
m_fileHistoryComboBox.SetItemImage(0,0); |
|---|
| 481 |
|
|---|
| 482 |
m_fileHistoryComboBox.SetColumnCount(0); |
|---|
| 483 |
m_fileHistoryComboBox.SetColumnWidth(0,100); |
|---|
| 484 |
|
|---|
| 485 |
nIndex = m_wndFileToolBar.GetToolBarCtrl().CommandToIndex(ID_PROJECTFILESCOMBO); |
|---|
| 486 |
m_wndFileToolBar.SetButtonInfo(nIndex, ID_PROJECTFILESCOMBO, TBBS_SEPARATOR, 320); |
|---|
| 487 |
m_wndFileToolBar.GetToolBarCtrl().GetItemRect(nIndex, &rect); |
|---|
| 488 |
rect.top = 1; |
|---|
| 489 |
|
|---|
| 490 |
rect.bottom = rect.top + 350 /*drop height*/; |
|---|
| 491 |
|
|---|
| 492 |
if(!m_fileComboBox.Create(CBS_DROPDOWNLIST | WS_VISIBLE | |
|---|
| 493 |
WS_TABSTOP | WS_VSCROLL | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS, rect, &m_wndFileToolBar, ID_PROJECTFILESCOMBO)) |
|---|
| 494 |
{ |
|---|
| 495 |
TRACE(_T("Failed to create combo-box\r\n")); |
|---|
| 496 |
return FALSE; |
|---|
| 497 |
} |
|---|
| 498 |
|
|---|
| 499 |
|
|---|
| 500 |
// m_fileComboBox.DisableFlatLook(false); |
|---|
| 501 |
m_fileComboBox.SetFont(&font ); |
|---|
| 502 |
m_fileComboBox.AddString("Project Files"); |
|---|
| 503 |
m_fileComboBox.SetCurSel(0); |
|---|
| 504 |
m_fileComboBox.SetImageList( &m_imageList2 ); |
|---|
| 505 |
m_fileComboBox.SetItemImage(0,0); |
|---|
| 506 |
|
|---|
| 507 |
m_fileComboBox.SetColumnCount(0); |
|---|
| 508 |
m_fileComboBox.SetColumnWidth(0,100); |
|---|
| 509 |
|
|---|
| 510 |
|
|---|
| 511 |
|
|---|
| 512 |
|
|---|
| 513 |
nIndex = m_wndFindToolBar.GetToolBarCtrl().CommandToIndex(ID_PLACEHOLDER_FINDEDIT); |
|---|
| 514 |
m_wndFindToolBar.SetButtonInfo(nIndex, ID_PLACEHOLDER_FINDEDIT, TBBS_SEPARATOR, 205); |
|---|
| 515 |
m_wndFindToolBar.GetToolBarCtrl().GetItemRect(nIndex, &rect); |
|---|
| 516 |
rect.top = 1; |
|---|
| 517 |
rect.bottom = rect.top + 20 /*drop height*/; |
|---|
| 518 |
rect.right = rect.left + 200; |
|---|
| 519 |
|
|---|
| 520 |
if(!m_findEdit.Create(WS_VISIBLE | |
|---|
| 521 |
WS_TABSTOP | WS_CHILD, rect, &m_wndFindToolBar, ID_PLACEHOLDER_FINDEDIT)) |
|---|
| 522 |
{ |
|---|
| 523 |
TRACE(_T("Failed to create combo-box\r\n")); |
|---|
| 524 |
return FALSE; |
|---|
| 525 |
} |
|---|
| 526 |
|
|---|
| 527 |
m_findEdit.SetFont(&font); |
|---|
| 528 |
|
|---|
| 529 |
|
|---|
| 530 |
nIndex = m_wndFindToolBar.GetToolBarCtrl().CommandToIndex(ID_PLACEHOLDER_FINDREPLACE); |
|---|
| 531 |
m_wndFindToolBar.SetButtonInfo(nIndex, ID_PLACEHOLDER_FINDREPLACE, TBBS_SEPARATOR, 205); |
|---|
| 532 |
m_wndFindToolBar.GetToolBarCtrl().GetItemRect(nIndex, &rect); |
|---|
| 533 |
rect.top = 1; |
|---|
| 534 |
rect.bottom = rect.top + 20 /*drop height*/; |
|---|
| 535 |
rect.right = rect.left + 200; |
|---|
| 536 |
|
|---|
| 537 |
|
|---|
| 538 |
if(!m_replaceEdit.Create(WS_VISIBLE | |
|---|
| 539 |
WS_TABSTOP | WS_CHILD, rect, &m_wndFindToolBar, ID_PLACEHOLDER_FINDREPLACE)) |
|---|
| 540 |
{ |
|---|
| 541 |
TRACE(_T("Failed to create combo-box\r\n")); |
|---|
| 542 |
return FALSE; |
|---|
| 543 |
} |
|---|
| 544 |
|
|---|
| 545 |
m_replaceEdit.SetFont(&font); |
|---|
| 546 |
|
|---|
| 547 |
|
|---|
| 548 |
m_wndFindToolBar.EnableDockingEx(CBRS_ALIGN_ANY, CBRS_XT_ALL_FLAT); |
|---|
| 549 |
m_wndMenuBar.EnableDockingEx(CBRS_ALIGN_ANY, CBRS_XT_ALL_FLAT); |
|---|
| 550 |
m_wndToolBar.EnableDockingEx(CBRS_ALIGN_ANY, CBRS_XT_ALL_FLAT); |
|---|
| 551 |
m_wndCodeToolBar.EnableDockingEx(CBRS_ALIGN_ANY, CBRS_XT_ALL_FLAT); |
|---|
| 552 |
m_wndOutputBar.EnableDockingEx(CBRS_ALIGN_ANY, CBRS_XT_ALL_FLAT|CBRS_XT_GRIPPER_GRAD); |
|---|
| 553 |
m_wndTabDockBar.EnableDockingEx(CBRS_ALIGN_ANY, CBRS_XT_ALL_FLAT|CBRS_XT_GRIPPER_GRAD); |
|---|
| 554 |
m_wndFileToolBar.EnableDockingEx(CBRS_ALIGN_ANY, CBRS_XT_ALL_FLAT|CBRS_XT_GRIPPER_GRAD); |
|---|
| 555 |
m_wndConfigToolbar.EnableDockingEx(CBRS_ALIGN_ANY, CBRS_XT_ALL_FLAT|CBRS_XT_GRIPPER_GRAD); |
|---|
| 556 |
|
|---|
| 557 |
EnableDockingEx(CBRS_ALIGN_ANY, CBRS_XT_ALL_FLAT); |
|---|
| 558 |
DockControlBarLeftOf(&m_wndFindToolBar,&m_wndCodeToolBar); |
|---|
| 559 |
DockControlBar(&m_wndMenuBar); |
|---|
| 560 |
DockControlBar(&m_wndConfigToolbar); |
|---|
| 561 |
DockControlBar(&m_wndToolBar); |
|---|
| 562 |
DockControlBar(&m_wndCodeToolBar); |
|---|
| 563 |
DockControlBar(&m_wndOutputBar); |
|---|
| 564 |
DockControlBar(&m_wndTabDockBar); |
|---|
| 565 |
DockControlBar(&m_wndFileToolBar); |
|---|
| 566 |
|
|---|
| 567 |
LoadBarState("PlacementControl"); |
|---|
| 568 |
|
|---|
| 569 |
AddLogo(); |
|---|
| 570 |
|
|---|
| 571 |
m_wndMDITabWindow.Install(this, 0, FALSE); |
|---|
| 572 |
|
|---|
| 573 |
m_wndMenuBar.ShowMDIButtons(TRUE); |
|---|
| 574 |
|
|---|
| 575 |
|
|---|
| 576 |
if ( Globals::settings->baseSettings->GetCache("m_coolMenus") == "1") |
|---|
| 577 |
InstallCoolMenus(IDR_MAINFRAME); |
|---|
| 578 |
else ; |
|---|
| 579 |
|
|---|
| 580 |
CXTCoolMenu::m_nAnimationDelay = 0; |
|---|
| 581 |
CXTCoolMenu::m_nAnimationType = 0; |
|---|
| 582 |
|
|---|
| 583 |
font.Detach(); |
|---|
| 584 |
|
|---|
| 585 |
ShowControlBar(&m_wndFindToolBar,false,false); |
|---|
| 586 |
|
|---|
| 587 |
return 0; |
|---|
| 588 |
} |
|---|
| 589 |
|
|---|
| 590 |
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) |
|---|
| 591 |
{ |
|---|
| 592 |
if( !CXTMDIFrameWnd::PreCreateWindow(cs) ) |
|---|
| 593 |
return FALSE; |
|---|
| 594 |
cs.lpszClass = AfxRegisterWndClass(0, NULL, NULL, |
|---|
| 595 |
AfxGetApp()->LoadIcon(IDR_MAINFRAME)); |
|---|
| 596 |
|
|---|
| 597 |
return TRUE; |
|---|
| 598 |
} |
|---|
| 599 |
|
|---|
| 600 |
///////////////////////////////////////////////////////////////////////////// |
|---|
| 601 |
// CMainFrame diagnostics |
|---|
| 602 |
|
|---|
| 603 |
#ifdef _DEBUG |
|---|
| 604 |
void CMainFrame::AssertValid() const |
|---|
| 605 |
{ |
|---|
| 606 |
CXTMDIFrameWnd::AssertValid(); |
|---|
| 607 |
} |
|---|
| 608 |
|
|---|
| 609 |
void CMainFrame::Dump(CDumpContext& dc) const |
|---|
| 610 |
{ |
|---|
| 611 |
CXTMDIFrameWnd::Dump(dc); |
|---|
| 612 |
} |
|---|
| 613 |
|
|---|
| 614 |
#endif //_DEBUG |
|---|
| 615 |
|
|---|
| 616 |
///////////////////////////////////////////////////////////////////////////// |
|---|
| 617 |
// CMainFrame message handlers |
|---|
| 618 |
|
|---|
| 619 |
void CMainFrame::AddLogo() |
|---|
| 620 |
{ |
|---|
| 621 |
if (!m_wndLogoPane.Create(_T("ELEPHANT"), &m_wndStatusBar)) |
|---|
| 622 |
{ |
|---|
| 623 |
TRACE0("Failed to create logo control.\n"); |
|---|
| 624 |
return; |
|---|
| 625 |
} |
|---|
| 626 |
|
|---|
| 627 |
int nWidth = m_wndLogoPane.GetTextSize().cx; |
|---|
| 628 |
|
|---|
| 629 |
m_wndStatusBar.AddIndicator(ID_INDICATOR_LOGO, 0); |
|---|
| 630 |
|
|---|
| 631 |
int nIndex = m_wndStatusBar.CommandToIndex(ID_INDICATOR_LOGO); |
|---|
| 632 |
ASSERT (nIndex != -1); |
|---|
| 633 |
|
|---|
| 634 |
m_wndStatusBar.SetPaneWidth(nIndex, nWidth); |
|---|
| 635 |
m_wndStatusBar.SetPaneStyle(nIndex, m_wndStatusBar.GetPaneStyle(nIndex) | SBPS_POPOUT); |
|---|
| 636 |
m_wndStatusBar.AddControl(&m_wndLogoPane, ID_INDICATOR_LOGO, FALSE); |
|---|
| 637 |
} |
|---|
| 638 |
|
|---|
| 639 |
void CMainFrame::RemoveLogo() |
|---|
| 640 |
{ |
|---|
| 641 |
m_wndStatusBar.RemoveIndicator(ID_INDICATOR_LOGO); |
|---|
| 642 |
} |
|---|
| 643 |
|
|---|
| 644 |
void CMainFrame::OnClose() |
|---|
| 645 |
{ |
|---|
| 646 |
SaveBarState(_T("Control Bar State")); |
|---|
| 647 |
|
|---|
| 648 |
m_wndPosition.SaveWindowPos(this); |
|---|
| 649 |
|
|---|
| 650 |
CXTMDIFrameWnd::OnClose(); |
|---|
| 651 |
} |
|---|
| 652 |
|
|---|
| 653 |
BOOL CMainFrame::ShowWindowEx(int nCmdShow) |
|---|
| 654 |
{ |
|---|
| 655 |
ASSERT_VALID(this); |
|---|
| 656 |
|
|---|
| 657 |
|
|---|
| 658 |
m_wndPosition.LoadWindowPos(this); |
|---|
| 659 |
nCmdShow = m_wndPosition.showCmd; |
|---|
| 660 |
|
|---|
| 661 |
|
|---|
| 662 |
UpdateRecentProjectsMenu(); |
|---|
| 663 |
UpdateToolsMenu (); |
|---|
| 664 |
|
|---|
| 665 |
return ShowWindow(nCmdShow); |
|---|
| 666 |
} |
|---|
| 667 |
|
|---|
| 668 |
void CMainFrame::DockControlBarLeftOf(CXTToolBar* Bar, CXTToolBar* LeftOf) |
|---|
| 669 |
{ |
|---|
| 670 |
CRect rect; |
|---|
| 671 |
DWORD dw; |
|---|
| 672 |
UINT n; |
|---|
| 673 |
|
|---|
| 674 |
// get MFC to adjust the dimensions of all docked ToolBars |
|---|
| 675 |
// so that GetWindowRect will be accurate |
|---|
| 676 |
RecalcLayout(TRUE); |
|---|
| 677 |
|
|---|
| 678 |
LeftOf->GetWindowRect(&rect); |
|---|
| 679 |
rect.OffsetRect(1,0); |
|---|
| 680 |
dw=LeftOf->GetBarStyle(); |
|---|
| 681 |
n = 0; |
|---|
| 682 |
n = (dw&CBRS_ALIGN_TOP) ? AFX_IDW_DOCKBAR_TOP : n; |
|---|
| 683 |
n = (dw&CBRS_ALIGN_BOTTOM && n==0) ? AFX_IDW_DOCKBAR_BOTTOM : n; |
|---|
| 684 |
n = (dw&CBRS_ALIGN_LEFT && n==0) ? AFX_IDW_DOCKBAR_LEFT : n; |
|---|
| 685 |
n = (dw&CBRS_ALIGN_RIGHT && n==0) ? AFX_IDW_DOCKBAR_RIGHT : n; |
|---|
| 686 |
|
|---|
| 687 |
// When we take the default parameters on rect, DockControlBar will dock |
|---|
| 688 |
// each Toolbar on a seperate line. By calculating a rectangle, we |
|---|
| 689 |
// are simulating a Toolbar being dragged to that location and docked. |
|---|
| 690 |
DockControlBar(Bar,n,&rect); |
|---|
| 691 |
} |
|---|
| 692 |
|
|---|
| 693 |
void CMainFrame::OnSettingsSettings() |
|---|
| 694 |
{ |
|---|
| 695 |
|
|---|
| 696 |
Globals::theApp.LogEvent(OPEN_SETTINGS_DLG ); |
|---|
| 697 |
CSettingsDlg x(this); |
|---|
| 698 |
x.DoModal(); |
|---|
| 699 |
|
|---|
| 700 |
|
|---|
| 701 |
} |
|---|
| 702 |
|
|---|
| 703 |
void CMainFrame::OnFileNewNewproject() |
|---|
| 704 |
{ |
|---|
| 705 |
|
|---|
| 706 |
CNewProjectDlg x(this); |
|---|
| 707 |
x.DoModal(); |
|---|
| 708 |
|
|---|
| 709 |
Globals::theApp.LogEvent(NEW_PROJECT,x.m_csLocation.GetBuffer(0) ); |
|---|
| 710 |
} |
|---|
| 711 |
|
|---|
| 712 |
void CMainFrame::OnFileNewNewaddprojectwizard() |
|---|
| 713 |
{ |
|---|
| 714 |
CAddNewProjectWizard d; |
|---|
| 715 |
|
|---|
| 716 |
d.DoModal(); // TODO: Add your command handler code here |
|---|
| 717 |
|
|---|
| 718 |
Globals::theApp.LogEvent(NEW_PROJECT_TYPE); |
|---|
| 719 |
} |
|---|
| 720 |
|
|---|
| 721 |
void CMainFrame::OnRegistersStoreinregister1() |
|---|
| 722 |
{ |
|---|
| 723 |
CStoreRegister reg(NULL,1); |
|---|
| 724 |
if (reg.DoModal()) |
|---|
| 725 |
{ |
|---|
| 726 |
|
|---|
| 727 |
} |
|---|
| 728 |
|
|---|
| 729 |
m_wndOutputBar.ShowWindow(SW_HIDE); |
|---|
| 730 |
|
|---|
| 731 |
RECT rect; |
|---|
| 732 |
m_wndTabDockBar.GetClientRect(&rect); |
|---|
| 733 |
|
|---|
| 734 |
this->UpdateAllViews(); |
|---|
| 735 |
//m_wndTabDockBar.SendMessage(WM_SIZE,0,0); |
|---|
| 736 |
// m_wndTabDockBar.MoveWindow(0,0,rect.right+1,rect.bottom + 400); |
|---|
| 737 |
// m_wndTabDockBar.ResizeTabView(&m_wndTabDockBar.m_wndTreeCtrl); |
|---|
| 738 |
|
|---|
| 739 |
|
|---|
| 740 |
} |
|---|
| 741 |
|
|---|
| 742 |
void CMainFrame::OnRegistersStoreinregister2() |
|---|
| 743 |
{ |
|---|
| 744 |
CStoreRegister reg(NULL,2); |
|---|
| 745 |
if (reg.DoModal()) |
|---|
| 746 |
{ |
|---|
| 747 |
|
|---|
| 748 |
} |
|---|
| 749 |
m_wndOutputBar.ShowWindow(SW_SHOW); |
|---|
| 750 |
} |
|---|
| 751 |
|
|---|
| 752 |
void CMainFrame::OnRegistersStoreinregister3() |
|---|
| 753 |
{ |
|---|
| 754 |
CStoreRegister reg(NULL,3); |
|---|
| 755 |
if (reg.DoModal()) |
|---|
| 756 |
{ |
|---|
| 757 |
|
|---|
| 758 |
} |
|---|
| 759 |
|
|---|
| 760 |
} |
|---|
| 761 |
|
|---|
| 762 |
void CMainFrame::OnRegistersStoreinregister4() |
|---|
| 763 |
{ |
|---|
| 764 |
CStoreRegister reg(NULL,4); |
|---|
| 765 |
if (reg.DoModal()) |
|---|
| 766 |
{ |
|---|
| 767 |
|
|---|
| 768 |
} |
|---|
| 769 |
|
|---|
| 770 |
} |
|---|
| 771 |
|
|---|
| 772 |
void CMainFrame::OnRegistersStoreinregister5() |
|---|
| 773 |
{ |
|---|
| 774 |
CStoreRegister reg(NULL,5); |
|---|
| 775 |
if (reg.DoModal()) |
|---|
| 776 |
{ |
|---|
| 777 |
|
|---|
| 778 |
} |
|---|
| 779 |
|
|---|
| 780 |
} |
|---|
| 781 |
|
|---|
| 782 |
void CMainFrame::OnSettingsProjectsettings() |
|---|
| 783 |
{ |
|---|
| 784 |
|
|---|
| 785 |
Globals::theApp.LogEvent(OPEN_SETTINGS_DLG); |
|---|
| 786 |
if ( Globals::currentProject ) |
|---|
| 787 |
{ |
|---|
| 788 |
CSettingsDlg x(this,true); |
|---|
| 789 |
x.DoModal(); |
|---|
| 790 |
} |
|---|
| 791 |
else |
|---|
| 792 |
{ |
|---|
| 793 |
CSettingsDlg x(this,false); |
|---|
| 794 |
x.DoModal(); |
|---|
| 795 |
|
|---|
| 796 |
} |
|---|
| 797 |
|
|---|
| 798 |
} |
|---|
| 799 |
|
|---|
| 800 |
void CMainFrame::OnToolsConfiguretools() |
|---|
| 801 |
{ |
|---|
| 802 |
Globals::theApp.LogEvent(OPEN_TOOLS_DIALOG); |
|---|
| 803 |
CConfigureToolsDlg x; |
|---|
| 804 |
x.DoModal(); |
|---|
| 805 |
UpdateToolsMenu(); |
|---|
| 806 |
|
|---|
| 807 |
} |
|---|
| 808 |
|
|---|
| 809 |
|
|---|
| 810 |
|
|---|
| 811 |
void CMainFrame::OnRegistersMangeregisters() |
|---|
| 812 |
{ |
|---|
| 813 |
CManageRegistersDlg x; |
|---|
| 814 |
x.DoModal(); |
|---|
| 815 |
|
|---|
| 816 |
} |
|---|
| 817 |
|
|---|
| 818 |
void CMainFrame::OnEditQuickfindandreplace() |
|---|
| 819 |
{ |
|---|
| 820 |
quickFindAndReplaceDlg->ShowWindow(SW_SHOW); |
|---|
| 821 |
} |
|---|
| 822 |
|
|---|
| 823 |
void CMainFrame::OnEditFindandreplace() |
|---|
| 824 |
{ |
|---|
| 825 |
|
|---|
| 826 |
if ( Globals::currentProject ) SetCurrentDirectory(Globals::currentProject->path.c_str() ); |
|---|
| 827 |
|
|---|
| 828 |
|
|---|
| 829 |
advancedFindAndReplaceDlg->ShowWindow(SW_SHOW); |
|---|
| 830 |
advancedFindAndReplaceDlg->SetFocus(); |
|---|
| 831 |
advancedFindAndReplaceDlg->Populate(); |
|---|
| 832 |
|
|---|
| 833 |
if ( Globals::currentProject ) SetCurrentDirectory(Globals::currentProject->path.c_str() ); |
|---|
| 834 |
|
|---|
| 835 |
Globals::theApp.LogEvent(ADVANCED_FIND ); |
|---|
| 836 |
|
|---|
| 837 |
|
|---|
| 838 |
|
|---|
| 839 |
} |
|---|
| 840 |
|
|---|
| 841 |
|
|---|
| 842 |
|
|---|
| 843 |
void CMainFrame::OnFiletreeAddfolder() |
|---|
| 844 |
{ |
|---|
| 845 |
|
|---|
| 846 |
/* |
|---|
| 847 |
|
|---|
| 848 |
ElephantMessageBox ( GetRelativePath("C:\\dmd\\src\\phobos","C:\\emacs") . c_str() ); |
|---|
| 849 |
ElephantMessageBox ( GetRelativePath("C:\\dmd\\src\\phobos","C:\\dmd\\src\\phobos\\FIZZLE\\FRY") . c_str() ); |
|---|
| 850 |
ElephantMessageBox ( GetRelativePath("C:\\dmd\\src\\phobos","C:\\dmd\\tester\\two") . c_str() ); |
|---|
| 851 |
*/ |
|---|
| 852 |
|
|---|
| 853 |
if ( !Globals::currentProject ) |
|---|
| 854 |
{ |
|---|
| 855 |
Globals::theApp.SetStatusBarText("Add Project Folder FAILED : Sorry there is no active project currently."); |
|---|
| 856 |
return ; |
|---|
| 857 |
} |
|---|
| 858 |
CGetInputDlg dlg("Please enter the new folder name."); |
|---|
| 859 |
|
|---|
| 860 |
bool useDefault = false; |
|---|
| 861 |
|
|---|
| 862 |
if ( !GetFileTree().FolderIsSelected()) |
|---|
| 863 |
{ |
|---|
| 864 |
useDefault = true; |
|---|
| 865 |
Globals::theApp.SetStatusBarText("No project folder selected, defaulting to first project folder."); |
|---|
| 866 |
} |
|---|
| 867 |
|
|---|
| 868 |
|
|---|
| 869 |
if ( dlg.DoModal()) |
|---|
| 870 |
{ |
|---|
| 871 |
string folder = dlg.m_csValue.GetBuffer(0); |
|---|
| 872 |
if ( folder == "" ) |
|---|
| 873 |
{ |
|---|
| 874 |
|
|---|
| 875 |
ElephantMessageBox("Could you please enter a valid ( non blank ) file name?"); |
|---|
| 876 |
return; |
|---|
| 877 |
} |
|---|
| 878 |
if ( Globals::currentProject->FolderExists(folder )) |
|---|
| 879 |
{ |
|---|
| 880 |
ElephantMessageBox("Sorry that folder name is taken, can you please choose another?"); |
|---|
| 881 |
} |
|---|
| 882 |
else GetFileTree().NewFolder(folder , useDefault); |
|---|
| 883 |
|
|---|
| 884 |
} |
|---|
| 885 |
|
|---|
| 886 |
} |
|---|
| 887 |
|
|---|
| 888 |
void CMainFrame::OnFileSaveSaveproject() |
|---|
| 889 |
{ |
|---|
| 890 |
|
|---|
| 891 |
Globals::theApp.LogEvent(SAVE_PROJECT,Globals::currentProject->path ); |
|---|
| 892 |
|
|---|
| 893 |
if ( Globals::currentProject ) |
|---|
| 894 |
{ |
|---|
| 895 |
|
|---|
| 896 |
vector<string> files = GetAllNamedFiles(); |
|---|
| 897 |
Globals::currentProject->SetCache("sessionFiles",Join(files,",") ); |
|---|
| 898 |
Globals::currentProject->Save(); |
|---|
| 899 |
} |
|---|
| 900 |
|
|---|
| 901 |
} |
|---|
| 902 |
|
|---|
| 903 |
void CMainFrame::OnFiletreeAddfile() |
|---|
| 904 |
{ |
|---|
| 905 |
if ( !Globals::currentProject ) return ; |
|---|
| 906 |
|
|---|
| 907 |
bool useDefault = false; |
|---|
| 908 |
|
|---|
| 909 |
if ( !GetFileTree().FolderIsSelected()) |
|---|
| 910 |
{ |
|---|
| 911 |
Globals::theApp.SetStatusBarText("No project folder selected, defaulting to first project folder."); |
|---|
| 912 |
useDefault = true; |
|---|
| 913 |
} |
|---|
| 914 |
//AfxMessageBox(Globals::currentProject->path.c_str()); |
|---|
| 915 |
vector<string> files; |
|---|
| 916 |
GetFilesFromCFileDialog(Globals::lastDir,files,"d","D Files (*.d)|*.d|C Files (*.c )|*.c| RC Files (*.rc) |*.rc| All Files (*.*)|*.*||",this); |
|---|
| 917 |
|
|---|
| 918 |
string file = ""; |
|---|
| 919 |
|
|---|
| 920 |
if ( files.size() > 0 ) |
|---|
| 921 |
{ |
|---|
| 922 |
for ( int i = 0 ; i < files.size();i ++ ) |
|---|
| 923 |
{ |
|---|
| 924 |
string path = files[i]; |
|---|
| 925 |
file = GetRelativePath(Globals::currentProject->path , StripDirPath(path)) + StripFileName(path); |
|---|
| 926 |
//AfxMessageBox(files[i].c_str() ); |
|---|
| 927 |
GetFileTree().AddFile(files[i], false, useDefault); |
|---|
| 928 |
Globals::theApp.AddImportToCurrentProject(file); |
|---|
| 929 |
} |
|---|
| 930 |
|
|---|
| 931 |
|
|---|
| 932 |
|
|---|
| 933 |
UpdateProjectFileLists(Globals::currentProject); |
|---|
| 934 |
} |
|---|
| 935 |
|
|---|
| 936 |
vector<string> myFiles; |
|---|
| 937 |
Split(Globals::currentProject->GetCache("files"),",",myFiles); |
|---|
| 938 |
string reloadPath = Globals::currentProject->path + "\\" + myFiles[0]; |
|---|
| 939 |
//AfxMessageBox(reloadPath.c_str()); |
|---|
| 940 |
ReloadNamedFile(CString(reloadPath.c_str() ) ); |
|---|
| 941 |
|
|---|
| 942 |
|
|---|
| 943 |
} |
|---|
| 944 |
|
|---|
| 945 |
|
|---|
| 946 |
void CMainFrame::ReloadNamedFile(CString& pathToReload) |
|---|
| 947 |
{ |
|---|
| 948 |
|
|---|
| 949 |
POSITION x = Globals::theApp.m_pDocTemplate->GetFirstDocPosition(); |
|---|
| 950 |
|
|---|
| 951 |
CElephantDoc* pDoc; |
|---|
| 952 |
while (x) { |
|---|
| 953 |
pDoc = (CElephantDoc*)Globals::theApp.m_pDocTemplate->GetNextDoc(x); |
|---|
| 954 |
CString path = pDoc->GetPathName() ; |
|---|
| 955 |
//AfxMessageBox(path); |
|---|
| 956 |
//AfxMessageBox(pathToReload); |
|---|
| 957 |
if ( path == pathToReload ) |
|---|
| 958 |
{ |
|---|
| 959 |
POSITION vPos = pDoc->GetFirstViewPosition(); |
|---|
| 960 |
CElephantView* view = (CElephantView* ) pDoc->GetNextView(vPos); |
|---|
| 961 |
|
|---|
| 962 |
string file = ReadFile(path.GetBuffer(0)); |
|---|
| 963 |
CScintillaCtrl& rCtrl = view->GetCtrl(); |
|---|
| 964 |
rCtrl.SetText(file.c_str()); |
|---|
| 965 |
|
|---|
| 966 |
} |
|---|
| 967 |
|
|---|
| 968 |
} |
|---|
| 969 |
|
|---|
| 970 |
} |
|---|
| 971 |
|
|---|
| 972 |
|
|---|
| 973 |
void CMainFrame::OnFiletreeInsertfile() |
|---|
| 974 |
{ |
|---|
| 975 |
|
|---|
| 976 |
if ( !GetFileTree().FolderIsSelected()) |
|---|
| 977 |
{ |
|---|
| 978 |
Globals::theApp.SetStatusBarText("No project folder selected, defaulting to first project folder."); |
|---|
| 979 |
} |
|---|
| 980 |
|
|---|
| 981 |
CGetInputDlg dlg("Please give me the new file name.","",this); |
|---|
| 982 |
|
|---|
| 983 |
if ( dlg.DoModal() ) |
|---|
| 984 |
{ |
|---|
| 985 |
|
|---|
| 986 |
string file = dlg.m_csValue.GetBuffer(0); |
|---|
| 987 |
if ( file.find(".") == string::npos ) |
|---|
| 988 |
{ |
|---|
| 989 |
file += ".d"; |
|---|
| 990 |
} |
|---|
| 991 |
|
|---|
| 992 |
if ( FileExists(file ) ) |
|---|
| 993 |
{ |
|---|
| 994 |
if ( !ElephantMessageBoxYesNo("The file " + file + " already exists in the project, do you want me to overwrite it ?") ) return; |
|---|
| 995 |
|
|---|
| 996 |
} |
|---|
| 997 |
GetFileTree().AddFile(file,true); |
|---|
| 998 |
if ( Globals::currentProject ) UpdateProjectFileLists(Globals::currentProject); |
|---|
| 999 |
} |
|---|
| 1000 |
|
|---|
| 1001 |
} |
|---|
| 1002 |
|
|---|
| 1003 |
void CMainFrame::OnFiletreeRemoveFolder() |
|---|
| 1004 |
{ |
|---|
| 1005 |
if ( !GetFileTree().FolderIsSelected()) |
|---|
| 1006 |
{ |
|---|
| 1007 |
Globals::theApp.SetStatusBarText("Remove folder FAILED. Sorry what you have selected is not a folder."); |
|---|
| 1008 |
} |
|---|
| 1009 |
|
|---|
| 1010 |
else GetFileTree().RemoveFolder(); |
|---|
| 1011 |
|
|---|
| 1012 |
} |
|---|
| 1013 |
|
|---|
| 1014 |
void CMainFrame::OnFiletreeRemovefile() |
|---|
| 1015 |
{ |
|---|
| 1016 |
|
|---|
| 1017 |
if ( !Globals::currentProject ) |
|---|
| 1018 |
{ |
|---|
| 1019 |
Globals::theApp.SetStatusBarText("Remove file FAILED. Sorry there is no current active project to remove files from."); |
|---|
| 1020 |
return; |
|---|
| 1021 |
} |
|---|
| 1022 |
|
|---|
| 1023 |
|
|---|
| 1024 |
if ( GetFileTree().FolderIsSelected() ) |
|---|
| 1025 |
{ |
|---|
| 1026 |
Globals::theApp.SetStatusBarText("Remove file FAILED. Sorry what you have selected looks like a folder not a file."); |
|---|
| 1027 |
|
|---|
| 1028 |
} |
|---|
| 1029 |
else if ( GetFileTree().ProjectIsSelected()) |
|---|
| 1030 |
{ |
|---|
| 1031 |
Globals::theApp.SetStatusBarText("Remove file FAILED. Sorry what you have selected looks like a project not a file."); |
|---|
| 1032 |
|
|---|
| 1033 |
} |
|---|
| 1034 |
else |
|---|
| 1035 |
{ |
|---|
| 1036 |
GetFileTree().RemoveFile(); |
|---|
| 1037 |
UpdateProjectFileLists(Globals::currentProject); |
|---|
| 1038 |
Globals::theApp.SetStatusBarText("Remove file SUCCEEDED."); |
|---|
| 1039 |
} |
|---|
| 1040 |
} |
|---|
| 1041 |
|
|---|
| 1042 |
|
|---|
| 1043 |
//void CMainFrame::StartProject(ProjectSettings* project) |
|---|
| 1044 |
//{ |
|---|
| 1045 |
// |
|---|
| 1046 |
// |
|---|
| 1047 |
//} |
|---|
| 1048 |
|
|---|
| 1049 |
bool CMainFrame::UpdateConfigCombo() |
|---|
| 1050 |
{ |
|---|
| 1051 |
DeleteAllComboItems((CComboBox*)&m_configComboBox); |
|---|
| 1052 |
|
|---|
| 1053 |
if ( Globals::currentProject ) |
|---|
| 1054 |
{ |
|---|
| 1055 |
vector<string> configs; |
|---|
| 1056 |
Split(Globals::currentProject->GetCache("Configurations"),",",configs ); |
|---|
| 1057 |
string activeConfig = Globals::currentProject->GetCache("CurrentConfiguration"); |
|---|
| 1058 |
int sel = 0; |
|---|
| 1059 |
for ( int i = 0;i < configs.size(); i++ ) |
|---|
| 1060 |
{ |
|---|
| 1061 |
if ( configs[i] == activeConfig ) |
|---|
| 1062 |
sel = i; |
|---|
| 1063 |
m_configComboBox.AddString(configs[i].c_str() ); |
|---|
| 1064 |
m_configComboBox.SetItemImage(i,3); |
|---|
| 1065 |
|
|---|
| 1066 |
} |
|---|
| 1067 |
m_configComboBox.SetCurSel(sel); |
|---|
| 1068 |
|
|---|
| 1069 |
|
|---|
| 1070 |
|
|---|
| 1071 |
} |
|---|
| 1072 |
else m_configComboBox.AddString("Project Configurations"); |
|---|
| 1073 |
|
|---|
| 1074 |
return true; |
|---|
| 1075 |
|
|---|
| 1076 |
} |
|---|
| 1077 |
|
|---|
| 1078 |
void CMainFrame::UpdateProjectFileLists(ProjectSettings* project) |
|---|
| 1079 |
{ |
|---|
| 1080 |
vector<string> sortFiles; |
|---|
| 1081 |
|
|---|
| 1082 |
DeleteAllComboItems((CComboBox*)&m_fileComboBox); |
|---|
| 1083 |
DeleteAllComboItems((CComboBox*)&m_wndTabDockBar.m_fileHistory.m_fileCombo); |
|---|
| 1084 |
|
|---|
| 1085 |
vector<string> files; |
|---|
| 1086 |
Split(project->GetCache("files"),",",files); |
|---|
| 1087 |
|
|---|
| 1088 |
|
|---|
| 1089 |
vector<string> addonFiles = Globals::theApp.GetAddOnFiles(project); |
|---|
| 1090 |
|
|---|
| 1091 |
std::copy(addonFiles.begin(),addonFiles.end(),std::back_inserter(files)); |
|---|
| 1092 |
|
|---|
| 1093 |
|
|---|
| 1094 |
for ( int j = 0 ; j < files.size(); j++ ) |
|---|
| 1095 |
{ |
|---|
| 1096 |
sortFiles.push_back(StripFileName(files[j]) ); |
|---|
| 1097 |
|
|---|
| 1098 |
} |
|---|
| 1099 |
|
|---|
| 1100 |
std::sort(sortFiles.begin(),sortFiles.end()); |
|---|
| 1101 |
|
|---|
| 1102 |
for ( int i = 0; i < sortFiles.size(); i++ ) |
|---|
| 1103 |
{ |
|---|
| 1104 |
m_fileComboBox.AddString(sortFiles[i].c_str()); |
|---|
| 1105 |
m_fileComboBox.SetItemImage(i,0); |
|---|
| 1106 |
|
|---|
| 1107 |
} |
|---|
| 1108 |
m_fileComboBox.SetCurSel(0); |
|---|
| 1109 |
|
|---|
| 1110 |
} |
|---|
| 1111 |
|
|---|
| 1112 |
void CMainFrame::OnNavigationBackonepage() |
|---|
| 1113 |
{ |
|---|
| 1114 |
LastView back = Globals::recentViews.Back(); |
|---|
| 1115 |
|
|---|
| 1116 |
if ( !back.me ) return; |
|---|
| 1117 |
|
|---|
| 1118 |
//AfxMessageBox(back.me->GetTitle() ); |
|---|
| 1119 |
|
|---|
| 1120 |
POSITION x = Globals::theApp.m_pDocTemplate->GetFirstDocPosition(); |
|---|
| 1121 |
CElephantDoc* pDoc; |
|---|
| 1122 |
|
|---|
| 1123 |
|
|---|
| 1124 |
|
|---|
| 1125 |
while (x) { |
|---|
| 1126 |
pDoc = (CElephantDoc*)Globals::theApp.m_pDocTemplate->GetNextDoc(x); |
|---|
| 1127 |
if ( pDoc == back.me && pDoc ) { |
|---|
| 1128 |
|
|---|
| 1129 |
POSITION p = pDoc->GetFirstViewPosition(); |
|---|
| 1130 |
CElephantView* view = (CElephantView*)pDoc->GetNextView(p); |
|---|
| 1131 |
if (!view) return; |
|---|
| 1132 |
if ( view == GetActiveView() ) { |
|---|
| 1133 |
OnNavigationBackonepage(); |
|---|
| 1134 |
return; |
|---|
| 1135 |
} |
|---|
| 1136 |
CString title= pDoc->GetTitle(); |
|---|
| 1137 |
Globals::theApp.LogEvent(NAVIGATE_BACK ,StripModifyStar(title) ); |
|---|
| 1138 |
MDIActivate( view->GetParent() ); |
|---|
| 1139 |
break; |
|---|
| 1140 |
} |
|---|
| 1141 |
|
|---|
| 1142 |
} |
|---|
| 1143 |
|
|---|
| 1144 |
|
|---|
| 1145 |
|
|---|
| 1146 |
} |
|---|
| 1147 |
|
|---|
| 1148 |
void CMainFrame::OnNavigationForward() |
|---|
| 1149 |
{ |
|---|
| 1150 |
LastView back = Globals::recentViews.Forward(); |
|---|
| 1151 |
|
|---|
| 1152 |
if ( !back.me ) return; |
|---|
| 1153 |
|
|---|
| 1154 |
POSITION x = Globals::theApp.m_pDocTemplate->GetFirstDocPosition(); |
|---|
| 1155 |
CElephantDoc* pDoc; |
|---|
| 1156 |
|
|---|
| 1157 |
while (x) { |
|---|
| 1158 |
pDoc = (CElephantDoc*)Globals::theApp.m_pDocTemplate->GetNextDoc(x); |
|---|
| 1159 |
if ( pDoc == back.me && pDoc ) { |
|---|
| 1160 |
|
|---|
| 1161 |
POSITION p = pDoc->GetFirstViewPosition(); |
|---|
| 1162 |
CElephantView* view = (CElephantView*)pDoc->GetNextView(p); |
|---|
| 1163 |
if (!view) return; |
|---|
| 1164 |
if ( view == GetActiveView() ) { |
|---|
| 1165 |
OnNavigationForward(); |
|---|
| 1166 |
return; |
|---|
| 1167 |
} |
|---|
| 1168 |
CString title= pDoc->GetTitle(); |
|---|
| 1169 |
MDIActivate( view->GetParent() ); |
|---|
| 1170 |
Globals::theApp.LogEvent(NAVIGATE_FORWARD ,StripModifyStar(title) ); |
|---|
| 1171 |
break; |
|---|
| 1172 |
|
|---|
| 1173 |
} |
|---|
| 1174 |
|
|---|
| 1175 |
} |
|---|
| 1176 |
|
|---|
| 1177 |
} |
|---|
| 1178 |
|
|---|
| 1179 |
void CMainFrame::OnNavigationFoldall() |
|---|
| 1180 |
{ |
|---|
| 1181 |
if ( GetActiveView() ) GetActiveView()->FoldAll(); |
|---|
| 1182 |
|
|---|
| 1183 |
} |
|---|
| 1184 |
|
|---|
| 1185 |
void CMainFrame::OnNavigationExpandall() |
|---|
| 1186 |
{ |
|---|
| 1187 |
if ( GetActiveView() ) GetActiveView()->ExpandAll(); |
|---|
| 1188 |
|
|---|
| 1189 |
} |
|---|
| 1190 |
|
|---|
| 1191 |
void CMainFrame::OnNavigationIsolate() |
|---|
| 1192 |
{ |
|---|
| 1193 |
if ( GetActiveView() ) GetActiveView()->Isolate(); |
|---|
| 1194 |
|
|---|
| 1195 |
|
|---|
| 1196 |
} |
|---|
| 1197 |
|
|---|
| 1198 |
void CMainFrame::OnNavigationGotoline() |
|---|
| 1199 |
{ |
|---|
| 1200 |
CGetInputDlg dlg("Enter the line number.","",this); |
|---|
| 1201 |
|
|---|
| 1202 |
if ( dlg.DoModal()) |
|---|
| 1203 |
{ |
|---|
| 1204 |
int line = atoi(dlg.m_csValue.GetBuffer(0) ) -1; |
|---|
| 1205 |
if ( GetActiveView() ) GetActiveView()->GotoLine(line); |
|---|
| 1206 |
|
|---|
| 1207 |
} |
|---|
| 1208 |
Globals::theApp.LogEvent(GOTO_LINE ,dlg.m_csValue.GetBuffer(0) ); |
|---|
| 1209 |
} |
|---|
| 1210 |
|
|---|
| 1211 |
void CMainFrame::OnNavigationCenterline() |
|---|
| 1212 |
{ |
|---|
| 1213 |
if ( GetActiveView() ) GetActiveView()->CenterLine(); |
|---|
| 1214 |
|
|---|
| 1215 |
} |
|---|
| 1216 |
|
|---|
| 1217 |
void CMainFrame::OnNavigationMakelinetop() |
|---|
| 1218 |
{ |
|---|
| 1219 |
|
|---|
| 1220 |
if ( GetActiveView() ) GetActiveView()->MakeLineTop(); |
|---|
| 1221 |
} |
|---|
| 1222 |
|
|---|
| 1223 |
void CMainFrame::OnRegistersPasteregister1() |
|---|
| 1224 |
{ |
|---|
| 1225 |
|
|---|
| 1226 |
string str = WhiteSpace::ReplaceCodesWithWhite( Globals::settings->baseSettings->GetCache("register_1") ); |
|---|
| 1227 |
if ( GetActiveView() ) GetActiveView()->InsertRegister(str.c_str()); |
|---|
| 1228 |
|
|---|
| 1229 |
} |
|---|
| 1230 |
|
|---|
| 1231 |
void CMainFrame::OnRegistersPasteregister2() |
|---|
| 1232 |
{ |
|---|
| 1233 |
string str = WhiteSpace::ReplaceCodesWithWhite( Globals::settings->baseSettings->GetCache("register_2") ); |
|---|
| 1234 |
if ( GetActiveView() ) GetActiveView()->InsertRegister(str.c_str()); |
|---|
| 1235 |
|
|---|
| 1236 |
|
|---|
| 1237 |
} |
|---|
| 1238 |
|
|---|
| 1239 |
void CMainFrame::OnRegistersPasteregister4() |
|---|
| 1240 |
{ |
|---|
| 1241 |
string str = WhiteSpace::ReplaceCodesWithWhite( Globals::settings->baseSettings->GetCache("register_4") ); |
|---|
| 1242 |
if ( GetActiveView() ) GetActiveView()->InsertRegister(str.c_str()); |
|---|
| 1243 |
|
|---|
| 1244 |
|
|---|
| 1245 |
} |
|---|
| 1246 |
|
|---|
| 1247 |
void CMainFrame::OnRegistersPasteregister3() |
|---|
| 1248 |
{ |
|---|
| 1249 |
string str = WhiteSpace::ReplaceCodesWithWhite( Globals::settings->baseSettings->GetCache("register_3") ); |
|---|
| 1250 |
if ( GetActiveView() ) GetActiveView()->InsertRegister(str.c_str()); |
|---|
| 1251 |
|
|---|
| 1252 |
|
|---|
| 1253 |
} |
|---|
| 1254 |
|
|---|
| 1255 |
void CMainFrame::OnRegistersPasteregister5() |
|---|
| 1256 |
{ |
|---|
| 1257 |
string str = WhiteSpace::ReplaceCodesWithWhite( Globals::settings->baseSettings->GetCache("register_5") ); |
|---|
| 1258 |
if ( GetActiveView() ) GetActiveView()->InsertRegister(str.c_str()); |
|---|
| 1259 |
|
|---|
| 1260 |
|
|---|
| 1261 |
} |
|---|
| 1262 |
|
|---|
| 1263 |
void CMainFrame::OnNavigationExecgotofile() |
|---|
| 1264 |
{ |
|---|
| 1265 |
CString str; |
|---|
| 1266 |
m_fileComboBox.GetLBText(m_fileComboBox.GetCurSel(),str ); |
|---|
| 1267 |
Globals::theApp.OpenFile(str.GetBuffer(0)); |
|---|
| 1268 |
|
|---|
| 1269 |
Globals::theApp.LogEvent(GOTO_SYM ,str.GetBuffer(0)); |
|---|
| 1270 |
|
|---|
| 1271 |
} |
|---|
| 1272 |
|
|---|
| 1273 |
void CMainFrame::OnNavigationExecgotosymbol() |
|---|
| 1274 |
{ |
|---|
| 1275 |
|
|---|
| 1276 |
if ( m_gotoPos > 0 ) { |
|---|
| 1277 |
|
|---|
| 1278 |
CScintillaCtrl &rCtrl = GetActiveView()->GetCtrl(); |
|---|
| 1279 |
rCtrl.GotoPos(m_gotoPos); |
|---|
| 1280 |
} |
|---|
| 1281 |
|
|---|
| 1282 |
|
|---|
| 1283 |
//ElephantMessageBox(ITOA(m_tagComboBox.GetCurSel()).c_str() ); |
|---|
| 1284 |
|
|---|
| 1285 |
int pos = m_tagComboBox.GetCurSel(); |
|---|
| 1286 |
CString str; |
|---|
| 1287 |
m_tagComboBox.GetLBText(pos,str); |
|---|
| 1288 |
if ( str == "Code Box" ) return; |
|---|
| 1289 |
|
|---|
| 1290 |
SymbolListing* listing = (SymbolListing*)m_tagComboBox.GetItemData(pos); |
|---|
| 1291 |
CMainFrame* mf = (CMainFrame*)Globals::theApp.m_pMainWnd; |
|---|
| 1292 |
if ( listing ) |
|---|
| 1293 |
{ |
|---|
| 1294 |
if ( !listing->type) return; |
|---|
| 1295 |
// ElephantMessageBox(listing->name.c_str()); |
|---|
| 1296 |
// ElephantMessageBox(listing->sym->loc.filename); |
|---|
| 1297 |
if ( listing->type == D_ENUM ) |
|---|
| 1298 |
{ |
|---|
| 1299 |
|
|---|
| 1300 |
mf->SetStatusBarText("Skipping going to symbol of type enum."); |
|---|
| 1301 |
|
|---|
| 1302 |
} |
|---|
| 1303 |
|
|---|
| 1304 |
else if ( listing->sym ) |
|---|
| 1305 |
{ |
|---|
| 1306 |
try { |
|---|
| 1307 |
|
|---|
| 1308 |
if ( listing->sym->isClassDeclaration() ) |
|---|
| 1309 |
Globals::theApp.OpenFile(listing->sym->loc.filename,listing->sym->loc.linnum - 1); |
|---|
| 1310 |
else |
|---|
| 1311 |
{ |
|---|
| 1312 |
|
|---|
| 1313 |
|
|---|
| 1314 |
if ( listing->sym->loc.filename ) |
|---|
| 1315 |
{ |
|---|
| 1316 |
|
|---|
| 1317 |
Globals::theApp.OpenFile(listing->sym->loc.filename,listing->sym->loc.linnum); |
|---|
| 1318 |
string text = listing->sym->toChars(); |
|---|
| 1319 |
text += " -> "; |
|---|
| 1320 |
text += listing->sym->loc.filename; |
|---|
| 1321 |
text += " [ " + ITOA(listing->sym->loc.linnum) + " ] "; |
|---|
| 1322 |
|
|---|
| 1323 |
mf->SetStatusBarText(text.c_str()); |
|---|
| 1324 |
} |
|---|
| 1325 |
|
|---|
| 1326 |
|
|---|
| 1327 |
|
|---|
| 1328 |
|
|---|
| 1329 |
|
|---|
| 1330 |
} |
|---|
| 1331 |
} |
|---|
| 1332 |
catch ( ... ) { mf->SetStatusBarText("Error finding symbol."); } |
|---|
| 1333 |
|
|---|
| 1334 |
|
|---|
| 1335 |
Globals::theApp.LogEvent(GOTO_SYM ,listing->sym->toChars() ); |
|---|
| 1336 |
} |
|---|
| 1337 |
} |
|---|
| 1338 |
|
|---|
| 1339 |
|
|---|
| 1340 |
|
|---|
| 1341 |
|
|---|
| 1342 |
|
|---|
| 1343 |
} |
|---|
| 1344 |
|
|---|
| 1345 |
|
|---|
| 1346 |
bool CMainFrame::UpdateProjectNodeMenu(ProjectSettings* project) |
|---|
| 1347 |
{ |
|---|
| 1348 |
|
|---|
| 1349 |
|
|---|
| 1350 |
CMenu *mmenu = GetMenu(); |
|---|
| 1351 |
// mmenu->LoadMenu(IDI_ICON1); |
|---|
| 1352 |
|
|---|
| 1353 |
int pos = FindMenuItem(mmenu, "&Project"); |
|---|
| 1354 |
if (pos == -1) { |
|---|
| 1355 |
ElephantMessageBox("Error finding project menu item! This is an internal error, meaningful only to charlie. Thats right -- charlie."); |
|---|
| 1356 |
return false; |
|---|
| 1357 |
} |
|---|
| 1358 |
|
|---|
| 1359 |
|
|---|
| 1360 |
CMenu* submenu = mmenu->GetSubMenu(pos); |
|---|
| 1361 |
|
|---|
| 1362 |
|
|---|
| 1363 |
pos = FindMenuItem(submenu, "&Project Nodes"); |
|---|
| 1364 |
|
|---|
| 1365 |
if (pos > -1) { |
|---|
| 1366 |
|
|---|
| 1367 |
int i; |
|---|
| 1368 |
|
|---|
| 1369 |
|
|---|
| 1370 |
CMenu *rpMenu = submenu->GetSubMenu(pos); |
|---|
| 1371 |
|
|---|
| 1372 |
if (rpMenu->GetMenuItemCount() > 2 ) { |
|---|
| 1373 |
|
|---|
| 1374 |
rpMenu->DeleteMenu(2,MF_BYPOSITION); |
|---|
| 1375 |
rpMenu->DeleteMenu(2,MF_BYPOSITION); |
|---|
| 1376 |
rpMenu->DeleteMenu(2,MF_BYPOSITION); |
|---|
| 1377 |
rpMenu->DeleteMenu(2,MF_BYPOSITION); |
|---|
| 1378 |
rpMenu->DeleteMenu(2,MF_BYPOSITION); |
|---|
| 1379 |
rpMenu->DeleteMenu(2,MF_BYPOSITION); |
|---|
| 1380 |
rpMenu->DeleteMenu(2,MF_BYPOSITION); |
|---|
| 1381 |
|
|---|
| 1382 |
} |
|---|
| 1383 |
|
|---|
| 1384 |
long enumPos = ID_PROJECT_NODE1; |
|---|
| 1385 |
int insPos = 3; |
|---|
| 1386 |
|
|---|
| 1387 |
|
|---|
| 1388 |
vector<string> nodes; |
|---|
| 1389 |
|
|---|
| 1390 |
Split(project->GetCache("AddOnProjects"),",",nodes); |
|---|
| 1391 |
|
|---|
| 1392 |
vector<string> projects; |
|---|
| 1393 |
|
|---|
| 1394 |
|
|---|
| 1395 |
for ( i = 0 ; i < nodes.size(); i++) |
|---|
| 1396 |
{ |
|---|
| 1397 |
string name = StripFileName(nodes[i] ); |
|---|
| 1398 |
StripExtension(name); |
|---|
| 1399 |
projects.push_back(name); |
|---|
| 1400 |
|
|---|
| 1401 |
} |
|---|
| 1402 |
|
|---|
| 1403 |
|
|---|
| 1404 |
for ( i = 0;i < projects.size();i++) { |
|---|
| 1405 |
if ( i == 7 ) break; |
|---|
| 1406 |
string insert = projects[i] + "\t[ C - A - " + ITOA(i+1) + " ]"; |
|---|
| 1407 |
rpMenu->InsertMenu(insPos++, MF_BYPOSITION , enumPos++,insert.c_str() ); |
|---|
| 1408 |
// submenu->EnableMenuItem(MF_DISABLED | MF_BYPOSITION, enumPos - 1); |
|---|
| 1409 |
} |
|---|
| 1410 |
|
|---|
| 1411 |
|
|---|
| 1412 |
|
|---|
| 1413 |
} |
|---|
| 1414 |
return true; |
|---|
| 1415 |
|
|---|
| 1416 |
|
|---|
| 1417 |
} |
|---|
| 1418 |
|
|---|
| 1419 |
bool CMainFrame::UpdateRecentProjectsMenu() { |
|---|
| 1420 |
|
|---|
| 1421 |
CMenu *mmenu = GetMenu(); |
|---|
| 1422 |
// mmenu->LoadMenu(IDI_ICON1); |
|---|
| 1423 |
|
|---|
| 1424 |
int pos = FindMenuItem(mmenu, "&File"); |
|---|
| 1425 |
if (pos == -1) { |
|---|
| 1426 |
return false; |
|---|
| 1427 |
} |
|---|
| 1428 |
|
|---|
| 1429 |
// Remove "New" menu item from the File menu. |
|---|
| 1430 |
CMenu* submenu = mmenu->GetSubMenu(pos); |
|---|
| 1431 |
|
|---|
| 1432 |
// Look for "Open" menu item from the File menu. Insert a new |
|---|
| 1433 |
// menu item called "Close" right after the "Open" menu item. |
|---|
| 1434 |
// ID_CLOSEFILE is the command id for the "Close" menu item. |
|---|
| 1435 |
|
|---|
| 1436 |
pos = FindMenuItem(submenu, "&Recent Projects"); |
|---|
| 1437 |
|
|---|
| 1438 |
if (pos > -1) { |
|---|
| 1439 |
|
|---|
| 1440 |
int i; |
|---|
| 1441 |
CMenu *rpMenu = submenu->GetSubMenu(pos); |
|---|
| 1442 |
if (rpMenu->GetMenuItemCount() > 2 ) { |
|---|
| 1443 |
|
|---|
| 1444 |
rpMenu->DeleteMenu(2,MF_BYPOSITION); |
|---|
| 1445 |
rpMenu->DeleteMenu(2,MF_BYPOSITION); |
|---|
| 1446 |
rpMenu->DeleteMenu(2,MF_BYPOSITION); |
|---|
| 1447 |
rpMenu->DeleteMenu(2,MF_BYPOSITION); |
|---|
| 1448 |
rpMenu->DeleteMenu(2,MF_BYPOSITION); |
|---|
| 1449 |
|
|---|
| 1450 |
} |
|---|
| 1451 |
|
|---|
| 1452 |
long enumPos = ID_RECENT_PROJECTS1; |
|---|
| 1453 |
int insPos = 3; |
|---|
| 1454 |
|
|---|
| 1455 |
|
|---|
| 1456 |
vector<string> projects; |
|---|
| 1457 |
Split(Globals::settings->baseSettings->GetCache("recentProjects"),",",projects); |
|---|
| 1458 |
|
|---|
| 1459 |
for ( i = 0;i < projects.size();i++) { |
|---|
| 1460 |
if ( i == 5 ) break; |
|---|
| 1461 |
rpMenu->InsertMenu(insPos++, MF_BYPOSITION | MF_DISABLED, enumPos++,projects[i].c_str() ); |
|---|
| 1462 |
// submenu->EnableMenuItem(MF_DISABLED | MF_BYPOSITION, enumPos - 1); |
|---|
| 1463 |
} |
|---|
| 1464 |
|
|---|
| 1465 |
for (i ; i < 5;i++) { |
|---|
| 1466 |
rpMenu->InsertMenu(insPos++, MF_BYPOSITION | MF_GRAYED | MF_DISABLED, enumPos++ , " [empty] " ); |
|---|
| 1467 |
// submenu->EnableMenuItem(enumPos, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); |
|---|
| 1468 |
} |
|---|
| 1469 |
|
|---|
| 1470 |
} |
|---|
| 1471 |
return true; |
|---|
| 1472 |
|
|---|
| 1473 |
} |
|---|
| 1474 |
|
|---|
| 1475 |
|
|---|
| 1476 |
void CMainFrame::OnProjectNodeSelected1() { |
|---|
| 1477 |
ActivateProjectNode(0); |
|---|
| 1478 |
} |
|---|
| 1479 |
void CMainFrame::OnProjectNodeSelected2() { ActivateProjectNode(1);} |
|---|
| 1480 |
void CMainFrame::OnProjectNodeSelected3() { ActivateProjectNode(2);} |
|---|
| 1481 |
void CMainFrame::OnProjectNodeSelected4() { ActivateProjectNode(3);} |
|---|
| 1482 |
void CMainFrame::OnProjectNodeSelected5() { ActivateProjectNode(4);} |
|---|
| 1483 |
|
|---|
| 1484 |
void CMainFrame::OnRecentProjectSelected1() { |
|---|
| 1485 |
|
|---|
| 1486 |
string file = GetSelectedRecentProject(ID_RECENT_PROJECTS1); |
|---|
| 1487 |
if ( file != " [empty] " ) |
|---|
| 1488 |
|
|---|
| 1489 |
{ |
|---|
| 1490 |
string path = StripDirPath( file); |
|---|
| 1491 |
string fileName = StripFileName(file); |
|---|
| 1492 |
StripExtension(fileName); |
|---|
| 1493 |
|
|---|
| 1494 |
ProjectSettings * p = new ProjectSettings(file); |
|---|
| 1495 |
|
|---|
| 1496 |
|
|---|
| 1497 |
Globals::SetProject(p); |
|---|
| 1498 |
|
|---|
| 1499 |
} |
|---|
| 1500 |
|
|---|
| 1501 |
|
|---|
| 1502 |
} |
|---|
| 1503 |
|
|---|
| 1504 |
|
|---|
| 1505 |
void CMainFrame::OnRecentProjectSelected2() { |
|---|
| 1506 |
|
|---|
| 1507 |
string file = GetSelectedRecentProject(ID_RECENT_PROJECTS2); |
|---|
| 1508 |
if ( file != " [empty] " ) |
|---|
| 1509 |
|
|---|
| 1510 |
{ |
|---|
| 1511 |
|
|---|
| 1512 |
ProjectSettings * p = new ProjectSettings(file); |
|---|
| 1513 |
|
|---|
| 1514 |
|
|---|
| 1515 |
Globals::SetProject(p); |
|---|
| 1516 |
|
|---|
| 1517 |
} |
|---|
| 1518 |
|
|---|
| 1519 |
} |
|---|
| 1520 |
|
|---|
| 1521 |
|
|---|
| 1522 |
void CMainFrame::OnRecentProjectSelected3() { |
|---|
| 1523 |
|
|---|
| 1524 |
string file = GetSelectedRecentProject(ID_RECENT_PROJECTS3); |
|---|
| 1525 |
if ( file != " [empty] " ) |
|---|
| 1526 |
|
|---|
| 1527 |
{ |
|---|
| 1528 |
string path = StripDirPath( file); |
|---|
| 1529 |
string fileName = StripFileName(file); |
|---|
| 1530 |
StripExtension(fileName); |
|---|
| 1531 |
|
|---|
| 1532 |
ProjectSettings * p = new ProjectSettings(file ); |
|---|
| 1533 |
|
|---|
| 1534 |
|
|---|
| 1535 |
Globals::SetProject(p); |
|---|
| 1536 |
|
|---|
| 1537 |
} |
|---|
| 1538 |
|
|---|
| 1539 |
|
|---|
| 1540 |
} |
|---|
| 1541 |
|
|---|
| 1542 |
|
|---|
| 1543 |
void CMainFrame::OnRecentProjectSelected4() { |
|---|
| 1544 |
|
|---|
| 1545 |
string file = GetSelectedRecentProject(ID_RECENT_PROJECTS4); |
|---|
| 1546 |
if ( file != " [empty] " ) |
|---|
| 1547 |
|
|---|
| 1548 |
{ |
|---|
| 1549 |
string path = StripDirPath( file); |
|---|
| 1550 |
string fileName = StripFileName(file); |
|---|
| 1551 |
StripExtension(fileName); |
|---|
| 1552 |
|
|---|
| 1553 |
ProjectSettings * p = new ProjectSettings(file); |
|---|
| 1554 |
|
|---|
| 1555 |
|
|---|
| 1556 |
Globals::SetProject(p); |
|---|
| 1557 |
|
|---|
| 1558 |
} |
|---|
| 1559 |
|
|---|
| 1560 |
|
|---|
| 1561 |
} |
|---|
| 1562 |
|
|---|
| 1563 |
|
|---|
| 1564 |
void CMainFrame::OnRecentProjectSelected5() { |
|---|
| 1565 |
|
|---|
| 1566 |
//Globals::theApp.ElephantMessageBox("Tester number three"); |
|---|
| 1567 |
|
|---|
| 1568 |
string file = GetSelectedRecentProject(ID_RECENT_PROJECTS5); |
|---|
| 1569 |
if ( file != " [empty] " ) |
|---|
| 1570 |
|
|---|
| 1571 |
{ |
|---|
| 1572 |
string path = StripDirPath( file); |
|---|
| 1573 |
string fileName = StripFileName(file); |
|---|
| 1574 |
StripExtension(fileName); |
|---|
| 1575 |
|
|---|
| 1576 |
ProjectSettings * p = new ProjectSettings(file ); |
|---|
| 1577 |
|
|---|
| 1578 |
|
|---|
| 1579 |
Globals::SetProject(p); |
|---|
| 1580 |
|
|---|
| 1581 |
} |
|---|
| 1582 |
|
|---|
| 1583 |
} |
|---|
| 1584 |
|
|---|
| 1585 |
|
|---|
| 1586 |
bool CMainFrame::UpdateToolsMenu() { |
|---|
| 1587 |
|
|---|
| 1588 |
|
|---|
| 1589 |
CMenu *mmenu = GetMenu(); |
|---|
| 1590 |
// mmenu->LoadMenu(IDI_ICON1); |
|---|
| 1591 |
|
|---|
| 1592 |
int pos = FindMenuItem(mmenu, "&Tools"); |
|---|
| 1593 |
if (pos == -1) { |
|---|
| 1594 |
return false; |
|---|
| 1595 |
} |
|---|
| 1596 |
|
|---|
| 1597 |
// Remove "New" menu item from the File menu. |
|---|
| 1598 |
CMenu* submenu = mmenu->GetSubMenu(pos); |
|---|
| 1599 |
|
|---|
| 1600 |
// Look for "Open" menu item from the File menu. Insert a new |
|---|
| 1601 |
// menu item called "Close" right after the "Open" menu item. |
|---|
| 1602 |
// ID_CLOSEFILE is the command id for the "Close" menu item. |
|---|
| 1603 |
int i = 0; |
|---|
| 1604 |
pos = FindMenuItem(submenu, "&Configure Tools...\t[ C - t ]"); |
|---|
| 1605 |
if (pos > -1) { |
|---|
| 1606 |
|
|---|
| 1607 |
long enumPos = ID_TOOLS1; |
|---|
| 1608 |
int insPos = 7; |
|---|
| 1609 |
|
|---|
| 1610 |
|
|---|
| 1611 |
if ( submenu->GetMenuItemCount () > 5 ) { |
|---|
| 1612 |
|
|---|
| 1613 |
submenu->DeleteMenu(insPos,MF_BYPOSITION); |
|---|
| 1614 |
submenu->DeleteMenu(insPos,MF_BYPOSITION); |
|---|
| 1615 |
submenu->DeleteMenu(insPos,MF_BYPOSITION); |
|---|
| 1616 |
submenu->DeleteMenu(insPos,MF_BYPOSITION); |
|---|
| 1617 |
submenu->DeleteMenu(insPos,MF_BYPOSITION); |
|---|
| 1618 |
|
|---|
| 1619 |
} |
|---|
| 1620 |
|
|---|
| 1621 |
vector<string> tools, temp; |
|---|
| 1622 |
Split(Globals::settings->baseSettings->GetCache("tools"),",",tools); |
|---|
| 1623 |
|
|---|
| 1624 |
for ( i = 0;i < tools.size();i++) { |
|---|
| 1625 |
|
|---|
| 1626 |
string buf = tools[i]; |
|---|
| 1627 |
Split(buf,"~",temp); |
|---|
| 1628 |
|
|---|
| 1629 |
submenu->InsertMenu(insPos++, MF_BYPOSITION | MF_DISABLED, enumPos++,temp[0].c_str() ); |
|---|
| 1630 |
temp.clear(); |
|---|
| 1631 |
// submenu->EnableMenuItem(MF_DISABLED | MF_BYPOSITION, enumPos - 1); |
|---|
| 1632 |
} |
|---|
| 1633 |
|
|---|
| 1634 |
// for (i ; i < 5;i++) { |
|---|
| 1635 |
// submenu->InsertMenu(insPos++, MF_BYPOSITION | MF_GRAYED | MF_DISABLED, 0, " [empty] " ); |
|---|
| 1636 |
// // submenu->EnableMenuItem(enumPos, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); |
|---|
| 1637 |
// } |
|---|
| 1638 |
|
|---|
| 1639 |
} |
|---|
| 1640 |
return true; |
|---|
| 1641 |
|
|---|
| 1642 |
|
|---|
| 1643 |
} |
|---|
| 1644 |
|
|---|
| 1645 |
CScintillaCtrl& CMainFrame::GetActiveToolOutput() |
|---|
| 1646 |
{ |
|---|
| 1647 |
|
|---|
| 1648 |
POSITION pos = Globals::theApp.m_pDocTemplate->GetFirstDocPosition(); |
|---|
| 1649 |
CElephantDoc* doc; |
|---|
| 1650 |
CElephantView* view; |
|---|
| 1651 |
while (pos) { |
|---|
| 1652 |
doc = (CElephantDoc*) Globals::theApp.m_pDocTemplate->GetNextDoc(pos); |
|---|
| 1653 |
|
|---|
| 1654 |
if ( doc->GetTitle() == "ToolOutput" || doc->GetTitle() == "ToolOutput*") { |
|---|
| 1655 |
POSITION firstPos = doc->GetFirstViewPosition(); |
|---|
| 1656 |
view = (CElephantView*)doc->GetNextView(firstPos); |
|---|
| 1657 |
return view->GetCtrl(); |
|---|
| 1658 |
|
|---|
| 1659 |
} |
|---|
| 1660 |
|
|---|
| 1661 |
} |
|---|
| 1662 |
|
|---|
| 1663 |
doc = (CElephantDoc*) Globals::theApp.m_pDocTemplate->OpenDocumentFile(NULL); |
|---|
| 1664 |
doc->SetTitle("ToolOutput"); |
|---|
| 1665 |
pos = doc->GetFirstViewPosition(); |
|---|
| 1666 |
view = (CElephantView*) doc->GetNextView(pos); |
|---|
| 1667 |
return view->GetCtrl(); |
|---|
| 1668 |
|
|---|
| 1669 |
|
|---|
| 1670 |
} |
|---|
| 1671 |
void CMainFrame::ExecuteTool(int i ) |
|---|
| 1672 |
{ |
|---|
| 1673 |
int toolNum = i - 1; |
|---|
| 1674 |
if ( !GetActiveDoc() ) return; |
|---|
| 1675 |
CString path = GetActiveDoc()->GetPathName(); |
|---|
| 1676 |
string currentFile = path.GetBuffer(0); |
|---|
| 1677 |
string currentExe = ""; |
|---|
| 1678 |
string projectDir = ""; |
|---|
| 1679 |
vector<string> files; |
|---|
| 1680 |
|
|---|
| 1681 |
if ( Globals::currentProject ) |
|---|
| 1682 |
{ |
|---|
| 1683 |
currentExe = Globals::currentProject->path + "\\" + Globals::currentProject->name + ".exe"; |
|---|
| 1684 |
projectDir = Globals::currentProject->path; |
|---|
| 1685 |
Split(Globals::currentProject->GetCache("files"),",",files); |
|---|
| 1686 |
} |
|---|
| 1687 |
|
|---|
| 1688 |
|
|---|
| 1689 |
|
|---|
| 1690 |
vector<string> tools; |
|---|
| 1691 |
Split(Globals::settings->baseSettings->GetCache("tools"),",",tools); |
|---|
| 1692 |
|
|---|
| 1693 |
if ( toolNum > tools.size() ) { |
|---|
| 1694 |
ElephantMessageBox("INTERNAL ERROR : Invalid tool selection."); |
|---|
| 1695 |
return; |
|---|
| 1696 |
} |
|---|
| 1697 |
else |
|---|
| 1698 |
{ |
|---|
| 1699 |
vector<string> temp; |
|---|
| 1700 |
Split(tools[toolNum],"~",temp); |
|---|
| 1701 |
|
|---|
| 1702 |
string command = temp[2].c_str() ; |
|---|
| 1703 |
command = TranslateToolsMenuConstants(command, currentFile, currentExe,projectDir,files); |
|---|
| 1704 |
|
|---|
| 1705 |
|
|---|
| 1706 |
SetStatusBarText("Executing command [ " + command + " ] for tool [ " + temp[0] + " ] "); |
|---|
| 1707 |
|
|---|
| 1708 |
Globals::theApp.LogEvent(RUN_TOOL, command ); |
|---|
| 1709 |
|
|---|
| 1710 |
if ( temp[1] == "1" ) |
|---|
| 1711 |
{ |
|---|
| 1712 |
|
|---|
| 1713 |
Executor x( command.c_str() ); |
|---|
| 1714 |
ULONG ret = x.Run(); |
|---|
| 1715 |
|
|---|
| 1716 |
|
|---|
| 1717 |
CScintillaCtrl& rCtrl = GetActiveToolOutput(); |
|---|
| 1718 |
rCtrl.InsertText(0,x.output.c_str()); |
|---|
| 1719 |
|
|---|
| 1720 |
SetStatusBarText("Command [ " + command + " ] returned with code [ " + ITOA(ret) + " ] "); |
|---|
| 1721 |
|
|---|
| 1722 |
} |
|---|
| 1723 |
else { |
|---|
| 1724 |
|
|---|
| 1725 |
RunSilent((char*)command.c_str(),""); |
|---|
| 1726 |
|
|---|
| 1727 |
} |
|---|
| 1728 |
|
|---|
| 1729 |
|
|---|
| 1730 |
|
|---|
| 1731 |
} |
|---|
| 1732 |
|
|---|
| 1733 |
} |
|---|
| 1734 |
|
|---|
| 1735 |
void CMainFrame::OnTools1() { ExecuteTool(1);} |
|---|
| 1736 |
void CMainFrame::OnTools2() { ExecuteTool(2);} |
|---|
| 1737 |
void CMainFrame::OnTools3() { ExecuteTool(3);} |
|---|
| 1738 |
void CMainFrame::OnTools4() { ExecuteTool(4);} |
|---|
| 1739 |
void CMainFrame::OnTools5() { ExecuteTool(5);} |
|---|
| 1740 |
void CMainFrame::OnTools6() { ExecuteTool(6);} |
|---|
| 1741 |
void CMainFrame::OnTools7() { ExecuteTool(7);} |
|---|
| 1742 |
void CMainFrame::OnTools8() { ExecuteTool(8);} |
|---|
| 1743 |
void CMainFrame::OnTools9() { ExecuteTool(9);} |
|---|
| 1744 |
|
|---|
| 1745 |
void CMainFrame::OnSettingsChangefont() |
|---|
| 1746 |
{ |
|---|
| 1747 |
|
|---|
| 1748 |
LOGFONT initFont; |
|---|
| 1749 |
|
|---|
| 1750 |
|
|---|
| 1751 |
strcpy(initFont.lfFaceName,Globals::settings->editorSettings->GetCache("fontFaceName").c_str() ); |
|---|
| 1752 |
initFont.lfItalic = Globals::settings->editorSettings->GetCache("fontItalic") == "1" ? 1 : 0; |
|---|
| 1753 |
initFont.lfUnderline = Globals::settings->editorSettings->GetCache("fontUnderline") == "1" ? 1 : 0; |
|---|
| 1754 |
initFont.lfHeight = atoi(Globals::settings->editorSettings->GetCache("fontSize").c_str()); |
|---|
| 1755 |
initFont.lfWeight = atoi(Globals::settings->editorSettings->GetCache("fontBold").c_str()); |
|---|
| 1756 |
initFont.lfStrikeOut = 0; |
|---|
| 1757 |
|
|---|
| 1758 |
CFontDialog dlg(&initFont); |
|---|
| 1759 |
if ( dlg.DoModal() == IDOK ) |
|---|
| 1760 |
{ |
|---|
| 1761 |
|
|---|
| 1762 |
LOGFONT lf; |
|---|
| 1763 |
dlg.GetCurrentFont(&lf); |
|---|
| 1764 |
|
|---|
| 1765 |
Globals::settings->editorSettings->SetCache("fontFaceName",lf.lfFaceName); |
|---|
| 1766 |
Globals::settings->editorSettings->SetCache("fontItalic",lf.lfItalic == 1 ? "1" : "0"); |
|---|
| 1767 |
Globals::settings->editorSettings->SetCache("fontUnderline",lf.lfUnderline == 1 ? "1" : "0"); |
|---|
| 1768 |
Globals::settings->editorSettings->SetCache("fontSize",ITOA( lf.lfHeight) ); |
|---|
| 1769 |
Globals::settings->editorSettings->SetCache("fontBold",ITOA(lf.lfWeight)); |
|---|
| 1770 |
|
|---|
| 1771 |
UpdateAllViews(); |
|---|
| 1772 |
} |
|---|
| 1773 |
|
|---|
| 1774 |
|
|---|
| 1775 |
} |
|---|
| 1776 |
|
|---|
| 1777 |
void CMainFrame::OnToolsStartrecordingmacro() |
|---|
| 1778 |
{ |
|---|
| 1779 |
|
|---|
| 1780 |
Globals::theApp.LogEvent(RECORD_MACRO ); |
|---|
| 1781 |
|
|---|
| 1782 |
if ( GetActiveView() ){ |
|---|
| 1783 |
GetActiveView()->NewMacro(); |
|---|
| 1784 |
GetActiveView()->StartRecordingMacro(); |
|---|
| 1785 |
} |
|---|
| 1786 |
|
|---|
| 1787 |
} |
|---|
| 1788 |
|
|---|
| 1789 |
|
|---|
| 1790 |
void CMainFrame::OnToolsStoprecordingmacro() |
|---|
| 1791 |
{ |
|---|
| 1792 |
if ( GetActiveView()) |
|---|
| 1793 |
{ |
|---|
| 1794 |
GetActiveView()->StopRecordingMacro(); |
|---|
| 1795 |
ElephantMacro* m = GetActiveView()->GetLastMacro(); |
|---|
| 1796 |
if ( !m ) |
|---|
| 1797 |
{ |
|---|
| 1798 |
Globals::theApp.SetStatusBarText("Stop Macro FAILED : Sorry you aren't currently recording anything."); |
|---|
| 1799 |
return; |
|---|
| 1800 |
} |
|---|
| 1801 |
else { |
|---|
| 1802 |
CGetInputDlg dlg("Please enter the name of the macro.","",this); |
|---|
| 1803 |
if ( dlg.DoModal() == IDOK) |
|---|
| 1804 |
{ |
|---|
| 1805 |
string path = Globals::settings->baseSettings->GetCache("installPath") + "\\Scripts\\"; |
|---|
| 1806 |
path += dlg.m_csValue.GetBuffer(0); |
|---|
| 1807 |
//ElephantMessageBox(path.c_str()); |
|---|
| 1808 |
|
|---|
| 1809 |
SaveMacro(path,m); |
|---|
| 1810 |
} |
|---|
| 1811 |
} |
|---|
| 1812 |
} |
|---|
| 1813 |
} |
|---|
| 1814 |
|
|---|
| 1815 |
void CMainFrame::OnToolsExecutescriptormacro() |
|---|
| 1816 |
{ |
|---|
| 1817 |
CExecuteScript dlg; |
|---|
| 1818 |
if ( dlg.DoModal() ) |
|---|
| 1819 |
{ |
|---|
| 1820 |
ElephantMacro m; |
|---|
| 1821 |
string path = Globals::settings->baseSettings->GetCache("installPath") + "\\Scripts\\"; |
|---|
| 1822 |
path += dlg.m_csScript.GetBuffer(0); |
|---|
| 1823 |
|
|---|
| 1824 |
|
|---|
| 1825 |
Globals::theApp.LogEvent(RECORD_MACRO ,path); |
|---|
| 1826 |
ReadMacro(path,&m ); |
|---|
| 1827 |
|
|---|
| 1828 |
if ( dlg.m_repeat ) |
|---|
| 1829 |
{ |
|---|
| 1830 |
if ( GetActiveView() ) |
|---|
| 1831 |
{ |
|---|
| 1832 |
CElephantView* v = GetActiveView(); |
|---|
| 1833 |
|
|---|
| 1834 |
int max = atoi(dlg.m_repeatNumber.GetBuffer(0)); |
|---|
| 1835 |
for ( int i = 0 ; i < max; i ++) |
|---|
| 1836 |
{ |
|---|
| 1837 |
v->ExecuteMacro(m); |
|---|
| 1838 |
} |
|---|
| 1839 |
} |
|---|
| 1840 |
} |
|---|
| 1841 |
else { |
|---|
| 1842 |
|
|---|
| 1843 |
if ( GetActiveView() ) |
|---|
| 1844 |
{ |
|---|
| 1845 |
GetActiveView()->ExecuteMacro(m); |
|---|
| 1846 |
} |
|---|
| 1847 |
} |
|---|
| 1848 |
} |
|---|
| 1849 |
|
|---|
| 1850 |
} |
|---|
| 1851 |
|
|---|
| 1852 |
|
|---|
| 1853 |
|
|---|
| 1854 |
void CMainFrame::OnEditPaste() |
|---|
| 1855 |
{ |
|---|
| 1856 |
if ( GetActiveView() ) GetActiveView()->Paste(); |
|---|
| 1857 |
|
|---|
| 1858 |
} |
|---|
| 1859 |
|
|---|
| 1860 |
void CMainFrame::OnEditUndox() |
|---|
| 1861 |
{ |
|---|
| 1862 |
if ( GetActiveView() ) GetActiveView()->Undo(); |
|---|
| 1863 |
|
|---|
| 1864 |
} |
|---|
| 1865 |
|
|---|
| 1866 |
void CMainFrame::OnEditCopyx() |
|---|
| 1867 |
{ |
|---|
| 1868 |
if ( GetActiveView() ) GetActiveView()->Copy(); |
|---|
| 1869 |
|
|---|
| 1870 |
} |
|---|
| 1871 |
|
|---|
| 1872 |
void CMainFrame::OnEditCutx() |
|---|
| 1873 |
{ |
|---|
| 1874 |
if ( GetActiveView() ) GetActiveView()->Cut(); |
|---|
| 1875 |
|
|---|
| 1876 |
} |
|---|
| 1877 |
|
|---|
| 1878 |
void CMainFrame::OnFileNewNewfile() |
|---|
| 1879 |
{ |
|---|
| 1880 |
Globals::theApp.m_pDocTemplate->OpenDocumentFile(NULL); |
|---|
| 1881 |
Globals::theApp.LogEvent(NEW_FILE); |
|---|
| 1882 |
|
|---|
| 1883 |
} |
|---|
| 1884 |
|
|---|
| 1885 |
void CMainFrame::OnFileNewNewfilefromtemplate() |
|---|
| 1886 |
{ |
|---|
| 1887 |
string pname = Globals::currentProject ? Globals::currentProject->name : ""; |
|---|
| 1888 |
string buffer = ReadTemplate(Globals::settings->baseSettings->GetCache("fileTemplate"),Globals::settings->baseSettings->GetCache("name"),pname); |
|---|
| 1889 |
Globals::theApp.m_pDocManager->OnFileNew(); |
|---|
| 1890 |
if ( GetActiveView() ) GetActiveView()->AddContent(buffer); |
|---|
| 1891 |
|
|---|
| 1892 |
|
|---|
| 1893 |
} |
|---|
| 1894 |
|
|---|
| 1895 |
void CMainFrame::OnFileSaveSaveall() |
|---|
| 1896 |
{ |
|---|
| 1897 |
CMultiDocTemplate* t = Globals::theApp.m_pDocTemplate; |
|---|
| 1898 |
POSITION x = t->GetFirstDocPosition(); |
|---|
| 1899 |
CElephantDoc* pDoc; |
|---|
| 1900 |
CString file; |
|---|
| 1901 |
string file_path; |
|---|
| 1902 |
while (x) { |
|---|
| 1903 |
|
|---|
| 1904 |
pDoc = (CElephantDoc*)t->GetNextDoc(x); |
|---|
| 1905 |
CScintillaCtrl& rCtrl = pDoc->GetCtrl(); |
|---|
| 1906 |
CString path = pDoc->GetPathName(); |
|---|
| 1907 |
|
|---|
| 1908 |
if ( path == "" ) |
|---|
| 1909 |
{ |
|---|
| 1910 |
|
|---|
| 1911 |
if ( ! rCtrl.GetModify() ) continue; |
|---|
| 1912 |
|
|---|
| 1913 |
CString title = pDoc->GetTitle(); |
|---|
| 1914 |
CString msg = "Would you like to save the file titled " + title + " ? "; |
|---|
| 1915 |
if ( ElephantMessageBoxYesNo(msg.GetBuffer(0) ) ) |
|---|
| 1916 |
pDoc->OnFileSaveSavefile(); |
|---|
| 1917 |
} |
|---|
| 1918 |
else |
|---|
| 1919 |
{ |
|---|
| 1920 |
pDoc->OnFileSaveSavefile(); |
|---|
| 1921 |
|
|---|
| 1922 |
} |
|---|
| 1923 |
|
|---|
| 1924 |
|
|---|
| 1925 |
} |
|---|
| 1926 |
|
|---|
| 1927 |
} |
|---|
| 1928 |
|
|---|
| 1929 |
vector<string> CMainFrame::GetAllNamedFiles(bool relative){ |
|---|
| 1930 |
|
|---|
| 1931 |
vector<string> paths; |
|---|
| 1932 |
|
|---|
| 1933 |
if ( relative ) |
|---|
| 1934 |
{ |
|---|
| 1935 |
if ( !Globals::currentProject ) return paths; |
|---|
| 1936 |
} |
|---|
| 1937 |
|
|---|
| 1938 |
CMultiDocTemplate* t = Globals::theApp.m_pDocTemplate; |
|---|
| 1939 |
POSITION x = t->GetFirstDocPosition(); |
|---|
| 1940 |
CElephantDoc* pDoc; |
|---|
| 1941 |
|
|---|
| 1942 |
|
|---|
| 1943 |
|
|---|
| 1944 |
while (x) { |
|---|
| 1945 |
pDoc = (CElephantDoc*)t->GetNextDoc(x); |
|---|
| 1946 |
CString path = pDoc->GetPathName(); |
|---|
| 1947 |
if ( path != "" ) |
|---|
| 1948 |
{ |
|---|
| 1949 |
string newPath = GetRelativePath(Globals::currentProject->path ,path.GetBuffer(0) ) ; |
|---|
| 1950 |
if ( newPath != "" ) |
|---|
| 1951 |
{ |
|---|
| 1952 |
if ( newPath[newPath.length() - 1] == '\\') |
|---|
| 1953 |
newPath = newPath.substr(0,newPath.length() - 1); |
|---|
| 1954 |
} |
|---|
| 1955 |
|
|---|
| 1956 |
|
|---|
| 1957 |
paths.push_back(newPath); |
|---|
| 1958 |
|
|---|
| 1959 |
|
|---|
| 1960 |
} |
|---|
| 1961 |
|
|---|
| 1962 |
} |
|---|
| 1963 |
|
|---|
| 1964 |
return paths; |
|---|
| 1965 |
|
|---|
| 1966 |
} |
|---|
| 1967 |
|
|---|
| 1968 |
void CMainFrame::OnEditCommentselect() |
|---|
| 1969 |
{ |
|---|
| 1970 |
CElephantView* view= GetActiveView(); |
|---|
| 1971 |
if ( view ) |
|---|
| 1972 |
{ |
|---|
| 1973 |
if ( view->HasTextSelected() ) view->CommentSelection(); |
|---|
| 1974 |
else view->InsertRegister("/"); |
|---|
| 1975 |
|
|---|
| 1976 |
} |
|---|
| 1977 |
|
|---|
| 1978 |
} |
|---|
| 1979 |
|
|---|
| 1980 |
void CMainFrame::OnEditUncommonselection() |
|---|
| 1981 |
{ |
|---|
| 1982 |
CElephantView* view= GetActiveView(); |
|---|
| 1983 |
if ( view ) |
|---|
| 1984 |
{ |
|---|
| 1985 |
if ( view->HasTextSelected() ) view->UncommentSelection(); |
|---|
| 1986 |
else view->InsertRegister("\\"); |
|---|
| 1987 |
|
|---|
| 1988 |
} |
|---|
| 1989 |
} |
|---|
| 1990 |
|
|---|
| 1991 |
void CMainFrame::OnEditQuickfind() |
|---|
| 1992 |
{ |
|---|
| 1993 |
ShowControlBar(&m_wndFindToolBar,true,false); |
|---|
| 1994 |
m_findEdit.SetFocus(); |
|---|
| 1995 |
|
|---|
| 1996 |
} |
|---|
| 1997 |
|
|---|
| 1998 |
|
|---|
| 1999 |
void CMainFrame::GotoFileAndLineNumber(const string& path , int lineNumber , const string& error ) |
|---|
| 2000 |
{ |
|---|
| 2001 |
Globals::theApp.OpenFile(path); |
|---|
| 2002 |
|
|---|
| 2003 |
CElephantView* view = GetActiveView(); |
|---|
| 2004 |
view->MakeLineTop(lineNumber); |
|---|
| 2005 |
|
|---|
| 2006 |
CScintillaCtrl& rCtrl = view->GetCtrl(); |
|---|
| 2007 |
rCtrl.SetSel(rCtrl.PositionFromLine( lineNumber - 1) , rCtrl.GetLineEndPosition(lineNumber - 1) ); |
|---|
| 2008 |
|
|---|
| 2009 |
SetStatusBarText(error); |
|---|
| 2010 |
|
|---|
| 2011 |
MDIActivate(view->GetParent()); |
|---|
| 2012 |
|
|---|
| 2013 |
|
|---|
| 2014 |
|
|---|
| 2015 |
|
|---|
| 2016 |
} |
|---|
| 2017 |
|
|---|
| 2018 |
|
|---|
| 2019 |
void CMainFrame::OnNavigationExecgotofilesymbol() |
|---|
| 2020 |
{ |
|---|
| 2021 |
} |
|---|
| 2022 |
|
|---|
| 2023 |
void CMainFrame::OnNavigationExecgotofilehistory() |
|---|
| 2024 |
{ |
|---|
| 2025 |
} |
|---|
| 2026 |
|
|---|
| 2027 |
|
|---|
| 2028 |
void CMainFrame::OnFileListCtrlUndo() {} |
|---|
| 2029 |
void CMainFrame::OnGotoAdvancedFileAndReplace() { |
|---|
| 2030 |
|
|---|
| 2031 |
advancedFindAndReplaceDlg->ShowWindow(SW_SHOW); |
|---|
| 2032 |
advancedFindAndReplaceDlg->SetFocus(); |
|---|
| 2033 |
advancedFindAndReplaceDlg->Populate(); |
|---|
| 2034 |
|
|---|
| 2035 |
} |
|---|
| 2036 |
void compOutput(const string& msg ) |
|---|
| 2037 |
{ |
|---|
| 2038 |
CMainFrame* m = (CMainFrame*)Globals::theApp.m_pMainWnd; |
|---|
| 2039 |
// ElephantMessageBox(msg.c_str() ); |
|---|
| 2040 |
m->m_wndOutputBar.AddBuildText(msg); |
|---|
| 2041 |
} |
|---|
| 2042 |
|
|---|
| 2043 |
|
|---|
| 2044 |
|
|---|
| 2045 |
void elepgant_log(const string& message, const string& file, int line) |
|---|
| 2046 |
{ |
|---|
| 2047 |
ofstream out("C:\\e-log.txt",std::ios::app ); |
|---|
| 2048 |
CTime _t = CTime::GetCurrentTime(); |
|---|
| 2049 |
CString t; |
|---|
| 2050 |
t.Format("%d.%d.%d -- %d:%d:%d ( %s : %d ) ",_t.GetMonth(),_t.GetDay(), _t.GetYear(),_t.GetHour(), _t.GetMinute(),_t.GetSecond(),file.c_str(),line); |
|---|
| 2051 |
out << t.GetBuffer(0) << " :: " ; |
|---|
| 2052 |
out << message << "\r\n"; |
|---|
| 2053 |
out.close(); |
|---|
| 2054 |
} |
|---|
| 2055 |
|
|---|
| 2056 |
void CMainFrame::OnNavigationNexterror() |
|---|
| 2057 |
{ |
|---|
| 2058 |
if ( currentErrorNumber < Globals::buildCompiler->errors.size() ) |
|---|
| 2059 |
{ |
|---|
| 2060 |
//AfxMessageBox(ITOA( Globals::buildCompiler->errors.size() ) .c_str() ) ; |
|---|
| 2061 |
|
|---|
| 2062 |
//AfxMessageBox(ITOA( currentErrorNumber ) .c_str() ); |
|---|
| 2063 |
ErrorPacket p = Globals::buildCompiler->errors[currentErrorNumber++]; |
|---|
| 2064 |
// AfxMessageBox(p.file.c_str() ); |
|---|
| 2065 |
// AfxMessageBox(ITOA( Globals::buildCompiler->errors.size() ) .c_str() ) ; |
|---|
| 2066 |
|
|---|
| 2067 |
Globals::theApp.LogEvent(NEXT_ERROR ,p.file,ITOA(p.lineNo) ); |
|---|
| 2068 |
Globals::theApp.OpenFile(p.file,p.lineNo); |
|---|
| 2069 |
} |
|---|
| 2070 |
|
|---|
| 2071 |
|
|---|
| 2072 |
} |
|---|
| 2073 |
|
|---|
| 2074 |
void CMainFrame::OnNavigationPreviouserror() |
|---|
| 2075 |
{ |
|---|
| 2076 |
if ( currentErrorNumber > 0 ) |
|---|
| 2077 |
{ |
|---|
| 2078 |
ErrorPacket p = Globals::buildCompiler->errors[--currentErrorNumber]; |
|---|
| 2079 |
Globals::theApp.LogEvent(PREV_ERROR ,p.file,ITOA(p.lineNo) ); |
|---|
| 2080 |
Globals::theApp.OpenFile(p.file,p.lineNo); |
|---|
| 2081 |
} |
|---|
| 2082 |
|
|---|
| 2083 |
|
|---|
| 2084 |
} |
|---|
| 2085 |
void CMainFrame::ShowOutputWindow () |
|---|
| 2086 |
{ |
|---|
| 2087 |
|
|---|
| 2088 |
if ( Globals::settings->baseSettings->GetCache("m_compilerAutoShow") == "1" ) |
|---|
| 2089 |
if ( ! m_wndOutputBar.IsVisible() ) |
|---|
| 2090 |
this->ShowControlBar(&m_wndOutputBar,true,false); |
|---|
| 2091 |
|
|---|
| 2092 |
} |
|---|
| 2093 |
|
|---|
| 2094 |
void CMainFrame::OnCompileCompileProject() |
|---|
| 2095 |
{ |
|---|
| 2096 |
|
|---|
| 2097 |
CompileProject(); |
|---|
| 2098 |
|
|---|
| 2099 |
|
|---|
| 2100 |
} |
|---|
| 2101 |
|
|---|
| 2102 |
void CMainFrame::OnNavigationCompileroutput() |
|---|
| 2103 |
{ |
|---|
| 2104 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW ,"Compiler Output"); |
|---|
| 2105 |
this->m_wndOutputBar.SetActiveView(1); |
|---|
| 2106 |
|
|---|
| 2107 |
} |
|---|
| 2108 |
|
|---|
| 2109 |
void CMainFrame::OnCompileCompileandrun() |
|---|
| 2110 |
{ |
|---|
| 2111 |
|
|---|
| 2112 |
OnCompileCompileProject(); |
|---|
| 2113 |
|
|---|
| 2114 |
if (Globals::currentProject ) |
|---|
| 2115 |
if ( cRet == 0 && lRet == 0 ) ShellExecute(0,"open",lastProjectExecutable.c_str(),"","",SW_SHOW); |
|---|
| 2116 |
|
|---|
| 2117 |
Globals::theApp.LogEvent(COMPILE_AND_RUN_PROJECT, lastProjectExecutable ); |
|---|
| 2118 |
|
|---|
| 2119 |
|
|---|
| 2120 |
|
|---|
| 2121 |
} |
|---|
| 2122 |
|
|---|
| 2123 |
|
|---|
| 2124 |
void CMainFrame::OnCompileEvaluatebuffer() |
|---|
| 2125 |
{ |
|---|
| 2126 |
|
|---|
| 2127 |
if ( Globals::currentProject ) SetCurrentDirectory(Globals::currentProject->path.c_str() ); |
|---|
| 2128 |
|
|---|
| 2129 |
CElephantView* view = GetActiveView(); |
|---|
| 2130 |
if ( view ) |
|---|
| 2131 |
{ |
|---|
| 2132 |
|
|---|
| 2133 |
ShowOutputWindow(); |
|---|
| 2134 |
|
|---|
| 2135 |
m_wndOutputBar.ClearBuildText(); |
|---|
| 2136 |
m_wndOutputBar.m_buildReport.m_buildList.DeleteAllItems(); |
|---|
| 2137 |
|
|---|
| 2138 |
string buffer = ""; |
|---|
| 2139 |
if ( view->HasTextSelected() ) buffer = view->GetSelectedText(); |
|---|
| 2140 |
else buffer = view->GetBufferText(); |
|---|
| 2141 |
//AfxMessageBox(buffer.c_str()); |
|---|
| 2142 |
string path = SaveTempFile(buffer); |
|---|
| 2143 |
string objectDir = Globals::settings->baseSettings->GetCache("installPath")+ "\\temp_object\\" + StripFileName(path); |
|---|
| 2144 |
objectDir = objectDir.substr(0,objectDir.length() - 2) + ".obj"; |
|---|
| 2145 |
|
|---|
| 2146 |
CompileFile(path); |
|---|
| 2147 |
_unlink(path.c_str()); |
|---|
| 2148 |
_unlink(objectDir.c_str()); |
|---|
| 2149 |
vector<ErrorPacket> uniqueErrors = Globals::buildCompiler->errors; |
|---|
| 2150 |
CString buf; |
|---|
| 2151 |
|
|---|
| 2152 |
|
|---|
| 2153 |
|
|---|
| 2154 |
if ( cRet != 0 ) |
|---|
| 2155 |
{ |
|---|
| 2156 |
buf.Format("Building FAILED : error code [ %d ]. " , cRet ); |
|---|
| 2157 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(0,buf); |
|---|
| 2158 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(1,""); |
|---|
| 2159 |
|
|---|
| 2160 |
|
|---|
| 2161 |
for ( int i = 0 ; i < uniqueErrors.size(); i++ ) |
|---|
| 2162 |
{ |
|---|
| 2163 |
|
|---|
| 2164 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(i+2,uniqueErrors[i].line.c_str() ); |
|---|
| 2165 |
m_wndOutputBar.m_buildReport.m_buildList.SetItemText(i+2,1,ITOA(uniqueErrors[i].lineNo).c_str()); |
|---|
| 2166 |
m_wndOutputBar.m_buildReport.m_buildList.SetItemText(i+2,2,StripFileName(uniqueErrors[i].file).c_str()); |
|---|
| 2167 |
|
|---|
| 2168 |
|
|---|
| 2169 |
} |
|---|
| 2170 |
|
|---|
| 2171 |
this->SetForegroundWindow(); |
|---|
| 2172 |
if ( Globals::currentProject ) SetCurrentDirectory(Globals::currentProject->path.c_str() ); |
|---|
| 2173 |
|
|---|
| 2174 |
Sleep(300); |
|---|
| 2175 |
this->SetForegroundWindow(); |
|---|
| 2176 |
buf.Format("Buffer Compiled : %s" ,buffer.c_str()); |
|---|
| 2177 |
|
|---|
| 2178 |
CString str; |
|---|
| 2179 |
m_wndOutputBar.m_buildSheet.m_buildEdit.GetWindowText(str); |
|---|
| 2180 |
str += "\n" + buf; |
|---|
| 2181 |
m_wndOutputBar.m_buildSheet.m_buildEdit.SetWindowText(str); |
|---|
| 2182 |
return; |
|---|
| 2183 |
|
|---|
| 2184 |
|
|---|
| 2185 |
} |
|---|
| 2186 |
|
|---|
| 2187 |
|
|---|
| 2188 |
|
|---|
| 2189 |
buf.Format("Building SUCCEEDED : error code [ %d ] " , cRet ); |
|---|
| 2190 |
|
|---|
| 2191 |
|
|---|
| 2192 |
|
|---|
| 2193 |
|
|---|
| 2194 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(0,buf); |
|---|
| 2195 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(1,""); |
|---|
| 2196 |
|
|---|
| 2197 |
|
|---|
| 2198 |
|
|---|
| 2199 |
buf.Format("Buffer Compiled : %s" ,WhiteSpace::ReplaceWithCodes(buffer).c_str()); |
|---|
| 2200 |
|
|---|
| 2201 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(2,buf); |
|---|
| 2202 |
|
|---|
| 2203 |
CString str; |
|---|
| 2204 |
m_wndOutputBar.m_buildSheet.m_buildEdit.GetWindowText(str); |
|---|
| 2205 |
str += "\n" + buf; |
|---|
| 2206 |
m_wndOutputBar.m_buildSheet.m_buildEdit.SetWindowText(str); |
|---|
| 2207 |
|
|---|
| 2208 |
|
|---|
| 2209 |
|
|---|
| 2210 |
|
|---|
| 2211 |
int itemCount = m_wndOutputBar.m_buildReport.m_buildList.GetItemCount(); |
|---|
| 2212 |
|
|---|
| 2213 |
|
|---|
| 2214 |
CTime _t = CTime::GetCurrentTime(); |
|---|
| 2215 |
CString t; |
|---|
| 2216 |
t.Format("Building completed %d.%d.%d %d:%d:%d ",_t.GetMonth(),_t.GetDay(), _t.GetYear(),_t.GetHour(), _t.GetMinute(),_t.GetSecond()); |
|---|
| 2217 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(itemCount,""); |
|---|
| 2218 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(++itemCount,t); |
|---|
| 2219 |
|
|---|
| 2220 |
this->SetForegroundWindow(); |
|---|
| 2221 |
} |
|---|
| 2222 |
|
|---|
| 2223 |
if ( Globals::currentProject ) SetCurrentDirectory(Globals::currentProject->path.c_str() ); |
|---|
| 2224 |
|
|---|
| 2225 |
} |
|---|
| 2226 |
|
|---|
| 2227 |
|
|---|
| 2228 |
void CMainFrame::CompileProject(ProjectSettings* proj) |
|---|
| 2229 |
{ |
|---|
| 2230 |
|
|---|
| 2231 |
//Globals::theApp.LogEvent(COMPILE_PROJECT,proj->path ); |
|---|
| 2232 |
|
|---|
| 2233 |
SaveAllNamedFiles(); |
|---|
| 2234 |
ShowOutputWindow(); |
|---|
| 2235 |
|
|---|
| 2236 |
currentErrorNumber = 0; |
|---|
| 2237 |
ProjectSettings* compileProject = proj != NULL ? proj : Globals::currentProject; |
|---|
| 2238 |
|
|---|
| 2239 |
|
|---|
| 2240 |
|
|---|
| 2241 |
if ( compileProject) |
|---|
| 2242 |
{ |
|---|
| 2243 |
|
|---|
| 2244 |
Globals::theApp.LogEvent(COMPILE_PROJECT,compileProject->name ); |
|---|
| 2245 |
|
|---|
| 2246 |
|
|---|
| 2247 |
|
|---|
| 2248 |
|
|---|
| 2249 |
|
|---|
| 2250 |
CSplashFactory factoryTwo; |
|---|
| 2251 |
if (!factoryTwo.Create(RUNTIME_CLASS(CCompileSplash))) |
|---|
| 2252 |
{ |
|---|
| 2253 |
ElephantMessageBox(_T("Failed to create splash screen") ); |
|---|
| 2254 |
return; |
|---|
| 2255 |
} |
|---|
| 2256 |
|
|---|
| 2257 |
|
|---|
| 2258 |
m_wndOutputBar.ClearBuildText(); |
|---|
| 2259 |
m_wndOutputBar.m_buildReport.m_buildList.DeleteAllItems(); |
|---|
| 2260 |
CString buf; |
|---|
| 2261 |
|
|---|
| 2262 |
|
|---|
| 2263 |
if (1) |
|---|
| 2264 |
{ |
|---|
| 2265 |
|
|---|
| 2266 |
ProjectSettings* p = compileProject; |
|---|
| 2267 |
string activeConfig = p->GetCache("CurrentConfiguration"); |
|---|
| 2268 |
|
|---|
| 2269 |
|
|---|
| 2270 |
// m_inline = Globals::currentProject->GetCache(currentConfig + "_inline") == "1"; |
|---|
| 2271 |
// m_optimize = Globals::currentProject->GetCache(currentConfig + "_optimize") == "1"; |
|---|
| 2272 |
// m_allowDeprecated = Globals::currentProject->GetCache(currentConfig + "_allowDeprecated") == "1"; |
|---|
| 2273 |
// m_warnings = Globals::currentProject->GetCache(currentConfig + "_warnings") == "1"; |
|---|
| 2274 |
// m_verbose = Globals::currentProject->GetCache(currentConfig + "_verbose") == "1"; |
|---|
| 2275 |
// m_release = Globals::currentProject->GetCache(currentConfig + "_release") == "1"; |
|---|
| 2276 |
// m_debug = Globals::currentProject->GetCache(currentConfig + "_debugG") == "1"; |
|---|
| 2277 |
// m_pHooks = Globals::currentProject->GetCache(currentConfig + "_pHooks") == "1"; |
|---|
| 2278 |
// m_unittest = Globals::currentProject->GetCache(currentConfig + "_unittest") == "1"; |
|---|
| 2279 |
|
|---|
| 2280 |
CompilerFlags flags; |
|---|
| 2281 |
flags.allowDeprecated = compileProject->GetCache(activeConfig + "_allowDeprecated") == "1"; |
|---|
| 2282 |
flags.debug = compileProject->GetCache(activeConfig + "_debugG") == "1"; |
|---|
| 2283 |
flags.debugInfo = compileProject->GetCache(activeConfig + "_debugInfo") == "1"; |
|---|
| 2284 |
flags.debugIdentifiers = compileProject->GetCache(activeConfig + "_debugIdentifiers"); |
|---|
| 2285 |
flags.debugPHooks = compileProject->GetCache(activeConfig + "_pHooks") == "1"; |
|---|
| 2286 |
flags.inline_ = compileProject->GetCache(activeConfig + "_inline") == "1"; |
|---|
| 2287 |
flags.optimize = compileProject->GetCache(activeConfig + "_optimize") == "1" ; |
|---|
| 2288 |
flags.release = compileProject->GetCache(activeConfig + "_release") == "1"; |
|---|
| 2289 |
//flagsactiveConfig + ._sharedLib = Globals |
|---|
| 2290 |
flags.unitTest = compileProject->GetCache(activeConfig + "_unittest") == "1"; |
|---|
| 2291 |
flags.verbose = compileProject->GetCache(activeConfig + "_verbose") == "1"; |
|---|
| 2292 |
flags.versionIdentifiers = compileProject->GetCache(activeConfig + "_versionIdentifiers"); |
|---|
| 2293 |
flags.staticLib = compileProject->GetCache(activeConfig + "_staticLib") == "1"; |
|---|
| 2294 |
flags.sharedLib = compileProject->GetCache(activeConfig + "_sharedLib") == "1"; |
|---|
| 2295 |
flags.warning = compileProject->GetCache(activeConfig + "_warning") == "1"; |
|---|
| 2296 |
Split(Globals::settings->baseSettings->GetCache("importPaths"),",",flags.importPaths ); |
|---|
| 2297 |
|
|---|
| 2298 |
|
|---|
| 2299 |
|
|---|
| 2300 |
string compilerLocation , linkLocation , libLocation, libEnvVar, projectLocation , projectName, |
|---|
| 2301 |
installPath, objectDir , resourceFile; |
|---|
| 2302 |
|
|---|
| 2303 |
vector<string> files , libs, linkerFlags, imports; |
|---|
| 2304 |
|
|---|
| 2305 |
string dmdPath = Globals::settings->baseSettings->GetCache("dmdPath"); |
|---|
| 2306 |
compilerLocation = dmdPath ; |
|---|
| 2307 |
dmdPath = StripDirPath(dmdPath) + "\\"; |
|---|
| 2308 |
linkLocation = dmdPath + "..\\..\\dm\\bin\\link.exe"; |
|---|
| 2309 |
libLocation = dmdPath + "..\\..\\dm\\bin\\lib.exe"; |
|---|
| 2310 |
libEnvVar = dmdPath + "..\\lib;" + dmdPath + "..\\..\\dm\\lib"; |
|---|
| 2311 |
projectLocation = compileProject->path; |
|---|
| 2312 |
projectName = compileProject->name; |
|---|
| 2313 |
installPath = Globals::settings->baseSettings->GetCache("installPath"); |
|---|
| 2314 |
|
|---|
| 2315 |
// ElephantMessageBox(projectLocation.c_str()); |
|---|
| 2316 |
|
|---|
| 2317 |
objectDir = shortPathName(objectDir); |
|---|
| 2318 |
|
|---|
| 2319 |
//ElephantMessageBox(string(projectLocation + "\\" + projectName + "_object").c_str()); |
|---|
| 2320 |
|
|---|
| 2321 |
//ElephantMessageBox(objectDir.c_str()); |
|---|
| 2322 |
|
|---|
| 2323 |
Split(compileProject->GetCache("files"),",",files); |
|---|
| 2324 |
Split(compileProject->GetCache("libraries"),",",libs); |
|---|
| 2325 |
Split(Globals::settings->baseSettings->GetCache("importPaths"),",",imports); |
|---|
| 2326 |
|
|---|
| 2327 |
vector<FileExtensionItem> extensions; |
|---|
| 2328 |
|
|---|
| 2329 |
|
|---|
| 2330 |
|
|---|
| 2331 |
|
|---|
| 2332 |
BuildFlags f; |
|---|
| 2333 |
|
|---|
| 2334 |
|
|---|
| 2335 |
f.names = p->GetCache(activeConfig + "_names") == "1"; |
|---|
| 2336 |
f.full = p->GetCache(activeConfig + "_full") == "1"; |
|---|
| 2337 |
f.link = p->GetCache(activeConfig + "_link") == "1"; |
|---|
| 2338 |
f.nolink = p->GetCache(activeConfig + "_nolink") == "1"; |
|---|
| 2339 |
f.lib = p->GetCache(activeConfig + "_lib") == "1"; |
|---|
| 2340 |
f.nolib = p->GetCache(activeConfig + "_nolib") == "1"; |
|---|
| 2341 |
f.obj = p->GetCache(activeConfig + "_obj") == "1"; |
|---|
| 2342 |
f.silent = p->GetCache(activeConfig + "_silent") == "1"; |
|---|
| 2343 |
f.allobj = p->GetCache(activeConfig + "_allobj") == "1"; |
|---|
| 2344 |
f.test = p->GetCache(activeConfig + "_test") == "1"; |
|---|
| 2345 |
f.dll = p->GetCache(activeConfig + "_dll") == "1"; |
|---|
| 2346 |
f.gui = p->GetCache(activeConfig + "_gui") == "1"; |
|---|
| 2347 |
f.clean = p->GetCache(activeConfig + "_clean") == "1"; |
|---|
| 2348 |
f.v = p->GetCache(activeConfig + "_v") == "1"; |
|---|
| 2349 |
f.X = p->GetCache(activeConfig + "_X").c_str(); |
|---|
| 2350 |
f.M = p->GetCache(activeConfig + "_M").c_str(); |
|---|
| 2351 |
f.verbatim = p->GetCache(activeConfig + "_verbatim").c_str(); |
|---|
| 2352 |
|
|---|
| 2353 |
|
|---|
| 2354 |
|
|---|
| 2355 |
|
|---|
| 2356 |
|
|---|
| 2357 |
BuildProjectCompilerSettings settings2(flags,f,files,compilerLocation , |
|---|
| 2358 |
linkLocation, libLocation, libEnvVar, projectLocation, |
|---|
| 2359 |
projectName, installPath, objectDir, resourceFile, libs, linkerFlags, imports ); |
|---|
| 2360 |
settings2.target = p->GetCache(activeConfig + "_targetName"); |
|---|
| 2361 |
settings2.buildPath = installPath + "\\Tools\\build.exe"; |
|---|
| 2362 |
|
|---|
| 2363 |
Globals::buildCompiler->SetSession(settings2,compOutput); |
|---|
| 2364 |
cRet = Globals::buildCompiler->Compile(); |
|---|
| 2365 |
|
|---|
| 2366 |
// |
|---|
| 2367 |
// |
|---|
| 2368 |
// ProjectCompilerSettings settings(flags,files,compilerLocation , |
|---|
| 2369 |
// linkLocation, libLocation, libEnvVar, projectLocation, |
|---|
| 2370 |
// projectName, installPath, objectDir, resourceFile, libs, linkerFlags ); |
|---|
| 2371 |
// Globals::buildCompiler->SetSession(settings,compOutput,extensions); |
|---|
| 2372 |
// cRet = Globals::buildCompiler->Compile(); |
|---|
| 2373 |
|
|---|
| 2374 |
vector<ErrorPacket> uniqueErrors = Globals::buildCompiler->errors; |
|---|
| 2375 |
|
|---|
| 2376 |
if ( cRet != 0 ) |
|---|
| 2377 |
{ |
|---|
| 2378 |
buf.Format("Building FAILED : error code [ %d ]." , cRet ); |
|---|
| 2379 |
Globals::theApp.SetStatusBarText(buf.GetBuffer(0 ) ); |
|---|
| 2380 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(0,buf); |
|---|
| 2381 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(1,""); |
|---|
| 2382 |
|
|---|
| 2383 |
|
|---|
| 2384 |
if ( cRet == -1 ) |
|---|
| 2385 |
{ |
|---|
| 2386 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(2,"Elephant could not find the DMD compiler , try setting the path in settings [ F4->compiler settings] ."); |
|---|
| 2387 |
|
|---|
| 2388 |
} |
|---|
| 2389 |
|
|---|
| 2390 |
|
|---|
| 2391 |
|
|---|
| 2392 |
for ( int i = 0 ; i < uniqueErrors.size(); i++ ) |
|---|
| 2393 |
{ |
|---|
| 2394 |
|
|---|
| 2395 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(i+2,uniqueErrors[i].line.c_str() ); |
|---|
| 2396 |
m_wndOutputBar.m_buildReport.m_buildList.SetItemText(i+2,1,ITOA(uniqueErrors[i].lineNo).c_str()); |
|---|
| 2397 |
m_wndOutputBar.m_buildReport.m_buildList.SetItemText(i+2,2,uniqueErrors[i].file.c_str()); |
|---|
| 2398 |
|
|---|
| 2399 |
|
|---|
| 2400 |
} |
|---|
| 2401 |
|
|---|
| 2402 |
Sleep(300); |
|---|
| 2403 |
this->SetForegroundWindow(); |
|---|
| 2404 |
//this->SetForegroundWindow(); |
|---|
| 2405 |
|
|---|
| 2406 |
|
|---|
| 2407 |
} |
|---|
| 2408 |
else |
|---|
| 2409 |
{ |
|---|
| 2410 |
|
|---|
| 2411 |
buf.Format("Building SUCCEEDED : project ( %s ) : error code [ %d ] " , projectName.c_str() , cRet ); |
|---|
| 2412 |
|
|---|
| 2413 |
Globals::theApp.SetStatusBarText(buf.GetBuffer(0 ) ); |
|---|
| 2414 |
// |
|---|
| 2415 |
// |
|---|
| 2416 |
// |
|---|
| 2417 |
// |
|---|
| 2418 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(0,buf); |
|---|
| 2419 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(1,""); |
|---|
| 2420 |
|
|---|
| 2421 |
CString le; |
|---|
| 2422 |
string ext; |
|---|
| 2423 |
if ( p->GetCache("Default_lib") == "1") ext = "lib"; |
|---|
| 2424 |
else if ( p->GetCache("Default_dll") == "1") ext = "dll"; |
|---|
| 2425 |
else ext = "exe"; |
|---|
| 2426 |
|
|---|
| 2427 |
le.Format("%s\\%s.%s",settings2.projectLocation.c_str(),settings2.target != "" ? settings2.target.c_str() : settings2.projectFiles[0].c_str() ,ext.c_str()); |
|---|
| 2428 |
buf.Format("File Created : %s\\%s.%s",settings2.projectLocation.c_str(),settings2.projectName.c_str(),ext.c_str()); |
|---|
| 2429 |
|
|---|
| 2430 |
lastProjectExecutable = le.GetBuffer(0); |
|---|
| 2431 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(2,buf); |
|---|
| 2432 |
|
|---|
| 2433 |
} |
|---|
| 2434 |
|
|---|
| 2435 |
// |
|---|
| 2436 |
// lRet = Globals::buildCompiler->Link(); |
|---|
| 2437 |
// |
|---|
| 2438 |
// |
|---|
| 2439 |
// //RemoveDuplicates(Globals::buildCompiler->errors,uniqueErrors); |
|---|
| 2440 |
// |
|---|
| 2441 |
// |
|---|
| 2442 |
// |
|---|
| 2443 |
// buf.Format("Compiling %s : error code [ %d ] " ,cRet != 0 ? "failed" : "succeeded" , cRet ); |
|---|
| 2444 |
// |
|---|
| 2445 |
// |
|---|
| 2446 |
// |
|---|
| 2447 |
// |
|---|
| 2448 |
// m_wndOutputBar.m_buildReport.m_buildList.InsertItem(0,buf); |
|---|
| 2449 |
// |
|---|
| 2450 |
// buf.Format("Linking %s : error code [ %d ] " , lRet != 0 ? "failed" : "succeeded" , lRet ); |
|---|
| 2451 |
// |
|---|
| 2452 |
// m_wndOutputBar.m_buildReport.m_buildList.InsertItem(1,buf); |
|---|
| 2453 |
// |
|---|
| 2454 |
// m_wndOutputBar.m_buildReport.m_buildList.InsertItem(2,""); |
|---|
| 2455 |
// |
|---|
| 2456 |
// if ( lRet == 0 && cRet == 0 ) |
|---|
| 2457 |
// { |
|---|
| 2458 |
// CString le; |
|---|
| 2459 |
// string ext; |
|---|
| 2460 |
// if ( settings.projectFlags.staticLib ) ext = "lib"; |
|---|
| 2461 |
// else if ( settings.projectFlags.sharedLib ) ext = "dll"; |
|---|
| 2462 |
// else ext = "exe"; |
|---|
| 2463 |
// le.Format("%s\\%s.%s",settings.projectLocation.c_str(),settings.projectName.c_str(),ext.c_str()); |
|---|
| 2464 |
// buf.Format("File Created : %s\\%s.%s",settings.projectLocation.c_str(),settings.projectName.c_str(),ext.c_str()); |
|---|
| 2465 |
// |
|---|
| 2466 |
// lastProjectExecutable = le.GetBuffer(0); |
|---|
| 2467 |
// m_wndOutputBar.m_buildReport.m_buildList.InsertItem(3,buf); |
|---|
| 2468 |
// } |
|---|
| 2469 |
// else |
|---|
| 2470 |
// { |
|---|
| 2471 |
// this->SetForegroundWindow(); |
|---|
| 2472 |
// return; |
|---|
| 2473 |
// } |
|---|
| 2474 |
// |
|---|
| 2475 |
// |
|---|
| 2476 |
// |
|---|
| 2477 |
|
|---|
| 2478 |
|
|---|
| 2479 |
} |
|---|
| 2480 |
|
|---|
| 2481 |
|
|---|
| 2482 |
|
|---|
| 2483 |
else if ( compileProject->GetCache("buildType") == "1") |
|---|
| 2484 |
{ |
|---|
| 2485 |
string make = Globals::settings->baseSettings->GetCache("makePath"); |
|---|
| 2486 |
string makefilePath = compileProject->GetCache("makefilePath"); |
|---|
| 2487 |
string cmd = make + " -f " + makefilePath; |
|---|
| 2488 |
|
|---|
| 2489 |
Executor exe(cmd.c_str()); |
|---|
| 2490 |
exe.Run(); |
|---|
| 2491 |
|
|---|
| 2492 |
CString output; |
|---|
| 2493 |
output.Format("Command : \r\n %s \r\nOutput : \r\n %s",cmd.c_str(),exe.output.c_str() ); |
|---|
| 2494 |
|
|---|
| 2495 |
m_wndOutputBar.m_buildSheet.m_buildEdit.SetWindowText(output); |
|---|
| 2496 |
|
|---|
| 2497 |
|
|---|
| 2498 |
} |
|---|
| 2499 |
|
|---|
| 2500 |
else if ( compileProject->GetCache("buildType") == "2" ) |
|---|
| 2501 |
{ |
|---|
| 2502 |
|
|---|
| 2503 |
string cmd = compileProject->GetCache("scriptPath"); |
|---|
| 2504 |
|
|---|
| 2505 |
|
|---|
| 2506 |
Executor exe(cmd.c_str()); |
|---|
| 2507 |
exe.Run(); |
|---|
| 2508 |
|
|---|
| 2509 |
m_wndOutputBar.m_buildSheet.m_buildEdit.SetWindowText(exe.output.c_str()); |
|---|
| 2510 |
|
|---|
| 2511 |
} |
|---|
| 2512 |
|
|---|
| 2513 |
|
|---|
| 2514 |
int itemCount = m_wndOutputBar.m_buildReport.m_buildList.GetItemCount(); |
|---|
| 2515 |
|
|---|
| 2516 |
|
|---|
| 2517 |
CTime _t = CTime::GetCurrentTime(); |
|---|
| 2518 |
CString t; |
|---|
| 2519 |
t.Format("Build completed %d.%d.%d %d:%d:%d ",_t.GetMonth(),_t.GetDay(), _t.GetYear(),_t.GetHour(), _t.GetMinute(),_t.GetSecond()); |
|---|
| 2520 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(itemCount,""); |
|---|
| 2521 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(++itemCount,t); |
|---|
| 2522 |
|
|---|
| 2523 |
this->SetForegroundWindow(); |
|---|
| 2524 |
// this->ShowWindowEx(SW_SHOWNORMAL); |
|---|
| 2525 |
// this->SetFocus(); |
|---|
| 2526 |
} |
|---|
| 2527 |
else |
|---|
| 2528 |
{ |
|---|
| 2529 |
|
|---|
| 2530 |
Globals::theApp.SetStatusBarText("Compile Project FAILED : There is no active project."); |
|---|
| 2531 |
} |
|---|
| 2532 |
|
|---|
| 2533 |
} |
|---|
| 2534 |
|
|---|
| 2535 |
void CMainFrame::OnCompileCompilefileWithbuild() |
|---|
| 2536 |
{ |
|---|
| 2537 |
|
|---|
| 2538 |
CString path = GetActiveDoc()->GetPathName(); |
|---|
| 2539 |
string filePath = path.GetBuffer(0) ; |
|---|
| 2540 |
|
|---|
| 2541 |
if ( filePath == "" ) |
|---|
| 2542 |
{ |
|---|
| 2543 |
Globals::theApp.SetStatusBarText("Compile File FAILED : You must save the file before using compile file. Using Evaluate Buffer [F9] instead."); |
|---|
| 2544 |
OnCompileEvaluatebuffer(); |
|---|
| 2545 |
return; |
|---|
| 2546 |
|
|---|
| 2547 |
} |
|---|
| 2548 |
|
|---|
| 2549 |
string fileName = StripFileName(filePath); |
|---|
| 2550 |
StripExtension(fileName); |
|---|
| 2551 |
BuildFlags f; |
|---|
| 2552 |
|
|---|
| 2553 |
string activeConfig = "file_build"; |
|---|
| 2554 |
|
|---|
| 2555 |
f.names = Globals::settings->baseSettings->GetCache(activeConfig + "_names") == "1"; |
|---|
| 2556 |
f.full = Globals::settings->baseSettings->GetCache(activeConfig + "_full") == "1"; |
|---|
| 2557 |
f.link = Globals::settings->baseSettings->GetCache(activeConfig + "_link") == "1"; |
|---|
| 2558 |
f.nolink = Globals::settings->baseSettings->GetCache(activeConfig + "_nolink") == "1"; |
|---|
| 2559 |
f.lib = Globals::settings->baseSettings->GetCache(activeConfig + "_lib") == "1"; |
|---|
| 2560 |
f.nolib = Globals::settings->baseSettings->GetCache(activeConfig + "_nolib") == "1"; |
|---|
| 2561 |
f.obj = Globals::settings->baseSettings->GetCache(activeConfig + "_obj") == "1"; |
|---|
| 2562 |
f.silent = Globals::settings->baseSettings->GetCache(activeConfig + "_silent") == "1"; |
|---|
| 2563 |
f.allobj = Globals::settings->baseSettings->GetCache(activeConfig + "_allobj") == "1"; |
|---|
| 2564 |
f.test = Globals::settings->baseSettings->GetCache(activeConfig + "_test") == "1"; |
|---|
| 2565 |
f.dll = Globals::settings->baseSettings->GetCache(activeConfig + "_dll") == "1"; |
|---|
| 2566 |
f.gui = Globals::settings->baseSettings->GetCache(activeConfig + "_gui") == "1"; |
|---|
| 2567 |
f.clean = Globals::settings->baseSettings->GetCache(activeConfig + "_clean") == "1"; |
|---|
| 2568 |
f.v = Globals::settings->baseSettings->GetCache(activeConfig + "_v") == "1"; |
|---|
| 2569 |
f.X = Globals::settings->baseSettings->GetCache(activeConfig + "_X").c_str(); |
|---|
| 2570 |
f.M = Globals::settings->baseSettings->GetCache(activeConfig + "_M").c_str(); |
|---|
| 2571 |
f.verbatim = Globals::settings->baseSettings->GetCache(activeConfig + "_verbatim").c_str(); |
|---|
| 2572 |
|
|---|
| 2573 |
|
|---|
| 2574 |
activeConfig = "file_dmd"; |
|---|
| 2575 |
|
|---|
| 2576 |
|
|---|
| 2577 |
|
|---|
| 2578 |
CompilerFlags flags; |
|---|
| 2579 |
|
|---|
| 2580 |
flags.allowDeprecated = false; |
|---|
| 2581 |
flags.debug = false; |
|---|
| 2582 |
flags.debugInfo = false; |
|---|
| 2583 |
flags.debugIdentifiers = ""; |
|---|
| 2584 |
flags.debugPHooks = false; |
|---|
| 2585 |
flags.dontLink = false; |
|---|
| 2586 |
flags.inline_ = false; |
|---|
| 2587 |
flags.optimize = false; |
|---|
| 2588 |
flags.release = false; |
|---|
| 2589 |
//flags.sharedLib = Globals |
|---|
| 2590 |
flags.unitTest = false; |
|---|
| 2591 |
flags.verbose = false; |
|---|
| 2592 |
flags.versionIdentifiers = ""; |
|---|
| 2593 |
flags.staticLib = false; |
|---|
| 2594 |
flags.sharedLib = false; |
|---|
| 2595 |
|
|---|
| 2596 |
|
|---|
| 2597 |
|
|---|
| 2598 |
string compilerLocation , linkLocation , libLocation, libEnvVar, projectLocation , projectName, |
|---|
| 2599 |
installPath, objectDir , resourceFile; |
|---|
| 2600 |
|
|---|
| 2601 |
vector<string> files , libs, linkerFlags, imports; |
|---|
| 2602 |
|
|---|
| 2603 |
string dmdPath = Globals::settings->baseSettings->GetCache("dmdPath"); |
|---|
| 2604 |
compilerLocation = dmdPath ; |
|---|
| 2605 |
dmdPath = StripDirPath(dmdPath) + "\\"; |
|---|
| 2606 |
linkLocation = dmdPath + "..\\..\\dm\\bin\\link.exe"; |
|---|
| 2607 |
libLocation = dmdPath + "..\\..\\dm\\bin\\lib.exe"; |
|---|
| 2608 |
libEnvVar = dmdPath + "..\\lib;" + dmdPath + "..\\..\\dm\\lib"; |
|---|
| 2609 |
projectLocation = StripDirPath(filePath ); |
|---|
| 2610 |
projectName = "File_Build"; |
|---|
| 2611 |
installPath = Globals::settings->baseSettings->GetCache("installPath"); |
|---|
| 2612 |
|
|---|
| 2613 |
// ElephantMessageBox(projectLocation.c_str()); |
|---|
| 2614 |
|
|---|
| 2615 |
objectDir = shortPathName(objectDir); |
|---|
| 2616 |
|
|---|
| 2617 |
//ElephantMessageBox(string(projectLocation + "\\" + projectName + "_object").c_str()); |
|---|
| 2618 |
|
|---|
| 2619 |
//ElephantMessageBox(objectDir.c_str()); |
|---|
| 2620 |
files.push_back(filePath ); |
|---|
| 2621 |
// Split(compileProject->GetCache("files"),",",files); |
|---|
| 2622 |
// Split(compileProject->GetCache("libraries"),",",libs); |
|---|
| 2623 |
Split(Globals::settings->baseSettings->GetCache("importPaths"),",",imports); |
|---|
| 2624 |
|
|---|
| 2625 |
vector<FileExtensionItem> extensions; |
|---|
| 2626 |
|
|---|
| 2627 |
|
|---|
| 2628 |
BuildProjectCompilerSettings settings2(flags,f,files,compilerLocation , |
|---|
| 2629 |
linkLocation, libLocation, libEnvVar, projectLocation, |
|---|
| 2630 |
projectName, installPath, objectDir, resourceFile, libs, linkerFlags, imports ); |
|---|
| 2631 |
// settings2.target = p->GetCache(activeConfig + "_targetName"); |
|---|
| 2632 |
settings2.buildPath = installPath + "\\Tools\\build.exe"; |
|---|
| 2633 |
|
|---|
| 2634 |
Globals::buildCompiler->SetSession(settings2,compOutput); |
|---|
| 2635 |
cRet = Globals::buildCompiler->Compile(); |
|---|
| 2636 |
|
|---|
| 2637 |
// |
|---|
| 2638 |
// |
|---|
| 2639 |
// ProjectCompilerSettings settings(flags,files,compilerLocation , |
|---|
| 2640 |
// linkLocation, libLocation, libEnvVar, projectLocation, |
|---|
| 2641 |
// projectName, installPath, objectDir, resourceFile, libs, linkerFlags ); |
|---|
| 2642 |
// Globals::buildCompiler->SetSession(settings,compOutput,extensions); |
|---|
| 2643 |
// cRet = Globals::buildCompiler->Compile(); |
|---|
| 2644 |
|
|---|
| 2645 |
vector<ErrorPacket> uniqueErrors = Globals::buildCompiler->errors; |
|---|
| 2646 |
|
|---|
| 2647 |
CString buf; |
|---|
| 2648 |
if ( cRet != 0 ) |
|---|
| 2649 |
{ |
|---|
| 2650 |
buf.Format("Building FAILED : build file : error code [ %d ]." , cRet ); |
|---|
| 2651 |
Globals::theApp.SetStatusBarText(buf.GetBuffer(0 ) ); |
|---|
| 2652 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(0,buf); |
|---|
| 2653 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(1,""); |
|---|
| 2654 |
|
|---|
| 2655 |
|
|---|
| 2656 |
for ( int i = 0 ; i < uniqueErrors.size(); i++ ) |
|---|
| 2657 |
{ |
|---|
| 2658 |
|
|---|
| 2659 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(i+2,uniqueErrors[i].line.c_str() ); |
|---|
| 2660 |
m_wndOutputBar.m_buildReport.m_buildList.SetItemText(i+2,1,ITOA(uniqueErrors[i].lineNo).c_str()); |
|---|
| 2661 |
m_wndOutputBar.m_buildReport.m_buildList.SetItemText(i+2,2,uniqueErrors[i].file.c_str()); |
|---|
| 2662 |
|
|---|
| 2663 |
|
|---|
| 2664 |
} |
|---|
| 2665 |
|
|---|
| 2666 |
Sleep(300); |
|---|
| 2667 |
this->SetForegroundWindow(); |
|---|
| 2668 |
//this->SetForegroundWindow(); |
|---|
| 2669 |
|
|---|
| 2670 |
|
|---|
| 2671 |
} |
|---|
| 2672 |
else |
|---|
| 2673 |
{ |
|---|
| 2674 |
|
|---|
| 2675 |
buf.Format("Building File SUCCEEDED : File ( %s ) : error code [ %d ] " , projectName.c_str() , cRet ); |
|---|
| 2676 |
|
|---|
| 2677 |
Globals::theApp.SetStatusBarText(buf.GetBuffer(0 ) ); |
|---|
| 2678 |
// |
|---|
| 2679 |
// |
|---|
| 2680 |
// |
|---|
| 2681 |
// |
|---|
| 2682 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(0,buf); |
|---|
| 2683 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(1,""); |
|---|
| 2684 |
|
|---|
| 2685 |
CString le; |
|---|
| 2686 |
string ext; |
|---|
| 2687 |
// if ( p->GetCache("Default_lib") == "1") ext = "lib"; |
|---|
| 2688 |
// else if ( p->GetCache("Default_dll") == "1") ext = "dll"; |
|---|
| 2689 |
ext = "exe"; |
|---|
| 2690 |
|
|---|
| 2691 |
le.Format("%s\\%s.%s",settings2.projectLocation.c_str(),settings2.target != "" ? settings2.target.c_str() : settings2.projectFiles[0].c_str() ,ext.c_str()); |
|---|
| 2692 |
buf.Format("File Created : %s\\%s.%s",settings2.projectLocation.c_str(),fileName.c_str(),ext.c_str()); |
|---|
| 2693 |
|
|---|
| 2694 |
lastProjectExecutable = le.GetBuffer(0); |
|---|
| 2695 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(2,buf); |
|---|
| 2696 |
|
|---|
| 2697 |
} |
|---|
| 2698 |
|
|---|
| 2699 |
|
|---|
| 2700 |
} |
|---|
| 2701 |
|
|---|
| 2702 |
vector<ErrorPacket> CMainFrame::CompileFile(const string & path ) |
|---|
| 2703 |
{ |
|---|
| 2704 |
|
|---|
| 2705 |
string activeConfig = "file_dmd"; |
|---|
| 2706 |
CompilerFlags flags; |
|---|
| 2707 |
flags.allowDeprecated = Globals::settings->baseSettings->GetCache(activeConfig + "_allowDeprecated") == "1"; |
|---|
| 2708 |
flags.debug = Globals::settings->baseSettings->GetCache(activeConfig + "_debugG") == "1"; |
|---|
| 2709 |
flags.debugInfo = Globals::settings->baseSettings->GetCache(activeConfig + "_debugInfo") == "1"; |
|---|
| 2710 |
flags.debugIdentifiers = Globals::settings->baseSettings->GetCache(activeConfig + "_debugIdentifiers"); |
|---|
| 2711 |
flags.debugPHooks = Globals::settings->baseSettings->GetCache(activeConfig + "_pHooks") == "1"; |
|---|
| 2712 |
flags.inline_ = Globals::settings->baseSettings->GetCache(activeConfig + "_inline") == "1"; |
|---|
| 2713 |
flags.optimize = Globals::settings->baseSettings->GetCache(activeConfig + "_optimize") == "1" ; |
|---|
| 2714 |
flags.release = Globals::settings->baseSettings->GetCache(activeConfig + "_release") == "1"; |
|---|
| 2715 |
//flagsactiveConfig + ._sharedLib = Globals |
|---|
| 2716 |
flags.unitTest = Globals::settings->baseSettings->GetCache(activeConfig + "_unittest") == "1"; |
|---|
| 2717 |
flags.verbose = Globals::settings->baseSettings->GetCache(activeConfig + "_verbose") == "1"; |
|---|
| 2718 |
flags.versionIdentifiers = Globals::settings->baseSettings->GetCache(activeConfig + "_versionIdentifiers"); |
|---|
| 2719 |
flags.staticLib = Globals::settings->baseSettings->GetCache(activeConfig + "_staticLib") == "1"; |
|---|
| 2720 |
flags.sharedLib = Globals::settings->baseSettings->GetCache(activeConfig + "_sharedLib") == "1"; |
|---|
| 2721 |
flags.warning = Globals::settings->baseSettings->GetCache(activeConfig + "_warning") == "1"; |
|---|
| 2722 |
flags.dontLink = Globals::settings->baseSettings->GetCache(activeConfig + "_dontLink") == "1"; |
|---|
| 2723 |
|
|---|
| 2724 |
|
|---|
| 2725 |
|
|---|
| 2726 |
Split(Globals::settings->baseSettings->GetCache("importPaths"),",",flags.importPaths ); |
|---|
| 2727 |
|
|---|
| 2728 |
|
|---|
| 2729 |
|
|---|
| 2730 |
string compilerLocation , linkLocation , libLocation, libEnvVar, projectLocation , projectName, |
|---|
| 2731 |
installPath, objectDir , resourceFile; |
|---|
| 2732 |
|
|---|
| 2733 |
vector<string> files , libs, linkerFlags; |
|---|
| 2734 |
|
|---|
| 2735 |
string dmdPath = Globals::settings->baseSettings->GetCache("dmdPath"); |
|---|
| 2736 |
compilerLocation = dmdPath ; |
|---|
| 2737 |
dmdPath = StripDirPath(dmdPath) + "\\"; |
|---|
| 2738 |
|
|---|
| 2739 |
linkLocation = dmdPath + "..\\..\\dm\\bin\\link.exe"; |
|---|
| 2740 |
libLocation = dmdPath + "..\\..\\dm\\bin\\lib.exe"; |
|---|
| 2741 |
libEnvVar = dmdPath + "..\\lib;" + dmdPath + "..\\..\\dm\\lib"; |
|---|
| 2742 |
|
|---|
| 2743 |
projectName = "foo"; |
|---|
| 2744 |
installPath = Globals::settings->baseSettings->GetCache("installPath"); |
|---|
| 2745 |
projectLocation = installPath; |
|---|
| 2746 |
// ElephantMessageBox(projectLocation.c_str()); |
|---|
| 2747 |
|
|---|
| 2748 |
objectDir = projectLocation + "\\temp_object"; |
|---|
| 2749 |
if ( !DirectoryExists(objectDir) ) CreateDirectory(objectDir.c_str(),NULL); |
|---|
| 2750 |
|
|---|
| 2751 |
objectDir = shortPathName(objectDir); |
|---|
| 2752 |
|
|---|
| 2753 |
//ElephantMessageBox(string(projectLocation + "\\" + projectName + "_object").c_str()); |
|---|
| 2754 |
|
|---|
| 2755 |
//ElephantMessageBox(objectDir.c_str()); |
|---|
| 2756 |
|
|---|
| 2757 |
files.push_back(path); |
|---|
| 2758 |
|
|---|
| 2759 |
|
|---|
| 2760 |
vector<FileExtensionItem> extensions; |
|---|
| 2761 |
|
|---|
| 2762 |
ProjectCompilerSettings settings(flags,files,compilerLocation , |
|---|
| 2763 |
linkLocation, libLocation, libEnvVar, projectLocation, |
|---|
| 2764 |
projectName, installPath, objectDir, resourceFile, libs, linkerFlags ); |
|---|
| 2765 |
Globals::compiler->SetSession(settings,compOutput,extensions); |
|---|
| 2766 |
cRet = Globals::compiler->Compile(); |
|---|
| 2767 |
this->SetForegroundWindow(); |
|---|
| 2768 |
return Globals::compiler->errors; |
|---|
| 2769 |
|
|---|
| 2770 |
} |
|---|
| 2771 |
|
|---|
| 2772 |
void CMainFrame::OnCompileCompilefile() |
|---|
| 2773 |
{ |
|---|
| 2774 |
|
|---|
| 2775 |
ShowOutputWindow(); |
|---|
| 2776 |
|
|---|
| 2777 |
|
|---|
| 2778 |
CElephantDoc* doc = GetActiveDoc(); |
|---|
| 2779 |
if ( doc ) |
|---|
| 2780 |
{ |
|---|
| 2781 |
CString currentDocpath = doc->GetPathName(); |
|---|
| 2782 |
if ( currentDocpath != "") |
|---|
| 2783 |
{ |
|---|
| 2784 |
|
|---|
| 2785 |
|
|---|
| 2786 |
CSplashFactory factoryTwo; |
|---|
| 2787 |
if (!factoryTwo.Create(RUNTIME_CLASS(CCompileSplash))) |
|---|
| 2788 |
{ |
|---|
| 2789 |
ElephantMessageBox(_T("Failed to create splash screen") ); |
|---|
| 2790 |
return; |
|---|
| 2791 |
} |
|---|
| 2792 |
|
|---|
| 2793 |
|
|---|
| 2794 |
m_wndOutputBar.ClearBuildText(); |
|---|
| 2795 |
m_wndOutputBar.m_buildReport.m_buildList.DeleteAllItems(); |
|---|
| 2796 |
CString buf; |
|---|
| 2797 |
|
|---|
| 2798 |
|
|---|
| 2799 |
CompileFile( currentDocpath.GetBuffer(0) ); |
|---|
| 2800 |
vector<ErrorPacket> uniqueErrors = Globals::compiler->errors; |
|---|
| 2801 |
if ( cRet != 0 ) |
|---|
| 2802 |
{ |
|---|
| 2803 |
buf.Format("Building FAILED : error code [ %d ]." , cRet ); |
|---|
| 2804 |
Globals::theApp.SetStatusBarText(buf.GetBuffer(0 ) ); |
|---|
| 2805 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(0,buf); |
|---|
| 2806 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(1,""); |
|---|
| 2807 |
|
|---|
| 2808 |
|
|---|
| 2809 |
for ( int i = 0 ; i < uniqueErrors.size(); i++ ) |
|---|
| 2810 |
{ |
|---|
| 2811 |
|
|---|
| 2812 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(i+2,uniqueErrors[i].line.c_str() ); |
|---|
| 2813 |
m_wndOutputBar.m_buildReport.m_buildList.SetItemText(i+2,1,ITOA(uniqueErrors[i].lineNo).c_str()); |
|---|
| 2814 |
m_wndOutputBar.m_buildReport.m_buildList.SetItemText(i+2,2,StripFileName(uniqueErrors[i].file).c_str()); |
|---|
| 2815 |
|
|---|
| 2816 |
|
|---|
| 2817 |
} |
|---|
| 2818 |
Sleep(300); |
|---|
| 2819 |
this->SetForegroundWindow(); |
|---|
| 2820 |
|
|---|
| 2821 |
return; |
|---|
| 2822 |
|
|---|
| 2823 |
|
|---|
| 2824 |
} |
|---|
| 2825 |
|
|---|
| 2826 |
|
|---|
| 2827 |
|
|---|
| 2828 |
buf.Format("Building SUCCEEDED : error code [ %d ] " , cRet ); |
|---|
| 2829 |
Globals::theApp.SetStatusBarText(buf.GetBuffer(0) ); |
|---|
| 2830 |
Globals::theApp.LogEvent(COMPILE_FILE, currentDocpath.GetBuffer(0)); |
|---|
| 2831 |
|
|---|
| 2832 |
|
|---|
| 2833 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(0,buf); |
|---|
| 2834 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(1,""); |
|---|
| 2835 |
|
|---|
| 2836 |
|
|---|
| 2837 |
if ( cRet == 0 ) |
|---|
| 2838 |
{ |
|---|
| 2839 |
|
|---|
| 2840 |
buf.Format("File Compiled : %s" ,currentDocpath.GetBuffer(0) ); |
|---|
| 2841 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(2,buf); |
|---|
| 2842 |
|
|---|
| 2843 |
} |
|---|
| 2844 |
|
|---|
| 2845 |
|
|---|
| 2846 |
int itemCount = m_wndOutputBar.m_buildReport.m_buildList.GetItemCount(); |
|---|
| 2847 |
|
|---|
| 2848 |
|
|---|
| 2849 |
CTime _t = CTime::GetCurrentTime(); |
|---|
| 2850 |
CString t; |
|---|
| 2851 |
t.Format("Building completed %d.%d.%d %d:%d:%d ",_t.GetMonth(),_t.GetDay(), _t.GetYear(),_t.GetHour(), _t.GetMinute(),_t.GetSecond()); |
|---|
| 2852 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(itemCount,""); |
|---|
| 2853 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(++itemCount,t); |
|---|
| 2854 |
|
|---|
| 2855 |
this->SetForegroundWindow(); |
|---|
| 2856 |
// this->ShowWindowEx(SW_SHOWNORMAL); |
|---|
| 2857 |
// this->SetFocus(); |
|---|
| 2858 |
|
|---|
| 2859 |
|
|---|
| 2860 |
|
|---|
| 2861 |
} |
|---|
| 2862 |
|
|---|
| 2863 |
|
|---|
| 2864 |
|
|---|
| 2865 |
|
|---|
| 2866 |
|
|---|
| 2867 |
|
|---|
| 2868 |
} |
|---|
| 2869 |
else |
|---|
| 2870 |
{ |
|---|
| 2871 |
|
|---|
| 2872 |
} |
|---|
| 2873 |
|
|---|
| 2874 |
|
|---|
| 2875 |
|
|---|
| 2876 |
|
|---|
| 2877 |
} |
|---|
| 2878 |
|
|---|
| 2879 |
void CMainFrame::OnCompileCompilehelp() |
|---|
| 2880 |
{ |
|---|
| 2881 |
string dmdPath = Globals::settings->baseSettings->GetCache("dmdPath") + "dmd.exe"; |
|---|
| 2882 |
Executor exe(dmdPath.c_str()); |
|---|
| 2883 |
exe.Run(); |
|---|
| 2884 |
CString buf = exe.output.c_str(); |
|---|
| 2885 |
|
|---|
| 2886 |
//buf.Replace("\r","\r\n"); |
|---|
| 2887 |
|
|---|
| 2888 |
m_wndOutputBar.m_buildSheet.m_buildEdit.SetWindowText(WhiteSpace::ReplaceWithCodes(exe.output).c_str()); |
|---|
| 2889 |
|
|---|
| 2890 |
|
|---|
| 2891 |
} |
|---|
| 2892 |
|
|---|
| 2893 |
void CMainFrame::CleanProject(ProjectSettings* proj ) |
|---|
| 2894 |
{ |
|---|
| 2895 |
|
|---|
| 2896 |
m_wndOutputBar.ClearBuildText(); |
|---|
| 2897 |
m_wndOutputBar.m_buildReport.m_buildList.DeleteAllItems(); |
|---|
| 2898 |
|
|---|
| 2899 |
|
|---|
| 2900 |
currentErrorNumber = 0; |
|---|
| 2901 |
ProjectSettings* compileProject = proj != NULL ? proj : Globals::currentProject; |
|---|
| 2902 |
|
|---|
| 2903 |
|
|---|
| 2904 |
|
|---|
| 2905 |
if ( compileProject) |
|---|
| 2906 |
{ |
|---|
| 2907 |
|
|---|
| 2908 |
Globals::theApp.LogEvent(COMPILE_PROJECT,compileProject->name , "Cleaning"); |
|---|
| 2909 |
ShowOutputWindow(); |
|---|
| 2910 |
|
|---|
| 2911 |
|
|---|
| 2912 |
CSplashFactory factoryTwo; |
|---|
| 2913 |
if (!factoryTwo.Create(RUNTIME_CLASS(CCompileSplash))) |
|---|
| 2914 |
{ |
|---|
| 2915 |
ElephantMessageBox(_T("Failed to create splash screen") ); |
|---|
| 2916 |
return; |
|---|
| 2917 |
} |
|---|
| 2918 |
|
|---|
| 2919 |
|
|---|
| 2920 |
m_wndOutputBar.ClearBuildText(); |
|---|
| 2921 |
m_wndOutputBar.m_buildReport.m_buildList.DeleteAllItems(); |
|---|
| 2922 |
CString buf; |
|---|
| 2923 |
|
|---|
| 2924 |
|
|---|
| 2925 |
if ( compileProject->GetCache("buildType") == "0") |
|---|
| 2926 |
{ |
|---|
| 2927 |
|
|---|
| 2928 |
ProjectSettings* p = compileProject; |
|---|
| 2929 |
string activeConfig = p->GetCache("CurrentConfiguration"); |
|---|
| 2930 |
|
|---|
| 2931 |
|
|---|
| 2932 |
// m_inline = Globals::currentProject->GetCache(currentConfig + "_inline") == "1"; |
|---|
| 2933 |
// m_optimize = Globals::currentProject->GetCache(currentConfig + "_optimize") == "1"; |
|---|
| 2934 |
// m_allowDeprecated = Globals::currentProject->GetCache(currentConfig + "_allowDeprecated") == "1"; |
|---|
| 2935 |
// m_warnings = Globals::currentProject->GetCache(currentConfig + "_warnings") == "1"; |
|---|
| 2936 |
// m_verbose = Globals::currentProject->GetCache(currentConfig + "_verbose") == "1"; |
|---|
| 2937 |
// m_release = Globals::currentProject->GetCache(currentConfig + "_release") == "1"; |
|---|
| 2938 |
// m_debug = Globals::currentProject->GetCache(currentConfig + "_debugG") == "1"; |
|---|
| 2939 |
// m_pHooks = Globals::currentProject->GetCache(currentConfig + "_pHooks") == "1"; |
|---|
| 2940 |
// m_unittest = Globals::currentProject->GetCache(currentConfig + "_unittest") == "1"; |
|---|
| 2941 |
|
|---|
| 2942 |
CompilerFlags flags; |
|---|
| 2943 |
|
|---|
| 2944 |
flags.allowDeprecated = false; |
|---|
| 2945 |
flags.debug = false; |
|---|
| 2946 |
flags.debugInfo = false; |
|---|
| 2947 |
flags.debugIdentifiers = ""; |
|---|
| 2948 |
flags.debugPHooks = false; |
|---|
| 2949 |
flags.dontLink = false; |
|---|
| 2950 |
flags.inline_ = false; |
|---|
| 2951 |
flags.optimize = false; |
|---|
| 2952 |
flags.release = false; |
|---|
| 2953 |
//flags.sharedLib = Globals |
|---|
| 2954 |
flags.unitTest = false; |
|---|
| 2955 |
flags.verbose = false; |
|---|
| 2956 |
flags.versionIdentifiers = ""; |
|---|
| 2957 |
flags.staticLib = false; |
|---|
| 2958 |
flags.sharedLib = false; |
|---|
| 2959 |
|
|---|
| 2960 |
|
|---|
| 2961 |
|
|---|
| 2962 |
string compilerLocation , linkLocation , libLocation, libEnvVar, projectLocation , projectName, |
|---|
| 2963 |
installPath, objectDir , resourceFile; |
|---|
| 2964 |
|
|---|
| 2965 |
vector<string> files , libs, linkerFlags, imports; |
|---|
| 2966 |
|
|---|
| 2967 |
string dmdPath = Globals::settings->baseSettings->GetCache("dmdPath"); |
|---|
| 2968 |
compilerLocation = dmdPath ; |
|---|
| 2969 |
dmdPath = StripDirPath(dmdPath) + "\\"; |
|---|
| 2970 |
linkLocation = dmdPath + "..\\..\\dm\\bin\\link.exe"; |
|---|
| 2971 |
libLocation = dmdPath + "..\\..\\dm\\bin\\lib.exe"; |
|---|
| 2972 |
libEnvVar = dmdPath + "..\\lib;" + dmdPath + "..\\..\\dm\\lib"; |
|---|
| 2973 |
projectLocation = compileProject->path; |
|---|
| 2974 |
projectName = compileProject->name; |
|---|
| 2975 |
installPath = Globals::settings->baseSettings->GetCache("installPath"); |
|---|
| 2976 |
|
|---|
| 2977 |
// ElephantMessageBox(projectLocation.c_str()); |
|---|
| 2978 |
|
|---|
| 2979 |
objectDir = shortPathName(objectDir); |
|---|
| 2980 |
|
|---|
| 2981 |
//ElephantMessageBox(string(projectLocation + "\\" + projectName + "_object").c_str()); |
|---|
| 2982 |
|
|---|
| 2983 |
//ElephantMessageBox(objectDir.c_str()); |
|---|
| 2984 |
|
|---|
| 2985 |
Split(compileProject->GetCache("files"),",",files); |
|---|
| 2986 |
Split(compileProject->GetCache("libraries"),",",libs); |
|---|
| 2987 |
Split(Globals::settings->baseSettings->GetCache("importPaths"),",",imports); |
|---|
| 2988 |
|
|---|
| 2989 |
vector<FileExtensionItem> extensions; |
|---|
| 2990 |
|
|---|
| 2991 |
|
|---|
| 2992 |
|
|---|
| 2993 |
|
|---|
| 2994 |
BuildFlags f; |
|---|
| 2995 |
|
|---|
| 2996 |
|
|---|
| 2997 |
f.names = false; |
|---|
| 2998 |
f.full = true; |
|---|
| 2999 |
f.link = false; |
|---|
| 3000 |
f.nolink = false; |
|---|
| 3001 |
f.lib = false; |
|---|
| 3002 |
f.nolib = false; |
|---|
| 3003 |
f.obj = false; |
|---|
| 3004 |
f.silent = false; |
|---|
| 3005 |
f.allobj = false; |
|---|
| 3006 |
f.test = true; |
|---|
| 3007 |
f.dll = false; |
|---|
| 3008 |
f.gui = false; |
|---|
| 3009 |
f.clean = true; |
|---|
| 3010 |
f.v = false; |
|---|
| 3011 |
f.X = ""; |
|---|
| 3012 |
f.M = ""; |
|---|
| 3013 |
f.verbatim = ""; |
|---|
| 3014 |
|
|---|
| 3015 |
|
|---|
| 3016 |
|
|---|
| 3017 |
|
|---|
| 3018 |
|
|---|
| 3019 |
|
|---|
| 3020 |
|
|---|
| 3021 |
|
|---|
| 3022 |
|
|---|
| 3023 |
BuildProjectCompilerSettings settings2(flags,f,files,compilerLocation , |
|---|
| 3024 |
linkLocation, libLocation, libEnvVar, projectLocation, |
|---|
| 3025 |
projectName, installPath, objectDir, resourceFile, libs, linkerFlags, imports ); |
|---|
| 3026 |
settings2.target = p->GetCache(activeConfig + "_targetName"); |
|---|
| 3027 |
settings2.buildPath = installPath + "\\Tools\\build.exe"; |
|---|
| 3028 |
|
|---|
| 3029 |
Globals::buildCompiler->SetSession(settings2,compOutput); |
|---|
| 3030 |
cRet = Globals::buildCompiler->Compile(); |
|---|
| 3031 |
|
|---|
| 3032 |
// |
|---|
| 3033 |
// |
|---|
| 3034 |
// ProjectCompilerSettings settings(flags,files,compilerLocation , |
|---|
| 3035 |
// linkLocation, libLocation, libEnvVar, projectLocation, |
|---|
| 3036 |
// projectName, installPath, objectDir, resourceFile, libs, linkerFlags ); |
|---|
| 3037 |
// Globals::buildCompiler->SetSession(settings,compOutput,extensions); |
|---|
| 3038 |
// cRet = Globals::buildCompiler->Compile(); |
|---|
| 3039 |
|
|---|
| 3040 |
vector<ErrorPacket> uniqueErrors = Globals::buildCompiler->errors; |
|---|
| 3041 |
|
|---|
| 3042 |
|
|---|
| 3043 |
|
|---|
| 3044 |
buf.Format("Cleaning %s : project (%s) : error code [ %d ] " , cRet != 0 ? "FAUKED" : "SUCCEEDED" , projectName.c_str() , cRet ); |
|---|
| 3045 |
Globals::theApp.SetStatusBarText(buf.GetBuffer(0) ); |
|---|
| 3046 |
Globals::theApp.LogEvent(CLEAN_PROJECT, projectName ); |
|---|
| 3047 |
// |
|---|
| 3048 |
// |
|---|
| 3049 |
// |
|---|
| 3050 |
// |
|---|
| 3051 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(0,buf); |
|---|
| 3052 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(1,""); |
|---|
| 3053 |
|
|---|
| 3054 |
|
|---|
| 3055 |
|
|---|
| 3056 |
|
|---|
| 3057 |
// |
|---|
| 3058 |
// lRet = Globals::buildCompiler->Link(); |
|---|
| 3059 |
// |
|---|
| 3060 |
// |
|---|
| 3061 |
// //RemoveDuplicates(Globals::buildCompiler->errors,uniqueErrors); |
|---|
| 3062 |
// |
|---|
| 3063 |
// |
|---|
| 3064 |
// |
|---|
| 3065 |
// buf.Format("Compiling %s : error code [ %d ] " ,cRet != 0 ? "failed" : "succeeded" , cRet ); |
|---|
| 3066 |
// |
|---|
| 3067 |
// |
|---|
| 3068 |
// |
|---|
| 3069 |
// |
|---|
| 3070 |
// m_wndOutputBar.m_buildReport.m_buildList.InsertItem(0,buf); |
|---|
| 3071 |
// |
|---|
| 3072 |
// buf.Format("Linking %s : error code [ %d ] " , lRet != 0 ? "failed" : "succeeded" , lRet ); |
|---|
| 3073 |
// |
|---|
| 3074 |
// m_wndOutputBar.m_buildReport.m_buildList.InsertItem(1,buf); |
|---|
| 3075 |
// |
|---|
| 3076 |
// m_wndOutputBar.m_buildReport.m_buildList.InsertItem(2,""); |
|---|
| 3077 |
// |
|---|
| 3078 |
// if ( lRet == 0 && cRet == 0 ) |
|---|
| 3079 |
// { |
|---|
| 3080 |
// CString le; |
|---|
| 3081 |
// string ext; |
|---|
| 3082 |
// if ( settings.projectFlags.staticLib ) ext = "lib"; |
|---|
| 3083 |
// else if ( settings.projectFlags.sharedLib ) ext = "dll"; |
|---|
| 3084 |
// else ext = "exe"; |
|---|
| 3085 |
// le.Format("%s\\%s.%s",settings.projectLocation.c_str(),settings.projectName.c_str(),ext.c_str()); |
|---|
| 3086 |
// buf.Format("File Created : %s\\%s.%s",settings.projectLocation.c_str(),settings.projectName.c_str(),ext.c_str()); |
|---|
| 3087 |
// |
|---|
| 3088 |
// lastProjectExecutable = le.GetBuffer(0); |
|---|
| 3089 |
// m_wndOutputBar.m_buildReport.m_buildList.InsertItem(3,buf); |
|---|
| 3090 |
// } |
|---|
| 3091 |
// else |
|---|
| 3092 |
// { |
|---|
| 3093 |
// this->SetForegroundWindow(); |
|---|
| 3094 |
// return; |
|---|
| 3095 |
// } |
|---|
| 3096 |
// |
|---|
| 3097 |
// |
|---|
| 3098 |
// |
|---|
| 3099 |
|
|---|
| 3100 |
|
|---|
| 3101 |
} |
|---|
| 3102 |
|
|---|
| 3103 |
|
|---|
| 3104 |
|
|---|
| 3105 |
|
|---|
| 3106 |
|
|---|
| 3107 |
int itemCount = m_wndOutputBar.m_buildReport.m_buildList.GetItemCount(); |
|---|
| 3108 |
|
|---|
| 3109 |
|
|---|
| 3110 |
CTime _t = CTime::GetCurrentTime(); |
|---|
| 3111 |
CString t; |
|---|
| 3112 |
t.Format("Cleaning completed %d.%d.%d %d:%d:%d ",_t.GetMonth(),_t.GetDay(), _t.GetYear(),_t.GetHour(), _t.GetMinute(),_t.GetSecond()); |
|---|
| 3113 |
m_wndOutputBar.m_buildReport.m_buildList.InsertItem(++itemCount,t); |
|---|
| 3114 |
|
|---|
| 3115 |
this->SetForegroundWindow(); |
|---|
| 3116 |
// this->ShowWindowEx(SW_SHOWNORMAL); |
|---|
| 3117 |
// this->SetFocus(); |
|---|
| 3118 |
} |
|---|
| 3119 |
else |
|---|
| 3120 |
{ |
|---|
| 3121 |
Globals::theApp.SetStatusBarText("Cleaning FAILED : There is no active project."); |
|---|
| 3122 |
} |
|---|
| 3123 |
|
|---|
| 3124 |
|
|---|
| 3125 |
|
|---|
| 3126 |
|
|---|
| 3127 |
|
|---|
| 3128 |
} |
|---|
| 3129 |
|
|---|
| 3130 |
void CMainFrame::OnCompileClean() |
|---|
| 3131 |
{ |
|---|
| 3132 |
CleanProject(); |
|---|
| 3133 |
} |
|---|
| 3134 |
|
|---|
| 3135 |
void CMainFrame::OnEditParserUpdateprojectparser() |
|---|
| 3136 |
{ |
|---|
| 3137 |
// AfxMessageBox ( "HERE" ); |
|---|
| 3138 |
if ( !Globals::currentProject ) |
|---|
| 3139 |
{ |
|---|
| 3140 |
Globals::theApp.SetStatusBarText("Update Project Parser FAILED : there is currently no active project"); |
|---|
| 3141 |
return; |
|---|
| 3142 |
} |
|---|
| 3143 |
|
|---|
| 3144 |
Globals::theApp.LogEvent(UPDATE_PROJECT_PARSER ,Globals::currentProject->path); |
|---|
| 3145 |
Globals::theApp.UpdateProjectParser(Globals::currentProject); |
|---|
| 3146 |
|
|---|
| 3147 |
|
|---|
| 3148 |
|
|---|
| 3149 |
|
|---|
| 3150 |
} |
|---|
| 3151 |
|
|---|
| 3152 |
void CMainFrame::OnViewShowhideoutputbar() |
|---|
| 3153 |
{ |
|---|
| 3154 |
|
|---|
| 3155 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW,"Outbut Bar"); |
|---|
| 3156 |
if ( m_wndOutputBar.IsVisible() ) this->ShowControlBar(&m_wndOutputBar,false ,true); |
|---|
| 3157 |
else this->ShowControlBar(&m_wndOutputBar,true ,true); |
|---|
| 3158 |
|
|---|
| 3159 |
} |
|---|
| 3160 |
|
|---|
| 3161 |
void CMainFrame::OnViewShowhideworkspace() |
|---|
| 3162 |
{ |
|---|
| 3163 |
|
|---|
| 3164 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW,"Workspace"); |
|---|
| 3165 |
if ( m_wndTabDockBar.IsVisible() ) this->ShowControlBar(&m_wndTabDockBar,false ,true); |
|---|
| 3166 |
else this->ShowControlBar(&m_wndTabDockBar,true ,true); |
|---|
| 3167 |
|
|---|
| 3168 |
} |
|---|
| 3169 |
|
|---|
| 3170 |
void CMainFrame::OnViewShowhidefiletoolbar() |
|---|
| 3171 |
{ |
|---|
| 3172 |
|
|---|
| 3173 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW,"File Toolbar"); |
|---|
| 3174 |
|
|---|
| 3175 |
if ( m_wndFileToolBar.IsVisible() ) this->ShowControlBar(&m_wndFileToolBar,false ,true); |
|---|
| 3176 |
else this->ShowControlBar(&m_wndFileToolBar,true ,true); |
|---|
| 3177 |
|
|---|
| 3178 |
} |
|---|
| 3179 |
|
|---|
| 3180 |
void CMainFrame::OnViewShowhidecodetoolbar() |
|---|
| 3181 |
{ |
|---|
| 3182 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW,"Code Toolbar"); |
|---|
| 3183 |
if ( m_wndCodeToolBar.IsVisible() ) this->ShowControlBar(&m_wndCodeToolBar,false ,true); |
|---|
| 3184 |
else this->ShowControlBar(&m_wndCodeToolBar,true ,true); |
|---|
| 3185 |
|
|---|
| 3186 |
} |
|---|
| 3187 |
|
|---|
| 3188 |
void CMainFrame::OnViewShowhidefindtoolbar() |
|---|
| 3189 |
{ |
|---|
| 3190 |
|
|---|
| 3191 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW,"Find Toolbar"); |
|---|
| 3192 |
|
|---|
| 3193 |
if ( m_wndFindToolBar.IsVisible() ) this->ShowControlBar(&m_wndFindToolBar,false ,true); |
|---|
| 3194 |
else this->ShowControlBar(&m_wndFindToolBar,true ,true); |
|---|
| 3195 |
|
|---|
| 3196 |
} |
|---|
| 3197 |
|
|---|
| 3198 |
void CMainFrame::OnViewShowhidestandardtoolbar() |
|---|
| 3199 |
{ |
|---|
| 3200 |
|
|---|
| 3201 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW,"Standard Toolbar"); |
|---|
| 3202 |
|
|---|
| 3203 |
if ( m_wndToolBar.IsVisible() ) this->ShowControlBar(&m_wndToolBar,false ,true); |
|---|
| 3204 |
else this->ShowControlBar(&m_wndToolBar,true ,true); |
|---|
| 3205 |
|
|---|
| 3206 |
} |
|---|
| 3207 |
|
|---|
| 3208 |
void CMainFrame::OnViewShowhidestatusbar() |
|---|
| 3209 |
{ |
|---|
| 3210 |
|
|---|
| 3211 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW,"Status Bar"); |
|---|
| 3212 |
|
|---|
| 3213 |
if ( m_wndStatusBar.IsVisible() ) this->ShowControlBar(&m_wndStatusBar,false ,true); |
|---|
| 3214 |
else this->ShowControlBar(&m_wndStatusBar,true ,true); |
|---|
| 3215 |
|
|---|
| 3216 |
} |
|---|
| 3217 |
|
|---|
| 3218 |
//void CMainFrame::OnEditParserUpdatefileparser() |
|---|
| 3219 |
// |
|---|
| 3220 |
//{ |
|---|
| 3221 |
// Globals::theApp.UpdateFileParser(); |
|---|
| 3222 |
// |
|---|
| 3223 |
//} |
|---|
| 3224 |
|
|---|
| 3225 |
void CMainFrame::OnNavigationBuildreportoutput() |
|---|
| 3226 |
{ |
|---|
| 3227 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW,"Build Report"); |
|---|
| 3228 |
this->m_wndOutputBar.SetActiveView(0); |
|---|
| 3229 |
|
|---|
| 3230 |
} |
|---|
| 3231 |
|
|---|
| 3232 |
void CMainFrame::OnNavigationFindbaroutput() |
|---|
| 3233 |
{ |
|---|
| 3234 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW,"Find Bar"); |
|---|
| 3235 |
this->m_wndOutputBar.SetActiveView(2); |
|---|
| 3236 |
|
|---|
| 3237 |
} |
|---|
| 3238 |
|
|---|
| 3239 |
void CMainFrame::OnViewMaximizeview() |
|---|
| 3240 |
{ |
|---|
| 3241 |
|
|---|
| 3242 |
OnViewMinimizeview(); |
|---|
| 3243 |
|
|---|
| 3244 |
} |
|---|
| 3245 |
|
|---|
| 3246 |
void CMainFrame::OnViewMinimizeview() |
|---|
| 3247 |
{ |
|---|
| 3248 |
|
|---|
| 3249 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW,"Minimize / Maximize"); |
|---|
| 3250 |
|
|---|
| 3251 |
CElephantView* view = GetActiveView(); |
|---|
| 3252 |
if ( view ) |
|---|
| 3253 |
{ |
|---|
| 3254 |
WINDOWPLACEMENT x; |
|---|
| 3255 |
view->GetParent()->GetWindowPlacement(&x); |
|---|
| 3256 |
|
|---|
| 3257 |
if ( x.showCmd == SW_MAXIMIZE ) view->GetParent()->ShowWindow(SW_RESTORE); |
|---|
| 3258 |
else view->GetParent()->ShowWindow(SW_MAXIMIZE); |
|---|
| 3259 |
|
|---|
| 3260 |
|
|---|
| 3261 |
} |
|---|
| 3262 |
|
|---|
| 3263 |
|
|---|
| 3264 |
} |
|---|
| 3265 |
|
|---|
| 3266 |
|
|---|
| 3267 |
void CMainFrame::OnFindBarFind() |
|---|
| 3268 |
{ |
|---|
| 3269 |
|
|---|
| 3270 |
CString str; |
|---|
| 3271 |
m_findEdit.GetWindowText(str); |
|---|
| 3272 |
//AfxMessageBox(str); |
|---|
| 3273 |
string buffer = str.GetBuffer(0); |
|---|
| 3274 |
|
|---|
| 3275 |
StartFindAtLastPos(); |
|---|
| 3276 |
m_simpleFindNeedsBegin = false; |
|---|
| 3277 |
FindSimpleString(buffer); |
|---|
| 3278 |
m_simpleFindNeedsBegin = true; |
|---|
| 3279 |
|
|---|
| 3280 |
} |
|---|
| 3281 |
|
|---|
| 3282 |
void CMainFrame::OnFindBarReplace() |
|---|
| 3283 |
{ |
|---|
| 3284 |
|
|---|
| 3285 |
|
|---|
| 3286 |
CElephantView* view = GetActiveView(); |
|---|
| 3287 |
if ( view ){ |
|---|
| 3288 |
|
|---|
| 3289 |
CString str; |
|---|
| 3290 |
m_replaceEdit.GetWindowText(str); |
|---|
| 3291 |
string buffer = str.GetBuffer(0); |
|---|
| 3292 |
string sel = view->GetSelectedText(); |
|---|
| 3293 |
Globals::theApp.LogEvent(FIND_BAR_REPLACE ,sel, string("With " + buffer) ); |
|---|
| 3294 |
//AfxMessageBox(str); |
|---|
| 3295 |
CScintillaCtrl& rCtrl = view->GetCtrl(); |
|---|
| 3296 |
if ( view->HasTextSelected () ) |
|---|
| 3297 |
{ |
|---|
| 3298 |
if ( view->GetSelectedText() == sel ) |
|---|
| 3299 |
{ |
|---|
| 3300 |
rCtrl.ReplaceSel(buffer.c_str() ); |
|---|
| 3301 |
} |
|---|
| 3302 |
else |
|---|
| 3303 |
ElephantMessageBox("Oops the selected text does not match the text you have in the find box. Im going to skip replacing ok ?"); |
|---|
| 3304 |
|
|---|
| 3305 |
} |
|---|
| 3306 |
|
|---|
| 3307 |
} |
|---|
| 3308 |
OnFindBarFind(); |
|---|
| 3309 |
} |
|---|
| 3310 |
|
|---|
| 3311 |
|
|---|
| 3312 |
void CMainFrame::OnDescentAutocompleteavailablelibraries() |
|---|
| 3313 |
{ |
|---|
| 3314 |
if ( GetActiveView() ) GetActiveView()->PerformLibraryCompletion(); |
|---|
| 3315 |
|
|---|
| 3316 |
} |
|---|
| 3317 |
|
|---|
| 3318 |
void CMainFrame::OnDescentAutocompleteavailableimports() |
|---|
| 3319 |
{ |
|---|
| 3320 |
if ( GetActiveView() ) GetActiveView()->PerformImportStart(); |
|---|
| 3321 |
|
|---|
| 3322 |
} |
|---|
| 3323 |
|
|---|
| 3324 |
void CMainFrame::OnDescentAutocompletecode() |
|---|
| 3325 |
{ |
|---|
| 3326 |
if ( GetActiveView() ) GetActiveView()->PerformAutoCompleteForce(); |
|---|
| 3327 |
|
|---|
| 3328 |
} |
|---|
| 3329 |
|
|---|
| 3330 |
void CMainFrame::OnViewShowhideconfigtoolbar() |
|---|
| 3331 |
{ |
|---|
| 3332 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW ,"Config Toolbar"); |
|---|
| 3333 |
|
|---|
| 3334 |
if ( m_wndConfigToolbar.IsVisible() ) this->ShowControlBar(&m_wndConfigToolbar,false ,true); |
|---|
| 3335 |
else this->ShowControlBar(&m_wndConfigToolbar,true ,true); |
|---|
| 3336 |
|
|---|
| 3337 |
} |
|---|
| 3338 |
|
|---|
| 3339 |
void CMainFrame::OnHelpBuildhelp() |
|---|
| 3340 |
{ |
|---|
| 3341 |
|
|---|
| 3342 |
::ShellExecute(0,"open","http://www.dsource.org/projects/build/",0,0,SW_SHOWNORMAL); |
|---|
| 3343 |
|
|---|
| 3344 |
|
|---|
| 3345 |
} |
|---|
| 3346 |
|
|---|
| 3347 |
void CMainFrame::OnViewMakeworkspacelarger() |
|---|
| 3348 |
{ |
|---|
| 3349 |
CRect rect; |
|---|
| 3350 |
m_wndTabDockBar.GetWindowRect(&rect); |
|---|
| 3351 |
rect.InflateRect(0,0,10,0); |
|---|
| 3352 |
|
|---|
| 3353 |
//this->Invalidate(); |
|---|
| 3354 |
} |
|---|
| 3355 |
|
|---|
| 3356 |
|
|---|
| 3357 |
|
|---|
| 3358 |
void CMainFrame::OnFileOpen() |
|---|
| 3359 |
{ |
|---|
| 3360 |
|
|---|
| 3361 |
|
|---|
| 3362 |
vector<string> files; |
|---|
| 3363 |
string filter = "Elephant Related Files(*.d , *.dprj, *.def, *.rdf )|*.d;*.dprj;*.def;*.rdf|All Files (*.*)|*.*||"; |
|---|
| 3364 |
string ext = "d"; |
|---|
| 3365 |
//CFileDialog op(true,"","",OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,filter.c_str(),this); |
|---|
| 3366 |
if ( GetFilesFromCFileDialog(Globals::lastDir,files,ext,filter,this) ) |
|---|
| 3367 |
{ |
|---|
| 3368 |
|
|---|
| 3369 |
for ( int i = 0 ; i < files.size(); i++ ) |
|---|
| 3370 |
{ |
|---|
| 3371 |
|
|---|
| 3372 |
string file = files[i]; |
|---|
| 3373 |
if ( !FileExists(file)) continue; |
|---|
| 3374 |
|
|---|
| 3375 |
string ext = FileExtension(file); |
|---|
| 3376 |
|
|---|
| 3377 |
if ( ext == "d") |
|---|
| 3378 |
{ |
|---|
| 3379 |
|
|---|
| 3380 |
Globals::theApp.OpenFile(file ); |
|---|
| 3381 |
|
|---|
| 3382 |
} |
|---|
| 3383 |
else if ( ext == "dprj") |
|---|
| 3384 |
{ |
|---|
| 3385 |
|
|---|
| 3386 |
|
|---|
| 3387 |
string path = StripDirPath( file); |
|---|
| 3388 |
string fileName = StripFileName(file); |
|---|
| 3389 |
StripExtension(fileName); |
|---|
| 3390 |
|
|---|
| 3391 |
ProjectSettings * p = new ProjectSettings(path,fileName ); |
|---|
| 3392 |
|
|---|
| 3393 |
|
|---|
| 3394 |
Globals::SetProject(p); |
|---|
| 3395 |
return; |
|---|
| 3396 |
|
|---|
| 3397 |
} |
|---|
| 3398 |
else Globals::theApp.OpenFile(file); |
|---|
| 3399 |
|
|---|
| 3400 |
|
|---|
| 3401 |
} |
|---|
| 3402 |
} // TODO: Add your command handler code here |
|---|
| 3403 |
|
|---|
| 3404 |
|
|---|
| 3405 |
|
|---|
| 3406 |
} |
|---|
| 3407 |
|
|---|
| 3408 |
void CMainFrame::OnNavigationLineup() |
|---|
| 3409 |
{ |
|---|
| 3410 |
// TODO: Add your command handler code here |
|---|
| 3411 |
if ( GetActiveView() ) GetActiveView()->EmacsUpLine(); |
|---|
| 3412 |
} |
|---|
| 3413 |
|
|---|
| 3414 |
void CMainFrame::OnNavigationLinedown() |
|---|
| 3415 |
{ |
|---|
| 3416 |
if ( GetActiveView() ) GetActiveView()->EmacsDownLine(); |
|---|
| 3417 |
|
|---|
| 3418 |
} |
|---|
| 3419 |
|
|---|
| 3420 |
void CMainFrame::OnWindowCloseall() |
|---|
| 3421 |
{ |
|---|
| 3422 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW ,"Close All Named"); |
|---|
| 3423 |
CloseAllNamedFiles(); |
|---|
| 3424 |
|
|---|
| 3425 |
} |
|---|
| 3426 |
|
|---|
| 3427 |
void CMainFrame::OnFiletreeInsertaddonproject() |
|---|
| 3428 |
{ |
|---|
| 3429 |
if ( !Globals::currentProject ) |
|---|
| 3430 |
{ |
|---|
| 3431 |
Globals::theApp.SetStatusBarText("Insert Node FAILED : Sorry there is no active project currently."); |
|---|
| 3432 |
return; |
|---|
| 3433 |
} |
|---|
| 3434 |
|
|---|
| 3435 |
|
|---|
| 3436 |
|
|---|
| 3437 |
|
|---|
| 3438 |
vector<string> files; |
|---|
| 3439 |
GetFilesFromCFileDialog(Globals::lastDir,files,"d","D Projects (*.dprj)|*.dprj||" ,this); |
|---|
| 3440 |
|
|---|
| 3441 |
if ( files.size() ) |
|---|
| 3442 |
{ |
|---|
| 3443 |
for ( int i = 0 ; i < files.size(); i++ ) |
|---|
| 3444 |
{ |
|---|
| 3445 |
|
|---|
| 3446 |
if ( !FileExists(files[i])) |
|---|
| 3447 |
{ |
|---|
| 3448 |
ElephantMessageBox("This project seems invalid : path ( " + files[i] + " )" ); |
|---|
| 3449 |
} |
|---|
| 3450 |
else |
|---|
| 3451 |
{ |
|---|
| 3452 |
|
|---|
| 3453 |
|
|---|
| 3454 |
|
|---|
| 3455 |
string newPath = GetRelativePath(Globals::currentProject->path, files[i]) ; |
|---|
| 3456 |
//Globals::currentProject->InsertProject(newPath) ; |
|---|
| 3457 |
string name = StripFileName(files[i]); |
|---|
| 3458 |
StripExtension(name); |
|---|
| 3459 |
|
|---|
| 3460 |
|
|---|
| 3461 |
if ( name == Globals::currentProject->name) |
|---|
| 3462 |
{ |
|---|
| 3463 |
Globals::theApp.SetStatusBarText("Insert Node FAILED. This looks like the active project node ( nodes must be unique )."); |
|---|
| 3464 |
return; |
|---|
| 3465 |
} |
|---|
| 3466 |
|
|---|
| 3467 |
|
|---|
| 3468 |
if ( newPath != "" ) |
|---|
| 3469 |
{ |
|---|
| 3470 |
if ( newPath[newPath.length() - 1] == '\\') |
|---|
| 3471 |
newPath = newPath.substr(0,newPath.length() - 1); |
|---|
| 3472 |
} |
|---|
| 3473 |
Globals::theApp.LogEvent(INSERT_ADDON ,newPath); |
|---|
| 3474 |
Globals::currentProject->InsertProject(newPath) ; |
|---|
| 3475 |
GetFileTree().InsertProject(name); |
|---|
| 3476 |
|
|---|
| 3477 |
Globals::theApp.SetStatusBarText("Inserting Node with path [ " +newPath + " ] "); |
|---|
| 3478 |
} |
|---|
| 3479 |
} |
|---|
| 3480 |
|
|---|
| 3481 |
} |
|---|
| 3482 |
|
|---|
| 3483 |
//UpdateProjectNodeMenu(Globals::currentProject ); |
|---|
| 3484 |
|
|---|
| 3485 |
|
|---|
| 3486 |
} |
|---|
| 3487 |
|
|---|
| 3488 |
void CMainFrame::OnFiletreeRemoveaddonproject() |
|---|
| 3489 |
{ |
|---|
| 3490 |
if ( GetFileTree().ProjectIsSelected() ) |
|---|
| 3491 |
{ |
|---|
| 3492 |
|
|---|
| 3493 |
|
|---|
| 3494 |
CFileTreeCtrl& ctrl = GetFileTree(); |
|---|
| 3495 |
string sel = GetSelTreeCtrlItem(&ctrl) ; |
|---|
| 3496 |
Globals::currentProject->RemoveProject(sel); |
|---|
| 3497 |
|
|---|
| 3498 |
Globals::theApp.LogEvent(REMOVE_ADDON ,sel); |
|---|
| 3499 |
HTREEITEM item = ctrl.GetNextItem(TVI_ROOT, TVGN_CARET) ; |
|---|
| 3500 |
ctrl.DeleteItem(item); |
|---|
| 3501 |
|
|---|
| 3502 |
UpdateProjectNodeMenu(Globals::currentProject); |
|---|
| 3503 |
Globals::theApp.SetStatusBarText("Succesfuly removed project node [ " + sel + " ] "); |
|---|
| 3504 |
|
|---|
| 3505 |
} |
|---|
| 3506 |
else |
|---|
| 3507 |
{ |
|---|
| 3508 |
|
|---|
| 3509 |
Globals::theApp.SetStatusBarText("Remove node FAILED. Please select the project node in the workspace window ( Alt-Q ) ."); |
|---|
| 3510 |
} |
|---|
| 3511 |
|
|---|
| 3512 |
} |
|---|
| 3513 |
|
|---|
| 3514 |
void CMainFrame::ActivateProjectNode(int i ) |
|---|
| 3515 |
{ |
|---|
| 3516 |
|
|---|
| 3517 |
|
|---|
| 3518 |
if ( !Globals::currentProject ) return; |
|---|
| 3519 |
|
|---|
| 3520 |
|
|---|
| 3521 |
vector<string> nodes; |
|---|
| 3522 |
Split(Globals::currentProject ->GetCache("AddOnProjects"),",",nodes); |
|---|
| 3523 |
|
|---|
| 3524 |
if ( i >= nodes.size() ) return; |
|---|
| 3525 |
|
|---|
| 3526 |
string path = nodes[i]; |
|---|
| 3527 |
|
|---|
| 3528 |
Globals::theApp.LogEvent(ACTIVATE_ADDON ,path); |
|---|
| 3529 |
|
|---|
| 3530 |
|
|---|
| 3531 |
if ( path != "" && FileExists(path)) |
|---|
| 3532 |
{ |
|---|
| 3533 |
Globals::theApp.SwitchToAddOnProject(path); |
|---|
| 3534 |
|
|---|
| 3535 |
} |
|---|
| 3536 |
else |
|---|
| 3537 |
{ |
|---|
| 3538 |
|
|---|
| 3539 |
|
|---|
| 3540 |
} |
|---|
| 3541 |
|
|---|
| 3542 |
|
|---|
| 3543 |
|
|---|
| 3544 |
} |
|---|
| 3545 |
void CMainFrame::OnFiletreeActivateaddonproject() |
|---|
| 3546 |
{ |
|---|
| 3547 |
|
|---|
| 3548 |
if ( !Globals::currentProject ) return; |
|---|
| 3549 |
|
|---|
| 3550 |
CFileTreeCtrl& ctrl = GetFileTree(); |
|---|
| 3551 |
string name = GetSelTreeCtrlItem(&ctrl); |
|---|
| 3552 |
|
|---|
| 3553 |
if ( Globals::currentProject->name == name ) |
|---|
| 3554 |
{ |
|---|
| 3555 |
Globals::theApp.SetStatusBarText("Activate Node FAILED for project [ " + name + " ] because it is the current active project."); |
|---|
| 3556 |
return; |
|---|
| 3557 |
} |
|---|
| 3558 |
|
|---|
| 3559 |
|
|---|
| 3560 |
|
|---|
| 3561 |
string path = Globals::currentProject->PathForProjectNode(name); |
|---|
| 3562 |
|
|---|
| 3563 |
Globals::theApp.LogEvent(ACTIVATE_ADDON ,path); |
|---|
| 3564 |
|
|---|
| 3565 |
if ( path != "" && FileExists(path)) Globals::theApp.SwitchToAddOnProject(path); |
|---|
| 3566 |
else |
|---|
| 3567 |
{ |
|---|
| 3568 |
Globals::theApp.SetStatusBarText("Activate Node FAILED for project [ " + name + " ] using path [ " + path + " ]."); |
|---|
| 3569 |
} |
|---|
| 3570 |
|
|---|
| 3571 |
} |
|---|
| 3572 |
|
|---|
| 3573 |
void CMainFrame::OnFiletreeBuildselectedproject() |
|---|
| 3574 |
{ |
|---|
| 3575 |
|
|---|
| 3576 |
if ( !Globals::currentProject ) return; |
|---|
| 3577 |
|
|---|
| 3578 |
CFileTreeCtrl& ctrl = GetFileTree(); |
|---|
| 3579 |
string name = GetSelTreeCtrlItem(&ctrl); |
|---|
| 3580 |
/* AfxMessageBox(name.c_str());*/ |
|---|
| 3581 |
|
|---|
| 3582 |
string path = ""; |
|---|
| 3583 |
|
|---|
| 3584 |
if ( Globals::currentProject->name == name ) |
|---|
| 3585 |
{ |
|---|
| 3586 |
|
|---|
| 3587 |
OnCompileCompileProject(); |
|---|
| 3588 |
return; |
|---|
| 3589 |
|
|---|
| 3590 |
|
|---|
| 3591 |
} |
|---|
| 3592 |
|
|---|
| 3593 |
else |
|---|
| 3594 |
{ |
|---|
| 3595 |
path = Globals::currentProject->PathForProjectNode(name); |
|---|
| 3596 |
|
|---|
| 3597 |
|
|---|
| 3598 |
|
|---|
| 3599 |
// AfxMessageBox(path.c_str()); |
|---|
| 3600 |
if ( path != "" && FileExists(path)) |
|---|
| 3601 |
{ |
|---|
| 3602 |
try |
|---|
| 3603 |
{ |
|---|
| 3604 |
|
|---|
| 3605 |
ProjectSettings* p = new ProjectSettings(path); |
|---|
| 3606 |
CompileProject(p); |
|---|
| 3607 |
|
|---|
| 3608 |
|
|---|
| 3609 |
} |
|---|
| 3610 |
catch ( ... ) |
|---|
| 3611 |
{ |
|---|
| 3612 |
CMainFrame* mf = static_cast<CMainFrame*>(Globals::theApp.m_pMainWnd); |
|---|
| 3613 |
mf->SetStatusBarText("Fatal error compiling project!"); |
|---|
| 3614 |
} |
|---|
| 3615 |
|
|---|
| 3616 |
|
|---|
| 3617 |
|
|---|
| 3618 |
} |
|---|
| 3619 |
else Globals::theApp.SetStatusBarText("Compile Project FAILED : project path [ " + path + " ] "); |
|---|
| 3620 |
SetCurrentDirectoryA(Globals::currentProject->path.c_str()); |
|---|
| 3621 |
|
|---|
| 3622 |
} |
|---|
| 3623 |
} |
|---|
| 3624 |
|
|---|
| 3625 |
void CMainFrame::OnFileNewImportprojecttype() |
|---|
| 3626 |
{ |
|---|
| 3627 |
string file = ""; |
|---|
| 3628 |
if ( GetFileFromCFileDialog(Globals::lastDir,file,"dimpj","D Import Projects (*.dimpj)|*.dimpj||" ,this) ) |
|---|
| 3629 |
{ |
|---|
| 3630 |
AfxMessageBox(file.c_str()); |
|---|
| 3631 |
} |
|---|
| 3632 |
|
|---|
| 3633 |
|
|---|
| 3634 |
|
|---|
| 3635 |
} |
|---|
| 3636 |
|
|---|
| 3637 |
|
|---|
| 3638 |
void CMainFrame::OnAppExitRelay() |
|---|
| 3639 |
{ |
|---|
| 3640 |
|
|---|
| 3641 |
this->SaveBarState("PlacementControl"); |
|---|
| 3642 |
|
|---|
| 3643 |
this->OnFileSaveSaveall(); |
|---|
| 3644 |
|
|---|
| 3645 |
|
|---|
| 3646 |
|
|---|
| 3647 |
if ( Globals::currentProject ) |
|---|
| 3648 |
{ |
|---|
| 3649 |
|
|---|
| 3650 |
|
|---|
| 3651 |
|
|---|
| 3652 |
|
|---|
| 3653 |
|
|---|
| 3654 |
vector<string> files = GetAllNamedFiles(); |
|---|
| 3655 |
Globals::currentProject->SetCache("sessionFiles",Join(files,",") ); |
|---|
| 3656 |
|
|---|
| 3657 |
|
|---|
| 3658 |
|
|---|
| 3659 |
Globals::currentProject->Save(); |
|---|
| 3660 |
} |
|---|
| 3661 |
|
|---|
| 3662 |
|
|---|
| 3663 |
this->ShowWindowEx(SW_HIDE); |
|---|
| 3664 |
|
|---|
| 3665 |
Globals::Save(); |
|---|
| 3666 |
|
|---|
| 3667 |
|
|---|
| 3668 |
|
|---|
| 3669 |
|
|---|
| 3670 |
|
|---|
| 3671 |
|
|---|
| 3672 |
|
|---|
| 3673 |
|
|---|
| 3674 |
PostQuitMessage(0); |
|---|
| 3675 |
|
|---|
| 3676 |
|
|---|
| 3677 |
} |
|---|
| 3678 |
|
|---|
| 3679 |
void CMainFrame::OnNavigationOpenmodule() |
|---|
| 3680 |
{ |
|---|
| 3681 |
string word = ""; |
|---|
| 3682 |
if ( !GetActiveView() ) return ; |
|---|
| 3683 |
word = GetActiveView()->ReadImportWord(); |
|---|
| 3684 |
|
|---|
| 3685 |
|
|---|
| 3686 |
if ( word == "" ) return; |
|---|
| 3687 |
|
|---|
| 3688 |
CString w(word.c_str()); |
|---|
| 3689 |
w.Replace(".","\\"); |
|---|
| 3690 |
|
|---|
| 3691 |
string text = "Searching with "; |
|---|
| 3692 |
text += w.GetBuffer(0); |
|---|
| 3693 |
|
|---|
| 3694 |
SetStatusBarText(text); |
|---|
| 3695 |
|
|---|
| 3696 |
//AfxMessageBox(w); |
|---|
| 3697 |
|
|---|
| 3698 |
string file; |
|---|
| 3699 |
|
|---|
| 3700 |
if ( Globals::proxyParser->importClass->getFullPath(w.GetBuffer(0),file) ) |
|---|
| 3701 |
{ |
|---|
| 3702 |
Globals::theApp.OpenFile(file); |
|---|
| 3703 |
Globals::theApp.LogEvent(GOTO_SYM ,file); |
|---|
| 3704 |
SetStatusBarText("Opening module " + file ); |
|---|
| 3705 |
|
|---|
| 3706 |
} |
|---|
| 3707 |
else |
|---|
| 3708 |
{ |
|---|
| 3709 |
file = w.GetBuffer(0); |
|---|
| 3710 |
file += ".d"; |
|---|
| 3711 |
|
|---|
| 3712 |
if ( FileExists(file)) |
|---|
| 3713 |
{ |
|---|
| 3714 |
Globals::theApp.OpenFile(file); |
|---|
| 3715 |
Globals::theApp.LogEvent(GOTO_SYM ,file); |
|---|
| 3716 |
SetStatusBarText("Opening module " + file ); |
|---|
| 3717 |
} |
|---|
| 3718 |
else |
|---|
| 3719 |
SetStatusBarText("Module Not Found " + text); |
|---|
| 3720 |
|
|---|
| 3721 |
} |
|---|
| 3722 |
|
|---|
| 3723 |
} |
|---|
| 3724 |
|
|---|
| 3725 |
void CMainFrame::OnProjectUpdateprojectparser() |
|---|
| 3726 |
{ |
|---|
| 3727 |
OnEditParserUpdateprojectparser(); |
|---|
| 3728 |
|
|---|
| 3729 |
} |
|---|
| 3730 |
|
|---|
| 3731 |
|
|---|
| 3732 |
void CMainFrame::OnNavigationFilebrowser() |
|---|
| 3733 |
{ |
|---|
| 3734 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW ,"File Browser"); |
|---|
| 3735 |
this->m_wndTabDockBar.SetActiveView(0); |
|---|
| 3736 |
|
|---|
| 3737 |
|
|---|
| 3738 |
|
|---|
| 3739 |
} |
|---|
| 3740 |
|
|---|
| 3741 |
void CMainFrame::OnNavigationSourcebrowser() |
|---|
| 3742 |
{ |
|---|
| 3743 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW ,"Source Browser"); |
|---|
| 3744 |
this->m_wndTabDockBar.SetActiveView(1); |
|---|
| 3745 |
|
|---|
| 3746 |
} |
|---|
| 3747 |
|
|---|
| 3748 |
void CMainFrame::OnNavigationHistorybrowser() |
|---|
| 3749 |
{ |
|---|
| 3750 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW ,"History Browser"); |
|---|
| 3751 |
this->m_wndTabDockBar.SetActiveView(2); |
|---|
| 3752 |
|
|---|
| 3753 |
} |
|---|
| 3754 |
|
|---|
| 3755 |
// Select All Open Files Combo |
|---|
| 3756 |
void CMainFrame::OnNavigationSelecttoolbarSelectfiletoolbar() |
|---|
| 3757 |
{ |
|---|
| 3758 |
|
|---|
| 3759 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW ,"Select All Open Files Combo"); |
|---|
| 3760 |
if ( !m_wndFileToolBar.IsVisible() ) this->ShowControlBar(&m_wndFileToolBar,true ,true); |
|---|
| 3761 |
m_fileHistoryComboBox.SetFocus(); |
|---|
| 3762 |
|
|---|
| 3763 |
|
|---|
| 3764 |
} |
|---|
| 3765 |
|
|---|
| 3766 |
// select project files |
|---|
| 3767 |
void CMainFrame::OnNavigationSelecttoolbarSelectcodetoolbar() |
|---|
| 3768 |
{ |
|---|
| 3769 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW ,"Select Project Files Combo"); |
|---|
| 3770 |
if ( !m_wndFileToolBar.IsVisible() ) this->ShowControlBar(&m_wndFileToolBar,true ,true); |
|---|
| 3771 |
|
|---|
| 3772 |
m_fileComboBox.SetFocus(); |
|---|
| 3773 |
|
|---|
| 3774 |
// TODO: Add your command handler code here |
|---|
| 3775 |
|
|---|
| 3776 |
} |
|---|
| 3777 |
|
|---|
| 3778 |
// select file tags combo |
|---|
| 3779 |
void CMainFrame::OnNavigationSelecttoolbarSelectsettingstoolbar() |
|---|
| 3780 |
{ |
|---|
| 3781 |
|
|---|
| 3782 |
// string m = "try"; |
|---|
| 3783 |
// if ( StartsWithBackward(m," yrt") ) AfxMessageBox("yes"); |
|---|
| 3784 |
// else AfxMessageBox("no"); |
|---|
| 3785 |
|
|---|
| 3786 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW ,"Settings Toolbar"); |
|---|
| 3787 |
if ( !m_wndCodeToolBar.IsVisible() ) this->ShowControlBar(&m_wndCodeToolBar,true ,true); |
|---|
| 3788 |
m_fileTagComboBox.SetFocus(); |
|---|
| 3789 |
|
|---|
| 3790 |
|
|---|
| 3791 |
} |
|---|
| 3792 |
|
|---|
| 3793 |
|
|---|
| 3794 |
|
|---|
| 3795 |
void CMainFrame::OnProjectSelectprojectnodeSelectnode1() |
|---|
| 3796 |
{ |
|---|
| 3797 |
|
|---|
| 3798 |
ActivateProjectNode(0); |
|---|
| 3799 |
|
|---|
| 3800 |
} |
|---|
| 3801 |
|
|---|
| 3802 |
void CMainFrame::OnProjectSelectprojectnodeSelectnode2() |
|---|
| 3803 |
{ |
|---|
| 3804 |
ActivateProjectNode(1); |
|---|
| 3805 |
|
|---|
| 3806 |
} |
|---|
| 3807 |
|
|---|
| 3808 |
void CMainFrame::OnProjectSelectprojectnodeSelectnode3() |
|---|
| 3809 |
{ |
|---|
| 3810 |
ActivateProjectNode(2); |
|---|
| 3811 |
|
|---|
| 3812 |
} |
|---|
| 3813 |
|
|---|
| 3814 |
void CMainFrame::OnProjectSelectprojectnodeSelectnode4() |
|---|
| 3815 |
{ |
|---|
| 3816 |
ActivateProjectNode(3); |
|---|
| 3817 |
|
|---|
| 3818 |
} |
|---|
| 3819 |
|
|---|
| 3820 |
void CMainFrame::OnProjectSelectprojectnodeSelectnode5() |
|---|
| 3821 |
{ |
|---|
| 3822 |
ActivateProjectNode(4); |
|---|
| 3823 |
|
|---|
| 3824 |
} |
|---|
| 3825 |
|
|---|
| 3826 |
void CMainFrame::OnProjectSelectprojectnodeSelectnode6() |
|---|
| 3827 |
{ |
|---|
| 3828 |
ActivateProjectNode(5); |
|---|
| 3829 |
|
|---|
| 3830 |
} |
|---|
| 3831 |
|
|---|
| 3832 |
void CMainFrame::OnProjectSelectprojectnodeSelectnode7() |
|---|
| 3833 |
{ |
|---|
| 3834 |
ActivateProjectNode(6); |
|---|
| 3835 |
} |
|---|
| 3836 |
|
|---|
| 3837 |
void CMainFrame::OnNavigationSelecttabLogbrowser() |
|---|
| 3838 |
{ |
|---|
| 3839 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW ,"Log Browser"); |
|---|
| 3840 |
this->m_wndTabDockBar.SetActiveView(3); |
|---|
| 3841 |
|
|---|
| 3842 |
} |
|---|
| 3843 |
|
|---|
| 3844 |
|
|---|
| 3845 |
void CMainFrame::BeginSimpleFind() { |
|---|
| 3846 |
|
|---|
| 3847 |
CElephantView* v = GetActiveView(); |
|---|
| 3848 |
|
|---|
| 3849 |
|
|---|
| 3850 |
if ( v ) { |
|---|
| 3851 |
|
|---|
| 3852 |
CScintillaCtrl& rCtrl = v->GetCtrl(); |
|---|
| 3853 |
int selLength = v->HasTextSelected() ? v->GetSelectedText().length() : 0; |
|---|
| 3854 |
rCtrl.SetSearchFlags(SCFIND_REGEXP); |
|---|
| 3855 |
rCtrl.SetTargetStart( rCtrl.GetCurrentPos() - selLength >= 0 |
|---|
| 3856 |
? |
|---|
| 3857 |
rCtrl.GetCurrentPos() - selLength |
|---|
| 3858 |
: |
|---|
| 3859 |
0 ); |
|---|
| 3860 |
rCtrl.SetTargetEnd(rCtrl.GetLength() ); |
|---|
| 3861 |
} |
|---|
| 3862 |
|
|---|
| 3863 |
m_simpleFindLastPos = 0; |
|---|
| 3864 |
} |
|---|
| 3865 |
|
|---|
| 3866 |
void CMainFrame::FindSimpleString(const string& str) { |
|---|
| 3867 |
|
|---|
| 3868 |
|
|---|
| 3869 |
Globals::theApp.LogEvent(FIND_BAR_FIND ,str); |
|---|
| 3870 |
|
|---|
| 3871 |
if ( m_simpleFindNeedsBegin ) { |
|---|
| 3872 |
|
|---|
| 3873 |
BeginSimpleFind(); |
|---|
| 3874 |
} |
|---|
| 3875 |
|
|---|
| 3876 |
|
|---|
| 3877 |
CElephantView* view = GetActiveView(); |
|---|
| 3878 |
if ( view ) { |
|---|
| 3879 |
CScintillaCtrl& rCtrl = view->GetCtrl(); |
|---|
| 3880 |
|
|---|
| 3881 |
int pos = 0; |
|---|
| 3882 |
|
|---|
| 3883 |
if ( (pos = rCtrl.SearchInTarget(str.size() , (char*)str.c_str () ) ) == -1 ) { |
|---|
| 3884 |
MessageBeep(-1); |
|---|
| 3885 |
|
|---|
| 3886 |
} |
|---|
| 3887 |
|
|---|
| 3888 |
else { |
|---|
| 3889 |
view->GotoAndCenter(rCtrl.LineFromPosition(pos)); |
|---|
| 3890 |
rCtrl.SetSel(pos, pos + str.length()); |
|---|
| 3891 |
} |
|---|
| 3892 |
|
|---|
| 3893 |
m_simpleFindLastPos = pos; |
|---|
| 3894 |
|
|---|
| 3895 |
m_findEdit.SetFocus(); |
|---|
| 3896 |
} |
|---|
| 3897 |
|
|---|
| 3898 |
|
|---|
| 3899 |
|
|---|
| 3900 |
|
|---|
| 3901 |
} |
|---|
| 3902 |
|
|---|
| 3903 |
void CMainFrame::StartFindAtLastPos( ) { |
|---|
| 3904 |
CElephantView* view = GetActiveView(); |
|---|
| 3905 |
|
|---|
| 3906 |
if ( view ) { |
|---|
| 3907 |
CScintillaCtrl& rCtrl = view->GetCtrl(); |
|---|
| 3908 |
|
|---|
| 3909 |
rCtrl.SetSearchFlags(SCFIND_REGEXP); |
|---|
| 3910 |
rCtrl.SetTargetStart(m_simpleFindLastPos + 1); |
|---|
| 3911 |
rCtrl.SetTargetEnd(rCtrl.GetLength() ); |
|---|
| 3912 |
} |
|---|
| 3913 |
|
|---|
| 3914 |
} |
|---|
| 3915 |
|
|---|
| 3916 |
void CMainFrame::OnNavigationSelectcomboboxSelectcodesymbol() |
|---|
| 3917 |
{ |
|---|
| 3918 |
|
|---|
| 3919 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW ,"Select Code Combo"); |
|---|
| 3920 |
if ( !m_wndCodeToolBar.IsVisible() ) this->ShowControlBar(&m_wndCodeToolBar,true ,true); |
|---|
| 3921 |
m_tagComboBox.SetFocus(); |
|---|
| 3922 |
|
|---|
| 3923 |
|
|---|
| 3924 |
|
|---|
| 3925 |
} |
|---|
| 3926 |
|
|---|
| 3927 |
void CMainFrame::OnNavigationSelectcomboboxSelectprojectconfiguration() |
|---|
| 3928 |
{ |
|---|
| 3929 |
Globals::theApp.LogEvent(HIDE_SHOW_WINDOW ,"Select Project Config Combo"); |
|---|
| 3930 |
if ( !m_wndConfigToolbar.IsVisible() ) this->ShowControlBar(&m_wndConfigToolbar,true ,true); |
|---|
| 3931 |
m_configComboBox.SetFocus(); |
|---|
| 3932 |
|
|---|
| 3933 |
|
|---|
| 3934 |
} |
|---|
| 3935 |
|
|---|
| 3936 |
void CMainFrame::OnFiletreeCleanselectedproject() |
|---|
| 3937 |
{ |
|---|
| 3938 |
|
|---|
| 3939 |
if ( !Globals::currentProject ) return; |
|---|
| 3940 |
|
|---|
| 3941 |
CFileTreeCtrl& ctrl = GetFileTree(); |
|---|
| 3942 |
string name = GetSelTreeCtrlItem(&ctrl); |
|---|
| 3943 |
/* AfxMessageBox(name.c_str());*/ |
|---|
| 3944 |
|
|---|
| 3945 |
string path = ""; |
|---|
| 3946 |
|
|---|
| 3947 |
if ( Globals::currentProject->name == name ) |
|---|
| 3948 |
{ |
|---|
| 3949 |
|
|---|
| 3950 |
OnCompileCompileProject(); |
|---|
| 3951 |
return; |
|---|
| 3952 |
|
|---|
| 3953 |
|
|---|
| 3954 |
} |
|---|
| 3955 |
|
|---|
| 3956 |
else |
|---|
| 3957 |
{ |
|---|
| 3958 |
path = Globals::currentProject->PathForProjectNode(name); |
|---|
| 3959 |
|
|---|
| 3960 |
|
|---|
| 3961 |
|
|---|
| 3962 |
// AfxMessageBox(path.c_str()); |
|---|
| 3963 |
if ( path != "" && FileExists(path)) |
|---|
| 3964 |
{ |
|---|
| 3965 |
try |
|---|
| 3966 |
{ |
|---|
| 3967 |
|
|---|
| 3968 |
ProjectSettings* p = new ProjectSettings(path); |
|---|
| 3969 |
CleanProject(p); |
|---|
| 3970 |
|
|---|
| 3971 |
|
|---|
| 3972 |
} |
|---|
| 3973 |
catch ( ... ) |
|---|
| 3974 |
{ |
|---|
| 3975 |
CMainFrame* mf = static_cast<CMainFrame*>(Globals::theApp.m_pMainWnd); |
|---|
| 3976 |
mf->SetStatusBarText("Fatal error cleaning project!"); |
|---|
| 3977 |
} |
|---|
| 3978 |
|
|---|
| 3979 |
|
|---|
| 3980 |
|
|---|
| 3981 |
} |
|---|
| 3982 |
else Globals::theApp.SetStatusBarText("Cleaning Project FAILED : project path [ " + path + " ] "); |
|---|
| 3983 |
SetCurrentDirectoryA(Globals::currentProject->path.c_str()); |
|---|
| 3984 |
|
|---|
| 3985 |
} |
|---|
| 3986 |
|
|---|
| 3987 |
} |
|---|