From 80addade60236be9522b630eb7c32f306c24d519 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sun, 4 Jan 2009 11:16:27 +0000 Subject: [PATCH] better File->Clear --- Common/OpenFile.cpp | 5 +++-- Common/OpenFile.h | 2 +- Fltk/menuWindow.cpp | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp index bd6de222e5..2c4df066e2 100644 --- a/Common/OpenFile.cpp +++ b/Common/OpenFile.cpp @@ -212,7 +212,7 @@ void ParseString(const char *str) } } -void SetProjectName(const char *name) +static void SetProjectName(const char *name) { char no_ext[256], ext[256], base[256]; SplitFileName(name, no_ext, ext, base); @@ -389,7 +389,7 @@ int MergeFile(const char *name, int warn_if_missing) return status; } -void ClearProject() +void ClearProject(const char *filename) { #if !defined(HAVE_NO_POST) for(int i = PView::list.size() - 1; i >= 0; i--) @@ -401,6 +401,7 @@ void ClearProject() for(int i = GModel::list.size() - 1; i >= 0; i--) delete GModel::list[i]; new GModel(); + SetProjectName(filename); #if defined(HAVE_FLTK) if(GUI::available()){ GUI::instance()->resetVisibility(); diff --git a/Common/OpenFile.h b/Common/OpenFile.h index 2a8da86081..1e0778cb0a 100644 --- a/Common/OpenFile.h +++ b/Common/OpenFile.h @@ -11,7 +11,7 @@ void ParseString(const char *str); void OpenProject(const char *filename); void OpenProjectMacFinder(const char *filename); int MergeFile(const char *filename, int warn_if_missing=0); -void ClearProject(); +void ClearProject(const char *filename); void SetBoundingBox(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax); diff --git a/Fltk/menuWindow.cpp b/Fltk/menuWindow.cpp index e78c1b2e30..e912f794a0 100644 --- a/Fltk/menuWindow.cpp +++ b/Fltk/menuWindow.cpp @@ -143,7 +143,7 @@ static void file_merge_cb(Fl_Widget *w, void *data) static void file_clear_cb(Fl_Widget *w, void *data) { - ClearProject(); + ClearProject(CTX.default_filename); Draw(); } @@ -329,7 +329,7 @@ static void file_rename_cb(Fl_Widget *w, void *data) goto test; } rename(CTX.filename, name.c_str()); - ClearProject(); + ClearProject(name.c_str()); OpenProject(name.c_str()); Draw(); } @@ -536,7 +536,7 @@ static void geometry_edit_cb(Fl_Widget *w, void *data) void geometry_reload_cb(Fl_Widget *w, void *data) { - ClearProject(); + ClearProject(CTX.filename); OpenProject(CTX.filename); Draw(); } -- GitLab