1 |
786 |
skrzyp |
// ####ECOSHOSTGPLCOPYRIGHTBEGIN####
|
2 |
|
|
// -------------------------------------------
|
3 |
|
|
// This file is part of the eCos host tools.
|
4 |
|
|
// Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
5 |
|
|
//
|
6 |
|
|
// This program is free software; you can redistribute it and/or modify
|
7 |
|
|
// it under the terms of the GNU General Public License as published by
|
8 |
|
|
// the Free Software Foundation; either version 2 or (at your option) any
|
9 |
|
|
// later version.
|
10 |
|
|
//
|
11 |
|
|
// This program is distributed in the hope that it will be useful, but
|
12 |
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 |
|
|
// General Public License for more details.
|
15 |
|
|
//
|
16 |
|
|
// You should have received a copy of the GNU General Public License
|
17 |
|
|
// along with this program; if not, write to the
|
18 |
|
|
// Free Software Foundation, Inc., 51 Franklin Street,
|
19 |
|
|
// Fifth Floor, Boston, MA 02110-1301, USA.
|
20 |
|
|
// -------------------------------------------
|
21 |
|
|
// ####ECOSHOSTGPLCOPYRIGHTEND####
|
22 |
|
|
// MainFrm.cpp : implementation of the CMainFrame class:
|
23 |
|
|
//
|
24 |
|
|
//===========================================================================
|
25 |
|
|
//#####DESCRIPTIONBEGIN####
|
26 |
|
|
//
|
27 |
|
|
// Author(s): sdf
|
28 |
|
|
// Contact(s): sdf
|
29 |
|
|
// Date: 1998/08/11
|
30 |
|
|
// Version: 0.01
|
31 |
|
|
// Purpose:
|
32 |
|
|
// Description: This is the implementation of the main frame class
|
33 |
|
|
// Requires:
|
34 |
|
|
// Provides:
|
35 |
|
|
// See also:
|
36 |
|
|
// Known bugs:
|
37 |
|
|
// Usage:
|
38 |
|
|
//
|
39 |
|
|
//####DESCRIPTIONEND####
|
40 |
|
|
//
|
41 |
|
|
//===========================================================================
|
42 |
|
|
|
43 |
|
|
#include "stdafx.h"
|
44 |
|
|
|
45 |
|
|
#define WM_SUBPROCESS (WM_USER+42)
|
46 |
|
|
|
47 |
|
|
#include "BinDirDialog.h"
|
48 |
|
|
#include "BuildOptionsDialog.h"
|
49 |
|
|
#include "CTOptionsDialog.h"
|
50 |
|
|
#include "CTUtils.h"
|
51 |
|
|
#include "CellView.h"
|
52 |
|
|
#include "ConfigItem.h"
|
53 |
|
|
#include "ConfigTool.h"
|
54 |
|
|
#include "ConfigToolDoc.h"
|
55 |
|
|
#include "ControlView.h"
|
56 |
|
|
#include "DescView.h"
|
57 |
|
|
#include "FindDialog.h"
|
58 |
|
|
#include "FolderDialog.h"
|
59 |
|
|
#include "MLTFrame.h"
|
60 |
|
|
#include "MainFrm.h"
|
61 |
|
|
#include "MessageBox.h"
|
62 |
|
|
#include "PlatformsDialog.h"
|
63 |
|
|
#include "NotePage.h"
|
64 |
|
|
#include "OutputView.h"
|
65 |
|
|
#include "PropertiesView.h"
|
66 |
|
|
#include "RegionGeneralPage.h"
|
67 |
|
|
#include "RulesView.h"
|
68 |
|
|
#include "SectionGeneralPage.h"
|
69 |
|
|
#include "SectionRelocationPage.h"
|
70 |
|
|
#include "Splash.h"
|
71 |
|
|
#include "SplitterWndEx.h"
|
72 |
|
|
#include "Subprocess.h"
|
73 |
|
|
#include "TestResource.h"
|
74 |
|
|
#include "ThinSplitter.h"
|
75 |
|
|
#include "ViewOptions.h"
|
76 |
|
|
|
77 |
|
|
#define INCLUDEFILE "build.hxx"
|
78 |
|
|
#include "IncludeSTL.h"
|
79 |
|
|
|
80 |
|
|
#include <afxpriv.h>
|
81 |
|
|
#include <htmlhelp.h>
|
82 |
|
|
#include <windowsx.h> // for GET_X_LPARAM, GET_Y_LPARAM
|
83 |
|
|
|
84 |
|
|
#ifdef _DEBUG
|
85 |
|
|
#define new DEBUG_NEW
|
86 |
|
|
#undef THIS_FILE
|
87 |
|
|
static char THIS_FILE[] = __FILE__;
|
88 |
|
|
#endif
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
/////////////////////////////////////////////////////////////////////////////
|
92 |
|
|
// CMainFrame
|
93 |
|
|
|
94 |
|
|
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
|
95 |
|
|
//UINT WM_FINDREPLACE = RegisterWindowMessage(FINDMSGSTRING);
|
96 |
|
|
|
97 |
|
|
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
|
98 |
|
|
//{{AFX_MSG_MAP(CMainFrame)
|
99 |
|
|
ON_WM_CREATE()
|
100 |
|
|
ON_COMMAND(ID_VIEW_PROPERTIES, OnViewProperties)
|
101 |
|
|
ON_UPDATE_COMMAND_UI(ID_VIEW_PROPERTIES, OnUpdateViewProperties)
|
102 |
|
|
ON_COMMAND(ID_VIEW_MLT, OnViewMLT)
|
103 |
|
|
ON_COMMAND(ID_VIEW_SHORTDESC, OnViewShortdesc)
|
104 |
|
|
ON_UPDATE_COMMAND_UI(ID_VIEW_SHORTDESC, OnUpdateViewShortdesc)
|
105 |
|
|
ON_COMMAND(ID_VIEW_OUTPUT, OnViewOutput)
|
106 |
|
|
ON_UPDATE_COMMAND_UI(ID_VIEW_OUTPUT, OnUpdateViewOutput)
|
107 |
|
|
ON_UPDATE_COMMAND_UI(ID_BUILD_CONFIGURE, OnUpdateBuildConfigure)
|
108 |
|
|
ON_COMMAND(ID_BUILD_STOP, OnBuildStop)
|
109 |
|
|
ON_UPDATE_COMMAND_UI(ID_BUILD_STOP, OnUpdateBuildStop)
|
110 |
|
|
ON_COMMAND(ID_BUILD_CONFIGURE, OnConfigurationBuild)
|
111 |
|
|
ON_WM_DESTROY()
|
112 |
|
|
ON_COMMAND(ID_BUILD_TESTS, OnBuildTests)
|
113 |
|
|
ON_UPDATE_COMMAND_UI(ID_BUILD_TESTS, OnUpdateBuildTests)
|
114 |
|
|
ON_UPDATE_COMMAND_UI(ID_FILE_SAVE, OnUpdateFileSave)
|
115 |
|
|
ON_UPDATE_COMMAND_UI(ID_FILE_SAVE_AS, OnUpdateFileSaveAs)
|
116 |
|
|
ON_UPDATE_COMMAND_UI(ID_FILE_OPEN, OnUpdateFileOpen)
|
117 |
|
|
ON_UPDATE_COMMAND_UI(ID_FILE_NEW, OnUpdateFileNew)
|
118 |
|
|
ON_UPDATE_COMMAND_UI(ID_APP_EXIT, OnUpdateAppExit)
|
119 |
|
|
ON_UPDATE_COMMAND_UI(ID_VIEW_MLT, OnUpdateViewMLT)
|
120 |
|
|
ON_WM_SYSCOMMAND()
|
121 |
|
|
ON_UPDATE_COMMAND_UI(ID_CONFIGURATION_REFRESH, OnUpdateConfigurationRefresh)
|
122 |
|
|
ON_COMMAND(ID_CONFIGURATION_REFRESH, OnConfigurationRefresh)
|
123 |
|
|
ON_COMMAND(ID_MENU_VIEW_SETTINGS, OnViewSettings)
|
124 |
|
|
ON_COMMAND(ID_TOOLS_PATHS, OnToolsPaths)
|
125 |
|
|
ON_WM_SIZE()
|
126 |
|
|
ON_UPDATE_COMMAND_UI(ID_CONFIGURATION_REPOSITORY, OnUpdateConfigurationRepository)
|
127 |
|
|
ON_COMMAND(ID_WINDOW_NEXT, OnWindowNext)
|
128 |
|
|
ON_COMMAND(ID_WINDOW_PREV, OnWindowPrev)
|
129 |
|
|
ON_COMMAND(ID_HELP_SUBMIT_PR, OnHelpSubmitPr)
|
130 |
|
|
ON_COMMAND(ID_HELP_ECOS, OnHelpEcos)
|
131 |
|
|
ON_COMMAND(ID_HELP_RED_HATONTHEWEB, OnHelpRedHatHome)
|
132 |
|
|
ON_COMMAND(ID_HELP_UITRON, OnHelpUitron)
|
133 |
|
|
ON_COMMAND(ID_HELP_ECOSHOME, OnHelpEcoshome)
|
134 |
|
|
ON_COMMAND(ID_RUN_SIM, OnRunSim)
|
135 |
|
|
ON_COMMAND(ID_BUILD_CLEAN, OnBuildClean)
|
136 |
|
|
ON_UPDATE_COMMAND_UI(ID_BUILD_CLEAN, OnUpdateBuildClean)
|
137 |
|
|
ON_COMMAND(ID_TOOLS_SHELL, OnToolsShell)
|
138 |
|
|
ON_WM_CLOSE()
|
139 |
|
|
ON_COMMAND(ID_BUILD_OPTIONS, OnBuildOptions)
|
140 |
|
|
ON_COMMAND(ID_TOOLS_OPTIONS, OnToolsOptions)
|
141 |
|
|
ON_COMMAND(ID_USERTOOLS_PATHS, OnUsertoolsPaths)
|
142 |
|
|
ON_MESSAGE(WM_SETMESSAGESTRING, OnSetMessageString)
|
143 |
|
|
ON_UPDATE_COMMAND_UI(ID_RUN_SIM, OnUpdateRunSim)
|
144 |
|
|
ON_COMMAND(ID_VIEW_CONFLICTS, OnViewConflicts)
|
145 |
|
|
ON_UPDATE_COMMAND_UI(ID_VIEW_CONFLICTS, OnUpdateViewConflicts)
|
146 |
|
|
ON_COMMAND(ID_VIEW_MLTBAR, OnViewMltbar)
|
147 |
|
|
ON_UPDATE_COMMAND_UI(ID_VIEW_MLTBAR, OnUpdateViewMltbar)
|
148 |
|
|
ON_COMMAND(ID_RESOLVE_CONFLICTS, OnResolveConflicts)
|
149 |
|
|
ON_UPDATE_COMMAND_UI(ID_RESOLVE_CONFLICTS, OnUpdateResolveConflicts)
|
150 |
|
|
ON_COMMAND(ID_GO_HOME, OnGoHome)
|
151 |
|
|
ON_WM_MEASUREITEM()
|
152 |
|
|
ON_WM_INITMENUPOPUP()
|
153 |
|
|
ON_UPDATE_COMMAND_UI(ID_BUILD_OPTIONS, OnUpdateBuildOptions)
|
154 |
|
|
ON_MESSAGE(WM_SUBPROCESS,OnSubprocess)
|
155 |
|
|
ON_UPDATE_COMMAND_UI(ID_TOOLS_ADMINISTRATION, OnUpdateToolsAdministration)
|
156 |
|
|
ON_WM_HELPINFO()
|
157 |
|
|
ON_COMMAND(ID_EDIT_PLATFORMS, OnEditPlatforms)
|
158 |
|
|
ON_WM_MENUCHAR()
|
159 |
|
|
ON_COMMAND(ID_HELP, OnHelp)
|
160 |
|
|
ON_WM_TIMER()
|
161 |
|
|
//}}AFX_MSG_MAP
|
162 |
|
|
ON_NOTIFY(HHN_NAVCOMPLETE, ID_HHNOTIFICATION, OnNavComplete)
|
163 |
|
|
ON_NOTIFY(HHN_TRACK, ID_HHNOTIFICATION, OnNavComplete)
|
164 |
|
|
ON_NOTIFY(HHN_WINDOW_CREATE,ID_HHNOTIFICATION, OnNavComplete)
|
165 |
|
|
END_MESSAGE_MAP()
|
166 |
|
|
|
167 |
|
|
UINT CMainFrame::indicators[] =
|
168 |
|
|
{
|
169 |
|
|
ID_SEPARATOR, // status line indicator
|
170 |
|
|
ID_THERMOMETER,
|
171 |
|
|
ID_SEPARATOR, // status line indicator
|
172 |
|
|
ID_SEPARATOR
|
173 |
|
|
};
|
174 |
|
|
|
175 |
|
|
bool CMainFrame::m_arMounted[26]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
176 |
|
|
|
177 |
|
|
/////////////////////////////////////////////////////////////////////////////
|
178 |
|
|
// CMainFrame construction/destruction
|
179 |
|
|
|
180 |
|
|
CMainFrame::CMainFrame():
|
181 |
|
|
m_pFindReplaceDialog(NULL),
|
182 |
|
|
m_strIdleMessage(),
|
183 |
|
|
m_nThermometerMax(0),
|
184 |
|
|
m_bFindInProgress(false),
|
185 |
|
|
m_bStatusBarCreated(false)
|
186 |
|
|
{
|
187 |
|
|
}
|
188 |
|
|
|
189 |
|
|
CMainFrame::~CMainFrame()
|
190 |
|
|
{
|
191 |
|
|
}
|
192 |
|
|
|
193 |
|
|
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
194 |
|
|
{
|
195 |
|
|
DragAcceptFiles();
|
196 |
|
|
|
197 |
|
|
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
|
198 |
|
|
return -1;
|
199 |
|
|
|
200 |
|
|
if (!m_wndToolBar.Create(this,WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,AFX_IDW_TOOLBAR) ||
|
201 |
|
|
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
|
202 |
|
|
{
|
203 |
|
|
TRACE0("Failed to create toolbar\n");
|
204 |
|
|
return -1; // fail to create
|
205 |
|
|
}
|
206 |
|
|
|
207 |
|
|
if (!m_wndMLTToolBar.Create(this,WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC,AFX_IDW_TOOLBAR+1) ||
|
208 |
|
|
!m_wndMLTToolBar.LoadToolBar(IDR_MLTBAR))
|
209 |
|
|
{
|
210 |
|
|
TRACE0("Failed to create MLT toolbar\n");
|
211 |
|
|
return -1; // fail to create
|
212 |
|
|
}
|
213 |
|
|
m_bMLTToolbarVisible=true;
|
214 |
|
|
|
215 |
|
|
if (!m_wndStatusBar.Create(this) ||
|
216 |
|
|
!m_wndStatusBar.SetIndicators(indicators,
|
217 |
|
|
sizeof(indicators)/sizeof(UINT)))
|
218 |
|
|
{
|
219 |
|
|
TRACE0("Failed to create status bar\n");
|
220 |
|
|
return -1; // fail to create
|
221 |
|
|
}
|
222 |
|
|
m_bStatusBarCreated=true;
|
223 |
|
|
CDC *pDC=GetDC();
|
224 |
|
|
CFont *pOldFont=pDC->SelectObject(m_wndStatusBar.GetFont());
|
225 |
|
|
m_nThermometerPaneSize=100;
|
226 |
|
|
m_nPercentagePaneSize=pDC->GetTextExtent(_T("100%")).cx;
|
227 |
|
|
m_nFailRulePaneSize=pDC->GetTextExtent(_T("333 conflicts")).cx;
|
228 |
|
|
pDC->SelectObject(pOldFont);
|
229 |
|
|
ReleaseDC(pDC);
|
230 |
|
|
|
231 |
|
|
CRect rect;
|
232 |
|
|
m_wndStatusBar.GetItemRect(ThermometerPane, rect);
|
233 |
|
|
|
234 |
|
|
m_Progress.Create(WS_VISIBLE|WS_CHILD|PBS_SMOOTH, rect,&m_wndStatusBar, ID_THERMOMETER);
|
235 |
|
|
m_Progress.SetRange(0,100);
|
236 |
|
|
m_Progress.SetPos(0);
|
237 |
|
|
|
238 |
|
|
//CConfigTool::GetConfigToolDoc()->UpdateFailingRuleCount();
|
239 |
|
|
// TODO: Delete these three lines if you don't want the toolbar to
|
240 |
|
|
// be dockable
|
241 |
|
|
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
|
242 |
|
|
m_wndMLTToolBar.EnableDocking(CBRS_ALIGN_ANY);
|
243 |
|
|
|
244 |
|
|
EnableDocking(CBRS_ALIGN_ANY);
|
245 |
|
|
DockControlBar(&m_wndToolBar);
|
246 |
|
|
DockControlBar(&m_wndMLTToolBar);
|
247 |
|
|
|
248 |
|
|
CSplashWnd::ShowSplashScreen(this);
|
249 |
|
|
|
250 |
|
|
return 0;
|
251 |
|
|
}
|
252 |
|
|
|
253 |
|
|
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
|
254 |
|
|
{
|
255 |
|
|
//cs.style|=~FWS_ADDTOTITLE;
|
256 |
|
|
return CFrameWnd::PreCreateWindow(cs);
|
257 |
|
|
}
|
258 |
|
|
|
259 |
|
|
/////////////////////////////////////////////////////////////////////////////
|
260 |
|
|
// CMainFrame diagnostics
|
261 |
|
|
|
262 |
|
|
#ifdef _DEBUG
|
263 |
|
|
void CMainFrame::AssertValid() const
|
264 |
|
|
{
|
265 |
|
|
CFrameWnd::AssertValid();
|
266 |
|
|
}
|
267 |
|
|
|
268 |
|
|
void CMainFrame::Dump(CDumpContext& dc) const
|
269 |
|
|
{
|
270 |
|
|
CFrameWnd::Dump(dc);
|
271 |
|
|
}
|
272 |
|
|
|
273 |
|
|
#endif //_DEBUG
|
274 |
|
|
|
275 |
|
|
/////////////////////////////////////////////////////////////////////////////
|
276 |
|
|
// CMainFrame message handlers
|
277 |
|
|
CMainFrame::ViewStruct CMainFrame::arView[PaneTypeMax]={
|
278 |
|
|
CMainFrame::ViewStruct(_T("Cell"), true,RUNTIME_CLASS(CCellView)),
|
279 |
|
|
CMainFrame::ViewStruct(_T("Configuration"), true,RUNTIME_CLASS(CControlView)),
|
280 |
|
|
CMainFrame::ViewStruct(_T("Short Description"), true,RUNTIME_CLASS(CDescView)),
|
281 |
|
|
CMainFrame::ViewStruct(_T("Output"), true,RUNTIME_CLASS(COutputView)),
|
282 |
|
|
CMainFrame::ViewStruct(_T("Properties"), true,RUNTIME_CLASS(CPropertiesView)),
|
283 |
|
|
CMainFrame::ViewStruct(_T("Rules"), false,RUNTIME_CLASS(CRulesView)),
|
284 |
|
|
CMainFrame::ViewStruct(_T("Memory Layout"), false,RUNTIME_CLASS(CMLTView))
|
285 |
|
|
};
|
286 |
|
|
|
287 |
|
|
// This data defines the layout of the nested splitters
|
288 |
|
|
CMainFrame::Split CMainFrame::arSplit[]={
|
289 |
|
|
CMainFrame::Split(Horz,1,0.8),
|
290 |
|
|
CMainFrame::Split(Horz,2,0.7),
|
291 |
|
|
CMainFrame::Split(Vert,3,0.5),
|
292 |
|
|
CMainFrame::Split(Thin,4,0.4),
|
293 |
|
|
CMainFrame::Split(Control,5),
|
294 |
|
|
CMainFrame::Split(Cell,5),
|
295 |
|
|
CMainFrame::Split(Horz,4,0.6),
|
296 |
|
|
CMainFrame::Split(Rules,5),
|
297 |
|
|
CMainFrame::Split(Horz,5,0.5),
|
298 |
|
|
CMainFrame::Split(Properties,6),
|
299 |
|
|
CMainFrame::Split(ShortDesc,6),
|
300 |
|
|
CMainFrame::Split(MLT,3),
|
301 |
|
|
CMainFrame::Split(Output,2)
|
302 |
|
|
};
|
303 |
|
|
|
304 |
|
|
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
|
305 |
|
|
{
|
306 |
|
|
for(int i=0;i<sizeof arView/sizeof arView[0];i++){
|
307 |
|
|
ViewStruct &v=arView[(PaneType)i];
|
308 |
|
|
v.bVisible=GetApp()->GetProfileInt(_T("Windows"),v.pszName,v.bVisible);
|
309 |
|
|
}
|
310 |
|
|
CRect rcClient;
|
311 |
|
|
GetClientRect(rcClient);
|
312 |
|
|
|
313 |
|
|
BOOL rc=TRUE;
|
314 |
|
|
|
315 |
|
|
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
316 |
|
|
// x | | x
|
317 |
|
|
// x Tree (T)| Cell(T) | x
|
318 |
|
|
// x ^^^^^^^^^^^^^^^^^^| Rules (2) x
|
319 |
|
|
// x 1 | x
|
320 |
|
|
// x | |---------------------------x
|
321 |
|
|
// x | | x
|
322 |
|
|
// x | | Properties (2) x
|
323 |
|
|
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
324 |
|
|
// x MLT x
|
325 |
|
|
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
326 |
|
|
// x x
|
327 |
|
|
// x Output (0) x
|
328 |
|
|
// x x
|
329 |
|
|
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
330 |
|
|
|
331 |
|
|
for(i=0;i<sizeof arSplit/sizeof arSplit[0];i++){
|
332 |
|
|
const CSize szDefault(50,50);
|
333 |
|
|
Split &s=arSplit[i];
|
334 |
|
|
CSplitterWndEx *pParent=NULL;
|
335 |
|
|
bool bSecond=false;
|
336 |
|
|
int nRowParent=0;
|
337 |
|
|
int nColParent=0;
|
338 |
|
|
// Search backwards for our parent. This is the first entry back of level one higher.
|
339 |
|
|
for(int j=i-1;j>=0;--j){
|
340 |
|
|
Split &sp=arSplit[j];
|
341 |
|
|
if(sp.nLevel==s.nLevel-1){
|
342 |
|
|
pParent=sp.pSplit;
|
343 |
|
|
nRowParent=(bSecond && Horz==sp.type);
|
344 |
|
|
nColParent=(bSecond && Horz!=sp.type);
|
345 |
|
|
break;
|
346 |
|
|
} else if(sp.nLevel==s.nLevel){
|
347 |
|
|
bSecond=true;
|
348 |
|
|
}
|
349 |
|
|
}
|
350 |
|
|
if(s.type>=0 /* a view */){
|
351 |
|
|
TRACE(_T("Create view index=%d [%s]\n"),i,arView[s.type].pszName);
|
352 |
|
|
VERIFY(pParent->CreateView (nRowParent, nColParent, arView[s.type].pClass, szDefault, pContext));
|
353 |
|
|
arView[s.type].pView=(CView *)pParent->GetPane(nRowParent,nColParent);
|
354 |
|
|
arView[s.type].pParent=pParent;
|
355 |
|
|
} else {
|
356 |
|
|
int nRows=1+(Horz==s.type);
|
357 |
|
|
int nCols=1+(Horz!=s.type);
|
358 |
|
|
UINT id;
|
359 |
|
|
CWnd *pwndParent;
|
360 |
|
|
if(NULL==pParent){
|
361 |
|
|
pwndParent=this;
|
362 |
|
|
id=AFX_IDW_PANE_FIRST;
|
363 |
|
|
} else {
|
364 |
|
|
id=pParent->IdFromRowCol(nRowParent,nColParent);
|
365 |
|
|
pwndParent=pParent;
|
366 |
|
|
}
|
367 |
|
|
if(Thin==s.type){
|
368 |
|
|
TRACE(_T("Create thin splitter index=%d\n"),i);
|
369 |
|
|
s.pSplit=new CThinSplitter;
|
370 |
|
|
VERIFY(s.pSplit->CreateStatic (pParent, 1, 2, WS_CHILD|WS_VISIBLE|WS_BORDER, id));
|
371 |
|
|
s.pSplit->SetScrollStyle(WS_VSCROLL);
|
372 |
|
|
} else {
|
373 |
|
|
TRACE(_T("Create splitter index=%d\n"),i);
|
374 |
|
|
s.pSplit=new CSplitterWndEx;
|
375 |
|
|
VERIFY(s.pSplit->CreateStatic (pwndParent, nRows, nCols, WS_CHILD|WS_VISIBLE|WS_BORDER, id));
|
376 |
|
|
}
|
377 |
|
|
}
|
378 |
|
|
};
|
379 |
|
|
|
380 |
|
|
for(i=0;i<PaneTypeMax;i++){
|
381 |
|
|
LOGFONT lf;
|
382 |
|
|
ViewStruct &v=arView[(PaneType)i];
|
383 |
|
|
GetApp()->LoadFont(v.pszName,lf);
|
384 |
|
|
if(!arView[(PaneType)i].font.CreateFontIndirect(&lf)){
|
385 |
|
|
CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT))->GetLogFont(&lf);
|
386 |
|
|
}
|
387 |
|
|
SetPaneFont((PaneType)i,lf);
|
388 |
|
|
//v.pParent->ShowPane(v.pView,v.bVisible);
|
389 |
|
|
}
|
390 |
|
|
|
391 |
|
|
for(i=0;i<sizeof arSplit/sizeof arSplit[0];i++){
|
392 |
|
|
Split &s=arSplit[i];
|
393 |
|
|
if(s.pSplit){
|
394 |
|
|
s.pSplit->RecalcLayout();
|
395 |
|
|
}
|
396 |
|
|
}
|
397 |
|
|
|
398 |
|
|
UNUSED_ALWAYS(lpcs); // avoid compiler warning
|
399 |
|
|
return rc;
|
400 |
|
|
}
|
401 |
|
|
|
402 |
|
|
void CMainFrame::OnViewProperties()
|
403 |
|
|
{
|
404 |
|
|
arView[Properties].bVisible^=1;
|
405 |
|
|
arView[Properties].pParent->ShowPane(arView[Properties].pView,arView[Properties].bVisible);
|
406 |
|
|
}
|
407 |
|
|
|
408 |
|
|
void CMainFrame::OnUpdateViewProperties(CCmdUI* pCmdUI)
|
409 |
|
|
{
|
410 |
|
|
pCmdUI->SetCheck(arView[Properties].bVisible);
|
411 |
|
|
}
|
412 |
|
|
|
413 |
|
|
void CMainFrame::OnViewMLT()
|
414 |
|
|
{
|
415 |
|
|
arView[MLT].bVisible^=1;
|
416 |
|
|
arView[MLT].pParent->ShowPane(arView[MLT].pView,arView[MLT].bVisible);
|
417 |
|
|
ShowControlBar(&m_wndMLTToolBar,arView[MLT].bVisible&m_bMLTToolbarVisible,false);
|
418 |
|
|
}
|
419 |
|
|
|
420 |
|
|
void CMainFrame::OnViewShortdesc()
|
421 |
|
|
{
|
422 |
|
|
arView[ShortDesc].bVisible^=1;
|
423 |
|
|
arView[ShortDesc].pParent->ShowPane(arView[ShortDesc].pView,arView[ShortDesc].bVisible);
|
424 |
|
|
}
|
425 |
|
|
|
426 |
|
|
void CMainFrame::OnUpdateViewShortdesc(CCmdUI* pCmdUI)
|
427 |
|
|
{
|
428 |
|
|
pCmdUI->SetCheck(arView[ShortDesc].bVisible);
|
429 |
|
|
}
|
430 |
|
|
|
431 |
|
|
void CMainFrame::OnViewOutput()
|
432 |
|
|
{
|
433 |
|
|
arView[Output].bVisible^=1;
|
434 |
|
|
arView[Output].pParent->ShowPane(arView[Output].pView,arView[Output].bVisible);
|
435 |
|
|
}
|
436 |
|
|
|
437 |
|
|
void CMainFrame::OnUpdateViewOutput(CCmdUI* pCmdUI)
|
438 |
|
|
{
|
439 |
|
|
pCmdUI->SetCheck(arView[Output].bVisible);
|
440 |
|
|
}
|
441 |
|
|
|
442 |
|
|
void CMainFrame::OnUpdateBuildConfigure(CCmdUI* pCmdUI)
|
443 |
|
|
{
|
444 |
|
|
pCmdUI->Enable(!m_sp.ProcessAlive());
|
445 |
|
|
}
|
446 |
|
|
|
447 |
|
|
void CMainFrame::OnBuildStop()
|
448 |
|
|
{
|
449 |
|
|
m_sp.Kill(); // leave the rest to OnSubprocessComplete()
|
450 |
|
|
}
|
451 |
|
|
|
452 |
|
|
void CMainFrame::OnUpdateBuildStop(CCmdUI* pCmdUI)
|
453 |
|
|
{
|
454 |
|
|
pCmdUI->Enable(m_sp.ProcessAlive());
|
455 |
|
|
}
|
456 |
|
|
|
457 |
|
|
void CMainFrame::OnConfigurationBuild()
|
458 |
|
|
{
|
459 |
|
|
Build();
|
460 |
|
|
}
|
461 |
|
|
|
462 |
|
|
DWORD CMainFrame::ThreadFunc(LPVOID param)
|
463 |
|
|
{
|
464 |
|
|
CMainFrame *pMain=(CMainFrame *)param;
|
465 |
|
|
CConfigToolDoc *pDoc=CConfigTool::GetConfigToolDoc();
|
466 |
|
|
CString strCmd(_T("make -n "));
|
467 |
|
|
strCmd+=pMain->m_strBuildTarget;
|
468 |
|
|
SetCurrentDirectory(pDoc->BuildTree());
|
469 |
|
|
String strOut;
|
470 |
|
|
CSubprocess sp;
|
471 |
|
|
sp.Run(strOut,strCmd);
|
472 |
|
|
// Don't attempt to change the thermometer itself - not safe from a separate thread
|
473 |
|
|
pMain->m_nThermometerMax=pDoc->GetCompilationCount(strOut);
|
474 |
|
|
|
475 |
|
|
return 0;
|
476 |
|
|
}
|
477 |
|
|
|
478 |
|
|
void CMainFrame::Build(const CString &strWhat/*=_T("")*/)
|
479 |
|
|
{
|
480 |
|
|
ASSERT(!m_sp.ProcessAlive());
|
481 |
|
|
CConfigToolDoc *pDoc=CConfigTool::GetConfigToolDoc();
|
482 |
|
|
|
483 |
|
|
if(!arView[Output].bVisible){
|
484 |
|
|
SendMessage(WM_COMMAND,ID_VIEW_OUTPUT,0);
|
485 |
|
|
}
|
486 |
|
|
|
487 |
|
|
if(pDoc->IsModified()||pDoc->BuildTree().IsEmpty()){
|
488 |
|
|
SendMessage (WM_COMMAND, ID_FILE_SAVE);
|
489 |
|
|
}
|
490 |
|
|
|
491 |
|
|
if(!(pDoc->IsModified()||pDoc->BuildTree().IsEmpty())){ // verify the save worked
|
492 |
|
|
CString strCmd (_T("make"));
|
493 |
|
|
if(!strWhat.IsEmpty()){
|
494 |
|
|
strCmd+=_TCHAR(' ');
|
495 |
|
|
strCmd+=strWhat;
|
496 |
|
|
}
|
497 |
|
|
if(!GetApp()->m_strMakeOptions.IsEmpty()){
|
498 |
|
|
strCmd+=_TCHAR(' ');
|
499 |
|
|
strCmd+=GetApp()->m_strMakeOptions;
|
500 |
|
|
}
|
501 |
|
|
|
502 |
|
|
strCmd += _T(" --directory ");
|
503 |
|
|
|
504 |
|
|
// Quoting the name may not mix with the 'sh' command on Unix, so only do it
|
505 |
|
|
// under Windows where it's more likely there will be spaces needing quoting.
|
506 |
|
|
#ifdef _WINDOWS
|
507 |
|
|
CString buildDir(pDoc->BuildTree());
|
508 |
|
|
|
509 |
|
|
#if 1 // ecUSE_ECOS_X_NOTATION
|
510 |
|
|
std::string cPath = cygpath(std::string(pDoc->BuildTree()));
|
511 |
|
|
buildDir = cPath.c_str();
|
512 |
|
|
#endif
|
513 |
|
|
strCmd += CString(_T("\"")) + buildDir + CString(_T("\""));
|
514 |
|
|
#else
|
515 |
|
|
strCmd += CString(pDoc->BuildTree()) ;
|
516 |
|
|
#endif
|
517 |
|
|
|
518 |
|
|
if(PrepareEnvironment()){
|
519 |
|
|
m_strBuildTarget=strWhat;
|
520 |
|
|
SetThermometerMax(250); // This is just a guess. The thread we are about to spawn will work out the correct answer
|
521 |
|
|
m_nLogicalLines=0;
|
522 |
|
|
UpdateThermometer(0);
|
523 |
|
|
CloseHandle(CreateThread(NULL, 0, ThreadFunc, this, 0 ,&m_dwThreadId));
|
524 |
|
|
CString strMsg;
|
525 |
|
|
strMsg.Format(_T("Building %s"),strWhat);
|
526 |
|
|
SetIdleMessage(strMsg);
|
527 |
|
|
|
528 |
|
|
SetTimer(42,1000,0); // This timer checks for process completion
|
529 |
|
|
SetCurrentDirectory(pDoc->BuildTree());
|
530 |
|
|
m_sp.Run(SubprocessOutputFunc, this, strCmd, false);
|
531 |
|
|
SetIdleMessage();
|
532 |
|
|
}
|
533 |
|
|
}
|
534 |
|
|
}
|
535 |
|
|
|
536 |
|
|
|
537 |
|
|
CConfigToolApp * CMainFrame::GetApp()
|
538 |
|
|
{
|
539 |
|
|
return (CConfigToolApp *)AfxGetApp();
|
540 |
|
|
}
|
541 |
|
|
|
542 |
|
|
void CMainFrame::ActivateFrame(int nCmdShow)
|
543 |
|
|
{
|
544 |
|
|
CConfigToolDoc *pDoc=CConfigTool::GetConfigToolDoc();
|
545 |
|
|
CRect rcDefault;
|
546 |
|
|
SystemParametersInfo(SPI_GETWORKAREA, 0, (PVOID)(RECT *)rcDefault, 0);
|
547 |
|
|
// Insist on nothing more than 1000 width, with the golden ratio
|
548 |
|
|
rcDefault.DeflateRect(max(0,(rcDefault.Width()-1000)/2),max(0,(rcDefault.Height()-618)/2));
|
549 |
|
|
|
550 |
|
|
GetApp()->RestoreWindowPlacement (this, _T("Window size"),rcDefault);
|
551 |
|
|
LoadBarState(_T("DockState"));
|
552 |
|
|
|
553 |
|
|
ShowControlBar(&m_wndMLTToolBar,arView[MLT].bVisible,false);
|
554 |
|
|
CFrameWnd::ActivateFrame(nCmdShow); // must be before we muck about with the splitters
|
555 |
|
|
|
556 |
|
|
CRect rcClient;
|
557 |
|
|
GetClientRect(rcClient);
|
558 |
|
|
for(int j=0;j<sizeof arSplit/sizeof arSplit[0];j++){
|
559 |
|
|
Split &s=arSplit[j];
|
560 |
|
|
if(s.pSplit){
|
561 |
|
|
CString strKey;
|
562 |
|
|
strKey.Format(_T("Split %d"),j);
|
563 |
|
|
const CString strSplit(GetApp()->GetProfileString(_T("Split"),strKey));
|
564 |
|
|
double fSplit=s.fFrac;
|
565 |
|
|
_tscanf(_T("%f"),&fSplit);
|
566 |
|
|
s.pSplit->SetSplitPoint(fSplit);
|
567 |
|
|
s.pSplit->RecalcLayout();
|
568 |
|
|
}
|
569 |
|
|
}
|
570 |
|
|
|
571 |
|
|
for(int i=0;i<PaneTypeMax;i++){
|
572 |
|
|
ViewStruct &v=arView[(PaneType)i];
|
573 |
|
|
v.pParent->ShowPane(v.pView,v.bVisible);
|
574 |
|
|
}
|
575 |
|
|
|
576 |
|
|
RecalcLayout();
|
577 |
|
|
pDoc->UpdateFailingRuleCount();
|
578 |
|
|
|
579 |
|
|
}
|
580 |
|
|
|
581 |
|
|
void CMainFrame::OnDestroy()
|
582 |
|
|
{
|
583 |
|
|
|
584 |
|
|
GetApp()->SaveWindowPlacement (this, _T("Window size"));
|
585 |
|
|
|
586 |
|
|
for(int i=0;i<PaneTypeMax;i++){
|
587 |
|
|
LOGFONT lf;
|
588 |
|
|
ViewStruct &v=arView[(PaneType)i];
|
589 |
|
|
v.font.GetLogFont(&lf);
|
590 |
|
|
GetApp()->SaveFont(v.pszName,lf);
|
591 |
|
|
}
|
592 |
|
|
for(int j=0;j<sizeof arSplit/sizeof arSplit[0];j++){
|
593 |
|
|
Split &s=arSplit[j];
|
594 |
|
|
if(s.pSplit){
|
595 |
|
|
CString strSplit;
|
596 |
|
|
strSplit.Format(_T("%f"),s.pSplit->GetSplitPoint());
|
597 |
|
|
CString strKey;
|
598 |
|
|
strKey.Format(_T("%d"),j);
|
599 |
|
|
GetApp()->WriteProfileString(_T("Split"),strKey,strSplit);
|
600 |
|
|
}
|
601 |
|
|
}
|
602 |
|
|
for(j=0;j<sizeof arSplit/sizeof arSplit[0];j++){
|
603 |
|
|
Split &s=arSplit[j];
|
604 |
|
|
if(s.pSplit){
|
605 |
|
|
deleteZ(s.pSplit);
|
606 |
|
|
}
|
607 |
|
|
}
|
608 |
|
|
|
609 |
|
|
if(m_sp.ProcessAlive()){
|
610 |
|
|
m_sp.Kill();
|
611 |
|
|
}
|
612 |
|
|
|
613 |
|
|
for(i=0;i<sizeof arView/sizeof arView[0];i++){
|
614 |
|
|
GetApp()->WriteProfileInt(_T("Windows"), arView[i].pszName, arView[i].bVisible);
|
615 |
|
|
}
|
616 |
|
|
|
617 |
|
|
CFrameWnd::OnDestroy();
|
618 |
|
|
}
|
619 |
|
|
|
620 |
|
|
void CMainFrame::OnBuildTests()
|
621 |
|
|
{
|
622 |
|
|
Build("tests");
|
623 |
|
|
}
|
624 |
|
|
|
625 |
|
|
void CMainFrame::OnUpdateBuildTests(CCmdUI* pCmdUI)
|
626 |
|
|
{
|
627 |
|
|
pCmdUI->Enable(!m_sp.ProcessAlive());
|
628 |
|
|
}
|
629 |
|
|
|
630 |
|
|
void CMainFrame::OnUpdateFileSave(CCmdUI* pCmdUI)
|
631 |
|
|
{
|
632 |
|
|
pCmdUI->Enable(!m_sp.ProcessAlive());
|
633 |
|
|
}
|
634 |
|
|
|
635 |
|
|
void CMainFrame::OnUpdateFileSaveAs(CCmdUI* pCmdUI)
|
636 |
|
|
{
|
637 |
|
|
pCmdUI->Enable(!m_sp.ProcessAlive());
|
638 |
|
|
}
|
639 |
|
|
|
640 |
|
|
void CMainFrame::OnUpdateFileOpen(CCmdUI* pCmdUI)
|
641 |
|
|
{
|
642 |
|
|
pCmdUI->Enable(!m_sp.ProcessAlive());
|
643 |
|
|
}
|
644 |
|
|
|
645 |
|
|
void CMainFrame::OnUpdateFileNew(CCmdUI* pCmdUI)
|
646 |
|
|
{
|
647 |
|
|
pCmdUI->Enable(!m_sp.ProcessAlive());
|
648 |
|
|
}
|
649 |
|
|
|
650 |
|
|
void CMainFrame::OnUpdateAppExit(CCmdUI* pCmdUI)
|
651 |
|
|
{
|
652 |
|
|
pCmdUI->Enable(!m_sp.ProcessAlive());
|
653 |
|
|
}
|
654 |
|
|
|
655 |
|
|
void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
|
656 |
|
|
{
|
657 |
|
|
CFrameWnd::OnSysCommand(nID, lParam);
|
658 |
|
|
}
|
659 |
|
|
|
660 |
|
|
|
661 |
|
|
void CMainFrame::OnUpdateConfigurationRefresh(CCmdUI* pCmdUI)
|
662 |
|
|
{
|
663 |
|
|
CConfigToolDoc *pDoc=CConfigTool::GetConfigToolDoc();
|
664 |
|
|
pCmdUI->Enable(!m_sp.ProcessAlive() && !pDoc->BuildTree().IsEmpty());
|
665 |
|
|
}
|
666 |
|
|
|
667 |
|
|
void CMainFrame::OnConfigurationRefresh()
|
668 |
|
|
{
|
669 |
|
|
CConfigToolDoc *pDoc=CConfigTool::GetConfigToolDoc();
|
670 |
|
|
pDoc->Reload();
|
671 |
|
|
}
|
672 |
|
|
|
673 |
|
|
void CMainFrame::OnViewSettings()
|
674 |
|
|
{
|
675 |
|
|
CViewOptions dlg;
|
676 |
|
|
dlg.DoModal();
|
677 |
|
|
}
|
678 |
|
|
|
679 |
|
|
void CMainFrame::OnHelp() // Help->Configuration Tool Help
|
680 |
|
|
{
|
681 |
|
|
CConfigTool::GetConfigToolDoc()->ShowURL(CUtils::LoadString(IDS_CONFIGTOOL_HELP));
|
682 |
|
|
}
|
683 |
|
|
|
684 |
|
|
void CMainFrame::OnSize(UINT nType, int cx, int cy)
|
685 |
|
|
{
|
686 |
|
|
CFrameWnd::OnSize(nType, cx, cy);
|
687 |
|
|
if(m_wndStatusBar){
|
688 |
|
|
cx=max(0,cx-m_nFailRulePaneSize-m_nThermometerPaneSize-m_nPercentagePaneSize);
|
689 |
|
|
m_wndStatusBar.SetPaneInfo(StatusPane, 0, SBPS_STRETCH , 0);
|
690 |
|
|
m_wndStatusBar.SetPaneInfo(ThermometerPane, 0, SBPS_NORMAL, m_nThermometerPaneSize);
|
691 |
|
|
m_wndStatusBar.SetPaneInfo(PercentagePane, 0, SBPS_NORMAL, m_nPercentagePaneSize);
|
692 |
|
|
m_wndStatusBar.SetPaneInfo(FailRulePane, 0, SBPS_NORMAL, m_nFailRulePaneSize);
|
693 |
|
|
CRect rc;
|
694 |
|
|
m_wndStatusBar.GetItemRect(ThermometerPane, rc);
|
695 |
|
|
// Reposition the progress control correctly!
|
696 |
|
|
m_Progress.SetWindowPos(&wndTop, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, 0);
|
697 |
|
|
}
|
698 |
|
|
}
|
699 |
|
|
|
700 |
|
|
void CMainFrame::OnUpdateConfigurationRepository(CCmdUI* pCmdUI)
|
701 |
|
|
{
|
702 |
|
|
pCmdUI->Enable(!m_sp.ProcessAlive());
|
703 |
|
|
}
|
704 |
|
|
|
705 |
|
|
void CMainFrame::OnWindowNext()
|
706 |
|
|
{
|
707 |
|
|
BumpWindow(+1);
|
708 |
|
|
}
|
709 |
|
|
|
710 |
|
|
void CMainFrame::OnWindowPrev()
|
711 |
|
|
{
|
712 |
|
|
BumpWindow(-1);
|
713 |
|
|
}
|
714 |
|
|
|
715 |
|
|
void CMainFrame::BumpWindow(int nInc)
|
716 |
|
|
{
|
717 |
|
|
CWnd *pWnd=CWnd::GetFocus();
|
718 |
|
|
if(pWnd){
|
719 |
|
|
int nWindows=sizeof arView/sizeof arView[0];
|
720 |
|
|
for(int i=0;i<nWindows;i++){
|
721 |
|
|
CWnd *pThisWnd=arView[i].pView;
|
722 |
|
|
if(pWnd->m_hWnd==pThisWnd->m_hWnd){
|
723 |
|
|
for(int j=((i+nInc+nWindows)%nWindows);j!=i;j=((j+nInc+nWindows)%nWindows)){
|
724 |
|
|
if(arView[j].bVisible){
|
725 |
|
|
arView[j].pView->SetFocus();
|
726 |
|
|
return;
|
727 |
|
|
}
|
728 |
|
|
}
|
729 |
|
|
}
|
730 |
|
|
}
|
731 |
|
|
}
|
732 |
|
|
}
|
733 |
|
|
|
734 |
|
|
void CMainFrame::OnHelpSubmitPr()
|
735 |
|
|
{
|
736 |
|
|
CString strURL;
|
737 |
|
|
if(strURL.LoadString(IDS_ECOS_PR_URL)){
|
738 |
|
|
CConfigTool::GetConfigToolDoc()->ShowURL(strURL);
|
739 |
|
|
}
|
740 |
|
|
}
|
741 |
|
|
|
742 |
|
|
void CMainFrame::OnHelpEcos()
|
743 |
|
|
{
|
744 |
|
|
CString strURL;
|
745 |
|
|
if(strURL.LoadString(IDS_ECOS_SOURCEWARE_URL)){
|
746 |
|
|
CConfigTool::GetConfigToolDoc()->ShowURL(strURL);
|
747 |
|
|
}
|
748 |
|
|
}
|
749 |
|
|
|
750 |
|
|
void CMainFrame::OnHelpEcoshome()
|
751 |
|
|
{
|
752 |
|
|
CString strURL;
|
753 |
|
|
if(strURL.LoadString(IDS_ECOS_HOME_URL)){
|
754 |
|
|
CConfigTool::GetConfigToolDoc()->ShowURL(strURL);
|
755 |
|
|
}
|
756 |
|
|
}
|
757 |
|
|
|
758 |
|
|
void CMainFrame::OnHelpRedHatHome()
|
759 |
|
|
{
|
760 |
|
|
CString strURL;
|
761 |
|
|
if(strURL.LoadString(IDS_RED_HAT_HOME_URL)){
|
762 |
|
|
CConfigTool::GetConfigToolDoc()->ShowURL(strURL);
|
763 |
|
|
}
|
764 |
|
|
}
|
765 |
|
|
|
766 |
|
|
void CMainFrame::OnHelpUitron()
|
767 |
|
|
{
|
768 |
|
|
CString strURL;
|
769 |
|
|
if(strURL.LoadString(IDS_UITRON_HOME_URL)){
|
770 |
|
|
CConfigTool::GetConfigToolDoc()->ShowURL(strURL);
|
771 |
|
|
}
|
772 |
|
|
}
|
773 |
|
|
|
774 |
|
|
void CMainFrame::OnBuildClean()
|
775 |
|
|
{
|
776 |
|
|
Build("clean");
|
777 |
|
|
}
|
778 |
|
|
|
779 |
|
|
void CMainFrame::OnUpdateBuildClean(CCmdUI* pCmdUI)
|
780 |
|
|
{
|
781 |
|
|
pCmdUI->Enable(!m_sp.ProcessAlive());
|
782 |
|
|
}
|
783 |
|
|
|
784 |
|
|
void CMainFrame::OnToolsShell()
|
785 |
|
|
{
|
786 |
|
|
if(PrepareEnvironment()){
|
787 |
|
|
|
788 |
|
|
CConfigToolDoc *pDoc=CConfigTool::GetConfigToolDoc();
|
789 |
|
|
const CFileName strOldFolder(CFileName::SetCurrentDirectory(pDoc->BuildTree()));
|
790 |
|
|
CUtils::Launch(_T(""),CUtils::LoadString(IDS_SHELL_NAME));
|
791 |
|
|
if(!strOldFolder.IsEmpty()){ // if the current directory was changed
|
792 |
|
|
SetCurrentDirectory(strOldFolder); // restore the previous current directory
|
793 |
|
|
}
|
794 |
|
|
}
|
795 |
|
|
}
|
796 |
|
|
|
797 |
|
|
bool CMainFrame::PrepareEnvironment(bool bWithBuildTools /* = true */)
|
798 |
|
|
{
|
799 |
|
|
|
800 |
|
|
CConfigToolDoc *pDoc=CConfigTool::GetConfigToolDoc();
|
801 |
|
|
CConfigToolApp *pApp=(CConfigToolApp *)GetApp();
|
802 |
|
|
::SetEnvironmentVariable(_T("PATH"),pApp->m_strOriginalPath);
|
803 |
|
|
|
804 |
|
|
const CString strPrefix(pDoc->CurrentTargetPrefix());
|
805 |
|
|
CFileName strBinDir;
|
806 |
|
|
|
807 |
|
|
bool rc=(! bWithBuildTools) || pApp->m_arstrBinDirs.Lookup(strPrefix,strBinDir);
|
808 |
|
|
if(!rc){
|
809 |
|
|
SendMessage(WM_COMMAND,ID_TOOLS_PATHS,0);
|
810 |
|
|
rc=pApp->m_arstrBinDirs.Lookup(strPrefix,strBinDir);
|
811 |
|
|
}
|
812 |
|
|
|
813 |
|
|
if(rc){
|
814 |
|
|
|
815 |
|
|
CFileName strUserBinDir(pApp->m_strUserToolsDir);
|
816 |
|
|
if(strUserBinDir.IsEmpty()){
|
817 |
|
|
if(1==pDoc->m_arstrUserToolPaths.GetSize()){
|
818 |
|
|
pApp->m_strUserToolsDir=pDoc->m_arstrUserToolPaths[0];
|
819 |
|
|
} else {
|
820 |
|
|
SendMessage(WM_COMMAND,ID_USERTOOLS_PATHS,0);
|
821 |
|
|
}
|
822 |
|
|
strUserBinDir=pApp->m_strUserToolsDir;
|
823 |
|
|
}
|
824 |
|
|
if(!strUserBinDir.IsEmpty()){
|
825 |
|
|
|
826 |
|
|
// calculate the directory of the host tools from this application's module name
|
827 |
|
|
CFileName strHostToolsBinDir;
|
828 |
|
|
::GetModuleFileName (::GetModuleHandle (NULL), strHostToolsBinDir.GetBuffer (1 + MAX_PATH), MAX_PATH);
|
829 |
|
|
strHostToolsBinDir.ReleaseBuffer ();
|
830 |
|
|
strHostToolsBinDir = strHostToolsBinDir.Head ();
|
831 |
|
|
#ifdef _DEBUG
|
832 |
|
|
strHostToolsBinDir = _T("C:\\Progra~1\\Redhat~1\\eCos");
|
833 |
|
|
#endif
|
834 |
|
|
|
835 |
|
|
// tools directories are in the order host-tools, user-tools, comp-tools, install/bin (if present), contrib-tools (if present) on the path
|
836 |
|
|
const CFileName strContribBinDir(strUserBinDir,_T("..\\contrib\\bin"));
|
837 |
|
|
CFileName strUsrBinDir(strUserBinDir,_T("..\\usr\\bin"));
|
838 |
|
|
const CFileName strInstallBinDir(pDoc->InstallTree (),_T("bin"));
|
839 |
|
|
|
840 |
|
|
// In case strUserBinDir is e.g. c:\program files\red hat\cygwin-00r1\usertools\h-i686-pc-cygwin\bin
|
841 |
|
|
if (!strUsrBinDir.IsDir ())
|
842 |
|
|
strUsrBinDir = CFileName(strUserBinDir + _T("..\\..\\..\\H-i686-pc-cygwin\\bin"));
|
843 |
|
|
|
844 |
|
|
if (
|
845 |
|
|
(strUsrBinDir.IsDir () && ! CUtils::AddToPath (strUsrBinDir)) ||
|
846 |
|
|
(strContribBinDir.IsDir () && ! CUtils::AddToPath (strContribBinDir)) ||
|
847 |
|
|
(strInstallBinDir.IsDir () && ! CUtils::AddToPath (strInstallBinDir)) ||
|
848 |
|
|
(bWithBuildTools && ! CUtils::AddToPath (strBinDir)) ||
|
849 |
|
|
! CUtils::AddToPath (strUserBinDir) ||
|
850 |
|
|
! CUtils::AddToPath (strHostToolsBinDir)) {
|
851 |
|
|
CUtils::MessageBoxF(_T("Failed to set PATH environment variable - rc=%d"),GetLastError());
|
852 |
|
|
rc=false;
|
853 |
|
|
} else {
|
854 |
|
|
if(!SetEnvironmentVariable(_T("MAKE_MODE"),_T("unix"))){
|
855 |
|
|
CUtils::MessageBoxF(_T("Failed to set MAKE_MODE environment variable - rc=%d"),GetLastError());
|
856 |
|
|
rc=false;
|
857 |
|
|
} else {
|
858 |
|
|
SetEnvironmentVariable(_T("GDBTK_LIBRARY"),NULL);
|
859 |
|
|
SetEnvironmentVariable(_T("GCC_EXEC_PREFIX"),NULL);
|
860 |
|
|
SetEnvironmentVariable(_T("ECOS_REPOSITORY"),pDoc->PackagesDir()); // useful for ecosconfig
|
861 |
|
|
|
862 |
|
|
if (! pDoc->BuildTree().IsEmpty())
|
863 |
|
|
CygMount(pDoc->BuildTree()[0]);
|
864 |
|
|
if (! pDoc->InstallTree().IsEmpty())
|
865 |
|
|
CygMount(pDoc->InstallTree()[0]);
|
866 |
|
|
if (! pDoc->Repository().IsEmpty())
|
867 |
|
|
CygMount(pDoc->Repository()[0]);
|
868 |
|
|
|
869 |
|
|
#ifdef _DEBUG
|
870 |
|
|
TCHAR buf[512];
|
871 |
|
|
::GetEnvironmentVariable(_T("PATH"), buf, 512);
|
872 |
|
|
CConfigTool::Log(buf);
|
873 |
|
|
#endif
|
874 |
|
|
|
875 |
|
|
}
|
876 |
|
|
}
|
877 |
|
|
}
|
878 |
|
|
}
|
879 |
|
|
return rc;
|
880 |
|
|
}
|
881 |
|
|
|
882 |
|
|
|
883 |
|
|
void CMainFrame::OnClose()
|
884 |
|
|
{
|
885 |
|
|
if(m_sp.ProcessAlive()){
|
886 |
|
|
if(IDNO==CUtils::MessageBoxFT(MB_YESNO|MB_DEFBUTTON2,_T("A build is in progress: exit anyway?"))){
|
887 |
|
|
return;
|
888 |
|
|
}
|
889 |
|
|
m_sp.Kill();
|
890 |
|
|
}
|
891 |
|
|
SaveBarState(_T("DockState"));
|
892 |
|
|
CFrameWnd::OnClose();
|
893 |
|
|
}
|
894 |
|
|
|
895 |
|
|
void CMainFrame::OnBuildOptions()
|
896 |
|
|
{
|
897 |
|
|
CBuildOptionsDialog dlg;
|
898 |
|
|
dlg.DoModal();
|
899 |
|
|
}
|
900 |
|
|
|
901 |
|
|
void CMainFrame::OnUpdateBuildOptions(CCmdUI* pCmdUI)
|
902 |
|
|
{
|
903 |
|
|
pCmdUI->Enable(TRUE);
|
904 |
|
|
}
|
905 |
|
|
|
906 |
|
|
void CMainFrame::OnToolsOptions()
|
907 |
|
|
{
|
908 |
|
|
CToolsOptionsDialog dlg;
|
909 |
|
|
dlg.DoModal();
|
910 |
|
|
}
|
911 |
|
|
|
912 |
|
|
void CMainFrame::OnUpdateViewMLT(CCmdUI* pCmdUI)
|
913 |
|
|
{
|
914 |
|
|
pCmdUI->SetCheck(arView[MLT].bVisible);
|
915 |
|
|
}
|
916 |
|
|
|
917 |
|
|
void CMainFrame::OnViewConflicts()
|
918 |
|
|
{
|
919 |
|
|
arView[Rules].bVisible^=1;
|
920 |
|
|
arView[Rules].pParent->ShowPane(arView[Rules].pView,arView[Rules].bVisible);
|
921 |
|
|
}
|
922 |
|
|
|
923 |
|
|
void CMainFrame::OnUpdateViewConflicts(CCmdUI* pCmdUI)
|
924 |
|
|
{
|
925 |
|
|
pCmdUI->SetCheck(arView[Rules].bVisible);
|
926 |
|
|
}
|
927 |
|
|
|
928 |
|
|
void CMainFrame::OnToolsPaths()
|
929 |
|
|
{
|
930 |
|
|
CConfigToolDoc *pDoc=CConfigTool::GetConfigToolDoc();
|
931 |
|
|
CConfigToolApp *pApp=(CConfigToolApp *)GetApp();
|
932 |
|
|
|
933 |
|
|
CString strDefault;
|
934 |
|
|
const CString strPrefix(pDoc->CurrentTargetPrefix());
|
935 |
|
|
|
936 |
|
|
CStringArray arstrPaths;
|
937 |
|
|
for(POSITION pos = pApp->m_arstrBinDirs.GetStartPosition(); pos != NULL; ){
|
938 |
|
|
CString strP,strB;
|
939 |
|
|
pApp->m_arstrBinDirs.GetNextAssoc(pos, strP, strB);
|
940 |
|
|
|
941 |
|
|
arstrPaths.Add(strB);
|
942 |
|
|
if(strP==strPrefix){
|
943 |
|
|
strDefault=strB;
|
944 |
|
|
}
|
945 |
|
|
}
|
946 |
|
|
|
947 |
|
|
CBinDirDialog dlg(arstrPaths,strDefault);
|
948 |
|
|
|
949 |
|
|
dlg.m_strDesc.Format(CUtils::LoadString(IDS_COMPTOOLS_DLG_DESC),strPrefix.IsEmpty()?_T("native"):strPrefix,strPrefix.IsEmpty()?_T(""):strPrefix+_T("-"));
|
950 |
|
|
dlg.m_strTitle=_T("Build Tools");
|
951 |
|
|
|
952 |
|
|
if(IDOK==dlg.DoModal()){
|
953 |
|
|
CFileName strExe;
|
954 |
|
|
strExe.Format(_T("%s\\%s%sgcc.exe"),dlg.m_strFolder,strPrefix,strPrefix.IsEmpty()?_T(""):_T("-"));
|
955 |
|
|
if(strExe.Exists()||
|
956 |
|
|
IDYES==CUtils::MessageBoxFT(MB_YESNO,_T("%s does not appear to contain the build tools - use this folder anyway?"),dlg.m_strFolder)){
|
957 |
|
|
pApp->m_arstrBinDirs.SetAt(strPrefix,dlg.m_strFolder);
|
958 |
|
|
}
|
959 |
|
|
}
|
960 |
|
|
}
|
961 |
|
|
|
962 |
|
|
void CMainFrame::OnUsertoolsPaths()
|
963 |
|
|
{
|
964 |
|
|
CConfigToolDoc *pDoc=CConfigTool::GetConfigToolDoc();
|
965 |
|
|
CConfigToolApp * pApp = (CConfigToolApp *) GetApp ();
|
966 |
|
|
|
967 |
|
|
CStringArray arstrPaths;
|
968 |
|
|
arstrPaths.Copy(pDoc->m_arstrUserToolPaths);
|
969 |
|
|
if(!pApp->m_strUserToolsDir.IsEmpty()){
|
970 |
|
|
arstrPaths.Add(pApp->m_strUserToolsDir);
|
971 |
|
|
}
|
972 |
|
|
CBinDirDialog dlg(arstrPaths, pApp->m_strUserToolsDir);
|
973 |
|
|
|
974 |
|
|
dlg.m_strDesc.LoadString(IDS_USERTOOLS_DLG_DESC);
|
975 |
|
|
dlg.m_strTitle=_T("User Tools");
|
976 |
|
|
|
977 |
|
|
if(IDOK==dlg.DoModal()){
|
978 |
|
|
CFileName strFile(dlg.m_strFolder);
|
979 |
|
|
strFile+=_T("ls.exe");
|
980 |
|
|
if(strFile.Exists()||
|
981 |
|
|
IDYES==CUtils::MessageBoxFT(MB_YESNO,_T("%s does not appear to contain the user tools - use this folder anyway?"),dlg.m_strFolder)){
|
982 |
|
|
pApp->m_strUserToolsDir=dlg.m_strFolder;
|
983 |
|
|
}
|
984 |
|
|
}
|
985 |
|
|
}
|
986 |
|
|
|
987 |
|
|
void CMainFrame::UpdateThermometer(int nLines)
|
988 |
|
|
{
|
989 |
|
|
if(nLines>=0 && 0!=m_nThermometerMax){
|
990 |
|
|
int nPercentage=min(100,(100*nLines)/m_nThermometerMax);
|
991 |
|
|
m_Progress.SetPos(nPercentage);
|
992 |
|
|
CString str;
|
993 |
|
|
if(nLines>0){
|
994 |
|
|
str.Format(_T("%d%%"),nPercentage);
|
995 |
|
|
}
|
996 |
|
|
m_wndStatusBar.SetPaneText(PercentagePane,str);
|
997 |
|
|
}
|
998 |
|
|
}
|
999 |
|
|
|
1000 |
|
|
void CMainFrame::SetThermometerMax (int nMax)
|
1001 |
|
|
{
|
1002 |
|
|
if(0==nMax){
|
1003 |
|
|
UpdateThermometer(0);
|
1004 |
|
|
}
|
1005 |
|
|
m_nThermometerMax=nMax;
|
1006 |
|
|
}
|
1007 |
|
|
|
1008 |
|
|
LRESULT CMainFrame::OnSetMessageString(WPARAM wParam, LPARAM lParam)
|
1009 |
|
|
{
|
1010 |
|
|
if (AFX_IDS_IDLEMESSAGE==wParam){
|
1011 |
|
|
wParam=0;
|
1012 |
|
|
lParam=(LPARAM)(LPCTSTR )m_strIdleMessage;
|
1013 |
|
|
}
|
1014 |
|
|
return CFrameWnd::OnSetMessageString(wParam, lParam);
|
1015 |
|
|
}
|
1016 |
|
|
|
1017 |
|
|
void CMainFrame::SetIdleMessage (LPCTSTR pszIdleMessage)
|
1018 |
|
|
{
|
1019 |
|
|
if(NULL==pszIdleMessage){
|
1020 |
|
|
m_strIdleMessage.LoadString(AFX_IDS_IDLEMESSAGE);
|
1021 |
|
|
} else {
|
1022 |
|
|
m_strIdleMessage=pszIdleMessage;
|
1023 |
|
|
}
|
1024 |
|
|
SendMessage(WM_SETMESSAGESTRING, AFX_IDS_IDLEMESSAGE, 0);
|
1025 |
|
|
}
|
1026 |
|
|
|
1027 |
|
|
void CMainFrame::OnRunSim()
|
1028 |
|
|
{
|
1029 |
|
|
CConfigTool::GetConfigToolDoc()->RunTests();
|
1030 |
|
|
}
|
1031 |
|
|
|
1032 |
|
|
bool CMainFrame::SetPaneFont(PaneType pane,const LOGFONT &lf)
|
1033 |
|
|
{
|
1034 |
|
|
CFont &font=arView[pane].font;
|
1035 |
|
|
font.Detach();
|
1036 |
|
|
font.CreateFontIndirect(&lf);
|
1037 |
|
|
switch(pane){
|
1038 |
|
|
case Output:
|
1039 |
|
|
CConfigTool::GetOutputView()->SendMessage(WM_SETFONT, (WPARAM)(HFONT)font, 0);
|
1040 |
|
|
break;
|
1041 |
|
|
case ShortDesc:
|
1042 |
|
|
CConfigTool::GetDescView()->SendMessage(WM_SETFONT, (WPARAM)(HFONT)font, 0);
|
1043 |
|
|
CConfigTool::GetDescView()->Invalidate();
|
1044 |
|
|
break;
|
1045 |
|
|
case Control:
|
1046 |
|
|
case Cell:
|
1047 |
|
|
CConfigTool::GetControlView()->SendMessage(WM_SETFONT, (WPARAM)(HFONT)font, 0);
|
1048 |
|
|
CConfigTool::GetCellView()->SendMessage(WM_SETFONT, (WPARAM)(HFONT)font, 0);
|
1049 |
|
|
CConfigTool::GetControlView()->Invalidate();
|
1050 |
|
|
CConfigTool::GetCellView()->Invalidate();
|
1051 |
|
|
break;
|
1052 |
|
|
case Properties:
|
1053 |
|
|
CConfigTool::GetPropertiesView()->SendMessage(WM_SETFONT, (WPARAM)(HFONT)font, 0);
|
1054 |
|
|
CConfigTool::GetPropertiesView()->Invalidate();
|
1055 |
|
|
break;
|
1056 |
|
|
case Rules:
|
1057 |
|
|
CConfigTool::GetRulesView()->SendMessage(WM_SETFONT, (WPARAM)(HFONT)font, 0);
|
1058 |
|
|
CConfigTool::GetRulesView()->Invalidate();
|
1059 |
|
|
break;
|
1060 |
|
|
case MLT:
|
1061 |
|
|
CConfigTool::GetRulesView()->SendMessage(WM_SETFONT, (WPARAM)(HFONT)font, 0);
|
1062 |
|
|
CConfigTool::GetRulesView()->Invalidate();
|
1063 |
|
|
break;
|
1064 |
|
|
default:
|
1065 |
|
|
ASSERT(FALSE);
|
1066 |
|
|
break;
|
1067 |
|
|
}
|
1068 |
|
|
return true;
|
1069 |
|
|
}
|
1070 |
|
|
|
1071 |
|
|
CFont &CMainFrame::GetPaneFont(PaneType pane)
|
1072 |
|
|
{
|
1073 |
|
|
return arView[pane].font;
|
1074 |
|
|
}
|
1075 |
|
|
|
1076 |
|
|
void CMainFrame::OnUpdateRunSim(CCmdUI* pCmdUI)
|
1077 |
|
|
{
|
1078 |
|
|
pCmdUI->Enable(!CConfigTool::GetConfigToolDoc()->InstallTree().IsEmpty() && !m_sp.ProcessAlive());
|
1079 |
|
|
}
|
1080 |
|
|
|
1081 |
|
|
void CMainFrame::SetFailRulePane(int nCount)
|
1082 |
|
|
{
|
1083 |
|
|
CString strCount;
|
1084 |
|
|
switch (nCount)
|
1085 |
|
|
{
|
1086 |
|
|
case 0:
|
1087 |
|
|
strCount = _T("No conflicts");
|
1088 |
|
|
break;
|
1089 |
|
|
case 1:
|
1090 |
|
|
strCount = _T("1 conflict");
|
1091 |
|
|
break;
|
1092 |
|
|
default:
|
1093 |
|
|
strCount.Format (_T("%d conflicts"), nCount);
|
1094 |
|
|
break;
|
1095 |
|
|
}
|
1096 |
|
|
if(m_bStatusBarCreated){
|
1097 |
|
|
m_wndStatusBar.SetPaneText (FailRulePane, strCount);
|
1098 |
|
|
}
|
1099 |
|
|
}
|
1100 |
|
|
|
1101 |
|
|
void CMainFrame::OnUpdateFrameTitle (BOOL bAddToTitle)
|
1102 |
|
|
{
|
1103 |
|
|
if ((GetStyle() & FWS_ADDTOTITLE) == 0)
|
1104 |
|
|
return; // leave it alone!
|
1105 |
|
|
/*
|
1106 |
|
|
#ifndef _AFX_NO_OLE_SUPPORT
|
1107 |
|
|
// allow hook to set the title (used for OLE support)
|
1108 |
|
|
if (m_pNotifyHook != NULL && m_pNotifyHook->OnUpdateFrameTitle())
|
1109 |
|
|
return;
|
1110 |
|
|
#endif
|
1111 |
|
|
*/
|
1112 |
|
|
CDocument* pDoc=CConfigTool::GetConfigToolDoc();
|
1113 |
|
|
if (bAddToTitle && pDoc != NULL)
|
1114 |
|
|
UpdateFrameTitleForDocument(pDoc->GetTitle() + (pDoc->IsModified () ? "*" : ""));
|
1115 |
|
|
else
|
1116 |
|
|
UpdateFrameTitleForDocument(NULL);
|
1117 |
|
|
}
|
1118 |
|
|
|
1119 |
|
|
void CMainFrame::OnViewMltbar()
|
1120 |
|
|
{
|
1121 |
|
|
m_bMLTToolbarVisible^=1;
|
1122 |
|
|
ShowControlBar(&m_wndMLTToolBar,m_bMLTToolbarVisible,false);
|
1123 |
|
|
}
|
1124 |
|
|
|
1125 |
|
|
void CMainFrame::OnUpdateViewMltbar(CCmdUI* pCmdUI)
|
1126 |
|
|
{
|
1127 |
|
|
pCmdUI->Enable(arView[MLT].bVisible);
|
1128 |
|
|
pCmdUI->SetCheck(m_bMLTToolbarVisible);
|
1129 |
|
|
}
|
1130 |
|
|
|
1131 |
|
|
void CMainFrame::OnResolveConflicts()
|
1132 |
|
|
{
|
1133 |
|
|
if(CConfigToolDoc::NotDone==CConfigTool::GetConfigToolDoc()->ResolveGlobalConflicts()){
|
1134 |
|
|
// Global inference handler was never invoked. Say something
|
1135 |
|
|
CUtils::MessageBoxF(_T("No solutions can be automatically determined for the current set of conflicts."));
|
1136 |
|
|
}
|
1137 |
|
|
}
|
1138 |
|
|
|
1139 |
|
|
void CMainFrame::OnUpdateResolveConflicts(CCmdUI* pCmdUI)
|
1140 |
|
|
{
|
1141 |
|
|
pCmdUI->Enable(CConfigTool::GetConfigToolDoc()->GetCdlInterpreter()->get_toplevel()->get_all_conflicts().size()>0);
|
1142 |
|
|
}
|
1143 |
|
|
|
1144 |
|
|
void CMainFrame::OnGoHome() // Help->eCos Documentation
|
1145 |
|
|
{
|
1146 |
|
|
CConfigTool::GetConfigToolDoc()->ShowURL(CUtils::LoadString(IDS_ECOS_HELP));
|
1147 |
|
|
}
|
1148 |
|
|
|
1149 |
|
|
HMENU CMainFrame::NewMenu()
|
1150 |
|
|
{
|
1151 |
|
|
// Load the menu from the resources
|
1152 |
|
|
m_menu.LoadMenu(IDR_MAINFRAME);
|
1153 |
|
|
|
1154 |
|
|
m_menu.LoadToolbar(IDR_MAINFRAME);
|
1155 |
|
|
m_menu.LoadToolbar(IDR_MISCBAR);
|
1156 |
|
|
|
1157 |
|
|
m_menu.ModifyODMenu(NULL,ID_HELP,IDB_HELP);
|
1158 |
|
|
m_menu.ModifyODMenu(NULL,ID_GO_HOME,IDB_HELP);
|
1159 |
|
|
m_menu.ModifyODMenu(NULL,ID_HELP_RED_HATONTHEWEB,IDB_HTML);
|
1160 |
|
|
m_menu.ModifyODMenu(NULL,ID_HELP_ECOSHOME,IDB_HTML);
|
1161 |
|
|
m_menu.ModifyODMenu(NULL,ID_HELP_ECOS,IDB_HTML);
|
1162 |
|
|
m_menu.ModifyODMenu(NULL,ID_HELP_UITRON,IDB_HTML);
|
1163 |
|
|
|
1164 |
|
|
return(m_menu.Detach());
|
1165 |
|
|
|
1166 |
|
|
}
|
1167 |
|
|
|
1168 |
|
|
//This handler ensure that the popup menu items are drawn correctly
|
1169 |
|
|
void CMainFrame::OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct)
|
1170 |
|
|
{
|
1171 |
|
|
BOOL setflag=FALSE;
|
1172 |
|
|
if(lpMeasureItemStruct->CtlType==ODT_MENU){
|
1173 |
|
|
if(IsMenu((HMENU)lpMeasureItemStruct->itemID)){
|
1174 |
|
|
CMenu* cmenu=CMenu::FromHandle((HMENU)lpMeasureItemStruct->itemID);
|
1175 |
|
|
if(BCMenu::IsMenu(cmenu)){
|
1176 |
|
|
m_menu.MeasureItem(lpMeasureItemStruct);
|
1177 |
|
|
setflag=TRUE;
|
1178 |
|
|
}
|
1179 |
|
|
}
|
1180 |
|
|
}
|
1181 |
|
|
if(!setflag)CFrameWnd::OnMeasureItem(nIDCtl, lpMeasureItemStruct);
|
1182 |
|
|
}
|
1183 |
|
|
|
1184 |
|
|
//This handler ensures that keyboard shortcuts work
|
1185 |
|
|
LRESULT CMainFrame::OnMenuChar(UINT nChar, UINT nFlags, CMenu* pMenu)
|
1186 |
|
|
{
|
1187 |
|
|
LRESULT lresult;
|
1188 |
|
|
if(BCMenu::IsMenu(pMenu))
|
1189 |
|
|
lresult=BCMenu::FindKeyboardShortcut(nChar, nFlags, pMenu);
|
1190 |
|
|
else
|
1191 |
|
|
lresult=CFrameWnd::OnMenuChar(nChar, nFlags, pMenu);
|
1192 |
|
|
return(lresult);
|
1193 |
|
|
}
|
1194 |
|
|
|
1195 |
|
|
//This handler updates the menus from time to time
|
1196 |
|
|
void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
|
1197 |
|
|
{
|
1198 |
|
|
CFrameWnd::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
|
1199 |
|
|
if(!bSysMenu){
|
1200 |
|
|
if(BCMenu::IsMenu(pPopupMenu))BCMenu::UpdateMenu(pPopupMenu);
|
1201 |
|
|
}
|
1202 |
|
|
}
|
1203 |
|
|
|
1204 |
|
|
void CALLBACK CMainFrame::SubprocessOutputFunc(void *pParam,LPCTSTR psz)
|
1205 |
|
|
{
|
1206 |
|
|
LPTSTR pszCopy=new TCHAR[1+_tcslen(psz)];
|
1207 |
|
|
_tcscpy(pszCopy,psz);
|
1208 |
|
|
// Post a message to the mainframe because it wouldn't be safe to manipulate controls from a different thread
|
1209 |
|
|
((CMainFrame *)pParam)->PostMessage(WM_SUBPROCESS,(WPARAM)pszCopy);
|
1210 |
|
|
}
|
1211 |
|
|
|
1212 |
|
|
LRESULT CMainFrame::OnSubprocess(WPARAM wParam, LPARAM)
|
1213 |
|
|
{
|
1214 |
|
|
LPTSTR psz=(LPTSTR)wParam;
|
1215 |
|
|
CConfigToolDoc *pDoc=CConfigTool::GetConfigToolDoc();
|
1216 |
|
|
m_nLogicalLines+=pDoc->GetCompilationCount(psz);
|
1217 |
|
|
UpdateThermometer (m_nLogicalLines);
|
1218 |
|
|
CConfigTool::GetOutputView()->AddText(psz);
|
1219 |
|
|
deleteZA(psz);
|
1220 |
|
|
return 0;
|
1221 |
|
|
}
|
1222 |
|
|
|
1223 |
|
|
void CMainFrame::OnUpdateToolsAdministration(CCmdUI* pCmdUI)
|
1224 |
|
|
{
|
1225 |
|
|
pCmdUI->Enable(!m_sp.ProcessAlive());
|
1226 |
|
|
}
|
1227 |
|
|
|
1228 |
|
|
void CMainFrame::CygMount(TCHAR c)
|
1229 |
|
|
{
|
1230 |
|
|
// May not be alpha if it's e.g. a UNC network path
|
1231 |
|
|
if (!_istalpha(c))
|
1232 |
|
|
return;
|
1233 |
|
|
|
1234 |
|
|
c=towlower(c);
|
1235 |
|
|
if(!m_arMounted[c-_TCHAR('a')]){
|
1236 |
|
|
m_arMounted[c-_TCHAR('a')]=true;
|
1237 |
|
|
CString strCmd;
|
1238 |
|
|
String strOutput;
|
1239 |
|
|
|
1240 |
|
|
strCmd.Format(_T("mount %c: /ecos-%c"),c,c);
|
1241 |
|
|
CSubprocess sub;
|
1242 |
|
|
sub.Run(strOutput,strCmd);
|
1243 |
|
|
}
|
1244 |
|
|
}
|
1245 |
|
|
|
1246 |
|
|
BOOL CMainFrame::OnHelpInfo(HELPINFO* pHelpInfo)
|
1247 |
|
|
{
|
1248 |
|
|
// TODO: Add your message handler code here and/or call default
|
1249 |
|
|
|
1250 |
|
|
return CFrameWnd::OnHelpInfo(pHelpInfo);
|
1251 |
|
|
}
|
1252 |
|
|
|
1253 |
|
|
void CMainFrame::OnNavComplete(NMHDR* pHdr, LRESULT*)
|
1254 |
|
|
{
|
1255 |
|
|
TRACE(_T("HH Notify\n"));
|
1256 |
|
|
}
|
1257 |
|
|
|
1258 |
|
|
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
|
1259 |
|
|
{
|
1260 |
|
|
if(WM_NOTIFY==pMsg->message){
|
1261 |
|
|
LPNMHDR pHdr=(LPNMHDR)pMsg->lParam;
|
1262 |
|
|
TRACE(_T("WM_NOTIFY id=%d idFrom=%d code=%d\n"),pMsg->wParam,pHdr->idFrom,pHdr->code);
|
1263 |
|
|
}
|
1264 |
|
|
|
1265 |
|
|
return CFrameWnd::PreTranslateMessage(pMsg);
|
1266 |
|
|
}
|
1267 |
|
|
|
1268 |
|
|
void CMainFrame::OnEditPlatforms()
|
1269 |
|
|
{
|
1270 |
|
|
CPlatformsDialog dlg;
|
1271 |
|
|
if(IDOK==dlg.DoModal()){
|
1272 |
|
|
CeCosTestPlatform::RemoveAllPlatforms();
|
1273 |
|
|
for(unsigned int i=0;i<dlg.PlatformCount();i++){
|
1274 |
|
|
CeCosTestPlatform::Add(*dlg.Platform(i));
|
1275 |
|
|
}
|
1276 |
|
|
CeCosTestPlatform::Save();
|
1277 |
|
|
}
|
1278 |
|
|
}
|
1279 |
|
|
|
1280 |
|
|
void CMainFrame::OnTimer(UINT nIDEvent)
|
1281 |
|
|
{
|
1282 |
|
|
if(!m_sp.ProcessAlive()){
|
1283 |
|
|
KillTimer(nIDEvent);
|
1284 |
|
|
|
1285 |
|
|
TRACE(_T("m_nThermometerMax=%d m_nLogicalLines=%d\n"),m_nThermometerMax,m_nLogicalLines);
|
1286 |
|
|
if(0==m_sp.GetExitCode){
|
1287 |
|
|
UpdateThermometer(m_nThermometerMax);
|
1288 |
|
|
Sleep(250); // Allow user to see it
|
1289 |
|
|
}
|
1290 |
|
|
UpdateThermometer(0);
|
1291 |
|
|
SetThermometerMax(0);
|
1292 |
|
|
}
|
1293 |
|
|
CFrameWnd::OnTimer(nIDEvent);
|
1294 |
|
|
}
|