root/trunk/BuildReportDlg.cpp

Revision 5, 3.7 kB (checked in by qbert, 6 years ago)

Initial ( and last :( ) commit

Line 
1 // BuildReportDlg.cpp : implementation file
2 //
3
4 #include "stdafx.h"
5 #include "Elephant.h"
6 #include "BuildReportDlg.h"
7
8 #ifdef _DEBUG
9 #define new DEBUG_NEW
10 #undef THIS_FILE
11 static char THIS_FILE[] = __FILE__;
12 #endif
13
14 /////////////////////////////////////////////////////////////////////////////
15 // CBuildReportDlg dialog
16
17
18 CBuildReportDlg::CBuildReportDlg(CWnd* pParent /*=NULL*/)
19     : CDialog(CBuildReportDlg::IDD, pParent)
20 {
21     //{{AFX_DATA_INIT(CBuildReportDlg)
22         // NOTE: the ClassWizard will add member initialization here
23     //}}AFX_DATA_INIT
24 }
25
26
27 void CBuildReportDlg::DoDataExchange(CDataExchange* pDX)
28 {
29     CDialog::DoDataExchange(pDX);
30     //{{AFX_DATA_MAP(CBuildReportDlg)
31     DDX_Control(pDX, IDC_LIST1, m_buildList);
32     //}}AFX_DATA_MAP
33 }
34
35
36 BEGIN_MESSAGE_MAP(CBuildReportDlg, CDialog)
37     //{{AFX_MSG_MAP(CBuildReportDlg)
38     ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
39     ON_WM_SIZE()   
40     ON_WM_KEYUP()
41     //}}AFX_MSG_MAP
42 END_MESSAGE_MAP()
43
44 /////////////////////////////////////////////////////////////////////////////
45 // CBuildReportDlg message handlers
46
47 void CBuildReportDlg::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
48 {
49    
50     vector<int> deletes;
51     POSITION pos = m_buildList.GetFirstSelectedItemPosition();
52    
53     if (pos == NULL)
54         TRACE0("No items were selected!\n");
55     else
56     {
57         int nItem = m_buildList.GetNextSelectedItem(pos);
58         char file[300];
59         char _line[300];
60         char _msg[300];
61
62         m_buildList.GetItemText(nItem,1,_line,300);
63         m_buildList.GetItemText(nItem,2,file,300);
64         m_buildList.GetItemText(nItem,0,_msg,300);
65
66         string _file = file;
67
68 //      if (Globals::currentProject)
69 //      {
70 //          _file = Globals::currentProject->PathForFile(_file);
71 //      }
72 //      ElephantMessageBox(_file);
73 //      ElephantMessageBox(line);
74
75         string msg(_msg);
76
77         if ( msg.find("File Created") != string::npos )
78         {
79             unsigned int pos = msg.find_first_of("File Created : ") + 15;
80             if ( pos > 0 && pos != string::npos )
81             {
82                 string file = msg.substr(pos);
83                 if ( FileExtension(file) == "lib" || FileExtension(file) == "dll" )
84                 {
85                     file = StripDirPath(file);
86
87                 }
88                
89                 ShellExecute(0,"open",file.c_str(),"","",SW_SHOW);
90             }
91         }
92
93         else if ( _file.find("random") == string::npos )
94         {
95            
96             if ( !FileExists(_file ) )
97             {
98
99                 if ( Globals::currentProject )
100                 {
101
102                     string newFile = Globals::currentProject->PathForFile(_file );
103
104                     if ( FileExists(newFile ) ) Globals::theApp.OpenFile(newFile,atoi(_line));
105
106
107                 }
108
109
110             }
111             else Globals::theApp.OpenFile(file,atoi(_line));
112
113         }
114        
115        
116     }
117     *pResult = 0;
118 }
119
120 BOOL CBuildReportDlg::OnInitDialog()
121 {
122     CDialog::OnInitDialog();
123    
124     m_buildList.InsertColumn(0,"Message",LVCFMT_LEFT,400);
125     m_buildList.InsertColumn(1,"Line Number",LVCFMT_LEFT,200);
126     m_buildList.InsertColumn(2,"File",LVCFMT_LEFT,200);
127
128     m_buildList.SetExtendedStyle(LVS_EX_FULLROWSELECT  | LVS_EX_GRIDLINES);
129    
130    
131     return TRUE;  // return TRUE unless you set the focus to a control
132                   // EXCEPTION: OCX Property Pages should return FALSE
133 }
134
135 void CBuildReportDlg::OnSize(UINT nType, int cx, int cy)
136 {
137    
138    
139     m_buildList.SetColumnWidth(0,cx - 400);
140     m_buildList.MoveWindow(0,0,cx,cy); 
141
142     CDialog::OnSize(nType, cx, cy);
143    
144 }
145
146
147 BOOL CBuildReportDlg::PreTranslateMessage(MSG* pMsg)
148 {
149     return Globals::theApp.m_pMainWnd->PreTranslateMessage(pMsg);
150    
151    
152 }
153
154 void CBuildReportDlg::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
155 {
156 if ( nChar == VK_ESCAPE )
157     {
158
159         CMainFrame* m = (CMainFrame*)Globals::theApp.m_pMainWnd;
160         if ( m ){
161        
162         CElephantView* v = m->GetActiveView();
163         if ( v )
164         {
165             CScintillaCtrl& rCtrl = v->GetCtrl();
166             rCtrl.SetFocus();
167         }
168
169         return;
170         }
171        
172
173
174     }   
175     CDialog::OnKeyUp(nChar, nRepCnt, nFlags);
176 }
Note: See TracBrowser for help on using the browser.