Patch #1529 2006-09-30 18:45
dermeister
OpenFileTree was once more not updated correctly- Download
- 1529-OpenFileTree_w.patch (1.7 KB)
Index: src/sdk/editormanager.h
===================================================================
--- src/sdk/editormanager.h (revision 2995)
+++ src/sdk/editormanager.h (working copy)
@@ -135,6 +135,7 @@
void BuildOpenedFilesTree(wxWindow* parent);
void RebuildOpenedFilesTree(wxTreeCtrl *tree = 0L);
void RefreshOpenedFilesTree(bool force = false);
+ bool RenameTreeFile(const wxString& oldname, const wxString& newname);
void OnGenericContextMenuHandler(wxCommandEvent& event);
void OnPageChanged(wxFlatNotebookEvent& event);
@@ -173,7 +174,6 @@
void DeleteItemfromTree(wxTreeItemId item);
void DeleteFilefromTree(const wxString& filename);
void AddFiletoTree(EditorBase* ed);
- bool RenameTreeFile(const wxString& oldname, const wxString& newname);
void InitPane();
AutoCompleteMap m_AutoCompleteMap;
Index: src/src/main.cpp
===================================================================
--- src/src/main.cpp (revision 2995)
+++ src/src/main.cpp (working copy)
@@ -1888,11 +1888,16 @@
if (!ed || !project)
return;
+ wxString oldname = ed->GetFilename();
if (cbMessageBox(_("Do you want to add this new file in the active project (has to be saved first)?"),
_("Add file to project"),
wxYES_NO | wxICON_QUESTION) == wxID_YES &&
ed->SaveAs() && ed->IsOK())
{
+ wxString newname = ed->GetFilename();
+ if (oldname != newname)
+ Manager::Get()->GetEditorManager()->RenameTreeFile(oldname, newname);
+
wxArrayInt targets;
if (Manager::Get()->GetProjectManager()->AddFileToProject(ed->GetFilename(), project, targets) != 0)
{
History
dermeister 2006-09-30 18:50
This patch solves the following issue:
- Open a project
- Hit "File->New->Empty file". A file called "Untitled*" is created and opened in the editor as well as added to the OpenFileTree with its current name.
- You are asked if you want to add the file to the project. Press 'Yes'.
- You are asked to save the file. Do it with a name different than its current name (which is "Untitled*").
The problem now is: The file is correctly saved with its new name and the title of the corresponding editor tab changes but not it's entry in the OpenedFilesTree.
This patch fixes this problem.
NOTE: This patch changes the access level of EditorManager::RenameTreeFile from protected to public!
killerbot 2006-10-06 20:16