Skip to content
Snippets Groups Projects
Commit 80addade authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

better File->Clear

parent a725e35c
No related branches found
No related tags found
No related merge requests found
...@@ -212,7 +212,7 @@ void ParseString(const char *str) ...@@ -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]; char no_ext[256], ext[256], base[256];
SplitFileName(name, no_ext, ext, base); SplitFileName(name, no_ext, ext, base);
...@@ -389,7 +389,7 @@ int MergeFile(const char *name, int warn_if_missing) ...@@ -389,7 +389,7 @@ int MergeFile(const char *name, int warn_if_missing)
return status; return status;
} }
void ClearProject() void ClearProject(const char *filename)
{ {
#if !defined(HAVE_NO_POST) #if !defined(HAVE_NO_POST)
for(int i = PView::list.size() - 1; i >= 0; i--) for(int i = PView::list.size() - 1; i >= 0; i--)
...@@ -401,6 +401,7 @@ void ClearProject() ...@@ -401,6 +401,7 @@ void ClearProject()
for(int i = GModel::list.size() - 1; i >= 0; i--) for(int i = GModel::list.size() - 1; i >= 0; i--)
delete GModel::list[i]; delete GModel::list[i];
new GModel(); new GModel();
SetProjectName(filename);
#if defined(HAVE_FLTK) #if defined(HAVE_FLTK)
if(GUI::available()){ if(GUI::available()){
GUI::instance()->resetVisibility(); GUI::instance()->resetVisibility();
......
...@@ -11,7 +11,7 @@ void ParseString(const char *str); ...@@ -11,7 +11,7 @@ void ParseString(const char *str);
void OpenProject(const char *filename); void OpenProject(const char *filename);
void OpenProjectMacFinder(const char *filename); void OpenProjectMacFinder(const char *filename);
int MergeFile(const char *filename, int warn_if_missing=0); int MergeFile(const char *filename, int warn_if_missing=0);
void ClearProject(); void ClearProject(const char *filename);
void SetBoundingBox(double xmin, double xmax, void SetBoundingBox(double xmin, double xmax,
double ymin, double ymax, double ymin, double ymax,
double zmin, double zmax); double zmin, double zmax);
......
...@@ -143,7 +143,7 @@ static void file_merge_cb(Fl_Widget *w, void *data) ...@@ -143,7 +143,7 @@ static void file_merge_cb(Fl_Widget *w, void *data)
static void file_clear_cb(Fl_Widget *w, void *data) static void file_clear_cb(Fl_Widget *w, void *data)
{ {
ClearProject(); ClearProject(CTX.default_filename);
Draw(); Draw();
} }
...@@ -329,7 +329,7 @@ static void file_rename_cb(Fl_Widget *w, void *data) ...@@ -329,7 +329,7 @@ static void file_rename_cb(Fl_Widget *w, void *data)
goto test; goto test;
} }
rename(CTX.filename, name.c_str()); rename(CTX.filename, name.c_str());
ClearProject(); ClearProject(name.c_str());
OpenProject(name.c_str()); OpenProject(name.c_str());
Draw(); Draw();
} }
...@@ -536,7 +536,7 @@ static void geometry_edit_cb(Fl_Widget *w, void *data) ...@@ -536,7 +536,7 @@ static void geometry_edit_cb(Fl_Widget *w, void *data)
void geometry_reload_cb(Fl_Widget *w, void *data) void geometry_reload_cb(Fl_Widget *w, void *data)
{ {
ClearProject(); ClearProject(CTX.filename);
OpenProject(CTX.filename); OpenProject(CTX.filename);
Draw(); Draw();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment