96
96
mainSizer->Add(m_book, 1, wxEXPAND | wxALL, 0);
98
// Add the parsing progress controls
99
m_staticText = new wxStaticText(this, wxID_ANY, wxT("Parsing workspace..."));
100
mainSizer->Add(m_staticText, 0, wxEXPAND|wxALL, 2);
102
m_parsingProgress = new wxGauge(this, wxID_ANY, 100, wxDefaultPosition, wxSize(-1, 15), wxGA_HORIZONTAL|wxGA_SMOOTH);
103
mainSizer->Add(m_parsingProgress, 0, wxEXPAND|wxALL, 1);
104
m_parsingProgress->Hide();
105
m_staticText->Hide();
98
107
// create tabs (possibly detached)
99
108
DetachedPanesInfo dpi;
100
109
EditorConfigST::Get()->ReadObject(wxT("DetachedPanesList"), &dpi);
171
169
wxTheApp->Connect(wxEVT_WORKSPACE_LOADED, wxCommandEventHandler(WorkspacePane::OnWorkspaceConfig), NULL, this);
172
170
wxTheApp->Connect(wxEVT_WORKSPACE_CONFIG_CHANGED, wxCommandEventHandler(WorkspacePane::OnWorkspaceConfig), NULL, this);
173
171
wxTheApp->Connect(wxEVT_WORKSPACE_CLOSED, wxCommandEventHandler(WorkspacePane::OnWorkspaceClosed), NULL, this);
174
wxTheApp->Connect(wxEVT_PROJ_FILE_ADDED, wxCommandEventHandler(WorkspacePane::OnProjectFileAdded), NULL, this);
175
wxTheApp->Connect(wxEVT_PROJ_FILE_REMOVED, wxCommandEventHandler(WorkspacePane::OnProjectFileRemoved), NULL, this);
176
wxTheApp->Connect(wxEVT_SYNBOL_TREE_UPDATE_ITEM, wxCommandEventHandler(WorkspacePane::OnSymbolsUpdated), NULL, this);
177
wxTheApp->Connect(wxEVT_SYNBOL_TREE_DELETE_ITEM, wxCommandEventHandler(WorkspacePane::OnSymbolsDeleted), NULL, this);
178
wxTheApp->Connect(wxEVT_SYNBOL_TREE_ADD_ITEM, wxCommandEventHandler(WorkspacePane::OnSymbolsAdded), NULL, this);
179
wxTheApp->Connect(wxEVT_FILE_RETAGGED, wxCommandEventHandler(WorkspacePane::OnFileRetagged), NULL, this);
180
wxTheApp->Connect(wxEVT_ACTIVE_EDITOR_CHANGED, wxCommandEventHandler(WorkspacePane::OnActiveEditorChanged), NULL, this);
181
wxTheApp->Connect(wxEVT_EDITOR_CLOSING, wxCommandEventHandler(WorkspacePane::OnEditorClosing), NULL, this);
182
wxTheApp->Connect(wxEVT_ALL_EDITORS_CLOSED, wxCommandEventHandler(WorkspacePane::OnAllEditorsClosed), NULL, this);
184
172
wxTheApp->Connect(XRCID("configuration_manager"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (WorkspacePane::OnConfigurationManager), NULL, this);
185
173
wxTheApp->Connect(XRCID("configuration_manager"), wxEVT_UPDATE_UI, wxUpdateUIEventHandler(WorkspacePane::OnConfigurationManagerUI), NULL, this);
189
extern wxImageList* CreateSymbolTreeImages();
191
void WorkspacePane::ShowCurrentOutline()
193
LEditor *editor = Frame::Get()->GetMainBook()->GetActiveEditor();
194
if (!editor || editor->GetProjectName().IsEmpty()) {
195
m_winStack->SelectNone();
198
wxString path = editor->GetFileName().GetFullPath();
199
if (m_winStack->GetSelectedKey() != path) {
200
m_winStack->Freeze();
201
if (m_winStack->Find(path) == NULL) {
202
CppSymbolTree *tree = new CppSymbolTree(m_winStack, wxID_ANY);
203
tree->SetSymbolsImages(CreateSymbolTreeImages());
204
tree->BuildTree(path);
205
m_winStack->Add(tree, path);
207
m_winStack->Select(path);
212
void WorkspacePane::OnActiveEditorChanged(wxCommandEvent& e)
215
ShowCurrentOutline();
218
void WorkspacePane::OnAllEditorsClosed(wxCommandEvent& e)
224
void WorkspacePane::OnEditorClosing(wxCommandEvent& e)
227
IEditor *editor = (IEditor*) e.GetClientData();
228
if (editor && !editor->GetProjectName().IsEmpty()) {
229
m_winStack->Delete(editor->GetFileName().GetFullPath());
233
void WorkspacePane::OnFileRetagged(wxCommandEvent& e)
236
std::vector<wxFileName> *files = (std::vector<wxFileName>*) e.GetClientData();
237
if (files && !files->empty()) {
238
m_winStack->Freeze();
239
// toss out any out-of-date outlines
240
for (size_t i = 0; i < files->size(); i++) {
241
m_winStack->Delete(files->at(i).GetFullPath());
243
ShowCurrentOutline(); // in case active editor's file was one of them
248
void WorkspacePane::OnProjectFileAdded(wxCommandEvent& e)
251
ShowCurrentOutline(); // in case the active editor's file is now tagged
254
void WorkspacePane::OnProjectFileRemoved(wxCommandEvent& e)
257
wxArrayString *files = (wxArrayString*) e.GetClientData();
258
if (files && !files->IsEmpty()) {
259
for (size_t i = 0; i < files->Count(); i++) {
260
m_winStack->Delete(files->Item(i));
262
ShowCurrentOutline(); // in case active editor's file is no longer tagged
266
void WorkspacePane::OnSymbolsAdded(wxCommandEvent& e)
269
ParseThreadEventData *data = (ParseThreadEventData*) e.GetClientData();
270
if (data && !data->GetItems().empty()) {
271
CppSymbolTree *tree = (CppSymbolTree*) m_winStack->Find(data->GetFileName());
273
tree->AddSymbols(data->GetItems());
278
void WorkspacePane::OnSymbolsDeleted(wxCommandEvent& e)
281
ParseThreadEventData *data = (ParseThreadEventData*) e.GetClientData();
282
if (data && !data->GetItems().empty()) {
283
CppSymbolTree *tree = (CppSymbolTree*) m_winStack->Find(data->GetFileName());
285
tree->DeleteSymbols(data->GetItems());
290
void WorkspacePane::OnSymbolsUpdated(wxCommandEvent& e)
293
ParseThreadEventData *data = (ParseThreadEventData*) e.GetClientData();
294
if (data && !data->GetItems().empty()) {
295
CppSymbolTree *tree = (CppSymbolTree*) m_winStack->Find(data->GetFileName());
297
tree->UpdateSymbols(data->GetItems());
302
176
void WorkspacePane::OnWorkspaceConfig(wxCommandEvent& e)