diff --git a/solvespace.cpp b/solvespace.cpp index 2a9e0242..05ce00f3 100644 --- a/solvespace.cpp +++ b/solvespace.cpp @@ -150,6 +150,8 @@ void SolveSpace::AfterNewFile(void) { later.showTW = true; // Then zoom to fit again, to fit the triangles GW.ZoomToFit(); + + UpdateWindowTitle(); } void SolveSpace::RemoveFromRecentList(char *file) { @@ -209,6 +211,16 @@ bool SolveSpace::OkayToStartNewFile(void) { } } +void SolveSpace::UpdateWindowTitle(void) { + if(strlen(saveFile) == 0) { + SetWindowTitle("SolveSpace - (not yet saved)"); + } else { + char buf[MAX_PATH+100]; + sprintf(buf, "SolveSpace - %s", saveFile); + SetWindowTitle(buf); + } +} + void SolveSpace::MenuFile(int id) { if(id >= RECENT_OPEN && id < (RECENT_OPEN+MAX_RECENT)) { char newFile[MAX_PATH]; @@ -287,4 +299,6 @@ void SolveSpace::MenuFile(int id) { default: oops(); } + + SS.UpdateWindowTitle(); } diff --git a/solvespace.h b/solvespace.h index ef8b5b06..c8156ca7 100644 --- a/solvespace.h +++ b/solvespace.h @@ -89,8 +89,10 @@ void dbp(char *str, ...); dbp("tri: (%.3f %.3f %.3f) (%.3f %.3f %.3f) (%.3f %.3f %.3f)", \ CO((tri).a), CO((tri).b), CO((tri).c)) +void SetWindowTitle(char *str); void Error(char *str, ...); void ExitNow(void); + void CnfFreezeString(char *str, char *name); void CnfFreezeDWORD(DWORD v, char *name); void CnfFreezeFloat(float v, char *name); @@ -398,6 +400,7 @@ public: bool GetFilenameAndSave(bool saveAs); bool OkayToStartNewFile(void); hGroup CreateDefaultDrawingGroup(void); + void UpdateWindowTitle(void); void NewFile(void); bool SaveToFile(char *filename); bool LoadFromFile(char *filename); diff --git a/win32/w32main.cpp b/win32/w32main.cpp index 4fb3ad85..beaccae7 100644 --- a/win32/w32main.cpp +++ b/win32/w32main.cpp @@ -102,6 +102,10 @@ float CnfThawFloat(float v, char *name) { return *((float *)&d); } +void SetWindowTitle(char *str) { + SetWindowText(GraphicsWnd, str); +} + //----------------------------------------------------------------------------- // A separate heap, on which we allocate expressions. Maybe a bit faster,